/* Sandy Mail production client. No network imports: fonts fall back to the system stack. */
:root {
  /* Light (default): black text on white. */
  --bg: #f6f6f4;
  --panel: #ffffff;
  --header: #fafaf9;
  --soft: #f0f0ed;
  --hover: #f2f2ef;
  --active: #e9e9e5;
  --line: #ddddd8;
  --line-soft: #ebebe7;
  --ink: #111111;
  --ink-2: #3a3a38;
  --muted: #6f6f69;
  --faint: #a2a29a;
  --primary: #1a1a1a;
  --on-primary: #ffffff;
  --accent: #1f5fd1;
  --unread: #1f5fd1;
  --flag: #d9902a;
  --danger: #c2412d;
  --danger-soft: #fbeae6;
  --warn-soft: #fdf4e1;
  --ok: #2e8b57;
  --focus: #5b8def;
  --shadow: 0 10px 40px rgba(20, 20, 15, .14), 0 2px 8px rgba(20, 20, 15, .06);
  --radius: 9px;
  --row-pad: 14px;
  --font: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
/* Night mode: white text on black. */
:root[data-theme="dark"] {
    --bg: #0b0b0b; --panel: #121212; --header: #0f0f0f; --soft: #1f1f1f; --hover: #1a1a1a; --active: #262626;
    --line: #2e2e2e; --line-soft: #222; --ink: #f5f5f5; --ink-2: #d6d6d6; --muted: #9c9c9c; --faint: #6c6c6c;
    --primary: #f5f5f5; --on-primary: #111; --accent: #7aa7ff; --unread: #7aa7ff; --flag: #f0b45c;
    --danger: #ff8a73; --danger-soft: #3a211c; --warn-soft: #3a2f16; --ok: #6fcf97; --shadow: 0 10px 40px rgba(0,0,0,.6), 0 2px 8px rgba(0,0,0,.4);
    color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="system"] {
    --bg: #0b0b0b; --panel: #121212; --header: #0f0f0f; --soft: #1f1f1f; --hover: #1a1a1a; --active: #262626;
    --line: #2e2e2e; --line-soft: #222; --ink: #f5f5f5; --ink-2: #d6d6d6; --muted: #9c9c9c; --faint: #6c6c6c;
    --primary: #f5f5f5; --on-primary: #111; --accent: #7aa7ff; --unread: #7aa7ff; --flag: #f0b45c;
    --danger: #ff8a73; --danger-soft: #3a211c; --warn-soft: #3a2f16; --ok: #6fcf97; --shadow: 0 10px 40px rgba(0,0,0,.6), 0 2px 8px rgba(0,0,0,.4);
    color-scheme: dark;
  }
}
:root[data-density="compact"] { --row-pad: 8px; }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body { font: 14px/1.45 var(--font); color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; overflow: hidden; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
button:disabled { opacity: .45; cursor: default; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.sprite { display: none; }
.skip-link { position: absolute; left: -9999px; top: 8px; z-index: 100; background: var(--panel); padding: 8px 12px; border-radius: var(--radius); }
.skip-link:focus { left: 8px; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px; padding: 0 16px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--panel); font-weight: 550; white-space: nowrap; }
.btn:hover:not(:disabled) { background: var(--hover); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn.primary:hover:not(:disabled) { background: var(--primary); opacity: .9; }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.ghost { background: transparent; }
.btn.full { width: 100%; }
.icon-btn { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 8px; color: var(--ink-2); }
.icon-btn:hover:not(:disabled) { background: var(--hover); color: var(--ink); }
.icon-btn.small { width: 28px; height: 28px; }
.icon-btn.small svg { width: 15px; height: 15px; }
.icon-btn[aria-pressed="true"] { color: var(--flag); }
.text-btn { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); padding: 8px 10px; border-radius: 8px; font-size: 13px; }
.text-btn:hover { background: var(--hover); color: var(--ink); }
.text-btn svg { width: 15px; height: 15px; }

/* Login */
.login-screen { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 16px; gap: 28px; overflow: auto; height: 100%; }
.login-brand, .brand { font-size: 26px; letter-spacing: -1.3px; white-space: nowrap; font-weight: 400; color: var(--ink); }
.login-brand b, .brand b { font-weight: 750; }
.login-card { width: 100%; max-width: 440px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 36px 32px; box-shadow: 0 3px 15px rgba(0,0,0,.03); }
.login-card .eyebrow { text-transform: uppercase; letter-spacing: .14em; font-size: 12px; color: var(--muted); font-weight: 500; }
.login-card h1 { font-size: 27px; font-weight: 650; letter-spacing: -.8px; line-height: 1.3; margin: 12px 0 10px; }
.login-card p { color: var(--muted); margin: 0 0 24px; }
.login-card form { display: grid; gap: 16px; }
.login-card label { display: grid; gap: 6px; font-weight: 500; color: var(--ink-2); font-size: 13px; }
.login-card input { height: 44px; border: 1px solid var(--line); border-radius: var(--radius); padding: 0 14px; background: var(--panel); font-size: 15px; }
.login-card .btn { height: 46px; margin-top: 4px; }
.form-message { color: var(--danger); font-size: 13px; min-height: 18px; }
.login-footer { color: var(--muted); font-size: 13px; }

/* App shell */
.app { height: 100vh; height: 100dvh; display: flex; flex-direction: column; }
.topbar { height: 64px; flex-shrink: 0; display: flex; align-items: center; gap: 24px; padding: 0 18px 0 24px; background: var(--header); border-bottom: 1px solid var(--line); }
.brand { width: 196px; flex-shrink: 0; }
.search { flex: 1; min-width: 0; max-width: 680px; position: relative; display: flex; align-items: center; background: var(--soft); border-radius: 11px; height: 42px; padding: 0 8px 0 14px; gap: 8px; border: 1px solid transparent; }
.search:focus-within { background: var(--panel); border-color: var(--line); box-shadow: 0 2px 10px rgba(0,0,0,.05); }
.search-icon { color: var(--muted); }
.search input { flex: 1; min-width: 0; border: 0; background: transparent; outline: none; height: 100%; font-size: 14px; }
.search input::-webkit-search-cancel-button { display: none; }
kbd { font: 11px var(--font); border: 1px solid var(--line); border-radius: 5px; padding: 1px 6px; color: var(--muted); background: var(--panel); }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.avatar-btn { border-radius: 50%; margin-left: 6px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-weight: 650; font-size: 13px; color: #fff; background: #6b6b63; flex-shrink: 0; text-transform: uppercase; }
.avatar.lg { width: 38px; height: 38px; font-size: 14px; }
.account-menu { position: relative; }
.popover { position: absolute; z-index: 40; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 6px; min-width: 220px; }
#account-pop { right: 0; top: 44px; }
.pop-head { padding: 10px 12px 12px; border-bottom: 1px solid var(--line-soft); margin-bottom: 6px; }
.pop-name { font-weight: 600; }
.pop-mail { color: var(--muted); font-size: 13px; }
.pop-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 12px; border-radius: 8px; text-align: left; }
.pop-item:hover, .pop-item.active { background: var(--hover); }
.pop-item svg { width: 16px; height: 16px; color: var(--muted); }
.popover .divider { height: 1px; background: var(--line-soft); margin: 4px 6px; }
.toast[data-error="1"] { background: var(--danger); color: #fff; }

.workspace { flex: 1; min-height: 0; display: grid; grid-template-columns: 236px minmax(320px, 400px) 1fr; position: relative; }
.sidebar { background: var(--header); border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 18px 12px 14px; gap: 6px; min-height: 0; overflow: auto; }
.compose-btn { height: 46px; margin: 0 4px 14px; font-size: 14px; }
.folders { display: grid; gap: 2px; }
.folder { display: flex; align-items: center; gap: 12px; width: 100%; padding: 9px 12px; border-radius: var(--radius); color: var(--ink-2); text-align: left; min-height: 38px; }
.folder:hover { background: var(--hover); color: var(--ink); }
.folder.active { background: var(--active); color: var(--ink); font-weight: 600; }
.folder.drop-target { background: var(--soft); box-shadow: inset 0 0 0 2px var(--accent); }
.folder svg { width: 17px; height: 17px; color: var(--muted); }
.folder .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.folder .count { font-size: 12px; font-weight: 600; color: var(--ink-2); }
.folder.unread .name { font-weight: 650; color: var(--ink); }
.folders .divider { height: 1px; background: var(--line-soft); margin: 8px 12px; }
.sidebar .text-btn { margin: 4px 2px; align-self: flex-start; }
.sidebar-foot { margin-top: auto; padding: 16px 12px 4px; color: var(--muted); font-size: 12px; line-height: 1.6; }

/* List */
.list-pane { display: flex; flex-direction: column; min-height: 0; background: var(--panel); border-right: 1px solid var(--line); }
.list-head { padding: 18px 16px 10px 14px; border-bottom: 1px solid var(--line-soft); display: grid; gap: 12px; position: relative; }
.list-title-row { display: flex; align-items: center; gap: 10px; min-width: 0; }
.list-title-row h1 { font-size: 20px; font-weight: 650; letter-spacing: -.5px; margin: 0; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-count { color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.filters { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { height: 28px; padding: 0 11px; border-radius: 999px; border: 1px solid var(--line); font-size: 12.5px; color: var(--ink-2); background: var(--panel); }
.chip:hover { background: var(--hover); }
.chip[aria-pressed="true"] { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.bulk-bar { position: absolute; inset: 0; background: var(--panel); display: flex; align-items: center; gap: 6px; padding: 0 10px 0 16px; z-index: 2; border-bottom: 1px solid var(--line-soft); }
.bulk-bar > span { font-weight: 600; font-size: 13px; margin-right: auto; white-space: nowrap; }
.bulk-actions { display: flex; flex-wrap: wrap; }
.check { position: relative; display: inline-grid; place-items: center; width: 22px; height: 22px; flex-shrink: 0; cursor: pointer; }
.check input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.check span { width: 16px; height: 16px; border: 1.5px solid var(--faint); border-radius: 4px; background: var(--panel); display: grid; place-items: center; }
.check input:checked + span { background: var(--primary); border-color: var(--primary); }
.check input:checked + span::after { content: ""; width: 8px; height: 4px; border: 2px solid var(--on-primary); border-top: 0; border-right: 0; transform: rotate(-45deg) translate(1px, -1px); }
.check input:indeterminate + span::after { content: ""; width: 8px; height: 2px; background: var(--primary); }
.check input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 2px; }

.message-list { flex: 1; overflow-y: auto; outline: none; overscroll-behavior: contain; }
.row { position: relative; display: grid; grid-template-columns: 24px 1fr; gap: 10px; padding: var(--row-pad) 16px var(--row-pad) 14px; border-bottom: 1px solid var(--line-soft); cursor: pointer; user-select: none; }
.row:hover { background: var(--hover); }
.row.selected { background: var(--active); }
.row.checked { background: color-mix(in srgb, var(--accent) 9%, var(--panel)); }
.row.focused { box-shadow: inset 3px 0 0 var(--ink); }
.row:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.row .check { margin-top: 1px; opacity: .55; }
.row:hover .check, .row.checked .check, .list-pane.selecting .row .check { opacity: 1; }
.row-main { min-width: 0; display: grid; gap: 3px; }
.row-top { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.row-from { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13.5px; color: var(--ink-2); }
.row-lead { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.row-star, .row-expand { display: grid; place-items: center; width: 24px; border-radius: 6px; color: var(--faint); }
.row-star { height: 22px; }
.row-star svg { width: 16px; height: 16px; }
.row-star:hover { color: var(--ink-2); background: var(--hover); }
.row-star.on { color: var(--flag); }
.row-star.on svg { fill: var(--flag); }
.row-expand { min-height: 30px; padding: 1px 0 0; gap: 0; color: var(--muted); border: 1px solid var(--line); background: var(--panel); font-size: 11px; font-weight: 650; line-height: 1.1; }
.row-expand:hover { color: var(--ink); border-color: var(--faint); }
.row-expand svg { width: 12px; height: 12px; transition: transform .15s; }
.row-expand[aria-expanded="true"] { color: var(--ink); border-color: var(--ink-2); }
.row-expand[aria-expanded="true"] svg { transform: rotate(90deg); }
.row-date { font-size: 12px; color: var(--muted); white-space: nowrap; }
.row-subject { font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); }
.row-preview { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
:root[data-preview="off"] .row-preview { display: none; }
.row.unread .row-from, .row.unread .row-subject { font-weight: 680; color: var(--ink); }
.row.unread::before { content: ""; position: absolute; left: 5px; top: calc(var(--row-pad) + 7px); width: 6px; height: 6px; border-radius: 50%; background: var(--unread); }
.row-meta { display: flex; align-items: center; gap: 6px; min-height: 0; }
.row-meta:empty { display: none; }
.tag { font-size: 11px; padding: 1px 7px; border-radius: 5px; background: var(--soft); color: var(--muted); white-space: nowrap; }
.row-meta svg { width: 14px; height: 14px; color: var(--muted); }
.row-meta .flagged { color: var(--flag); fill: var(--flag); }
.row-actions { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); display: none; gap: 2px; background: var(--hover); border-radius: 8px; padding: 2px; box-shadow: -12px 0 12px var(--hover); }
.row.selected .row-actions { background: var(--active); box-shadow: -12px 0 12px var(--active); }
.row:hover .row-actions { display: flex; }
.row-actions .icon-btn { width: 30px; height: 30px; }
.row-actions svg { width: 16px; height: 16px; }
.row.leaving { opacity: 0; transition: opacity .18s; }
.empty-list { padding: 64px 24px; text-align: center; color: var(--muted); }
.empty-list strong { display: block; color: var(--ink); font-size: 15px; margin-bottom: 4px; }
.skeleton { padding: 16px; border-bottom: 1px solid var(--line-soft); display: grid; gap: 8px; }
.skeleton i { display: block; height: 10px; border-radius: 4px; background: var(--soft); animation: pulse 1.2s ease-in-out infinite; }
.skeleton i:nth-child(1) { width: 40%; } .skeleton i:nth-child(2) { width: 75%; } .skeleton i:nth-child(3) { width: 90%; }
@keyframes pulse { 50% { opacity: .5; } }
.list-foot { padding: 0 16px; }
.list-foot .btn { margin: 12px auto; display: flex; }

/* Reader */
.reader-pane { min-width: 0; min-height: 0; overflow-y: auto; background: var(--panel); }
.reader-empty { height: 100%; display: grid; place-content: center; text-align: center; color: var(--muted); padding: 24px; }
.reader-empty h2 { color: var(--ink); font-size: 18px; margin: 14px 0 4px; font-weight: 600; }
.reader-empty p { margin: 0; }
.empty-icon { width: 44px; height: 44px; margin: auto; color: var(--faint); stroke-width: 1.2; }
.reader-toolbar { position: sticky; top: 0; z-index: 3; display: flex; align-items: center; gap: 2px; padding: 10px 24px; background: var(--panel); border-bottom: 1px solid var(--line-soft); min-height: 56px; }
.reader-toolbar .sep { width: 1px; height: 22px; background: var(--line); margin: 0 6px; }
.reader-toolbar .spacer { flex: 1; }
.reader-toolbar .pos { color: var(--muted); font-size: 12.5px; margin-right: 4px; white-space: nowrap; }
.reader-flow { max-width: 900px; padding: 26px 40px 60px; }
.reader-subject { font-size: 24px; line-height: 1.3; font-weight: 650; letter-spacing: -.6px; margin: 0 0 6px; overflow-wrap: anywhere; }
.reader-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 18px; }
.msg { border: 1px solid var(--line-soft); border-radius: 12px; margin-bottom: 12px; background: var(--panel); }
.msg-head { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: start; padding: 16px 18px; cursor: pointer; }
.msg.open .msg-head { cursor: default; padding-bottom: 6px; }
.msg-who { min-width: 0; }
.msg-from { font-weight: 620; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-from .addr { color: var(--muted); font-weight: 400; font-size: 12.5px; margin-left: 6px; }
.msg-to { color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-snippet { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-side { display: flex; align-items: center; gap: 2px; color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.msg-side .date { margin-right: 6px; }
.msg-body { padding: 4px 18px 18px 68px; }
.msg-text { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14.5px; line-height: 1.7; color: var(--ink); }
.msg-text a, .msg-html-note a { color: var(--accent); }
.quote-toggle { margin-top: 8px; font-size: 12px; color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 1px 8px; }
.quote-toggle:hover { background: var(--hover); }
.msg-quote { white-space: pre-wrap; color: var(--muted); border-left: 2px solid var(--line); padding-left: 12px; margin-top: 8px; font-size: 13.5px; }
.msg-frame { width: 100%; border: 0; display: block; min-height: 40px; background: #fff; border-radius: 6px; color-scheme: light; }
.msg-frame.invert { filter: invert(1) hue-rotate(180deg); background: #ededed; }
.notice { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); background: var(--soft); border-radius: 8px; padding: 7px 10px; margin-bottom: 10px; }
.notice svg { width: 15px; height: 15px; }
.notice .text-btn { padding: 2px 6px; margin-left: auto; }
.attachments { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.att { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 9px; padding: 7px 10px; font-size: 13px; max-width: 280px; background: var(--panel); }
.att:hover { background: var(--hover); }
.att .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att .sz { color: var(--muted); font-size: 12px; white-space: nowrap; }
.att svg { width: 15px; height: 15px; color: var(--muted); }
.reply-bar { display: flex; gap: 8px; margin: 4px 0 16px; flex-wrap: wrap; align-items: center; }
.reply-bar .btn { height: 40px; border-radius: 20px; }
.reply-prompt { flex: 1; min-width: 200px; display: flex; align-items: center; gap: 10px; height: 40px; padding: 0 16px; border: 1px solid var(--line); border-radius: 20px; color: var(--muted); background: var(--panel); text-align: left; }
.reply-prompt:hover { border-color: var(--faint); color: var(--ink-2); }
.reply-slot:empty { display: none; }
.reply-slot { margin: 4px 0 16px; }
.collapsed-group { display: block; width: 100%; text-align: center; color: var(--muted); font-size: 12.5px; padding: 8px; border: 1px dashed var(--line); border-radius: 10px; margin-bottom: 12px; }
.collapsed-group:hover { background: var(--hover); }

/* Composer */
.composer-dock { position: fixed; right: 24px; bottom: 0; z-index: 30; display: flex; align-items: flex-end; gap: 12px; pointer-events: none; }
.composer { pointer-events: auto; width: 560px; max-width: calc(100vw - 32px); height: min(620px, calc(100vh - 90px)); background: var(--panel); border: 1px solid var(--line); border-bottom: 0; border-radius: 12px 12px 0 0; box-shadow: var(--shadow); display: flex; flex-direction: column; overflow: hidden; }
.composer.min { height: auto; width: 300px; }
.composer.min .c-body, .composer.min .c-foot, .composer.min .c-fields, .composer.min .c-toolbar, .composer.min .c-atts { display: none; }
.composer.max { position: fixed; inset: 5vh 8vw; width: auto; height: auto; max-width: none; border-radius: 12px; border-bottom: 1px solid var(--line); }
.c-head { display: flex; align-items: center; gap: 4px; padding: 6px 6px 6px 16px; background: var(--header); border-bottom: 1px solid var(--line-soft); cursor: pointer; min-height: 44px; }
.c-title { flex: 1; font-weight: 600; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.c-status { color: var(--muted); font-size: 12px; margin-right: 6px; white-space: nowrap; }
.c-fields { border-bottom: 1px solid var(--line-soft); }
.c-field { display: flex; align-items: flex-start; gap: 8px; padding: 4px 12px 4px 16px; border-bottom: 1px solid var(--line-soft); min-height: 40px; }
.c-field:last-child { border-bottom: 0; }
.c-field > label { color: var(--muted); font-size: 13px; width: 52px; flex-shrink: 0; padding-top: 8px; }
.c-field select, .c-field .subject { flex: 1; border: 0; background: transparent; outline: none; min-width: 0; height: 32px; font-size: 14px; }
.c-field .cc-toggle { font-size: 12.5px; color: var(--muted); padding: 8px 6px; }
.c-field .cc-toggle:hover { color: var(--ink); }
.recips { flex: 1; display: flex; flex-wrap: wrap; gap: 4px; align-items: center; min-height: 32px; position: relative; min-width: 0; padding: 3px 0; }
.recips input { flex: 1; min-width: 120px; border: 0; outline: none; background: transparent; height: 26px; font-size: 14px; }
.pill { display: inline-flex; align-items: center; gap: 4px; background: var(--soft); border-radius: 999px; padding: 2px 4px 2px 10px; font-size: 13px; max-width: 100%; }
.pill.bad { background: var(--danger-soft); color: var(--danger); }
.pill .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pill button { width: 18px; height: 18px; display: grid; place-items: center; border-radius: 50%; color: var(--muted); }
.pill button:hover { background: var(--active); }
.pill svg { width: 12px; height: 12px; }
.suggest { position: absolute; left: 0; top: 100%; z-index: 5; min-width: 280px; max-width: 100%; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); padding: 4px; }
.suggest button { display: grid; width: 100%; text-align: left; padding: 7px 10px; border-radius: 7px; }
.suggest button.active, .suggest button:hover { background: var(--hover); }
.suggest .s-name { font-size: 13.5px; }
.suggest .s-mail { font-size: 12px; color: var(--muted); }
.c-toolbar { display: flex; gap: 2px; padding: 4px 8px; border-bottom: 1px solid var(--line-soft); flex-wrap: wrap; }
.c-toolbar .icon-btn { width: 30px; height: 30px; }
.c-toolbar svg { width: 16px; height: 16px; }
.c-body { flex: 1; min-height: 80px; overflow-y: auto; padding: 14px 16px; outline: none; font-size: 14.5px; line-height: 1.6; overflow-wrap: anywhere; }
.c-body:empty::before { content: attr(data-placeholder); color: var(--faint); }
.c-body blockquote { margin: 8px 0; padding-left: 12px; border-left: 2px solid var(--line); color: var(--muted); }
.c-body a { color: var(--accent); }
.c-body .sig { color: var(--ink-2); }
.c-atts { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 16px 8px; }
.c-atts:empty { display: none; }
.c-atts .att { padding: 4px 4px 4px 10px; }
.c-atts .att.uploading { opacity: .6; }
.c-foot { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--line-soft); }
.c-foot .spacer { flex: 1; }
.composer.dragover::after { content: "Drop files to attach"; position: absolute; inset: 44px 0 0; display: grid; place-items: center; background: color-mix(in srgb, var(--panel) 85%, transparent); border: 2px dashed var(--accent); font-weight: 600; }
.composer { position: relative; }

/* Toast, modal, menus */
.toast-region { position: fixed; left: 24px; bottom: 24px; z-index: 60; }
.toast { display: flex; align-items: center; gap: 12px; background: #252525; color: #f3f3ee; border-radius: 10px; padding: 10px 8px 10px 16px; box-shadow: var(--shadow); max-width: min(460px, calc(100vw - 32px)); font-size: 13.5px; }
:root[data-theme="dark"] .toast { background: #ecece6; color: #161615; }
.toast-action { font-weight: 700; color: #8fb6ff; padding: 4px 8px; border-radius: 6px; }
:root[data-theme="dark"] .toast-action { color: #2f6fdf; }
.toast .icon-btn { color: inherit; }
.toast .icon-btn:hover { background: rgba(255,255,255,.12); }
.move-pop { position: fixed; width: 260px; max-height: 360px; display: flex; flex-direction: column; }
.move-filter { border: 0; border-bottom: 1px solid var(--line-soft); outline: none; padding: 9px 10px; background: transparent; }
.move-list { overflow-y: auto; padding-top: 4px; }
.modal-wrap { position: fixed; inset: 0; z-index: 70; background: rgba(15, 15, 12, .38); display: grid; place-items: center; padding: 16px; }
.modal { width: 100%; max-width: 520px; max-height: calc(100vh - 32px); overflow: auto; background: var(--panel); border-radius: 14px; box-shadow: var(--shadow); border: 1px solid var(--line); }
.modal.wide { max-width: 720px; }
.modal-head { display: flex; align-items: center; padding: 16px 16px 8px 22px; }
.modal-head h2 { flex: 1; margin: 0; font-size: 18px; font-weight: 650; }
.modal-body { padding: 8px 22px 16px; }
.modal-body p { margin: 0 0 12px; color: var(--ink-2); }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 22px 20px; }
.modal-foot:empty { display: none; }
.field { display: grid; gap: 6px; margin-bottom: 16px; }
.field > span { font-weight: 550; font-size: 13px; }
.field small { color: var(--muted); font-size: 12px; }
.field input[type="text"], .field input[type="date"], .field select, .field textarea { border: 1px solid var(--line); border-radius: var(--radius); padding: 9px 12px; background: var(--panel); outline: none; }
.field textarea { min-height: 90px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--focus); }
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line-soft); }
.toggle-row:first-child { border-top: 0; }
.toggle-row span small { display: block; color: var(--muted); font-size: 12px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 9px; padding: 2px; gap: 2px; }
.seg button { padding: 5px 11px; border-radius: 7px; font-size: 13px; color: var(--ink-2); }
.seg button[aria-pressed="true"] { background: var(--active); color: var(--ink); font-weight: 600; }
.keys { display: grid; grid-template-columns: repeat(2, 1fr); gap: 4px 28px; }
.keys div { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; border-bottom: 1px solid var(--line-soft); font-size: 13px; }
.keys kbd { white-space: nowrap; }
.keys h3 { grid-column: 1 / -1; font-size: 12px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin: 12px 0 2px; }

.mobile-only { display: none !important; }
.scrim { position: fixed; inset: 0; background: rgba(15, 15, 12, .35); z-index: 19; }
.fab { position: fixed; right: 18px; bottom: calc(18px + env(safe-area-inset-bottom)); width: 56px; height: 56px; border-radius: 16px; background: var(--primary); color: var(--on-primary); box-shadow: var(--shadow); place-items: center; z-index: 15; }

/* Medium screens: reading pane takes over the list area */
@media (max-width: 1180px) {
  .workspace { grid-template-columns: 220px minmax(300px, 360px) 1fr; }
  .brand { width: auto; }
  .reader-flow { padding: 22px 26px 50px; }
  .msg-body { padding-left: 18px; }
}
@media (max-width: 960px) {
  .workspace { grid-template-columns: 220px 1fr; }
  .reader-pane { display: none; }
  .app.reading .list-pane { display: none; }
  .app.reading .reader-pane { display: block; }
  .reader-pane { grid-column: 2; }
}
@media (max-width: 760px) {
  .mobile-only { display: inline-grid !important; }
  .desktop-only { display: none !important; }
  .topbar { height: 56px; gap: 8px; padding: 0 8px; }
  .brand { display: none; }
  .topbar > * { min-width: 0; }
  .search { height: 38px; }
  .top-actions { gap: 0; }
  .top-actions #refresh-btn { display: none; }
  .workspace { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 20; left: 0; top: 0; bottom: 0; width: min(300px, 84vw); transform: translateX(-102%); transition: transform .2s ease; box-shadow: var(--shadow); padding-top: calc(18px + env(safe-area-inset-top)); }
  .sidebar.open { transform: none; }
  .sidebar .compose-btn { display: none; }
  .reader-pane, .app.reading .reader-pane { grid-column: 1; }
  .list-head { padding: 14px 12px 10px; }
  .row { padding-left: 12px; padding-right: 12px; }
  .row-actions { display: none !important; }
  .reader-toolbar { padding: 6px 8px; min-height: 52px; }
  .reader-flow { padding: 18px 16px 90px; }
  .reader-subject { font-size: 20px; }
  .msg-head { padding: 12px; gap: 10px; }
  .msg-body { padding: 0 12px 14px; }
  .composer-dock { right: 0; left: 0; bottom: 0; top: 0; pointer-events: none; }
  .composer, .composer.max { position: fixed; inset: 0; width: 100%; max-width: none; height: 100%; border-radius: 0; border: 0; }
  .composer.min { inset: auto 0 0 0; height: auto; width: 100%; }
  .toast-region { left: 16px; right: 16px; bottom: calc(86px + env(safe-area-inset-bottom)); }
  .keys { grid-template-columns: 1fr; }
  .app.reading .fab { display: none !important; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
@media print {
  .topbar, .sidebar, .list-pane, .reader-toolbar, .reply-bar, .composer-dock, .fab, .toast-region { display: none !important; }
  .workspace { display: block; } .reader-pane { overflow: visible; } body { overflow: visible; }
}

/* ---- conversations in the list ---- */
.row.expanded { background: var(--hover); }
.subrows { border-bottom: 1px solid var(--line-soft); background: var(--soft); padding: 2px 0 6px; }
.subrow { display: grid; grid-template-columns: auto minmax(70px, 30%) 1fr auto; gap: 10px; align-items: baseline; width: 100%; text-align: left; padding: 7px 16px 7px 14px; font-size: 12.5px; color: var(--ink-2); }
.subrow:hover { background: var(--hover); }
.subrow.selected { background: var(--active); box-shadow: inset 3px 0 0 var(--ink); }
.subrow.unread .sr-from { font-weight: 700; color: var(--ink); }
.sr-from, .sr-preview { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-preview { color: var(--muted); }
.sr-date { color: var(--muted); font-size: 11.5px; white-space: nowrap; }
#threads-toggle[aria-pressed="true"] { color: var(--ink); background: var(--active); }
mark { background: #ffe58f; color: inherit; border-radius: 2px; padding: 0 1px; }
:root[data-theme="dark"] mark { background: #6b5a14; }
.tag.accent { background: color-mix(in srgb, var(--accent) 14%, var(--panel)); color: var(--accent); }

/* ---- labels ---- */
.label-chip { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; padding: 1px 7px; border-radius: 5px; background: color-mix(in srgb, var(--lc) 16%, var(--panel)); color: var(--ink-2); white-space: nowrap; max-width: 160px; }
.lc-dot, .label-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--lc); flex-shrink: 0; }
.label-dot { width: 10px; height: 10px; margin: 0 4px; }
.lc-name { overflow: hidden; text-overflow: ellipsis; }
.lc-x { display: grid; place-items: center; width: 14px; height: 14px; border-radius: 50%; color: var(--muted); }
.lc-x:hover { background: var(--active); color: var(--ink); }
.lc-x svg { width: 10px; height: 10px; }
.reader-tags .tag.add-label { display: inline-flex; align-items: center; gap: 3px; border: 1px dashed var(--line); background: transparent; cursor: pointer; }
.reader-tags .tag.add-label svg { width: 11px; height: 11px; }
.reader-tags .label-chip { font-size: 12px; padding: 2px 8px; }
.nav-heading { display: flex; align-items: center; justify-content: space-between; padding: 14px 6px 4px 12px; font-size: 11.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.nav-empty { padding: 4px 12px 8px; font-size: 12px; color: var(--faint); }
.contacts-link { margin-top: 2px; }

/* ---- menus & pickers ---- */
.pop-heading { padding: 8px 12px 4px; font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 280px; }
.pop-item .pi-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pop-item .pi-sub { color: var(--muted); font-size: 12px; margin-left: 12px; white-space: nowrap; }
.pop-item:disabled { opacity: .55; }
.pop-item.create { color: var(--accent); }
.pop-empty { padding: 10px 12px; color: var(--muted); font-size: 13px; }
.pi-check { width: 16px; height: 16px; border: 1.5px solid var(--faint); border-radius: 4px; display: grid; place-items: center; flex-shrink: 0; }
.pi-check svg { width: 12px; height: 12px; opacity: 0; }
.pi-check.on { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.pi-check.on svg { opacity: 1; }
.snooze-menu { min-width: 260px; }

/* ---- reader extras ---- */
.msg.focused { box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 45%, transparent); }
.msg-name { font-weight: 620; color: var(--ink); padding: 0; }
button.msg-name:hover { text-decoration: underline; }
.msg-from { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; white-space: normal; }
.badge { display: inline-flex; align-items: center; gap: 3px; font-size: 11px; font-weight: 600; border-radius: 5px; padding: 1px 6px; }
.badge svg { width: 14px; height: 14px; }
.badge.ok { color: var(--ok); padding: 0; }
.badge.bad { color: var(--danger); background: var(--danger-soft); }
.badge.ext { color: var(--muted); background: var(--soft); font-weight: 500; }
.badge.snoozed { color: var(--accent); background: var(--soft); font-weight: 500; gap: 4px; }
.badge.snoozed svg { width: 12px; height: 12px; }
.safety { display: flex; gap: 10px; padding: 12px 14px; border-radius: 10px; margin-bottom: 12px; font-size: 13px; line-height: 1.5; }
.safety.danger { background: var(--danger-soft); color: var(--ink); border: 1px solid color-mix(in srgb, var(--danger) 35%, transparent); }
.safety.danger > svg { color: var(--danger); width: 20px; height: 20px; margin-top: 1px; }
.safety strong { display: block; color: var(--danger); margin-bottom: 2px; }
.safety .hint { color: var(--muted); margin-top: 4px; font-size: 12.5px; }
.msg-text a.phone-link, .msg-text a.mail-link { color: var(--accent); text-decoration: underline; text-decoration-style: dotted; text-underline-offset: 2px; }
.att.risk-high { border-color: color-mix(in srgb, var(--danger) 50%, var(--line)); background: var(--danger-soft); }
.att.risk-high > svg:first-child { color: var(--danger); }
.att .tag { font-size: 10.5px; }

/* ---- invites ---- */
.invite { display: flex; gap: 14px; border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; margin-bottom: 14px; background: var(--panel); }
.invite.loading { color: var(--muted); align-items: center; gap: 8px; font-size: 13px; }
.invite.cancelled .inv-title { text-decoration: line-through; color: var(--muted); }
.inv-icon { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: color-mix(in srgb, var(--accent) 12%, var(--panel)); color: var(--accent); flex-shrink: 0; }
.inv-icon svg { width: 22px; height: 22px; }
.inv-main { min-width: 0; flex: 1; display: grid; gap: 3px; }
.inv-title { font-weight: 650; font-size: 15px; }
.inv-when { color: var(--ink-2); font-size: 13.5px; }
.inv-where, .inv-who { color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.inv-where a { color: var(--accent); }
.inv-status { font-size: 13px; font-weight: 600; color: var(--ok); min-height: 0; }
.inv-status:empty { display: none; }
.inv-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.inv-q { font-size: 13px; color: var(--muted); margin-right: 4px; }
.btn.small { height: 30px; padding: 0 12px; font-size: 13px; }
.btn.small.on { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }

/* ---- inline (chat-style) reply composer ---- */
.composer.inline { position: static; width: 100%; max-width: none; height: auto; border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 2px 14px rgba(0,0,0,.06); }
.composer.inline .c-head { display: none; }
.composer:not(.inline) .c-replyto, .composer:not(.inline) .c-summary { display: none; }
.composer.inline:not(.expanded) .c-fields { display: none; }
.composer.inline.expanded .c-summary { display: none; }
.composer.inline .c-body { min-height: 110px; max-height: 50vh; flex: none; }
.c-replyto { display: flex; align-items: flex-start; gap: 4px; margin: 10px 10px 0; padding: 8px 6px 8px 12px; border-radius: 10px; background: var(--soft); border-left: 3px solid var(--accent); }
.rt-main { flex: 1; min-width: 0; }
.rt-who { display: flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 650; color: var(--accent); }
.rt-who svg { width: 14px; height: 14px; }
.rt-snip { font-size: 13px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 2px; }
.c-replyto .icon-btn { width: 30px; height: 30px; }
.c-summary { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; padding: 8px 16px 2px; font-size: 13px; color: var(--muted); }
.c-summary .cs-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.c-summary .cs-edit { color: var(--accent); font-size: 12.5px; flex-shrink: 0; }
.c-summary:hover .cs-edit { text-decoration: underline; }
.c-toolbar .tb-sep { width: 1px; height: 18px; background: var(--line); margin: 6px 4px; }
.composer > .quote-toggle { align-self: flex-start; margin: 0 16px 8px; }
.send-group { display: inline-flex; }
.send-group .btn.primary { border-radius: var(--radius) 0 0 var(--radius); }
.send-group .send-more { width: 32px; height: 38px; border-radius: 0 var(--radius) var(--radius) 0; background: var(--primary); color: var(--on-primary); border-left: 1px solid color-mix(in srgb, var(--on-primary) 25%, transparent); }
.send-group .send-more:hover:not(:disabled) { background: var(--primary); color: var(--on-primary); opacity: .9; }
.c-foot .c-status { font-size: 12px; color: var(--muted); margin-left: 4px; }

/* ---- search suggestions ---- */
.search-suggest { left: 0; right: 0; top: calc(100% + 4px); max-width: none; min-width: 0; max-height: min(70vh, 520px); overflow-y: auto; padding: 6px; }
.sg-heading { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: 8px 10px 4px; }
.sg-item { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 7px 10px; border-radius: 8px; }
.sg-item svg { width: 16px; height: 16px; color: var(--muted); }
.sg-item.active, .sg-item:hover { background: var(--hover); }
.sg-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sg-sub { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 45%; }

/* ---- banner ---- */
.app-banner { display: flex; align-items: center; gap: 10px; padding: 8px 20px; background: var(--warn-soft); border-bottom: 1px solid var(--line); font-size: 13px; }
.app-banner svg { color: var(--flag); }
.app-banner span { flex: 1; }
.offline-banner { background: var(--soft); }
.offline-banner svg { color: var(--muted); }

/* ---- installed app (PWA) ---- */
@media (display-mode: standalone) {
  .topbar { height: auto; min-height: 64px; padding-top: env(safe-area-inset-top); }
  .workspace { padding-bottom: env(safe-area-inset-bottom); }
  /* No browser chrome to drag: let the header move the window where the platform allows it. */
  .topbar { -webkit-app-region: drag; app-region: drag; }
  .topbar button, .topbar input, .topbar [role="button"], .topbar .popover { -webkit-app-region: no-drag; app-region: no-drag; }
}
@media (display-mode: window-controls-overlay) {
  .topbar { padding-left: env(titlebar-area-x, 0); padding-right: calc(100% - env(titlebar-area-x, 0px) - env(titlebar-area-width, 100%)); min-height: env(titlebar-area-height, 48px); }
}
ol.steps { margin: 4px 0 12px 18px; padding: 0; line-height: 1.6; }
ol.steps li + li { margin-top: 6px; }

/* ---- settings, contacts ---- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line-soft); margin: -4px 0 14px; overflow-x: auto; }
.tabs button { padding: 9px 12px; font-size: 13.5px; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--ink); font-weight: 600; }
.settings-panel { min-height: 300px; }
.settings-modal .modal-body, .contacts-modal .modal-body { padding-bottom: 22px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field input[type="datetime-local"], .field input[type="password"], .field input[type="search"] { border: 1px solid var(--line); border-radius: var(--radius); padding: 9px 12px; background: var(--panel); outline: none; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.form-message { min-height: 0; margin: 4px 0; }
.form-message.ok { color: var(--ok); }
.sig-preview { border: 1px dashed var(--line); border-radius: var(--radius); padding: 10px 12px; font-size: 13.5px; color: var(--ink-2); min-height: 44px; }
.panel-h { font-size: 14px; margin: 18px 0 10px; }
.account-card { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 12px; background: var(--soft); }
.rule-list { display: grid; gap: 6px; margin: 8px 0; }
.rule { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line-soft); border-radius: 10px; }
.rule-main { flex: 1; min-width: 0; display: grid; gap: 2px; font-size: 13px; }
.rule-main .muted { overflow: hidden; text-overflow: ellipsis; }
.conds { display: grid; gap: 6px; margin: 6px 0; }
.cond { display: flex; gap: 6px; align-items: center; }
.cond select, .cond input { border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; background: var(--panel); }
.cond input { flex: 1; min-width: 0; }
.field > span select { border: 1px solid var(--line); border-radius: 8px; padding: 4px 8px; background: var(--panel); font-weight: 400; }
.act { display: flex; align-items: center; gap: 8px; padding: 5px 0; font-size: 13.5px; }
.act select { border: 1px solid var(--line); border-radius: 8px; padding: 5px 8px; background: var(--panel); }
.contacts-bar { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; }
.contacts-bar input { flex: 1; min-width: 0; border: 1px solid var(--line); border-radius: var(--radius); padding: 9px 12px; background: var(--panel); outline: none; }
.contact-list { max-height: 55vh; overflow-y: auto; border: 1px solid var(--line-soft); border-radius: 10px; }
.contact { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-bottom: 1px solid var(--line-soft); }
.contact:last-child { border-bottom: 0; }
.ct-main { flex: 1; min-width: 0; display: grid; text-align: left; }
.ct-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ct-sub { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 760px) {
  .two-col { grid-template-columns: 1fr; }
  .reply-bar .btn .lbl { display: none; }
  .reply-bar .btn { width: 40px; padding: 0; }
  .subrow { padding-left: 10px; grid-template-columns: auto minmax(60px, 35%) 1fr auto; }
  .composer.inline { border-radius: 12px; }
  .search-suggest { position: fixed; left: 8px; right: 8px; top: 52px; }
  .app-banner { padding: 8px 12px; }
}
@media print { .reply-slot, .app-banner { display: none !important; } }

.features { display: grid; border: 1px solid var(--line-soft); border-radius: 10px; }
.feat-row { display: flex; justify-content: space-between; gap: 12px; padding: 8px 12px; border-bottom: 1px solid var(--line-soft); font-size: 13px; }
.feat-row:last-child { border-bottom: 0; }
.feat { text-align: right; }
.feat.on { color: var(--ok); }
.feat.off { color: var(--muted); }

.rt-mode { display: inline-flex; align-items: center; gap: 5px; height: 28px; padding: 0 10px; border-radius: 14px; border: 1px solid var(--line); background: var(--panel); font-size: 12.5px; color: var(--ink-2); white-space: nowrap; align-self: center; }
.rt-mode:hover { border-color: var(--faint); color: var(--ink); }
.rt-mode svg { width: 14px; height: 14px; }
@media (max-width: 760px) { .rt-mode span { display: none; } .rt-mode { padding: 0 7px; } }

/* ---- v3: message view switch, source, delete chooser ---- */
.view-note { display: flex; align-items: center; gap: 8px; margin: -2px 0 10px; font-size: 12.5px; color: var(--muted); }
.view-seg { padding: 1px; border-radius: 8px; }
.view-seg button { padding: 3px 9px; font-size: 12px; border-radius: 6px; }
.msg-html .notice .text-btn { margin-left: auto; white-space: nowrap; }
.source-wrap { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.source-tools { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-bottom: 1px solid var(--line-soft); background: var(--soft); }
.source-tools .muted { margin-right: auto; }
.msg-source { margin: 0; padding: 12px; max-height: 70vh; overflow: auto; font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere; background: var(--panel); color: var(--ink); }
.modal .source-wrap .msg-source { max-height: 62vh; }
.switch-row { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 13.5px; color: var(--ink-2); }
.hint { color: var(--muted); font-size: 13px; }
.pick-tools { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.pick-tools .hint { margin-left: auto; }
.pick-list { border: 1px solid var(--line); border-radius: 10px; max-height: 50vh; overflow-y: auto; }
.pick-row { display: grid; grid-template-columns: auto minmax(70px, 28%) 1fr auto; gap: 10px; align-items: center; padding: 9px 12px; border-bottom: 1px solid var(--line-soft); cursor: pointer; font-size: 13px; }
.pick-row:last-child { border-bottom: 0; }
.pick-row:hover { background: var(--hover); }
.pr-from, .pr-preview { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pr-from { font-weight: 600; color: var(--ink); }
.pr-preview { color: var(--muted); }
.pr-date { color: var(--muted); font-size: 12px; white-space: nowrap; }

/* ---- v3: search ---- */
.search-mode { display: inline-flex; flex-shrink: 0; border: 1px solid var(--line); border-radius: 8px; padding: 2px; gap: 2px; background: var(--panel); }
.search-mode button { display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 9px; border-radius: 6px; font-size: 12px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.search-mode button svg { width: 13px; height: 13px; }
.search-mode button:hover { color: var(--ink); }
.search-mode button[aria-pressed="true"] { background: var(--primary); color: var(--on-primary); }
.adv-search { right: 0; top: calc(100% + 4px); width: min(560px, calc(100vw - 24px)); padding: 0; }
.adv-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px 6px 16px; }
.adv-form { display: grid; gap: 8px; padding: 4px 16px 14px; }
.adv-row { display: grid; grid-template-columns: 120px 1fr; align-items: center; gap: 10px; font-size: 13px; color: var(--ink-2); }
.adv-row input[type=text], .adv-row select, .adv-date select { height: 34px; border: 1px solid var(--line); border-radius: 8px; padding: 0 10px; background: var(--panel); color: var(--ink); min-width: 0; width: 100%; }
.adv-date { display: grid; gap: 6px; }
.adv-range { display: flex; align-items: center; gap: 6px; }
.adv-range[hidden] { display: none; }
.adv-range input { height: 32px; border: 1px solid var(--line); border-radius: 8px; padding: 0 8px; background: var(--panel); color: var(--ink); min-width: 0; flex: 1; }
.adv-checks { display: flex; flex-wrap: wrap; gap: 16px; padding-left: 130px; font-size: 13px; }
.adv-check { display: inline-flex; align-items: center; gap: 6px; }
.adv-foot { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.adv-foot .muted { margin-right: auto; }
.search-interp { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 12.5px; }
.search-interp[hidden] { display: none; }
.q-via { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-weight: 600; }
.q-via svg { width: 14px; height: 14px; }
.q-via.ai { color: var(--accent); }
.q-chip { display: inline-flex; align-items: center; gap: 2px; padding: 2px 3px 2px 9px; border-radius: 999px; border: 1px solid var(--line); background: var(--soft); color: var(--ink-2); max-width: 100%; }
.q-chip > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.q-chip.exact { border-style: dashed; }
.q-x { display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; color: var(--muted); }
.q-x:hover { background: var(--hover); color: var(--ink); }
.q-x svg { width: 11px; height: 11px; }
.text-btn.small { font-size: 12.5px; }

/* ---- v3: mail brief ---- */
.reader-empty.has-brief { display: block; place-content: initial; text-align: left; color: var(--ink); padding: 0; height: auto; }
.brief-idle { display: grid; justify-items: center; text-align: center; color: var(--muted); }
.reader-empty.has-brief .brief { max-width: 760px; margin: 0 auto; padding: 28px 32px 48px; }
.brief-head { display: flex; align-items: flex-start; gap: 10px; }
.bh-text { flex: 1; min-width: 0; }
.brief-head h2 { margin: 0; font-size: 22px; font-weight: 650; letter-spacing: -.4px; color: var(--ink); }
.brief-head p { margin: 2px 0 0; color: var(--muted); font-size: 13.5px; }
.brief-stats { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 6px; }
.bstat { padding: 6px 12px; border-radius: 999px; background: var(--soft); font-size: 13px; color: var(--ink-2); }
.bstat b { color: var(--ink); }
.bstat.zero { color: var(--muted); }
.bstat.zero b { color: var(--muted); }
.brief-ai { margin: 14px 0 4px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: color-mix(in srgb, var(--accent) 5%, var(--panel)); }
.brief-ai p { margin: 4px 0 0; font-size: 14px; line-height: 1.55; }
.ba-label { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: .4px; }
.ba-label svg { width: 14px; height: 14px; }
.brief-sec { margin-top: 22px; }
.brief-sec h3 { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 14px; font-weight: 700; color: var(--ink); }
.bs-count { font-size: 12px; font-weight: 650; color: var(--muted); background: var(--soft); border-radius: 999px; padding: 1px 8px; }
.bs-hint { margin: 2px 0 8px; color: var(--muted); font-size: 12.5px; }
.bs-acts { display: flex; gap: 8px; flex-wrap: wrap; }
.brief-list { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; margin-bottom: 6px; }
.brief-item { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 10px 12px; border-bottom: 1px solid var(--line-soft); cursor: pointer; }
.brief-item:last-child { border-bottom: 0; }
.brief-item:hover { background: var(--hover); }
.brief-item:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.bi-main { min-width: 0; display: grid; gap: 1px; }
.bi-top { display: flex; gap: 8px; align-items: baseline; }
.bi-from { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13.5px; color: var(--ink-2); }
.brief-item.unread .bi-from, .brief-item.unread .bi-subject { font-weight: 680; color: var(--ink); }
.bi-date { font-size: 12px; color: var(--muted); white-space: nowrap; }
.bi-subject { font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); }
.bi-why { display: flex; align-items: center; gap: 4px; font-size: 12.5px; color: var(--muted); min-width: 0; }
.bi-why span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bi-ai svg { width: 12px; height: 12px; color: var(--accent); }
.bi-acts { display: flex; gap: 2px; align-items: center; opacity: .75; }
.brief-item:hover .bi-acts, .brief-item:focus-within .bi-acts { opacity: 1; }
.brief-clear { margin: 30px 0 10px; text-align: center; color: var(--muted); }
.brief-clear svg { width: 34px; height: 34px; color: var(--ok); }
.brief-clear h3 { margin: 8px 0 2px; color: var(--ink); font-size: 16px; }
.brief-clear p { margin: 0; }
.brief-foot { margin-top: 26px; color: var(--muted); font-size: 12px; }
.brief-sec.resolved { display: grid; gap: 8px; }
.brief-resolved { display: flex; align-items: flex-start; gap: 10px; padding: 10px 14px; border-radius: 10px; background: var(--soft); font-size: 13px; line-height: 1.5; }
.br-mark { display: grid; place-items: center; width: 20px; height: 20px; margin-top: 1px; border-radius: 10px; background: var(--ok); color: #fff; flex-shrink: 0; }
.br-mark svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 2.5; }
.br-text { flex: 1; min-width: 0; color: var(--ink-2); overflow-wrap: anywhere; }
.br-text b { color: var(--ink); font-weight: 650; }
.br-acts { display: flex; gap: 10px; flex-shrink: 0; }
.br-acts .text-btn { font-size: 12.5px; font-weight: 600; }
@media (max-width: 760px) { .brief-resolved { flex-wrap: wrap; } .br-acts { width: 100%; justify-content: flex-end; } }
.brief-loading { padding: 32px; }
@media (max-width: 960px) {
  .app.briefing .list-pane { display: none; }
  .app.briefing .reader-pane { display: block; }
}
@media (max-width: 760px) {
  .search-mode { display: none; }
  .reader-empty.has-brief .brief { padding: 16px 14px 40px; }
  .adv-row { grid-template-columns: 1fr; gap: 4px; }
  .adv-checks { padding-left: 0; }
  .adv-search { position: fixed; left: 8px; right: 8px; top: 52px; width: auto; max-height: calc(100vh - 70px); overflow-y: auto; }
  .adv-foot .muted { display: none; }
  .view-seg button { padding: 3px 7px; }
  .pick-row { grid-template-columns: auto 1fr auto; }
  .pr-preview { display: none; }
}

/* ---- tags: editor, groups, legal hold ---- */
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch { width: 26px; height: 26px; border-radius: 50%; background: var(--lc); border: 2px solid transparent; box-shadow: 0 0 0 1px var(--line); cursor: pointer; }
.swatch[aria-checked="true"] { border-color: var(--panel); box-shadow: 0 0 0 2px var(--ink); }
.swatch:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.beh { display: flex; align-items: flex-start; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line-soft); cursor: pointer; }
.beh:first-of-type { border-top: 0; }
.beh input[type=checkbox] { margin-top: 3px; }
.beh > span:first-of-type { display: grid; gap: 1px; flex: 1; min-width: 0; }
.beh small { color: var(--muted); font-size: 12.5px; }
.beh .years { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; color: var(--ink-2); font-size: 13px; }
.beh .years input { width: 64px; height: 32px; border: 1px solid var(--line); border-radius: 8px; padding: 0 8px; background: var(--panel); color: var(--ink); }
.folder .hold-mark { display: inline-grid; color: var(--muted); }
.folder .hold-mark svg { width: 13px; height: 13px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 560px) { .field-row { grid-template-columns: 1fr; } }

/* ---- rules: modes, activity, suggestions ---- */
.mode-chip { margin-left: 8px; font-size: 11px; font-weight: 650; padding: 1px 7px; border-radius: 999px; background: var(--soft); color: var(--muted); vertical-align: 1px; }
.mode-chip.ask { background: color-mix(in srgb, var(--accent) 12%, var(--panel)); color: var(--accent); }
.settings-sub { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 18px 0 6px; }
.activity { border: 1px solid var(--line); border-radius: 10px; max-height: 260px; overflow-y: auto; }
.activity > p { margin: 10px 12px; }
.act-row { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: baseline; padding: 8px 12px; border-bottom: 1px solid var(--line-soft); font-size: 13px; }
.act-row:last-child { border-bottom: 0; }
.act-row.undone { opacity: .55; }
.act-when { color: var(--muted); font-size: 12px; white-space: nowrap; }
.act-main { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rule-suggest { margin: 6px 0 10px; }
.rule-suggest .text-btn { margin-left: 4px; }
.rules-banner { border-top: 1px solid var(--line-soft); }
/* ask your inbox */
.ask-list { display: flex; flex-direction: column; gap: 18px; margin-top: 18px; }
.ask-q { margin: 0 0 6px; font-weight: 600; color: var(--ink); font-size: 14.5px; }
.ask-a { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 10px; background: color-mix(in srgb, var(--accent) 7%, var(--panel)); border: 1px solid var(--line-soft); font-size: 14px; line-height: 1.5; color: var(--ink-2); }
.ask-a > svg { flex-shrink: 0; margin-top: 2px; color: var(--accent); width: 16px; height: 16px; }
.ask-a p { margin: 0; white-space: pre-wrap; }
.ask-a.not-found { background: var(--soft); }
.ask-a.muted { color: var(--muted); }
.ask-cites { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 10px; }
.ask-cite { font: inherit; font-size: 12px; text-align: left; padding: 3px 8px; border-radius: 6px; border: 1px solid var(--line); background: var(--panel); color: var(--ink-2); cursor: pointer; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ask-cite:hover, .ask-cite:focus-visible { border-color: var(--accent); color: var(--ink); }
.ask-cite b { display: inline-grid; place-items: center; min-width: 16px; height: 16px; border-radius: 4px; background: var(--accent); color: #fff; font-size: 10.5px; margin-right: 2px; }
.ask-input { margin-top: 16px; }
.ask-input input { width: 100%; box-sizing: border-box; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); font: inherit; }
/* suggested tags */
.tag-suggest { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; padding: 1px 4px 1px 8px; border-radius: 5px; border: 1px dashed color-mix(in srgb, var(--lc) 60%, var(--line)); color: var(--muted); white-space: nowrap; }
.tag-suggest button { display: inline-grid; place-items: center; width: 20px; height: 20px; padding: 0; border: 0; border-radius: 4px; background: transparent; color: var(--muted); cursor: pointer; }
.tag-suggest button:hover, .tag-suggest button:focus-visible { background: var(--soft); color: var(--ink); }
.tag-suggest button svg { width: 12px; height: 12px; }
/* mailboxes (accounts) */
.accounts .folder.account .tag { margin-left: auto; }
.accounts .folder.account .tag + .count { margin-left: 6px; }
.accounts .folder .name { overflow: hidden; text-overflow: ellipsis; }
.all-sec h3 { display: flex; align-items: center; gap: 6px; }
.all-sec h3 .text-btn { margin-left: auto; }
.add-account-result { min-height: 24px; margin: 10px 0; }
.add-account-result .provider { padding: 12px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--soft); }
.add-account-result .provider p { margin: 6px 0 0; }
.add-account-result .provider .btn { margin-top: 10px; }
.add-account-result .error { color: var(--danger, #c0392b); }
/* shared mailboxes */
.shared-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 10px 12px; margin: 10px 0 4px; border: 1px solid var(--line-soft); border-radius: 10px; background: color-mix(in srgb, var(--accent) 5%, var(--panel)); font-size: 13px; }
.shared-bar .sb-label { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; color: var(--ink); }
.shared-bar .sb-label svg { width: 16px; height: 16px; }
.shared-bar .sb-assign { display: inline-flex; align-items: center; gap: 6px; }
.shared-bar select { font: inherit; padding: 4px 8px; border-radius: 7px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); max-width: 240px; }
.shared-bar .sb-rights { margin-left: auto; }
.status-seg button { padding: 3px 10px; }
.tag.assignee { background: color-mix(in srgb, var(--accent) 14%, var(--panel)); color: var(--accent); }
.tag.status-done { background: color-mix(in srgb, #2e9d5b 16%, var(--panel)); color: #2e7d4f; }
.tag.status-waiting { background: color-mix(in srgb, #d98e04 18%, var(--panel)); color: #9a6500; }
.shared-notes { display: flex; flex-direction: column; gap: 8px; margin: 8px 0; }
.note-card { padding: 10px 12px; border-radius: 10px; background: color-mix(in srgb, #f2c94c 22%, var(--panel)); border: 1px solid color-mix(in srgb, #f2c94c 50%, var(--line)); font-size: 13.5px; }
.note-card .note-head { display: flex; align-items: center; gap: 6px; font-size: 12.5px; }
.note-card .note-head svg { width: 14px; height: 14px; }
.note-card p { margin: 6px 0 0; white-space: pre-wrap; color: var(--ink-2); }
.note-form textarea { width: 100%; box-sizing: border-box; padding: 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); font: inherit; }
.note-form .note-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }

/* conversations / messages switch in the list header */
.view-toggle { display: inline-flex; align-items: center; gap: 5px; height: 28px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); color: var(--ink-2); font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.view-toggle svg { width: 15px; height: 15px; }
.view-toggle:hover { border-color: var(--faint); color: var(--ink); }
.view-toggle[aria-pressed="true"] { background: var(--active); color: var(--ink); }
@media (max-width: 520px) { .view-toggle .vt-label { display: none; } .view-toggle { padding: 0 7px; } }

/* labels on each message of an expanded conversation */
.subrow .sr-tags { grid-column: 2 / -1; display: flex; flex-wrap: wrap; gap: 4px; margin-top: -2px; }

/* message checkboxes in an expanded conversation */
.subrow { cursor: pointer; }
.subrow .sr-check { width: 18px; }
.subrow.checked { background: var(--active); }
.subrow .sr-tags { grid-column: 3 / -1; }
/* tag group: sub-tags included or only this tag */
.subtags-chip { margin-left: auto; }
.subtags-chip[aria-pressed="false"] { border-style: dashed; }
.hint.inherited { margin: 0 0 6px; }

/* contact suggestions in search options (From / To) */
.adv-row { position: relative; --ps-left: 130px; }
@media (max-width: 960px) { .adv-row { --ps-left: 0px; } }
.people-suggest { position: absolute; z-index: 30; left: var(--ps-left, 130px); right: 0; top: 100%; margin-top: 2px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.12); padding: 4px; max-height: 240px; overflow: auto; }
.people-suggest .ps-item { display: flex; flex-direction: column; align-items: flex-start; width: 100%; padding: 6px 10px; border-radius: 7px; text-align: left; font: inherit; background: none; border: 0; color: var(--ink); cursor: pointer; }
.people-suggest .ps-item:hover, .people-suggest .ps-item.active { background: var(--hover); }
.people-suggest .ps-name { font-size: 13.5px; font-weight: 600; }
.people-suggest .ps-mail { font-size: 12px; color: var(--muted); }

/* Devices: mail-app setup, phone code, signed-in browsers */
.setup-steps { margin: 8px 0 4px; padding-left: 20px; display: grid; gap: 6px; }
.setup-qr { display: flex; gap: 16px; align-items: center; margin: 16px 0 8px; padding: 12px; border: 1px solid var(--line-soft); border-radius: 12px; }
.setup-qr img { width: 160px; height: 160px; flex: none; border-radius: 8px; background: #fff; }
.setup-qr p { margin: 4px 0 0; }
.setup-details { margin: 12px 0; }
.setup-details summary { cursor: pointer; font-weight: 600; padding: 6px 0; }
.setup-manual .form-actions { margin-top: 8px; }
.copy-val, .copy-inline { display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; color: inherit; font: inherit; cursor: pointer; padding: 0; text-align: right; }
.copy-val svg, .copy-inline svg { width: 14px; height: 14px; opacity: .6; }
.copy-val:hover svg, .copy-inline:hover svg { opacity: 1; }
.check-row { display: flex; align-items: center; gap: 8px; margin: 10px 0 4px; font-size: 14px; }
@media (max-width: 640px) { .setup-qr { flex-direction: column; text-align: center; } }

/* Extra addresses */
.aliases .alias-row span { word-break: break-all; }
.alias-add { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.alias-input { display: flex; align-items: center; flex: 1 1 260px; border: 1px solid var(--line); border-radius: 8px; padding: 0 10px; background: var(--bg); }
.alias-input input { flex: 1; min-width: 0; border: 0; background: none; padding: 9px 0; font: inherit; color: inherit; outline: none; }
.alias-input:focus-within { outline: 2px solid var(--focus, currentColor); outline-offset: 1px; }
.alias-input select { border: 0; background: none; font: inherit; color: inherit; }
.alias-domain { color: var(--muted, inherit); opacity: .8; }
.alias-status { min-height: 20px; font-size: 13px; margin-top: 6px; }
.alias-status.ok { color: var(--ok, #1d7a3e); }
.alias-status.bad { color: var(--danger, #b3261e); }
.alias-confirm { display: inline-flex; gap: 8px; align-items: center; }

/* Images loading in a message */
.img-status { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); padding: 4px 2px 8px; }
.img-status svg { width: 14px; height: 14px; }
.img-status .spinner { width: 12px; height: 12px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: img-spin .8s linear infinite; }
@keyframes img-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .img-status .spinner { animation: none; } }

/* Attachments: preview or download straight away */
.att { padding: 3px 3px 3px 10px; }
.att .att-main { display: inline-flex; align-items: center; gap: 8px; min-width: 0; border: 0; background: none; color: inherit; font: inherit; cursor: pointer; padding: 4px 0; text-align: left; }
.att .att-main:hover .nm { text-decoration: underline; }
.att .att-hint { font-size: 11px; color: var(--accent); white-space: nowrap; }
.att .att-dl { flex: none; }
.preview-modal .modal-body { padding: 0; }
.att-preview { display: flex; align-items: center; justify-content: center; min-height: 240px; max-height: 72vh; overflow: auto; background: var(--soft); }
.att-preview img { max-width: 100%; max-height: 72vh; object-fit: contain; }
.att-preview iframe { width: 100%; height: 72vh; border: 0; background: #fff; }
.att-preview video { max-width: 100%; max-height: 72vh; }
.att-preview .att-text { align-self: stretch; width: 100%; margin: 0; padding: 14px 16px; white-space: pre-wrap; font: 12.5px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--panel); }
.att-preview-loading { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.att-preview-loading .spinner { width: 14px; height: 14px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: img-spin .8s linear infinite; }
.att-preview:has(img, iframe, video, audio, pre) .att-preview-loading { position: absolute; }

/* Calendar (read only): week of day columns; overlaps and free/held time are marked, not hidden. */
/* ---- Calendar page: Mail · Calendar · Tasks rail, time grid, Sandy rail ---- */
:root { --cal-serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, "Times New Roman", serif; --cal-paper: #fbfaf7; --cal-line: #e6e4de; --cal-ev: #e3e3dc; }
:root[data-theme="dark"] { --cal-paper: #101010; --cal-line: #262626; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --cal-paper: #101010; --cal-line: #262626; } }
.app.calendar-open .workspace { display: none; }
.app.calendar-open .search { visibility: hidden; }
.app.calendar-open .fab { display: none !important; }
#calendar-btn[aria-pressed="true"] { background: var(--active); color: var(--ink); }
.calendar-page { position: relative; flex: 1; min-height: 0; overflow: hidden; display: grid; grid-template-columns: 236px minmax(0, 1fr) 300px; grid-template-rows: minmax(0, 1fr); background: var(--cal-paper); }
.cal-side { background: var(--header); border-right: 1px solid var(--line); padding: 18px 14px 14px; display: flex; flex-direction: column; gap: 18px; min-height: 0; overflow: auto; }
.cal-nav { display: flex; flex-direction: column; gap: 4px; }
.cal-nav-item { display: flex; align-items: center; gap: 12px; height: 40px; padding: 0 12px; border-radius: 10px; text-align: left; font-weight: 550; color: var(--ink-2); }
.cal-nav-item svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.cal-nav-item:hover:not(:disabled) { background: var(--hover); }
.cal-nav-item.active { background: var(--primary); color: var(--on-primary); }
.cal-nav-item:disabled { color: var(--faint); cursor: default; }
.cal-soon { margin-left: auto; font-size: 10.5px; font-weight: 650; letter-spacing: .3px; text-transform: uppercase; padding: 2px 7px; border-radius: 999px; background: var(--soft); color: var(--muted); }
.cal-mini-h { display: flex; align-items: center; justify-content: space-between; padding: 0 4px 8px; font-size: 13.5px; }
.cal-mini-nav { display: inline-flex; gap: 2px; }
.cal-mini-nav .icon-btn.small, .cal-side-h .icon-btn.small { width: 26px; height: 26px; }
.cal-mini-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.cal-mini-dow { text-align: center; font-size: 11px; color: var(--muted); padding: 2px 0 4px; }
.cal-mini-day { position: relative; height: 28px; border-radius: 8px; font-size: 12.5px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.cal-mini-day:hover { background: var(--hover); }
.cal-mini-day.other { color: var(--faint); }
.cal-mini-day.in-range { background: var(--soft); }
.cal-mini-day.today { background: var(--primary); color: var(--on-primary); font-weight: 650; }
.cal-mini-day.has-events::after { content: ""; position: absolute; left: 50%; bottom: 3px; width: 4px; height: 4px; margin-left: -2px; border-radius: 2px; background: currentColor; opacity: .55; }
.cal-mini-day.today.has-events::after { background: var(--on-primary); }
.cal-side-h { display: flex; align-items: center; justify-content: space-between; font-size: 13.5px; font-weight: 600; padding: 0 4px 6px; }
.cal-mycal { display: flex; align-items: center; gap: 10px; padding: 7px 4px; }
.cal-mycal-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13.5px; }
.cal-dot { width: 12px; height: 12px; border-radius: 6px; flex-shrink: 0; border: 1px solid rgba(0,0,0,.08); }
.cal-dot.hold { background: repeating-linear-gradient(135deg, transparent 0 2px, var(--muted) 2px 3px) !important; }
.cal-switch { position: relative; width: 36px; height: 20px; border-radius: 10px; background: var(--line); transition: background .15s; flex-shrink: 0; }
.cal-switch i { position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 8px; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: left .15s; }
.cal-switch.on { background: var(--primary); }
.cal-switch.on i { left: 18px; }
.cal-side .sidebar-foot { margin-top: auto; white-space: pre-line; }

.cal-main { display: flex; flex-direction: column; min-height: 0; min-width: 0; padding: 18px 24px 18px; container-type: inline-size; }
.cal-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.cal-title { margin: 0; font-family: var(--cal-serif); font-weight: 500; font-size: 30px; letter-spacing: -.3px; outline: none; }
.cal-head-nav { display: flex; align-items: center; gap: 6px; }
.cal-head-nav .btn.small { height: 34px; padding: 0 14px; }
.cal-arrows { display: inline-flex; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; background: var(--panel); }
.cal-arrows .icon-btn { width: 34px; height: 34px; border-radius: 0; }
.cal-arrows .icon-btn + .icon-btn { border-left: 1px solid var(--line); }
.cal-head-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.cal-seg { display: inline-flex; border: 1px solid var(--line); border-radius: 9px; background: var(--panel); padding: 2px; }
.cal-seg-btn { height: 30px; padding: 0 14px; border-radius: 7px; font-size: 13px; font-weight: 550; color: var(--muted); }
.cal-seg-btn.active { background: var(--soft); color: var(--ink); }
.cal-head-right .btn.primary { height: 36px; }
.cal-head-right .btn.primary svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; }
.cal-sub { display: flex; align-items: baseline; gap: 14px; margin: 8px 0 12px; font-size: 14.5px; }
.cal-sub-range { color: var(--ink-2); }
.cal-status { margin: 0 0 10px; padding: 8px 12px; border-radius: 8px; background: var(--hover); font-size: 13px; }
.cal-status.incomplete, .cal-status.error { background: var(--warn-soft); }
.cal-status.loading { background: transparent; color: var(--muted); padding-left: 0; }

/* Time grid (day & week) */
.cal-timegrid { flex: 1; min-height: 0; display: flex; flex-direction: column; border: 1px solid var(--cal-line); border-radius: 12px; background: var(--panel); overflow: hidden; --gutter: 64px; }
.cal-tg-head, .cal-tg-allday { display: grid; grid-template-columns: var(--gutter) repeat(var(--days), minmax(0, 1fr)); border-bottom: 1px solid var(--cal-line); }
.cal-tg-gutter { font-size: 11.5px; color: var(--muted); padding: 8px 8px; text-align: right; }
.cal-tg-day { display: flex; align-items: baseline; justify-content: center; gap: 6px; padding: 12px 6px; border-left: 1px solid var(--cal-line); font-size: 14px; color: var(--ink-2); }
.cal-tg-day:hover { background: var(--hover); }
.cal-tg-dow { font-size: 13px; }
.cal-tg-num { font-family: var(--cal-serif); font-size: 19px; color: var(--ink); }
.cal-tg-day.today { background: var(--soft); }
.cal-tg-day.today .cal-tg-num { color: var(--accent); }
.cal-tg-allday-cell { border-left: 1px solid var(--cal-line); padding: 4px; display: flex; flex-direction: column; gap: 3px; min-height: 30px; }
.cal-tg-scroll { flex: 1; min-height: 0; overflow: auto; }
.cal-tg-grid { position: relative; display: grid; grid-template-columns: var(--gutter) repeat(var(--days), minmax(0, 1fr)); }
.cal-tg-hours { position: relative; }
.cal-tg-hour { position: absolute; right: 8px; transform: translateY(-50%); }
.cal-tg-hour.first { transform: none; top: 4px !important; font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.cal-tg-col { position: relative; border-left: 1px solid var(--cal-line); min-width: 0; }
.cal-tg-col.weekend { background: var(--cal-paper); }
.cal-tg-col.today { background: color-mix(in srgb, var(--soft) 55%, transparent); }
.cal-tg-line { position: absolute; left: 0; right: 0; border-top: 1px solid var(--cal-line); }
.cal-tg-line.half { border-top-style: dashed; opacity: .55; }
.cal-tg-line.first { border-top: 0; }
.cal-tg-now { position: absolute; left: 0; right: 0; border-top: 2px solid #d93025; z-index: 2; pointer-events: none; }
.cal-tg-now::before { content: ""; position: absolute; left: -5px; top: -6px; width: 10px; height: 10px; border-radius: 5px; background: #d93025; }
.cal-tg-now span { position: absolute; left: 10px; top: -22px; font-size: 11px; font-weight: 600; background: var(--panel); padding: 1px 5px; border-radius: 4px; }

/* Events */
.cal-event { --ev: var(--cal-ev); position: absolute; box-sizing: border-box; display: flex; flex-direction: column; align-items: flex-start; gap: 1px; overflow: hidden; text-align: left; padding: 6px 9px; border-radius: 8px; font-size: 12.5px; line-height: 1.3; background: color-mix(in srgb, var(--ev) 26%, var(--panel)); border: 1px solid color-mix(in srgb, var(--ev) 45%, var(--panel)); border-left: 3px solid var(--ev); color: var(--ink); z-index: 1; }
.cal-event:hover { filter: brightness(.97); }
.cal-event.selected { outline: 2px solid var(--ink); outline-offset: 1px; z-index: 3; }
.cal-event.hold { background: repeating-linear-gradient(135deg, var(--panel) 0 5px, var(--soft) 5px 9px); border: 1px dashed var(--muted); border-left-width: 1px; color: var(--ink-2); }
.cal-event.free:not(.hold) { background: transparent; border: 1px dashed color-mix(in srgb, var(--ev) 50%, var(--muted)); color: var(--ink-2); }
.cal-event.pending { border-style: dashed; }
.cal-event.declined, .cal-event.cancelled { opacity: .5; }
.cal-event.cancelled .cal-event-title { text-decoration: line-through; }
.cal-event-when { font-size: 11.5px; color: var(--ink-2); font-variant-numeric: tabular-nums; flex: none; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-event-title { font-weight: 600; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: none; }
.cal-event-where { font-size: 11.5px; color: var(--ink-2); max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: none; }
.cal-event-flag { font-size: 10px; font-weight: 700; letter-spacing: .3px; text-transform: uppercase; color: var(--accent); flex: none; }
.cal-event.short { flex-direction: row; align-items: center; gap: 6px; padding: 0 8px; }
.cal-event.short .cal-event-when, .cal-event.short .cal-event-where { display: none; }
.cal-event.compact { position: static; flex: none; width: 100%; padding: 3px 8px; border-radius: 6px; font-size: 12px; }
.cal-hide { display: none !important; }
.cal-month-more { flex: none; }
.cal-rail-toggle, .cal-rail-close { display: none !important; }
.cal-rail-brand .cal-rail-close { margin-left: auto; }
/* The header compacts to one row instead of wrapping when the calendar pane is narrow. */
@container (max-width: 900px) {
  .cal-head { gap: 10px; flex-wrap: nowrap; }
  .cal-title { font-size: 24px; white-space: nowrap; }
  .cal-head-right { gap: 6px; }
  .cal-seg-btn { padding: 0 10px; }
  .cal-head-right .btn.primary { width: 36px; padding: 0; }
  .cal-new-label { display: none; }
}
@container (max-width: 660px) {
  .cal-head { flex-wrap: wrap; }
  .cal-head-right { margin-left: 0; width: 100%; justify-content: space-between; }
}

/* Month */
.cal-month { flex: 1; min-height: 0; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); grid-template-rows: auto repeat(6, minmax(0, 1fr)); border: 1px solid var(--cal-line); border-radius: 12px; background: var(--panel); overflow: hidden; }
.cal-month-dow { padding: 10px 10px 8px; font-size: 12.5px; color: var(--muted); border-bottom: 1px solid var(--cal-line); }
.cal-month-cell { border-top: 1px solid var(--cal-line); border-left: 1px solid var(--cal-line); padding: 4px 6px 5px; display: flex; flex-direction: column; gap: 2px; min-height: 0; overflow: hidden; }
.cal-month-cell .cal-event.compact { padding: 2px 7px; font-size: 11.5px; line-height: 1.3; }
.cal-month-cell:nth-child(7n+1) { border-left: 0; }
.cal-month-cell.other { background: var(--cal-paper); }
.cal-month-cell.other .cal-month-num { color: var(--faint); }
.cal-month-h { display: flex; align-items: center; justify-content: space-between; gap: 4px; flex: none; min-height: 24px; }
.cal-month-num { font-family: var(--cal-serif); font-size: 15px; width: 24px; height: 24px; border-radius: 12px; color: var(--ink-2); flex: none; }
.cal-month-num:hover { background: var(--hover); }
.cal-month-cell.today .cal-month-num { background: var(--primary); color: var(--on-primary); }
.cal-month-more { font-size: 11.5px; color: var(--muted); padding: 2px 6px; border-radius: 6px; white-space: nowrap; }
.cal-month-more:hover { background: var(--hover); }

/* Agenda */
.cal-agenda { flex: 1; min-height: 0; overflow: auto; display: flex; flex-direction: column; gap: 18px; padding: 4px 0 24px; }
.cal-agenda-day { display: grid; gap: 6px; max-width: 760px; }
.cal-agenda-h { margin: 0 0 4px; display: flex; align-items: baseline; gap: 12px; font-size: 14px; font-weight: 500; color: var(--ink-2); }
.cal-agenda-num { font-family: var(--cal-serif); font-size: 26px; color: var(--ink); min-width: 34px; }
.cal-agenda-day.today .cal-agenda-num { color: var(--accent); }
.cal-agenda .cal-event { position: static; flex-direction: row; align-items: center; gap: 14px; padding: 10px 14px; }
.cal-agenda .cal-event-when { min-width: 120px; }
.cal-agenda-empty { padding: 24px 0; }

/* Right rail: Sandy */
.cal-rail { background: var(--header); border-left: 1px solid var(--line); padding: 18px 18px 16px; display: flex; flex-direction: column; gap: 14px; min-height: 0; overflow: auto; }
.cal-rail-brand { display: flex; align-items: center; gap: 4px; font-family: var(--cal-serif); font-size: 26px; letter-spacing: -.3px; }
.cal-rail-brand svg { width: 20px; height: 20px; margin-left: 4px; fill: none; stroke: #b48ad8; stroke-width: 1.6; }
.cal-rail-intro h2 { margin: 4px 0 4px; font-size: 20px; font-weight: 600; letter-spacing: -.3px; }
.cal-rail-intro p { margin: 0; font-size: 13.5px; line-height: 1.5; }
.cal-card { border: 1px solid var(--line); border-radius: 12px; background: var(--panel); padding: 14px 14px 12px; display: flex; flex-direction: column; gap: 10px; }
.cal-card h3 { margin: 0; font-size: 15px; font-weight: 600; }
.cal-card p { margin: 0; line-height: 1.5; }
.cal-card-h { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.cal-field select { width: 100%; height: 40px; padding: 0 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel); color: var(--ink); font: inherit; }
.cal-slots { display: flex; flex-wrap: wrap; gap: 8px; }
.cal-slot { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); font-size: 12.5px; text-align: left; }
.cal-slot:hover { background: var(--hover); }
.cal-slot b { font-weight: 650; }
.cal-today-item { display: flex; align-items: flex-start; gap: 10px; padding: 8px 4px; border-radius: 8px; text-align: left; width: 100%; }
.cal-today-item:hover { background: var(--hover); }
.cal-today-item.past { opacity: .55; }
.cal-today-item .cal-dot { margin-top: 4px; }
.cal-today-body { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.cal-today-when { font-size: 12.5px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.cal-today-title { font-weight: 600; font-size: 13.5px; }
.cal-ask { margin-top: auto; display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); padding: 8px 10px 8px 12px; }
.cal-ask svg { width: 16px; height: 16px; fill: none; stroke: #b48ad8; stroke-width: 1.6; flex-shrink: 0; }
.cal-ask input { flex: 1; min-width: 0; border: 0; background: transparent; font: inherit; color: var(--ink); }
.cal-ask input:disabled { color: var(--muted); }

/* Event panel in the rail */
.cal-panel { display: flex; flex-direction: column; gap: 10px; }
.cal-back { align-self: flex-start; display: inline-flex; align-items: center; gap: 4px; }
.cal-back svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; }
.cal-panel-kind { display: flex; align-items: center; gap: 8px; font-size: 11px; font-weight: 650; letter-spacing: .4px; text-transform: uppercase; color: var(--muted); }
.cal-panel-swatch { width: 12px; height: 12px; border-radius: 4px; }
.cal-panel-swatch.hold { background: repeating-linear-gradient(135deg, transparent 0 2px, var(--muted) 2px 3px) !important; border: 1px dashed var(--muted); }
.cal-panel-title { margin: 0; font-family: var(--cal-serif); font-weight: 500; font-size: 24px; line-height: 1.2; overflow-wrap: anywhere; }
.cal-panel-when { margin: 0; font-size: 14px; }
.cal-panel-where { margin: 0; font-size: 13px; }
.cal-actions { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 4px; }
.cal-actions .btn { height: 38px; text-decoration: none; }
.cal-options { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.cal-options:empty { display: none; }
.cal-options h4, .cal-people h4 { width: 100%; margin: 6px 0 2px; font-size: 11px; font-weight: 650; letter-spacing: .4px; text-transform: uppercase; color: var(--muted); }
.cal-people { display: flex; flex-direction: column; gap: 6px; }
.cal-person { display: flex; align-items: center; gap: 8px; font-size: 13.5px; }
.cal-person-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-pdot { width: 8px; height: 8px; border-radius: 4px; background: var(--line); flex-shrink: 0; }
.cal-pdot.accepted { background: var(--ok); }
.cal-pdot.tentative { background: var(--flag); }
.cal-pdot.declined { background: var(--danger); }
.cal-panel-meta { border-top: 1px solid var(--line-soft); padding-top: 10px; margin-top: 6px; line-height: 1.5; }
.cal-unknown { color: var(--ink-2); }
.cal-unavailable { display: grid; justify-items: center; gap: 6px; padding: 48px 8px; text-align: center; }
.cal-unavailable svg { width: 28px; height: 28px; fill: none; stroke: currentColor; stroke-width: 1.5; }
.cal-editor-row { display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: 10px; }
.cal-editor .field input[type="time"] { border: 1px solid var(--line); border-radius: var(--radius); padding: 9px 12px; background: var(--panel); }
.cal-check { display: flex; align-items: center; gap: 8px; margin: -6px 0 14px; font-size: 13.5px; }
.cal-search-results { display: flex; flex-direction: column; gap: 4px; max-height: 50vh; overflow: auto; }
.cal-search-hit { display: flex; justify-content: space-between; gap: 10px; padding: 8px 10px; border-radius: 8px; text-align: left; }
.cal-search-hit:hover { background: var(--hover); }

@media (max-width: 1180px) and (min-width: 961px) {
  .calendar-page { grid-template-columns: 210px minmax(0, 1fr); }
  .cal-rail { position: absolute; top: 0; right: 0; bottom: 0; width: 320px; z-index: 20; box-shadow: var(--shadow); transform: translateX(100%); visibility: hidden; transition: transform .18s ease, visibility .18s; }
  .calendar-page.rail-open .cal-rail, .calendar-page.has-panel .cal-rail { transform: none; visibility: visible; }
  .cal-rail-toggle, .cal-rail-close { display: inline-grid !important; }
}
@media (max-width: 960px) {
  .calendar-page { grid-template-columns: minmax(0, 1fr); }
  .cal-side { display: none; }
  .cal-rail { display: none; }
  .calendar-page.has-panel .cal-main, .calendar-page.rail-open .cal-main { display: none; }
  .calendar-page.has-panel .cal-rail, .calendar-page.rail-open .cal-rail { display: flex; border-left: 0; }
  .cal-rail-toggle, .cal-rail-close { display: inline-grid !important; }
  .cal-main { padding: 12px 14px 14px; }
  .cal-title { font-size: 24px; }
  .cal-head-right { width: 100%; margin-left: 0; justify-content: space-between; flex-wrap: wrap; }
  .cal-timegrid { --gutter: 48px; }
  .cal-timegrid.week .cal-tg-head, .cal-timegrid.week .cal-tg-allday, .cal-timegrid.week .cal-tg-grid { min-width: 820px; }
  .cal-timegrid.week { overflow-x: auto; }
  .cal-timegrid.week .cal-tg-scroll { overflow-x: hidden; min-width: 820px; }
  .cal-tg-dow { display: none; }
  .cal-month-cell .cal-event.compact .cal-event-title { font-size: 10.5px; }
  .cal-editor-row { grid-template-columns: 1fr; }
}

/* Connected accounts */
.conn-list { display: grid; gap: 8px; margin: 10px 0; }
.conn-row { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between; padding: 10px 12px; border: 1px solid var(--line-soft); border-radius: 10px; }
.conn-main { min-width: 0; flex: 1 1 260px; }
.conn-main strong { word-break: break-all; }
.conn-status { color: var(--muted); margin-top: 2px; }
.conn-row.status-auth .conn-status, .conn-row.status-action_required .conn-status, .conn-row.status-error .conn-status { color: var(--danger); }
.conn-row.status-importing .conn-status, .conn-row.status-connecting .conn-status { color: var(--accent); }
.conn-acts { display: flex; gap: 10px; flex-wrap: wrap; }
.conn-pw, .conn-confirm { flex-basis: 100%; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.conn-pw input { flex: 1 1 200px; }
.connect-form { display: grid; gap: 8px; margin-top: 8px; }
.connect-form p { margin: 0; }
.connect-adv summary { cursor: pointer; font-size: 13px; color: var(--muted); }
.connect-grid { display: grid; grid-template-columns: 1fr 90px; gap: 8px; margin-top: 8px; }
.connect-grid .field.small:nth-child(5) { grid-column: 1 / -1; }
@media (max-width: 640px) { .connect-grid { grid-template-columns: 1fr; } }
.report-outcome.outcome-complete strong, .report-outcome.outcome-complete_with_exclusions strong { color: var(--ok); }
.report-outcome.outcome-incomplete strong { color: var(--accent); }

/* ---------- several accounts: one group per account, All accounts on top ---------- */
/* Denser sidebar (smaller type, tighter rows) so long folder names and counts fit in the same width. */
.sidebar .folder { gap: 9px; padding: 5px 8px 5px 10px; min-height: 30px; font-size: 13px; }
.sidebar .folder svg { width: 15px; height: 15px; }
.sidebar .folder .count { font-size: 11.5px; flex: none; min-width: 2ch; text-align: right; }
.sidebar .nav-heading { padding: 12px 6px 3px 10px; font-size: 10.5px; }
.acct-head { display: flex; align-items: center; gap: 2px; margin-top: 6px; border-radius: var(--radius); color: var(--ink); }
.acct-head:hover { background: var(--hover); }
.acct-toggle { flex: 1; min-width: 0; display: flex; align-items: center; gap: 7px; padding: 5px 6px 5px 2px; min-height: 30px; font-weight: 650; font-size: 12.5px; text-align: left; color: inherit; }
.acct-toggle > svg:first-child { width: 14px; height: 14px; color: var(--muted); flex: none; transform: rotate(-90deg); transition: transform .15s; }
.acct-head.open .acct-toggle > svg:first-child { transform: rotate(0); }
.acct-head.all .acct-toggle { text-transform: uppercase; letter-spacing: .07em; font-size: 10.5px; color: var(--muted); font-weight: 600; }
.acct-head .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-head .count { font-size: 11.5px; font-weight: 600; color: var(--ink-2); flex: none; text-transform: none; letter-spacing: 0; }
.acct-more { flex: none; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 6px; color: var(--muted); opacity: 0; }
.acct-more svg { width: 15px; height: 15px; }
.acct-head:hover .acct-more, .acct-more:focus-visible, .acct-head:focus-within .acct-more { opacity: 1; }
.acct-more:hover { background: var(--active); color: var(--ink); }
.acct-head.current .acct-dot { box-shadow: 0 0 0 3px color-mix(in srgb, var(--acct) 25%, transparent); }
.acct-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--acct); flex: none; }
.acct-warn svg { width: 13px; height: 13px; color: var(--danger, #d9534f); }
/* one indent only: the group's rule sits under the arrow */
.acct-body { display: grid; gap: 0; margin-left: 8px; padding-left: 4px; border-left: 2px solid color-mix(in srgb, var(--acct, var(--line)) 40%, transparent); }
.acct-body.all { border-left-color: var(--line); }
.acct-body .folder { padding-left: 8px; }
.folder.quiet { color: var(--muted); }
.folder.quiet .name { font-weight: 400; }
/* the account a folder view belongs to, under its name */
/* The folder's account and its size, on their own full-width line under the title: the address is
   always shown in full (never ellipsized); only an address longer than the whole line wraps. */
.list-sub { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 6px; row-gap: 2px; margin: -4px 0 0 34px; min-width: 0; font-size: 12px; color: var(--muted); }
.list-sub .list-count { font-size: 12px; white-space: nowrap; }
.list-sub:empty, .list-sub:has(.list-account[hidden]):has(.list-count:empty) { display: none; }
.list-account { min-width: 0; max-width: 100%; color: var(--ink-2); overflow-wrap: anywhere; }
.list-account::before { content: ''; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--acct); margin-right: 6px; vertical-align: 1px; }
.list-account[hidden] { display: none; }
.list-sub .list-account:not([hidden]) + .list-count::before { content: '· '; }
/* touch screens keep comfortable targets */
@media (pointer: coarse) {
  .sidebar .folder, .acct-toggle { min-height: 40px; }
  .acct-more { opacity: 1; }
}
/* rows that mix accounts: a colour stripe and the account as a chip */
.row.acct-row { box-shadow: inset 3px 0 0 var(--acct); }
.row.acct-row.focused { box-shadow: inset 3px 0 0 var(--acct), inset 6px 0 0 var(--ink); }
.tag.acct-chip { color: var(--acct); border: 1px solid color-mix(in srgb, var(--acct) 45%, transparent); background: color-mix(in srgb, var(--acct) 8%, transparent); max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* the sending account in the inline reply summary and the From row */
.cs-from { color: var(--ink-2); flex-shrink: 0; white-space: nowrap; }
.cs-from b { font-weight: 600; color: var(--ink); }
.c-field.c-from { box-shadow: inset 3px 0 0 var(--acct); }
.c-field.c-from select { max-width: 100%; }
/* search scope */
.q-scope { font: inherit; font-size: 12px; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); color: var(--ink-2); cursor: pointer; }
.q-scope[style*="--acct"] { border-color: color-mix(in srgb, var(--acct) 50%, transparent); color: var(--acct); }
.q-scope:hover { background: var(--hover); }
