/* @portee: tous */
/* =========================================================================
   Messagerie EIT — compléments du design system : primitives manquantes, pages publiques,
   coquille de l'espace utilisateur (rail + barre), messagerie trois volets, panneau IA,
   agenda, tâches, contacts, réglages. Variables du thème uniquement (eit.css + /theme-*.css).
   ========================================================================= */

/* ------------------------------------------------------------ Primitives */
.card { background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 1.1rem 1.2rem; min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: .8rem; margin-bottom: .8rem; }
.card-title { font-size: .95rem; font-weight: 760; margin: 0; display: flex; align-items: center; gap: .5rem; }
.card-title .ph { color: var(--brand); }
.pill { display: inline-flex; align-items: center; gap: .35rem; padding: .22rem .65rem; border-radius: var(--r-pill); font-size: .74rem; font-weight: 700; letter-spacing: .02em; background: var(--muted-soft); color: var(--text-2); white-space: nowrap; }
.pill.tone-brand, .pill.tone-success { background: var(--brand-soft); color: var(--brand-ink); }
.pill.tone-info { background: var(--info-soft); color: var(--info); }
.pill.tone-warning { background: var(--warning-soft); color: var(--warning); }
.pill.tone-danger { background: var(--danger-soft); color: var(--danger); }
.pill.tone-violet { background: var(--violet-soft); color: var(--violet); }
.pill.tone-orange { background: var(--orange-soft); color: var(--orange); }
.wrap { flex-wrap: wrap; }
.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1080px) { .cols-3, .cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 680px) { .cols-2, .cols-3, .cols-4 { grid-template-columns: minmax(0, 1fr); } }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .85em; }
.dot { display: inline-block; width: .55rem; height: .55rem; border-radius: 50%; background: currentColor; }
.hr { border: 0; border-top: 1px solid var(--line); margin: 1rem 0; }
.tag-color { width: .85rem; height: .85rem; border-radius: 4px; display: inline-block; flex-shrink: 0; }
.meter { height: 6px; border-radius: 6px; background: var(--muted-soft); overflow: hidden; }
.meter > i { display: block; height: 100%; background: var(--brand); border-radius: 6px; transition: width .4s var(--ease); }
.meter.is-warning > i { background: var(--warning); } .meter.is-danger > i { background: var(--danger); }
.pw-meter { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin-top: .4rem; }
.pw-meter span { height: 4px; border-radius: 4px; background: var(--muted-soft); }
.pw-meter[data-level="1"] span:nth-child(-n+1) { background: var(--danger); }
.pw-meter[data-level="2"] span:nth-child(-n+2) { background: var(--warning); }
.pw-meter[data-level="3"] span:nth-child(-n+3) { background: var(--info); }
.pw-meter[data-level="4"] span { background: var(--brand); }
.offline-banner { position: fixed; left: 50%; bottom: 1rem; transform: translateX(-50%); z-index: 400; display: flex; align-items: center; gap: .5rem; padding: .55rem .9rem; border-radius: var(--r-pill); background: var(--text); color: var(--bg); font-size: .82rem; font-weight: 600; box-shadow: var(--shadow-pop); }
.offline-banner[hidden] { display: none; }
html.is-offline .needs-online { opacity: .5; pointer-events: none; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1rem; font-size: .88rem; }
.kv dt { color: var(--text-3); } .kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.code-block { background: var(--bg-sunken); border: 1px solid var(--line); border-radius: var(--r-sm); padding: .8rem; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .78rem; white-space: pre-wrap; word-break: break-all; max-height: 360px; overflow: auto; }
.color-swatches { display: flex; flex-wrap: wrap; gap: .5rem; }
.color-swatch { width: 2rem; height: 2rem; border-radius: 50%; border: 2px solid transparent; cursor: pointer; position: relative; box-shadow: var(--shadow-1); }
.color-swatch.is-active { border-color: var(--text); }
.color-swatch.is-active::after { content: "✓"; position: absolute; inset: 0; display: grid; place-items: center; color: #fff; font-weight: 800; text-shadow: 0 1px 2px rgba(0,0,0,.5); }
.table .ph { vertical-align: -.12em; }
.sticky-actions { position: sticky; bottom: 0; background: var(--bg-elev); border-top: 1px solid var(--line); padding: .8rem 0; margin-top: 1rem; display: flex; justify-content: flex-end; gap: .5rem; }
[data-density="compacte"] { --dens: .85; } [data-density="confortable"] { --dens: 1; } [data-density="aeree"] { --dens: 1.18; }

/* ------------------------------------------------------------ Page d'accueil */
.home-mock { background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--r-xl); overflow: hidden; box-shadow: var(--shadow-pop); font-size: .78rem; }
.home-mock-bar { display: flex; align-items: center; gap: .4rem; padding: .6rem .9rem; border-bottom: 1px solid var(--line); background: var(--bg-sunken); }
.home-mock-bar span { width: .6rem; height: .6rem; border-radius: 50%; background: var(--line-strong); }
.home-mock-bar i { margin-left: auto; font-style: normal; color: var(--text-3); font-weight: 600; }
.home-mock-body { display: grid; grid-template-columns: 44px minmax(0, 1.1fr) minmax(0, 1.3fr); min-height: 300px; }
.home-mock-nav { display: flex; flex-direction: column; align-items: center; gap: .9rem; padding: .9rem 0; border-right: 1px solid var(--line); color: var(--text-3); font-size: 1.05rem; }
.home-mock-nav .ph:first-child { color: var(--brand); }
.home-mock-list { border-right: 1px solid var(--line); }
.home-mock-row { display: flex; gap: .6rem; padding: .65rem .75rem; border-bottom: 1px solid var(--line); align-items: center; }
.home-mock-row:first-child { background: var(--brand-soft); border-left: 3px solid var(--brand); }
.home-mock-row b { display: block; font-size: .8rem; } .home-mock-row small { display: block; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 170px; }
.home-mock-read { padding: .9rem; display: flex; flex-direction: column; gap: .8rem; min-width: 0; overflow: hidden; }
.home-mock-read .chip { font-size: .72rem; padding: .25rem .55rem; }
.home-mock-read > div:last-child { display: flex; flex-wrap: wrap; gap: .4rem; }
.home-mock-ai { display: flex; gap: .6rem; padding: .7rem; border-radius: var(--r); background: var(--violet-soft); color: var(--violet); align-items: flex-start; }
.home-mock-ai b { display: block; font-size: .78rem; } .home-mock-ai small { color: var(--text-2); display: block; }
.home-mock-lines span { display: block; height: 7px; border-radius: 7px; background: var(--muted-soft); margin-bottom: .5rem; }
.home-features .home-feature { display: flex; flex-direction: column; gap: .5rem; }
.home-feature .icon-box { width: 2.6rem; height: 2.6rem; font-size: 1.3rem; }
.home-feature p { margin: 0; }
.home-security { display: grid; grid-template-columns: 1.2fr 1fr; gap: 2rem; padding: 2rem; align-items: center; }
.home-checks { list-style: none; margin: 0; padding: 0; display: grid; gap: .6rem; }
.home-checks li { display: flex; gap: .55rem; align-items: flex-start; font-size: .92rem; }
.home-checks .ph { color: var(--brand); flex-shrink: 0; font-size: 1.2rem; }
@media (max-width: 900px) { .home-security { grid-template-columns: 1fr; } .home-mock-body { grid-template-columns: 36px 1fr; } .home-mock-read { display: none; } }

/* ------------------------------------------------------------ Coquille espace utilisateur */
.app-body { overflow: hidden; }
.app { display: flex; height: 100dvh; width: 100%; background: var(--bg); --rail-w: 72px; position: fixed; inset: 0; overflow: hidden; }
.app.is-rail-labels { --rail-w: 168px; }
.app-rail { width: var(--rail-w); flex-shrink: 0; background: var(--bg-sunken); border-right: 1px solid var(--line); display: flex; flex-direction: column; align-items: stretch; padding: .6rem .5rem; gap: .25rem; transition: width .2s var(--ease); }
.app-rail-brand { display: flex; align-items: center; justify-content: center; padding: .4rem 0 .8rem; }
.app-rail-brand img { width: 36px; height: 36px; border-radius: 50%; }
.app-rail-link { position: relative; display: flex; align-items: center; justify-content: center; gap: .65rem; padding: .62rem .5rem; border-radius: var(--r); color: var(--text-2); font-size: 1.35rem; text-decoration: none !important; border: 0; background: none; cursor: pointer; font-family: inherit; transition: background .15s, color .15s; }
.app-rail-link span { display: none; font-size: .86rem; font-weight: 650; white-space: nowrap; }
.app.is-rail-labels .app-rail-link { justify-content: flex-start; padding-inline: .9rem; }
.app.is-rail-labels .app-rail-link span { display: inline; }
.app-rail-link:hover { background: var(--bg-hover); color: var(--text); }
.app-rail-link.is-active { color: var(--accent, var(--brand)); background: var(--accent-soft, var(--brand-soft)); }
.app-rail-link.is-active::before { content: ""; position: absolute; left: -.5rem; top: 22%; height: 56%; width: 3px; border-radius: 3px; background: var(--accent, var(--brand)); }
.app-rail-badge { position: absolute; top: .3rem; right: .4rem; min-width: 1.1rem; height: 1.1rem; padding: 0 .3rem; border-radius: var(--r-pill); background: var(--danger); color: #fff; font-size: .62rem; font-weight: 800; display: grid; place-items: center; }
.app-rail-badge[hidden] { display: none; }
.app.is-rail-labels .app-rail-badge { position: static; margin-left: auto; }
.app-rail-spacer { flex: 1; }
.app-rail-toggle { font-size: 1.05rem; color: var(--text-3); }
.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.app-top { height: 56px; flex-shrink: 0; display: flex; align-items: center; gap: .8rem; padding: 0 1rem; border-bottom: 1px solid var(--line); background: var(--bg-elev); }
.app-top-title { display: flex; gap: .4rem; align-items: baseline; font-size: .95rem; white-space: nowrap; }
.app-search { flex: 1; max-width: 640px; margin-inline: auto; position: relative; }
.app-search .input { border-radius: var(--r-pill); background: var(--bg-sunken); }
.app-search-menu { width: 100%; max-height: min(70vh, 540px); overflow-y: auto; }
.app-top-actions { margin-left: auto; }
.app-sync { color: var(--text-3); display: inline-grid; place-items: center; width: 2rem; height: 2rem; }
.app-sync.is-syncing .ph { animation: spin 1.2s linear infinite; color: var(--brand); }
.app-sync.is-error { color: var(--danger); }
.app-sync.is-offline { color: var(--warning); }
@keyframes spin { to { transform: rotate(360deg); } }
.app-content { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.app-page { padding: 1.2rem 1.4rem; overflow: auto; height: 100%; }
.app-page .container { max-width: 1240px; }
.app-mobile-nav { position: fixed; inset: 0; z-index: 300; background: rgba(0,0,0,.45); }
.app-mobile-nav-panel { width: min(320px, 85vw); height: 100%; background: var(--bg-elev); padding: 1rem .6rem; display: flex; flex-direction: column; gap: .15rem; }
@media (max-width: 900px) { .app-rail { display: none; } .app-top-title { display: none; } }

/* ------------------------------------------------------------ Messagerie : trois volets */
.mail { display: grid; grid-template-columns: var(--folders-w, 248px) var(--list-w, 400px) minmax(0, 1fr); height: 100%; min-height: 0; }
.mail.is-folders-hidden { grid-template-columns: 0 var(--list-w, 400px) minmax(0, 1fr); }
.mail.is-reading-bottom { grid-template-columns: var(--folders-w, 248px) minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) minmax(0, 1fr); }
.mail.is-reading-bottom .mail-folders { grid-row: 1 / -1; }
.mail.is-reading-off { grid-template-columns: var(--folders-w, 248px) minmax(0, 1fr); }
.mail.is-reading-off .mail-read { display: none; }
.mail-folders, .mail-list, .mail-read { min-height: 0; display: flex; flex-direction: column; }
.mail-folders { border-right: 1px solid var(--line); background: var(--bg-sunken); overflow: hidden; }
.mail-folders-scroll { overflow-y: auto; flex: 1; padding: .5rem .5rem 1rem; }
.mail-compose-btn { margin: .7rem .7rem .4rem; }
.mail-account { margin-top: .5rem; }
.mail-account-head { display: flex; align-items: center; gap: .5rem; padding: .45rem .6rem; border-radius: var(--r-sm); cursor: pointer; font-size: .82rem; font-weight: 700; color: var(--text-2); user-select: none; }
.mail-account-head:hover { background: var(--bg-hover); }
.mail-account-head .caret { margin-left: auto; transition: transform .15s; font-size: .9rem; }
.mail-account-head.is-collapsed .caret { transform: rotate(-90deg); }
.mail-account-dot { width: .6rem; height: .6rem; border-radius: 50%; flex-shrink: 0; }
.mail-account-head .status { margin-left: .2rem; font-size: .85rem; }
.folder { display: flex; align-items: center; gap: .55rem; padding: .42rem .6rem .42rem calc(.6rem + var(--depth, 0) * .9rem); border-radius: var(--r-sm); color: var(--text-2); font-size: .88rem; cursor: pointer; text-decoration: none !important; user-select: none; position: relative; }
.folder:hover { background: var(--bg-hover); color: var(--text); }
.folder.is-active { background: var(--bg-elev); color: var(--text); font-weight: 650; box-shadow: var(--shadow-1); }
.folder.is-active .ph { color: var(--accent, var(--brand)); }
.folder .ph { font-size: 1.1rem; flex-shrink: 0; color: var(--text-3); }
.folder .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.folder .count { font-size: .72rem; font-weight: 800; color: var(--accent, var(--brand)); min-width: 1.2rem; text-align: right; }
.folder .count.is-total { color: var(--text-3); font-weight: 600; }
.folder.is-drop { outline: 2px dashed var(--brand); outline-offset: -2px; background: var(--brand-soft); }
.folder .toggle { width: 1.1rem; height: 1.1rem; display: grid; place-items: center; border-radius: 4px; color: var(--text-3); font-size: .75rem; margin-left: -.35rem; }
.folder .toggle:hover { background: var(--bg-hover); color: var(--text); }
.folders-section { padding: .6rem .6rem .25rem; font-size: .68rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--text-3); display: flex; align-items: center; justify-content: space-between; }
.folders-section .btn { margin: -.3rem 0; }
.label-dot { width: .7rem; height: .7rem; border-radius: 50%; flex-shrink: 0; }
.mail-quota { padding: .6rem .8rem; border-top: 1px solid var(--line); font-size: .74rem; color: var(--text-3); display: flex; flex-direction: column; gap: .35rem; }

.mail-list { border-right: 1px solid var(--line); background: var(--bg-elev); }
.mail-list-head { padding: .6rem .8rem .4rem; display: flex; flex-direction: column; gap: .5rem; border-bottom: 1px solid var(--line); }
.mail-list-title { display: flex; align-items: center; gap: .5rem; min-width: 0; }
.mail-list-title h2 { font-size: 1.02rem; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-list-tools { display: flex; align-items: center; gap: .25rem; flex-wrap: wrap; }
.mail-list-tabs { display: flex; gap: .15rem; }
.mail-list-tabs button { border: 0; background: none; padding: .35rem .7rem; border-radius: var(--r-pill); font: inherit; font-size: .82rem; font-weight: 650; color: var(--text-2); cursor: pointer; }
.mail-list-tabs button.is-active { background: var(--text); color: var(--bg); }
.mail-list-tabs button .n { margin-left: .3rem; font-size: .72rem; opacity: .75; }
.mail-list-scroll { flex: 1; overflow-y: auto; overscroll-behavior: contain; }
.mail-group { position: sticky; top: 0; z-index: 2; background: var(--bg-elev); padding: .45rem .9rem .3rem; font-size: .7rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); border-bottom: 1px solid var(--line); }
.msg { position: relative; outline: none; display: grid; grid-template-columns: auto 1fr auto; gap: .2rem .65rem; padding: .6rem .8rem .6rem .7rem; border-bottom: 1px solid var(--line); cursor: pointer; user-select: none; border-left: 3px solid transparent; transition: background .1s; }
.msg:hover { background: var(--bg-hover); }
.msg.is-active { background: var(--accent-soft, var(--brand-soft)); border-left-color: var(--accent, var(--brand)); }
.msg.is-selected { background: var(--info-soft); }
.msg.is-unread { border-left-color: var(--accent, var(--brand)); }
.msg.is-unread .msg-from, .msg.is-unread .msg-subject { font-weight: 760; color: var(--text); }
.msg-check { grid-row: 1 / span 3; display: flex; align-items: flex-start; padding-top: .15rem; }
.msg-check .avatar { width: 2.1rem; height: 2.1rem; font-size: .72rem; }
.msg-check input { display: none; position: absolute; }
.msg:hover .msg-check .avatar, .msg.is-selected .msg-check .avatar, .mail-list.has-selection .msg-check .avatar { display: none; }
.msg:hover .msg-check input, .msg.is-selected .msg-check input, .mail-list.has-selection .msg-check input { display: block; position: static; width: 1.15rem; height: 1.15rem; margin: .45rem .45rem; accent-color: var(--accent, var(--brand)); }
.msg-from { font-size: .9rem; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; align-items: center; gap: .35rem; }
.msg-from .thread-n { font-size: .7rem; font-weight: 700; color: var(--text-3); background: var(--muted-soft); border-radius: var(--r-pill); padding: 0 .4rem; }
.msg-date { font-size: .74rem; color: var(--text-3); white-space: nowrap; text-align: right; }
.msg.is-unread .msg-date { color: var(--accent, var(--brand)); font-weight: 700; }
.msg-subject { grid-column: 2 / span 2; font-size: .88rem; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; align-items: center; gap: .4rem; }
.msg-snippet { grid-column: 2 / span 2; font-size: .8rem; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; align-items: center; gap: .4rem; }
.msg-snippet .ph { flex-shrink: 0; font-size: .95rem; }
.msg-icons { display: inline-flex; gap: .25rem; align-items: center; color: var(--text-3); font-size: .95rem; margin-left: auto; flex-shrink: 0; }
.msg-icons .is-flag { color: var(--signal); } .msg-icons .is-pin { color: var(--info); } .msg-icons .is-phish { color: var(--danger); }
.msg-cat { font-size: .66rem; font-weight: 800; padding: .05rem .4rem; border-radius: var(--r-pill); letter-spacing: .03em; }
.msg-cat.tone-danger { background: var(--danger-soft); color: var(--danger); } .msg-cat.tone-warning { background: var(--warning-soft); color: var(--warning); } .msg-cat.tone-info { background: var(--info-soft); color: var(--info); } .msg-cat.tone-muted { background: var(--muted-soft); color: var(--text-3); } .msg-cat.tone-violet { background: var(--violet-soft); color: var(--violet); }
.msg-labels { display: inline-flex; gap: .25rem; }
.msg-labels i { width: .55rem; height: .55rem; border-radius: 50%; display: inline-block; }
.msg-hover { position: absolute; right: .5rem; top: .45rem; display: none; gap: .1rem; background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--r-sm); padding: .1rem; box-shadow: var(--shadow-1); }
.msg:hover .msg-hover { display: inline-flex; }
.msg:hover .msg-date { visibility: hidden; }
.msg-hover .btn { width: 1.7rem; height: 1.7rem; }
.msg-account-bar { position: absolute; left: 0; top: 0; bottom: 0; width: 3px; }
.mail-list.is-compact .msg { padding-block: .35rem; } .mail-list.is-compact .msg-snippet { display: none; }
.mail-list-foot { padding: .5rem .8rem; border-top: 1px solid var(--line); font-size: .76rem; color: var(--text-3); display: flex; justify-content: space-between; align-items: center; }
.mail-skeleton { padding: .7rem .8rem; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 2.1rem 1fr; gap: .5rem; }
.mail-skeleton span { display: block; height: .7rem; border-radius: 6px; background: var(--muted-soft); animation: pulse 1.4s ease-in-out infinite; }
.mail-skeleton .av { width: 2.1rem; height: 2.1rem; border-radius: 50%; grid-row: span 2; }
@keyframes pulse { 50% { opacity: .45; } }
.bulk-bar { display: flex; align-items: center; gap: .3rem; padding: .35rem .6rem; background: var(--info-soft); border-bottom: 1px solid var(--line); font-size: .82rem; flex-wrap: wrap; }
.bulk-bar b { margin-right: .3rem; }

.mail-read { background: var(--bg); overflow: hidden; position: relative; }
.mail-read-scroll { flex: 1; overflow-y: auto; padding: 1rem 1.4rem 2rem; }
.mail-read-empty { height: 100%; display: flex; align-items: center; justify-content: center; color: var(--text-3); text-align: center; padding: 2rem; }
.mail-read-empty .icon-box { width: 4rem; height: 4rem; font-size: 2rem; margin: 0 auto .8rem; }
.read-toolbar { display: flex; align-items: center; gap: .15rem; padding: .45rem .8rem; border-bottom: 1px solid var(--line); background: var(--bg-elev); flex-wrap: wrap; }
.read-toolbar .sep { width: 1px; height: 1.4rem; background: var(--line); margin: 0 .3rem; }
.read-toolbar .btn-ghost { color: var(--text-2); }
.read-subject { font-size: 1.25rem; font-weight: 780; margin: 0 0 .6rem; line-height: 1.25; display: flex; align-items: flex-start; gap: .6rem; flex-wrap: wrap; }
.read-subject .pill { margin-top: .2rem; }
.thread-msg { background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--r-lg); margin-bottom: .8rem; overflow: hidden; }
.thread-msg.is-collapsed .thread-body, .thread-msg.is-collapsed .thread-att, .thread-msg.is-collapsed .thread-meta-full { display: none; }
.thread-msg.is-collapsed .thread-head { cursor: pointer; }
.thread-msg.is-collapsed .thread-head:hover { background: var(--bg-hover); }
.thread-head { display: flex; gap: .8rem; padding: .85rem 1rem .6rem; align-items: flex-start; }
.thread-head .avatar { width: 2.4rem; height: 2.4rem; }
.thread-who { flex: 1; min-width: 0; }
.thread-who b { font-size: .95rem; }
.thread-who .to { font-size: .8rem; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thread-who .to button { border: 0; background: none; color: var(--text-3); cursor: pointer; font: inherit; padding: 0; text-decoration: underline dotted; }
.thread-meta { text-align: right; font-size: .78rem; color: var(--text-3); white-space: nowrap; display: flex; flex-direction: column; align-items: flex-end; gap: .25rem; }
.thread-meta .row { gap: .1rem; }
.thread-meta-full { padding: 0 1rem .6rem; font-size: .8rem; }
.thread-meta-full .kv { grid-template-columns: 5rem 1fr; }
.thread-preview { padding: 0 1rem .7rem; font-size: .82rem; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thread-msg:not(.is-collapsed) .thread-preview { display: none; }
.thread-body { padding: .4rem 1rem 1rem; }
.thread-body iframe { width: 100%; border: 0; display: block; min-height: 120px; background: #fff; border-radius: var(--r-sm); }
[data-theme="dark"] .thread-body iframe.is-dark-adapt { filter: invert(.92) hue-rotate(180deg); }
.thread-body pre.plain { white-space: pre-wrap; word-break: break-word; font: inherit; margin: 0; font-size: .92rem; line-height: 1.55; }
.thread-body blockquote.quoted { margin: .6rem 0 0; padding-left: .8rem; border-left: 3px solid var(--line-strong); color: var(--text-3); }
.quote-toggle { margin-top: .5rem; }
.remote-images-bar, .phish-bar, .list-bar, .ai-bar { display: flex; align-items: center; gap: .6rem; padding: .55rem .9rem; font-size: .82rem; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.remote-images-bar { background: var(--warning-soft); color: var(--warning); }
.phish-bar { background: var(--danger-soft); color: var(--danger); }
.list-bar { background: var(--muted-soft); color: var(--text-2); }
.ai-bar { background: var(--violet-soft); color: var(--violet); align-items: flex-start; }
.ai-bar .ph-sparkle { margin-top: .15rem; }
.ai-bar p { margin: 0; color: var(--text); }
.thread-att { display: flex; flex-wrap: wrap; gap: .5rem; padding: 0 1rem .9rem; }
.att { display: flex; align-items: center; gap: .55rem; padding: .45rem .6rem; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--bg); font-size: .8rem; max-width: 260px; text-decoration: none !important; color: var(--text); }
.att:hover { border-color: var(--line-strong); background: var(--bg-hover); }
.att .ph { font-size: 1.4rem; color: var(--text-2); flex-shrink: 0; }
.att .att-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.att .att-size { color: var(--text-3); font-size: .72rem; display: block; }
.att img.att-thumb { width: 2.2rem; height: 2.2rem; object-fit: cover; border-radius: 4px; }
.att-actions { display: flex; gap: .1rem; margin-left: auto; }
.att-actions .btn { width: 1.6rem; height: 1.6rem; }
.read-quick-reply { display: flex; gap: .5rem; padding: .3rem 0 0; flex-wrap: wrap; }
.read-quick-reply .chip { cursor: pointer; }
.quick-reply-box { background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--r-lg); padding: .8rem 1rem; margin-top: .6rem; }
.note-box { background: var(--warning-soft); border: 1px dashed var(--warning); border-radius: var(--r); padding: .6rem .8rem; font-size: .85rem; margin-bottom: .8rem; }
.read-nav { display: flex; align-items: center; gap: .1rem; margin-left: auto; }
.suggested-actions { display: flex; flex-direction: column; gap: .4rem; margin: .6rem 0 .2rem; }
.suggested-action { display: flex; align-items: center; gap: .6rem; padding: .5rem .7rem; border: 1px solid var(--line); border-radius: var(--r); background: var(--bg-elev); font-size: .85rem; }
.suggested-action .ph { color: var(--violet); font-size: 1.2rem; }
.suggested-action .grow b { display: block; font-size: .85rem; } .suggested-action .grow small { color: var(--text-3); display: block; }

/* contacts popover */
.contact-pop { position: absolute; z-index: 20; background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-pop); padding: .9rem 1rem; width: 300px; font-size: .85rem; }
.contact-pop .avatar { width: 2.8rem; height: 2.8rem; font-size: .95rem; }

/* ------------------------------------------------------------ Rédaction */
.compose-dock { position: fixed; right: 1rem; bottom: 0; z-index: 250; width: min(760px, calc(100vw - 2rem)); height: min(78vh, 720px); background: var(--bg-elev); border: 1px solid var(--line); border-bottom: 0; border-radius: var(--r-lg) var(--r-lg) 0 0; box-shadow: var(--shadow-pop); display: flex; flex-direction: column; transition: height .2s var(--ease), width .2s var(--ease); }
.compose-dock.is-min { height: 44px; width: 320px; }
.compose-dock.is-min .compose-body, .compose-dock.is-min .compose-foot { display: none; }
.compose-dock.is-max { position: fixed; inset: 1.5rem; width: auto; height: auto; border-radius: var(--r-lg); border-bottom: 1px solid var(--line); }
.compose-dock.is-popout { position: static; width: 100%; height: 100%; border: 0; border-radius: 0; box-shadow: none; }
.compose-head { display: flex; align-items: center; gap: .5rem; padding: .35rem .5rem .35rem .9rem; border-bottom: 1px solid var(--line); background: var(--bg-sunken); border-radius: var(--r-lg) var(--r-lg) 0 0; min-height: 44px; cursor: default; }
.compose-head b { flex: 1; min-width: 0; font-size: .88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.compose-head .saving { font-size: .72rem; color: var(--text-3); }
.compose-body { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.compose-row { display: flex; align-items: center; gap: .5rem; padding: .2rem .9rem; border-bottom: 1px solid var(--line); min-height: 40px; }
.compose-row > label { width: 2.6rem; font-size: .8rem; color: var(--text-3); flex-shrink: 0; font-weight: 650; }
.compose-row .input { border: 0; background: none; padding-inline: .2rem; box-shadow: none !important; }
.compose-row .compose-aside { margin-left: auto; display: flex; gap: .2rem; align-items: center; }
.compose-row .link-btn { font-size: .78rem; }
.recips { flex: 1; display: flex; flex-wrap: wrap; align-items: center; gap: .3rem; min-width: 0; position: relative; }
.recips input { border: 0; background: none; outline: none; font: inherit; font-size: .9rem; min-width: 140px; flex: 1; padding: .3rem .2rem; color: var(--text); }
.recip { display: inline-flex; align-items: center; gap: .35rem; padding: .18rem .3rem .18rem .2rem; border-radius: var(--r-pill); background: var(--muted-soft); font-size: .8rem; max-width: 100%; }
.recip .avatar { width: 1.35rem; height: 1.35rem; font-size: .55rem; }
.recip.is-invalid { background: var(--danger-soft); color: var(--danger); }
.recip.is-external { box-shadow: inset 0 0 0 1px var(--warning); }
.recip button { border: 0; background: none; cursor: pointer; color: inherit; opacity: .6; padding: 0 .15rem; display: inline-grid; place-items: center; }
.recip button:hover { opacity: 1; }
.recips-menu { position: absolute; left: 0; top: 100%; z-index: 30; min-width: 320px; }
.compose-editor { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.compose-editor .ql-toolbar { border: 0; border-bottom: 1px solid var(--line); background: var(--bg); padding: .3rem .6rem; }
.compose-editor .ql-container { border: 0; flex: 1; min-height: 0; font-family: inherit; font-size: .95rem; }
.compose-editor .ql-editor { min-height: 160px; color: var(--text); padding: .9rem 1rem; }
.compose-editor .ql-editor.ql-blank::before { color: var(--text-3); font-style: normal; }
[data-theme="dark"] .ql-snow .ql-stroke { stroke: var(--text-2); } [data-theme="dark"] .ql-snow .ql-fill { fill: var(--text-2); } [data-theme="dark"] .ql-snow .ql-picker { color: var(--text-2); }
[data-theme="dark"] .ql-snow .ql-picker-options { background: var(--bg-elev); border-color: var(--line); }
.compose-plain { flex: 1; border: 0; resize: none; padding: .9rem 1rem; font: inherit; font-size: .95rem; background: none; color: var(--text); outline: none; }
.compose-atts { display: flex; flex-wrap: wrap; gap: .4rem; padding: .4rem .9rem; border-top: 1px solid var(--line); max-height: 120px; overflow: auto; }
.compose-atts .att { padding: .3rem .5rem; }
.compose-foot { display: flex; align-items: center; gap: .3rem; padding: .45rem .7rem; border-top: 1px solid var(--line); background: var(--bg-sunken); flex-wrap: wrap; }
.compose-foot .grow { text-align: right; font-size: .74rem; color: var(--text-3); }
.compose-drop { position: absolute; inset: 0; z-index: 5; display: grid; place-items: center; background: color-mix(in srgb, var(--brand) 12%, var(--bg-elev)); border: 2px dashed var(--brand); border-radius: var(--r-lg); font-weight: 700; color: var(--brand-ink); pointer-events: none; }
.ai-rewrite-menu { min-width: 240px; }
.ai-proposals { display: flex; flex-direction: column; gap: .5rem; }
.ai-proposal { border: 1px solid var(--line); border-radius: var(--r); padding: .7rem .8rem; cursor: pointer; background: var(--bg); font-size: .85rem; }
.ai-proposal:hover { border-color: var(--brand); background: var(--brand-soft); }
.ai-proposal b { display: block; font-size: .78rem; color: var(--violet); margin-bottom: .25rem; }
.ai-proposal p { margin: 0; white-space: pre-wrap; max-height: 7.5em; overflow: hidden; }
@media (max-width: 760px) { .compose-dock, .compose-dock.is-max { inset: 0; width: 100%; height: 100%; right: 0; border-radius: 0; } }

/* ------------------------------------------------------------ Panneau IA */
.ai-panel { position: fixed; top: 0; right: 0; bottom: 0; width: min(420px, 100vw); z-index: 260; background: var(--bg-elev); border-left: 1px solid var(--line); box-shadow: var(--shadow-pop); display: flex; flex-direction: column; transform: translateX(100%); transition: transform .22s var(--ease); }
.ai-panel.is-open { transform: none; }
.ai-panel-head { display: flex; align-items: center; gap: .5rem; padding: .6rem .8rem; border-bottom: 1px solid var(--line); }
.ai-panel-head .ph-sparkle { color: var(--violet); font-size: 1.3rem; }
.ai-panel-head b { flex: 1; }
.ai-thread { flex: 1; overflow-y: auto; padding: .9rem; display: flex; flex-direction: column; gap: .7rem; }
.ai-msg { max-width: 92%; padding: .6rem .8rem; border-radius: var(--r-lg); font-size: .88rem; line-height: 1.5; white-space: pre-wrap; word-break: break-word; }
.ai-msg.is-user { align-self: flex-end; background: var(--text); color: var(--bg); border-bottom-right-radius: 6px; }
.ai-msg.is-assistant { align-self: flex-start; background: var(--bg-sunken); border-bottom-left-radius: 6px; }
.ai-msg.is-assistant .cite { display: inline-flex; align-items: center; gap: .2rem; padding: 0 .4rem; border-radius: var(--r-pill); background: var(--info-soft); color: var(--info); font-size: .74rem; font-weight: 700; cursor: pointer; text-decoration: none; }
.ai-msg.is-assistant .cite:hover { filter: brightness(.95); }
.ai-msg.is-thinking { color: var(--text-3); font-style: italic; }
.ai-thinking i { display: inline-block; width: .4rem; height: .4rem; border-radius: 50%; background: var(--violet); margin-right: .2rem; animation: pulse 1s infinite; }
.ai-thinking i:nth-child(2) { animation-delay: .2s; } .ai-thinking i:nth-child(3) { animation-delay: .4s; }
.ai-actions { display: flex; flex-direction: column; gap: .4rem; align-self: stretch; }
.ai-action { display: flex; gap: .6rem; align-items: flex-start; padding: .6rem .7rem; border: 1px solid var(--violet); border-radius: var(--r); background: var(--violet-soft); font-size: .84rem; }
.ai-action .ph { color: var(--violet); font-size: 1.25rem; margin-top: .1rem; }
.ai-action b { display: block; } .ai-action small { color: var(--text-2); display: block; white-space: pre-wrap; }
.ai-action .row { margin-top: .4rem; }
.ai-action.is-done { border-color: var(--brand-line); background: var(--brand-soft); } .ai-action.is-done .ph { color: var(--brand); }
.ai-action.is-rejected { opacity: .55; border-color: var(--line); background: var(--bg-sunken); }
.ai-suggestions { display: flex; flex-wrap: wrap; gap: .4rem; padding: 0 .9rem .5rem; }
.ai-suggestions .chip { cursor: pointer; }
.ai-input { display: flex; gap: .4rem; padding: .6rem .8rem; border-top: 1px solid var(--line); align-items: flex-end; }
.ai-input textarea { flex: 1; resize: none; min-height: 2.6rem; height: 2.6rem; max-height: 140px; border-radius: var(--r-lg); padding: .6rem .8rem; line-height: 1.35; }
.ai-credits { font-size: .72rem; color: var(--text-3); padding: 0 .9rem .5rem; display: flex; gap: .5rem; align-items: center; }
.ai-credits .meter { flex: 1; }
.ai-panel-hist { position: absolute; inset: 0; background: var(--bg-elev); display: flex; flex-direction: column; }

/* ------------------------------------------------------------ Agenda */
.cal { display: grid; grid-template-columns: 260px minmax(0, 1fr); height: 100%; min-height: 0; }
.cal-side { border-right: 1px solid var(--line); background: var(--bg-sunken); padding: .8rem; overflow-y: auto; display: flex; flex-direction: column; gap: 1rem; }
.cal-main { display: flex; flex-direction: column; min-height: 0; }
.cal-toolbar { display: flex; align-items: center; gap: .5rem; padding: .6rem 1rem; border-bottom: 1px solid var(--line); background: var(--bg-elev); flex-wrap: wrap; }
.cal-toolbar h2 { margin: 0; font-size: 1.05rem; min-width: 180px; text-transform: capitalize; }
.mini-cal { font-size: .78rem; }
.mini-cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: .4rem; font-weight: 700; text-transform: capitalize; }
.mini-cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; text-align: center; }
.mini-cal-grid .dow { color: var(--text-3); font-size: .66rem; font-weight: 700; }
.mini-cal-grid button { border: 0; background: none; font: inherit; font-size: .76rem; width: 100%; aspect-ratio: 1; border-radius: 50%; cursor: pointer; color: var(--text); position: relative; }
.mini-cal-grid button.is-other { color: var(--text-3); opacity: .6; }
.mini-cal-grid button.is-today { font-weight: 800; color: var(--accent, var(--brand)); }
.mini-cal-grid button.is-selected { background: var(--text); color: var(--bg); }
.mini-cal-grid button.has-events::after { content: ""; position: absolute; bottom: 3px; left: 50%; transform: translateX(-50%); width: 4px; height: 4px; border-radius: 50%; background: var(--accent, var(--brand)); }
.mini-cal-grid button.is-selected.has-events::after { background: var(--bg); }
.cal-grid { flex: 1; min-height: 0; overflow: auto; background: var(--bg-elev); }
.cal-month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); grid-auto-rows: minmax(110px, 1fr); height: 100%; }
.cal-month .dow { position: sticky; top: 0; z-index: 2; background: var(--bg-elev); padding: .4rem; font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); border-bottom: 1px solid var(--line); text-align: center; grid-row: auto; min-height: 0; height: 30px; }
.cal-cell { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: .3rem; display: flex; flex-direction: column; gap: .15rem; min-width: 0; cursor: pointer; }
.cal-cell:hover { background: var(--bg-hover); }
.cal-cell.is-other { background: var(--bg-sunken); color: var(--text-3); }
.cal-cell .d { font-size: .78rem; font-weight: 700; width: 1.6rem; height: 1.6rem; display: grid; place-items: center; border-radius: 50%; }
.cal-cell.is-today .d { background: var(--accent, var(--brand)); color: #fff; }
.cal-ev { font-size: .74rem; padding: .12rem .4rem; border-radius: 5px; background: var(--ev, var(--brand)); color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; border-left: 3px solid rgba(0,0,0,.2); }
.cal-ev.is-tentative { background: color-mix(in srgb, var(--ev, var(--brand)) 25%, transparent); color: var(--text); border-left-style: dashed; }
.cal-ev.is-cancelled { text-decoration: line-through; opacity: .5; }
.cal-more { font-size: .7rem; color: var(--text-3); padding-left: .3rem; cursor: pointer; }
.cal-week { display: grid; grid-template-columns: 56px repeat(var(--days, 7), minmax(0, 1fr)); position: relative; }
.cal-week .wk-head { position: sticky; top: 0; z-index: 3; background: var(--bg-elev); border-bottom: 1px solid var(--line); text-align: center; padding: .4rem .2rem; font-size: .74rem; font-weight: 700; color: var(--text-2); }
.cal-week .wk-head b { display: block; font-size: 1.1rem; width: 2rem; height: 2rem; margin: .1rem auto 0; display: grid; place-items: center; border-radius: 50%; }
.cal-week .wk-head.is-today b { background: var(--accent, var(--brand)); color: #fff; }
.cal-week .allday { border-bottom: 1px solid var(--line); min-height: 28px; padding: 2px; display: flex; flex-direction: column; gap: 2px; border-right: 1px solid var(--line); }
.cal-week .hours { position: relative; }
.cal-week .hour { height: 56px; border-bottom: 1px solid var(--line); font-size: .68rem; color: var(--text-3); text-align: right; padding-right: .4rem; transform: translateY(-.5em); }
.cal-week .day-col { position: relative; border-right: 1px solid var(--line); background-image: repeating-linear-gradient(to bottom, transparent 0 55px, var(--line) 55px 56px); height: calc(56px * 24); cursor: pointer; }
.cal-week .day-col.is-today { background-color: color-mix(in srgb, var(--accent, var(--brand)) 5%, transparent); }
.cal-week .ev-abs { position: absolute; left: 2px; right: 4px; border-radius: 6px; background: var(--ev, var(--brand)); color: #fff; font-size: .74rem; padding: .2rem .4rem; overflow: hidden; border-left: 3px solid rgba(0,0,0,.25); cursor: pointer; box-shadow: var(--shadow-1); }
.cal-week .ev-abs small { display: block; opacity: .85; }
.cal-week .now-line { position: absolute; left: 0; right: 0; height: 2px; background: var(--danger); z-index: 2; pointer-events: none; }
.cal-week .now-line::before { content: ""; position: absolute; left: -4px; top: -3px; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); }
.cal-agenda { padding: 1rem; display: flex; flex-direction: column; gap: 1rem; }
.cal-agenda-day h3 { font-size: .82rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); margin: 0 0 .4rem; }
.cal-agenda-ev { display: flex; gap: .8rem; padding: .55rem .7rem; border-radius: var(--r); border: 1px solid var(--line); background: var(--bg-elev); cursor: pointer; align-items: center; margin-bottom: .4rem; }
.cal-agenda-ev .when { width: 5.5rem; font-size: .8rem; color: var(--text-2); flex-shrink: 0; }
.cal-agenda-ev .bar { width: 4px; align-self: stretch; border-radius: 4px; background: var(--ev, var(--brand)); }
.cal-list-item { display: flex; align-items: center; gap: .5rem; font-size: .84rem; padding: .25rem .2rem; }
.ev-popover { position: fixed; z-index: 280; width: min(380px, 92vw); background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-pop); padding: 1rem; }
.ev-popover .color-bar { height: 5px; border-radius: 5px; margin: -1rem -1rem .8rem; }
@media (max-width: 900px) { .cal { grid-template-columns: 1fr; } .cal-side { display: none; } .cal-month { grid-auto-rows: minmax(70px, 1fr); } }

/* ------------------------------------------------------------ Tâches */
.tasks { display: grid; grid-template-columns: 250px minmax(0, 1fr) minmax(0, 360px); height: 100%; min-height: 0; }
.tasks.is-detail-hidden { grid-template-columns: 250px minmax(0, 1fr); }
.tasks-side { border-right: 1px solid var(--line); background: var(--bg-sunken); padding: .7rem .5rem; overflow-y: auto; }
.tasks-main { display: flex; flex-direction: column; min-height: 0; background: var(--bg-elev); }
.tasks-head { padding: .8rem 1.2rem .5rem; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: .6rem; }
.tasks-head h2 { margin: 0; font-size: 1.1rem; flex: 1; }
.tasks-add { display: flex; align-items: center; gap: .5rem; padding: .6rem 1.2rem; border-bottom: 1px solid var(--line); }
.tasks-add input { flex: 1; border: 0; background: none; font: inherit; font-size: .95rem; outline: none; color: var(--text); padding: .4rem .2rem; }
.tasks-scroll { flex: 1; overflow-y: auto; padding: .4rem 0 1rem; }
.task { display: flex; align-items: center; gap: .7rem; padding: .55rem 1.2rem; border-bottom: 1px solid var(--line); cursor: pointer; }
.task:hover { background: var(--bg-hover); }
.task.is-active { background: var(--accent-soft, var(--brand-soft)); }
.task.is-done .task-title { text-decoration: line-through; color: var(--text-3); }
.task-check { width: 1.25rem; height: 1.25rem; border-radius: 50%; border: 2px solid var(--line-strong); display: grid; place-items: center; flex-shrink: 0; cursor: pointer; color: transparent; font-size: .8rem; transition: all .12s; }
.task-check:hover { border-color: var(--brand); color: var(--brand); }
.task.is-done .task-check { background: var(--brand); border-color: var(--brand); color: #fff; }
.task-title { flex: 1; min-width: 0; font-size: .92rem; }
.task-meta { display: flex; gap: .6rem; font-size: .74rem; color: var(--text-3); align-items: center; flex-wrap: wrap; }
.task-meta .is-overdue { color: var(--danger); font-weight: 700; }
.task-star { color: var(--text-3); border: 0; background: none; cursor: pointer; font-size: 1.1rem; }
.task-star.is-on { color: var(--signal); }
.task-prio-1 .task-title::before { content: "!"; color: var(--danger); font-weight: 800; margin-right: .3rem; }
.tasks-detail { border-left: 1px solid var(--line); background: var(--bg); padding: 1rem; overflow-y: auto; }
.tasks-group { padding: .6rem 1.2rem .2rem; font-size: .72rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); display: flex; align-items: center; gap: .4rem; cursor: pointer; }
@media (max-width: 1000px) { .tasks { grid-template-columns: 1fr; } .tasks-side, .tasks-detail { display: none; } }

/* ------------------------------------------------------------ Contacts */
.contacts { display: grid; grid-template-columns: 230px minmax(0, 1fr) minmax(0, 400px); height: 100%; min-height: 0; }
.contacts-side { border-right: 1px solid var(--line); background: var(--bg-sunken); padding: .7rem .5rem; overflow-y: auto; }
.contacts-main { display: flex; flex-direction: column; min-height: 0; background: var(--bg-elev); }
.contacts-scroll { flex: 1; overflow-y: auto; }
.contact-row { display: flex; align-items: center; gap: .8rem; padding: .55rem 1rem; border-bottom: 1px solid var(--line); cursor: pointer; }
.contact-row:hover { background: var(--bg-hover); } .contact-row.is-active { background: var(--accent-soft, var(--brand-soft)); }
.contact-row .avatar { width: 2.3rem; height: 2.3rem; font-size: .8rem; }
.contact-row b { font-size: .92rem; display: block; } .contact-row small { color: var(--text-3); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.contacts-detail { border-left: 1px solid var(--line); background: var(--bg); padding: 1.2rem; overflow-y: auto; }
.contact-hero { display: flex; flex-direction: column; align-items: center; text-align: center; gap: .4rem; margin-bottom: 1rem; }
.contact-hero .avatar { width: 4.2rem; height: 4.2rem; font-size: 1.4rem; }
.alpha-index { position: sticky; top: 0; background: var(--bg-elev); padding: .3rem 1rem; font-size: .72rem; font-weight: 800; color: var(--text-3); border-bottom: 1px solid var(--line); z-index: 2; }
@media (max-width: 1000px) { .contacts { grid-template-columns: 1fr; } .contacts-side, .contacts-detail { display: none; } }

/* ------------------------------------------------------------ Réglages (utilisateur) */
.settings { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 1.5rem; max-width: 1200px; }
.settings-nav { display: flex; flex-direction: column; gap: .15rem; position: sticky; top: 0; align-self: start; }
.settings-nav a { display: flex; align-items: center; gap: .6rem; padding: .55rem .8rem; border-radius: var(--r-sm); color: var(--text-2); font-size: .9rem; text-decoration: none !important; }
.settings-nav a:hover { background: var(--bg-hover); color: var(--text); }
.settings-nav a.is-active { background: var(--bg-elev); color: var(--text); font-weight: 650; box-shadow: var(--shadow-1); }
.settings-nav a.is-active .ph { color: var(--accent, var(--brand)); }
.settings-section { display: flex; flex-direction: column; gap: 1.2rem; }
.settings-block { background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 1.2rem 1.4rem; }
.settings-block h3 { margin: 0 0 .25rem; font-size: 1rem; }
.settings-block .lead { color: var(--text-3); font-size: .85rem; margin: 0 0 1rem; }
.account-card { display: flex; gap: .9rem; align-items: center; padding: .9rem 1rem; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--bg-elev); }
.account-card .avatar { width: 2.8rem; height: 2.8rem; font-size: .9rem; }
.account-card .grow b { display: block; } .account-card .grow small { color: var(--text-3); display: block; }
.account-card .st { display: inline-flex; align-items: center; gap: .3rem; font-size: .76rem; font-weight: 700; }
.account-card .st.is-ok { color: var(--brand-ink); } .account-card .st.is-err { color: var(--danger); } .account-card .st.is-pause { color: var(--warning); } .account-card .st.is-sync { color: var(--info); }
.provider-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .7rem; }
.provider-tile { border: 1px solid var(--line); border-radius: var(--r-lg); padding: 1rem .8rem; text-align: center; cursor: pointer; background: var(--bg-elev); display: flex; flex-direction: column; align-items: center; gap: .4rem; font-weight: 650; font-size: .9rem; transition: all .15s; }
.provider-tile:hover { border-color: var(--line-strong); transform: translateY(-2px); box-shadow: var(--shadow-2); }
.provider-tile.is-active { border-color: var(--brand); background: var(--brand-soft); }
.provider-tile .ph { font-size: 1.9rem; color: var(--text-2); }
.provider-tile.is-active .ph { color: var(--brand); }
.provider-tile small { font-size: .72rem; color: var(--text-3); font-weight: 500; }
.step-dots { display: flex; gap: .4rem; align-items: center; font-size: .78rem; color: var(--text-3); }
.step-dots i { width: .55rem; height: .55rem; border-radius: 50%; background: var(--line-strong); }
.step-dots i.is-on { background: var(--brand); }
@media (max-width: 860px) { .settings { grid-template-columns: 1fr; } .settings-nav { position: static; flex-direction: row; flex-wrap: wrap; } }

/* ------------------------------------------------------------ Ma journée */
.today-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 1.2rem; }
.today-hero { display: flex; align-items: center; gap: 1rem; padding: 1.2rem 1.4rem; border-radius: var(--r-xl); background: linear-gradient(135deg, var(--brand-soft), var(--bg-elev)); border: 1px solid var(--brand-line); margin-bottom: 1.2rem; }
.today-hero h1 { margin: 0; font-size: 1.5rem; }
.today-hero p { margin: .2rem 0 0; color: var(--text-2); }
.today-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: .7rem; margin-bottom: 1.2rem; }
.today-kpi { background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--r-lg); padding: .8rem 1rem; display: flex; flex-direction: column; gap: .2rem; text-decoration: none !important; color: inherit; }
.today-kpi b { font-size: 1.5rem; } .today-kpi span { font-size: .78rem; color: var(--text-3); }
.today-kpi.is-danger b { color: var(--danger); } .today-kpi.is-warning b { color: var(--warning); } .today-kpi.is-info b { color: var(--info); }
.today-item { display: flex; gap: .7rem; align-items: flex-start; padding: .6rem 0; border-bottom: 1px solid var(--line); text-decoration: none !important; color: inherit; }
.today-item:last-child { border-bottom: 0; }
.today-item .avatar { width: 2.1rem; height: 2.1rem; font-size: .72rem; flex-shrink: 0; }
.today-item b { display: block; font-size: .88rem; } .today-item small { display: block; color: var(--text-3); font-size: .78rem; }
.today-item .when { margin-left: auto; font-size: .78rem; color: var(--text-3); white-space: nowrap; }
@media (max-width: 900px) { .today-grid { grid-template-columns: 1fr; } .today-kpis { grid-template-columns: repeat(2, 1fr); } }

/* ------------------------------------------------------------ Responsive messagerie */
@media (max-width: 1100px) { .mail { --list-w: 340px; --folders-w: 220px; } }
@media (max-width: 900px) {
  .mail, .mail.is-folders-hidden, .mail.is-reading-off, .mail.is-reading-bottom { display: block; position: relative; height: 100%; }
  .mail-folders, .mail-list, .mail-read { position: absolute; inset: 0; width: 100%; }
  .mail-folders { z-index: 3; transform: translateX(-100%); transition: transform .2s var(--ease); }
  .mail.is-mobile-folders .mail-folders { transform: none; box-shadow: var(--shadow-pop); }
  .mail-read { z-index: 2; transform: translateX(100%); transition: transform .2s var(--ease); background: var(--bg-elev); }
  .mail.is-mobile-reading .mail-read { transform: none; }
  .mail-list { border-right: 0; }
}

/* ------------------------------------------------------------ Impression */
@media print { .app-rail, .app-top, .mail-folders, .mail-list, .read-toolbar, .ai-panel, .compose-dock, .toasts, .offline-banner { display: none !important; } .mail { display: block; } .mail-read-scroll { overflow: visible; padding: 0; } }

/* compteurs vides masqués (eit.css donne un fond aux .count) */
.folder .count, .app-rail-badge { background: none; padding: 0; }
.folder .count:empty { display: none; }
@media (hover: none) { .msg-hover { display: none !important; } .msg:hover .msg-date { visibility: visible; } }
@media (max-width: 600px) { .app-top { padding: 0 .5rem; gap: .35rem; } .app-top .app-search .input { padding-left: 2rem; } .app-top-actions .btn-ghost[data-tip="Thème sombre"], .app-top-actions .btn-ghost[data-tip="Thème clair"] { display: none; } }
