:root{
  --accent:#5b4bff; --accent-soft:#ecebff; --ink:#1f2430; --muted:#7c8598;
  --line:#e9ecf3; --bg:#e9edf3; --card:#fff;
}
*{box-sizing:border-box}
html,body{margin:0;height:100%}
body{font:14px/1.5 -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Arial,sans-serif;color:var(--ink);background:var(--bg)}
button{font:inherit;cursor:pointer}
input,select,textarea{font:inherit;color:var(--ink)}
.btn{background:var(--accent);color:#fff;border:0;border-radius:9px;padding:9px 16px;font-weight:600}
.btn:hover{filter:brightness(1.06)}
.btn.ghost{background:#fff;color:var(--ink);border:1px solid var(--line)}
.btn.ghost:hover{background:#f4f6fa}
.dot{width:26px;height:26px;border-radius:8px;background:var(--accent);color:#fff;display:grid;place-items:center;font-weight:800}
.boot{padding:40px;text-align:center;color:var(--muted)}

/* login */
.login{min-height:100%;display:grid;place-items:center;padding:20px}
.login form{background:var(--card);border:1px solid var(--line);border-radius:18px;padding:28px;width:min(380px,92vw);box-shadow:0 10px 40px rgba(16,22,35,.08)}
.brand{display:flex;align-items:center;gap:10px;font-weight:800;font-size:20px;margin-bottom:6px}
.sub{color:var(--muted);margin:0 0 18px}
.login label{display:block;font-weight:600;margin:12px 0 6px}
.login input{width:100%;padding:11px 12px;border:1px solid var(--line);border-radius:10px}
.err{color:#d93025;margin-top:10px;min-height:18px}

/* ---- 3-pane full-bleed (l'app remplit tout l'écran ; la carte grise du mockup n'était qu'une présentation) ---- */
.wrap{position:fixed;inset:0;background:var(--card);display:grid;grid-template-columns:238px 1fr;overflow:hidden}
.main{min-width:0;display:flex;overflow:hidden}
.main .listpane,.main .readpane{flex:1;min-width:0}
.main .readpane{display:none}
.main.show-reader .listpane{display:none}
.main.show-reader .readpane{display:flex}

/* sidebar */
.side{border-right:1px solid var(--line);padding:14px 12px;display:flex;flex-direction:column;min-height:0}
.side-scroll{flex:1;overflow:auto;min-height:0}
.me{display:flex;align-items:center;gap:10px;width:100%;border:0;background:transparent;padding:8px;border-radius:12px;margin-top:8px;border-top:1px solid var(--line);padding-top:12px}
.me:hover{background:#f4f6fa}
.me-av{width:34px;height:34px;border-radius:50%;background:#2b3350;color:#fff;display:grid;place-items:center;font-weight:700;flex:0 0 auto}
.me-txt{flex:1;min-width:0;text-align:left;display:flex;flex-direction:column}
.me-txt b{font-size:13px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.me-txt span{font-size:12px;color:var(--muted);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.acct{display:flex;align-items:center;gap:10px;width:100%;border:0;background:transparent;padding:8px;border-radius:12px}
.acct:hover{background:#f4f6fa}
.acct-av{width:40px;height:40px;border-radius:12px;background:var(--accent);color:#fff;display:grid;place-items:center;font-weight:700;flex:0 0 auto}
.acct-txt{flex:1;min-width:0;text-align:left;display:flex;flex-direction:column}
.acct-txt b{font-size:14px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.acct-txt span{font-size:12px;color:var(--muted);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.acct-more{color:var(--muted);display:flex}.acct-more svg{width:18px;height:18px}
.new{display:flex;align-items:center;justify-content:center;gap:8px;width:100%;margin:14px 0;background:var(--accent);color:#fff;border:0;border-radius:12px;padding:12px;font-weight:600;box-shadow:0 4px 14px rgba(91,75,255,.32)}
.new:hover{filter:brightness(1.06)}.new svg{width:18px;height:18px}
.nav,.labels{display:flex;flex-direction:column;gap:2px}
.nav-i{display:flex;align-items:center;gap:12px;width:100%;border:0;background:transparent;border-radius:10px;padding:9px 10px;color:#414755;text-align:left}
.nav-i:hover{background:#f4f6fa}
.nav-i.on{background:var(--accent-soft);color:var(--accent);font-weight:600}
.ni-ic{display:flex;width:20px}.ni-ic svg{width:20px;height:20px}
.ni-lb{flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:14px}
.ni-ct{font-size:12px;color:var(--muted);font-weight:600}
.ni-ct.hot{background:var(--accent);color:#fff;border-radius:999px;padding:1px 7px}
.nav-i.on .ni-ct{color:var(--accent)}
.dotc{width:10px;height:10px;border-radius:50%;flex:0 0 auto;margin:0 5px}
.lbl-h{display:flex;align-items:center;justify-content:space-between;color:var(--muted);font-size:11px;font-weight:700;letter-spacing:.6px;padding:18px 10px 6px}
.lbl-add{border:0;background:transparent;color:var(--muted);display:flex;padding:2px;border-radius:6px}.lbl-add svg{width:14px;height:14px}
.lbl-add:hover{background:#f4f6fa;color:var(--accent)}
.lbl-empty{color:var(--muted);font-size:12px;padding:2px 10px}

/* list pane */
.listpane{display:grid;grid-template-rows:auto auto auto 1fr;min-height:0}
.lp-head,.lp-tools,.lp-filter{max-width:1100px}
.lp-head{padding:20px 20px 6px}
.lp-head h1{margin:0;font-size:22px;font-weight:700}
.lp-sub{color:var(--muted);font-size:13px;margin-top:2px}
.lp-tools{display:flex;gap:8px;padding:10px 16px 6px}
.lp-search{flex:1;display:flex;align-items:center;gap:8px;background:#f1f3f8;border-radius:10px;padding:0 12px}
.lp-search svg{width:18px;height:18px;color:var(--muted)}
.lp-search input{flex:1;border:0;background:transparent;padding:10px 0;outline:none}
.sq{width:40px;border:1px solid var(--line);background:#fff;border-radius:10px;display:grid;place-items:center;color:var(--muted)}
.sq svg{width:18px;height:18px}.sq:hover{background:#f4f6fa}
.lp-filter{padding:2px 16px 8px}
.drop{display:inline-flex;align-items:center;gap:6px;border:1px solid var(--line);background:#fff;border-radius:8px;padding:6px 10px;color:var(--muted);font-size:13px}
.drop svg{width:14px;height:14px}
.lp-list{overflow:auto;min-height:0}
.mrow{display:flex;align-items:center;gap:12px;width:100%;border-bottom:1px solid #f1f3f8;padding:0 18px;min-height:46px;border-left:3px solid transparent;background:#f8f9fc;cursor:pointer}
.mrow.unread{background:#fff}
.mrow:hover{background:#f2f4f9}
.mrow.sel{background:var(--accent-soft);border-left-color:var(--accent)}
.star{border:0;background:transparent;color:#c9cdd6;font-size:17px;padding:4px;line-height:1;flex:0 0 auto}
.star.on{color:#f5b400}
.mfrom{width:200px;flex:0 0 auto;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:#414755;font-size:14px}
.mrow.unread .mfrom{font-weight:700;color:var(--ink)}
.mmid{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:14px;color:#9aa0ab}
.mmid .msubj{color:#414755}
.mrow.unread .mmid .msubj{font-weight:700;color:var(--ink)}
.msnip{color:#9aa0ab}
.mclip{color:var(--muted);display:flex;flex:0 0 auto}.mclip svg{width:15px;height:15px}
.mdate{flex:0 0 auto;color:var(--muted);font-size:12px;white-space:nowrap;min-width:54px;text-align:right}
.tag{font-size:11px;font-weight:600;padding:1px 8px;border-radius:999px;background:#eef0f4;color:#475569;margin:0 2px}
.tag.assign{background:var(--accent-soft);color:var(--accent)}
.tag a{cursor:pointer;text-decoration:none;opacity:.6;margin-left:2px}

/* reader pane */
.readpane{min-width:0;display:flex;flex-direction:column}
.rp-empty{flex:1;display:grid;place-items:center;color:var(--muted);padding:40px}
.rp-top{display:flex;align-items:center;gap:12px;padding:12px 18px;border-bottom:1px solid var(--line)}
.pager{display:flex;align-items:center;gap:6px;color:var(--muted);font-size:13px;margin:0 auto}
.rp-top-r{display:flex;gap:4px}
.ico{width:36px;height:36px;border:0;background:transparent;border-radius:50%;display:grid;place-items:center;color:var(--muted)}
.ico:hover{background:#f1f3f8}.ico svg{width:18px;height:18px}
.back{display:grid}
.rp-scroll{overflow:auto;padding:22px 28px;min-height:0}
.rp-hd{display:flex;align-items:center;gap:12px;flex-wrap:wrap}
.rp-ava{width:44px;height:44px;border-radius:50%;background:var(--accent);color:#fff;display:grid;place-items:center;font-weight:700;flex:0 0 auto}
.rp-meta{flex:1;min-width:140px}
.rp-name{font-weight:700}
.rp-addr{color:var(--muted);font-size:13px}
.rp-date{color:var(--muted);font-size:13px}
.rp-acts{display:flex;gap:2px}
.rp-subj{font-size:22px;font-weight:700;margin:20px 0 16px}
.rp-body{font-size:14px;line-height:1.7;color:#3c4043}
.rp-body iframe{width:100%;border:0;min-height:48vh;background:#fff}
.rp-body pre{white-space:pre-wrap;word-break:break-word;margin:0;font:inherit}
.rp-atts{margin-top:26px;border-top:1px solid var(--line);padding-top:16px}
.rp-atts-h{display:flex;justify-content:space-between;color:var(--muted);font-size:12px;font-weight:700;letter-spacing:.5px;margin-bottom:12px}
.rp-atts-list{display:flex;flex-wrap:wrap;gap:10px}
.att-card{display:flex;align-items:center;gap:10px;border:1px solid var(--line);border-radius:10px;padding:9px 12px;text-decoration:none;color:var(--ink);min-width:210px}
.att-card:hover{background:#f8f9fc}
.att-ic{width:34px;height:34px;border-radius:8px;background:var(--accent-soft);color:var(--accent);display:grid;place-items:center;flex:0 0 auto}
.att-ic svg{width:18px;height:18px}
.att-tx{display:flex;flex-direction:column}.att-tx b{font-size:13px}.att-tx span{font-size:11px;color:var(--muted)}
.teambar{display:flex;flex-wrap:wrap;gap:6px;margin-top:20px}

/* modal / toast / menu */
.modal{position:fixed;inset:0;background:rgba(16,22,35,.45);display:grid;place-items:center;padding:16px;z-index:40}
.composer{background:#fff;border-radius:16px;width:min(640px,96vw);padding:20px;max-height:92vh;overflow:auto}
.composer h3{margin:0 0 12px}
.composer input,.composer textarea{width:100%;padding:10px 12px;border:1px solid var(--line);border-radius:10px;margin-bottom:10px}
.composer textarea{min-height:180px;resize:vertical}
.crow{display:flex;align-items:center;justify-content:space-between;gap:10px}
.file{border:1px solid var(--line);border-radius:9px;padding:8px 12px;color:var(--muted);cursor:pointer}
.chint{color:var(--muted);margin-bottom:10px}
.row{display:flex;gap:10px;justify-content:flex-end}
.notes{display:flex;flex-direction:column;gap:8px;margin:8px 0}
.note{background:#f8f9fc;border:1px solid var(--line);border-radius:8px;padding:8px 10px;font-size:13px}
.note>span{color:var(--muted);font-size:11px;margin-left:6px}
.noterow{display:flex;gap:8px}.noterow input{flex:1;margin:0}
.hint{color:var(--muted);font-weight:400}
.toast{position:fixed;bottom:22px;left:50%;transform:translateX(-50%);background:#1f2430;color:#fff;padding:10px 16px;border-radius:10px;z-index:60;box-shadow:0 8px 24px rgba(0,0,0,.25)}
.ctxmenu{position:fixed;background:#fff;border:1px solid var(--line);border-radius:12px;box-shadow:0 10px 34px rgba(32,40,60,.22);padding:6px;z-index:70;min-width:210px;max-height:70vh;overflow:auto}
.ctxmenu button{display:block;width:100%;text-align:left;border:0;background:transparent;padding:9px 12px;border-radius:8px;font-size:14px}
.ctxmenu button:hover{background:var(--accent-soft)}
.ctxmenu .sep{height:1px;background:var(--line);margin:6px 4px}

@media(max-width:900px){
  .wrap{grid-template-columns:1fr}
  .side{display:none}
}
@media(max-width:600px){
  .mfrom{width:120px}
}
