/* TALNEXQ Mail - design system and layout (2.2)

   Colour carries meaning, and nothing else is coloured:
     indigo  = you: your actions, what you selected
     teal    = QI: anything QI wrote, found or did
     red / amber = risk
   Type is Atkinson Hyperlegible, chosen so look-alike characters (l I 1, O 0, rn m)
   stay different. Addresses and links use its mono cut for the same reason. */

/* ---------- typeface (SIL OFL 1.1, served from this site) ---------- */
@font-face {
  font-family: "Atkinson Hyperlegible Next"; font-style: normal; font-weight: 200 800; font-display: swap;
  src: url(/fonts/ahn-latin-ext.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Atkinson Hyperlegible Next"; font-style: normal; font-weight: 200 800; font-display: swap;
  src: url(/fonts/ahn-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Atkinson Hyperlegible Next"; font-style: italic; font-weight: 200 800; font-display: swap;
  src: url(/fonts/ahn-italic-latin-ext.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Atkinson Hyperlegible Next"; font-style: italic; font-weight: 200 800; font-display: swap;
  src: url(/fonts/ahn-italic-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Atkinson Hyperlegible Mono"; font-style: normal; font-weight: 200 800; font-display: swap;
  src: url(/fonts/ahm-latin-ext.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Atkinson Hyperlegible Mono"; font-style: normal; font-weight: 200 800; font-display: swap;
  src: url(/fonts/ahm-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ---------- tokens ---------- */
:root {
  --font: "Atkinson Hyperlegible Next", "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --mono: "Atkinson Hyperlegible Mono", ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace;
  --radius-sm: 8px;      /* small controls, menu items */
  --radius: 10px;        /* buttons, inputs, callouts */
  --radius-lg: 14px;     /* panes, cards */
  --radius-xl: 18px;     /* dialogs */

  --accent: #5b5bf7;         /* links, icons, rules */
  --accent-solid: #5252ee;   /* fills that carry white text */
  --on-accent: #ffffff;
  --accent-2: #7c5cf7;
  --accent-soft: #ededff;
  --accent-ink: #3a3acc;     /* text on accent-soft */
  --qi: #0e93b4;             /* QI rules, icons */
  --qi-ink: #0b6c86;         /* QI text */
  --qi-soft: #e7f6fa;
  --qi-solid: #0b7592;       /* QI buttons */
  --on-qi: #ffffff;
  --grad: linear-gradient(120deg, #5b5bf7 0%, #7c5cf7 48%, #22c7e6 100%);  /* brand art only */

  --bg: #f1f2f6;
  --surface: #ffffff;
  --surface-2: #f6f7fa;
  --surface-3: #eceef3;
  --line: #e2e5ec;
  --line-2: #cbd0dc;
  --text: #131828;
  --text-2: #464e66;
  --text-3: #676f88;
  --hover: rgba(19, 24, 40, 0.05);
  --selected: #ebebff;
  --unread: #0b1020;

  --ok: #177a3c;
  --ok-soft: #e6f5ec;
  --warn: #a8480b;
  --warn-soft: #fdf0e3;
  --bad: #c62323;
  --bad-soft: #fceaea;
  --star: #d49a00;

  --shadow-1: 0 1px 2px rgba(19, 24, 40, 0.06);
  --shadow-2: 0 2px 6px rgba(19, 24, 40, 0.06), 0 12px 28px -6px rgba(19, 24, 40, 0.16);
  --shadow-3: 0 8px 20px rgba(19, 24, 40, 0.10), 0 32px 72px -16px rgba(19, 24, 40, 0.34);
  --ring: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);

  --sidebar: 244px;
  --rail: 68px;
  --topbar: 60px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  color-scheme: light;
}

:root[data-theme="dark"] {
  --accent: #9a9dff;
  --accent-solid: #5b5bf7;
  --on-accent: #ffffff;
  --accent-2: #b39bff;
  --accent-soft: #20224c;
  --accent-ink: #c5c7ff;
  --qi: #22d3ee;
  --qi-ink: #7ce7f8;
  --qi-soft: #0b2732;
  --qi-solid: #22d3ee;
  --on-qi: #04222b;

  --bg: #080b17;
  --surface: #0f1427;
  --surface-2: #141a31;
  --surface-3: #1c2340;
  --line: #222a48;
  --line-2: #343e63;
  --text: #e9ecf8;
  --text-2: #b4bcd4;
  --text-3: #8d97b6;
  --hover: rgba(255, 255, 255, 0.055);
  --selected: #1e2350;
  --unread: #ffffff;

  --ok: #4ade80;
  --ok-soft: #0e2a1a;
  --warn: #fb9a4b;
  --warn-soft: #2e1b0c;
  --bad: #ff7b7b;
  --bad-soft: #321316;
  --star: #f5c542;

  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.5);
  --shadow-2: 0 2px 6px rgba(0, 0, 0, 0.35), 0 14px 32px -6px rgba(0, 0, 0, 0.6);
  --shadow-3: 0 10px 24px rgba(0, 0, 0, 0.4), 0 36px 80px -16px rgba(0, 0, 0, 0.75);
  color-scheme: dark;
}

/* ---------- base ---------- */
* { box-sizing: border-box; scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
html, body { height: 100%; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
/* QI dark: a low glow behind the app, strongest near the mark */
:root[data-theme="dark"] body {
  background:
    radial-gradient(880px 420px at 6% -12%, rgba(91, 91, 247, 0.20), transparent 62%),
    radial-gradient(720px 380px at 98% -6%, rgba(34, 211, 238, 0.09), transparent 60%),
    var(--bg);
  background-attachment: fixed;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { text-wrap: balance; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
::selection { background: color-mix(in srgb, var(--accent) 26%, transparent); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: fixed; left: 12px; top: -60px; z-index: 300; padding: 10px 14px; border-radius: var(--radius); background: var(--accent-solid); color: var(--on-accent); font-weight: 650; }
.skip-link:focus { top: 12px; text-decoration: none; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.small { font-size: 12.5px; }
.tiny { font-size: 11.5px; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.num { font-variant-numeric: tabular-nums; }
.row { display: flex; align-items: center; gap: 8px; }
.col { display: flex; flex-direction: column; gap: 8px; }
.grow { flex: 1; min-width: 0; }
.wrap { flex-wrap: wrap; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.spacer { flex: 1; }
.hidden { display: none !important; }

/* ---------- icons ---------- */
.icon { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.icon.sm { width: 15px; height: 15px; }
.icon.lg { width: 22px; height: 22px; }
.icon.fill { fill: currentColor; stroke: none; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 36px; padding: 0 14px; border-radius: var(--radius); border: 1px solid var(--line-2);
  background: var(--surface); color: var(--text); cursor: pointer; font-weight: 600; white-space: nowrap;
  transition: background .12s, border-color .12s, box-shadow .12s;
}
.btn:hover { background: var(--surface-2); border-color: color-mix(in srgb, var(--line-2) 70%, var(--text-3)); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--accent-solid); border-color: transparent; color: var(--on-accent); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .16), 0 1px 2px rgba(19, 24, 40, .18); }
.btn.primary:hover { background: color-mix(in srgb, var(--accent-solid) 88%, #000); }
.btn.qi { background: var(--qi-solid); border-color: transparent; color: var(--on-qi); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .16), 0 1px 2px rgba(19, 24, 40, .18); }
.btn.qi:hover { background: color-mix(in srgb, var(--qi-solid) 88%, #000); filter: none; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--hover); border-color: transparent; }
.btn.danger { color: var(--bad); }
.btn.danger.solid { background: var(--bad); color: #fff; border-color: transparent; }
:root[data-theme="dark"] .btn.danger.solid { background: #c62323; }
.btn.sm { height: 30px; padding: 0 10px; font-size: 13px; border-radius: var(--radius-sm); }
.btn.lg { height: 46px; padding: 0 20px; font-size: 15px; border-radius: 12px; }
.btn.block { width: 100%; }
.iconbtn {
  display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: var(--radius);
  border: 0; background: transparent; color: var(--text-2); cursor: pointer; flex: none;
  transition: background .12s, color .12s;
}
.iconbtn:hover { background: var(--hover); color: var(--text); }
.iconbtn.active { color: var(--accent-ink); background: var(--accent-soft); }
.iconbtn.sm { width: 28px; height: 28px; border-radius: var(--radius-sm); }

/* ---------- inputs ---------- */
.input, .select, .textarea {
  width: 100%; height: 38px; padding: 0 12px; border-radius: var(--radius); border: 1px solid var(--line-2);
  background: var(--surface); color: var(--text); outline: none; transition: border-color .12s, box-shadow .12s;
}
.textarea { height: auto; min-height: 90px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.input:focus, .select:focus, .textarea:focus { border-color: var(--accent); box-shadow: var(--ring); }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field > label, .label { font-weight: 650; font-size: 13px; color: var(--text-2); }
.help { font-size: 12.5px; color: var(--text-3); }
.check { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; padding: 6px 0; }
.check input { margin-top: 3px; accent-color: var(--accent-solid); width: 15px; height: 15px; }
.switch { position: relative; width: 38px; height: 22px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: var(--line-2); border-radius: 22px; transition: .18s; cursor: pointer; }
.switch span::before { content: ""; position: absolute; left: 3px; top: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: .18s var(--ease); box-shadow: var(--shadow-1); }
.switch input:checked + span { background: var(--accent-solid); }
.switch input:checked + span::before { transform: translateX(16px); }
.switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.pw-wrap { position: relative; }
.pw-wrap .input { padding-right: 44px; }
.pw-wrap .iconbtn { position: absolute; right: 3px; top: 2px; }

/* ---------- chips & badges ---------- */
.chip {
  border: 0;
  display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 999px;
  font-size: 12px; font-weight: 650; background: var(--surface-3); color: var(--text-2); white-space: nowrap;
}
.chip.accent { background: var(--accent-soft); color: var(--accent-ink); }
.chip.qi { background: var(--qi-soft); color: var(--qi-ink); }
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.bad { background: var(--bad-soft); color: var(--bad); }
.chip.click { cursor: pointer; }
.chip.click:hover { filter: brightness(.96); }
:root[data-theme="dark"] .chip.click:hover { filter: brightness(1.2); }
.badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; font-size: 11.5px; font-weight: 700; display: inline-grid; place-items: center; background: var(--surface-3); color: var(--text-2); font-variant-numeric: tabular-nums; }
.badge.accent { background: var(--accent-solid); color: var(--on-accent); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex: none; }

/* ---------- avatar ---------- */
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 12.5px; flex: none; letter-spacing: .01em; user-select: none; }
.avatar.sm { width: 26px; height: 26px; font-size: 10.5px; }
.avatar.lg { width: 42px; height: 42px; font-size: 15px; }

/* ---------- cards / panels ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); }
.card.pad { padding: 20px; }
.panel-title { font-size: 17px; font-weight: 700; margin: 0 0 4px; letter-spacing: -0.005em; }
.section-title { font-size: 12.5px; font-weight: 700; color: var(--text-3); margin: 18px 0 8px; }
hr.sep { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }

/* ---------- brand ---------- */
.brand { display: flex; align-items: center; gap: 10px; font-weight: 750; font-size: 16px; letter-spacing: -0.01em; user-select: none; white-space: nowrap; }
.brand small { font-weight: 550; color: var(--text-3); font-size: 15px; margin-left: -5px; letter-spacing: 0; }
.mark { width: 30px; height: 30px; border-radius: 9px; background: var(--accent-solid); display: grid; place-items: center; color: #fff; flex: none; font-weight: 800; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .22), 0 1px 2px rgba(19, 24, 40, .25); }
.mark svg { width: 100%; height: 100%; display: block; }
.mark .ring { fill: none; stroke: #fff; stroke-width: 3.1; }
.mark .tail { fill: none; stroke: #7deaf9; stroke-width: 3.1; stroke-linecap: round; }
.mark.lg { width: 40px; height: 40px; border-radius: 12px; }
.postmark { display: block; overflow: visible; }
.postmark text { font-family: var(--font); font-weight: 700; fill: currentColor; }
.postmark .pm-line { fill: none; stroke: currentColor; }

/* ---------- app shell ---------- */
.app { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); grid-template-rows: var(--topbar) minmax(0, 1fr); height: 100vh; height: 100dvh; overflow: hidden; }
.app.rail { --sidebar: var(--rail); }
.topbar { grid-column: 1 / -1; display: flex; align-items: center; padding: 0 12px 0 0; min-width: 0; }
.topbar .brand { width: var(--sidebar); flex: none; padding-left: 19px; color: inherit; text-decoration: none; }
.app.rail .topbar .brand > span:not(.mark), .app.rail .topbar .brand small { display: none; }
.search { flex: 1; max-width: 720px; position: relative; min-width: 0; }
.search .input { height: 42px; padding-left: 42px; padding-right: 108px; border-radius: 12px; background: var(--surface); border-color: var(--line); }
.search .input:hover { border-color: var(--line-2); }
.search .input:focus { border-color: var(--accent); box-shadow: var(--ring); }
.search > .icon { position: absolute; left: 14px; top: 12px; color: var(--text-3); pointer-events: none; }
.search .ask { position: absolute; right: 6px; top: 6px; height: 30px; }
.top-actions { display: flex; align-items: center; gap: 2px; margin-left: auto; padding-left: 12px; }

.sidebar { grid-column: 1; grid-row: 2; overflow-y: auto; overflow-x: hidden; padding: 4px 10px 10px; display: flex; flex-direction: column; gap: 1px; }
.compose-btn { display: flex; align-items: center; justify-content: center; gap: 9px; height: 42px; padding: 0 16px; margin: 2px 0 12px; border-radius: 12px; border: 0; background: var(--accent-solid); color: var(--on-accent); font-weight: 650; font-size: 14.5px; cursor: pointer; flex: none; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .18), 0 1px 2px rgba(19, 24, 40, .2), 0 8px 16px -8px color-mix(in srgb, var(--accent-solid) 80%, transparent); transition: background .12s; }
.compose-btn:hover { background: color-mix(in srgb, var(--accent-solid) 88%, #000); }
.compose-btn .plus { display: grid; place-items: center; }
.nav-item { display: flex; align-items: center; gap: 11px; height: 34px; padding: 0 10px; border-radius: var(--radius-sm); cursor: pointer; color: var(--text-2); font-weight: 550; user-select: none; text-decoration: none; border: 0; background: none; width: 100%; text-align: left; flex: none; position: relative; }
.nav-item:hover { background: var(--hover); color: var(--text); text-decoration: none; }
.nav-item.active { background: var(--selected); color: var(--accent-ink); font-weight: 700; }
.nav-item .count { margin-left: auto; font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; }
.nav-item .icon { color: inherit; }
.nav-item.qi .icon { color: var(--qi); }
.nav-group { font-size: 12.5px; font-weight: 700; color: var(--text-3); padding: 16px 10px 6px; display: flex; align-items: center; flex: none; }
.nav-group .iconbtn { margin-left: auto; width: 24px; height: 24px; }
.rail-sep { display: none; }
.side-foot { margin-top: auto; padding-top: 12px; display: flex; flex-direction: column; gap: 4px; flex: none; }
.storage { padding: 0 10px 6px; font-size: 12px; color: var(--text-3); }
.meter { height: 5px; border-radius: 5px; background: var(--surface-3); overflow: hidden; margin-top: 6px; }
.meter > i { display: block; height: 100%; background: var(--accent); border-radius: 5px; }
.meter > span { display: block; height: 100%; border-radius: 5px; transition: width .2s, background .2s; }

/* sidebar folded down to icons (the grid column follows .app.rail; the panel follows .is-rail,
   so the same sidebar can open full width over the page on smaller screens) */
.sidebar.is-rail { align-items: center; padding-left: 0; padding-right: 0; }
.sidebar.is-rail .compose-btn { width: 44px; padding: 0; }
.sidebar.is-rail .lbl, .sidebar.is-rail .nav-group, .sidebar.is-rail .storage, .sidebar.is-rail .nav-labels { display: none; }
.sidebar.is-rail .nav-item { width: 44px; height: 38px; justify-content: center; padding: 0; }
.sidebar.is-rail .nav-item .count { position: absolute; top: 1px; right: 1px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--accent-solid); color: var(--on-accent); font-size: 10px; display: grid; place-items: center; margin: 0; }
.sidebar.is-rail .rail-sep { display: block; width: 28px; height: 1px; background: var(--line-2); margin: 8px 0; flex: none; }
.sidebar.is-rail .side-foot { align-items: center; }

.main { grid-column: 2; grid-row: 2; overflow: hidden; display: flex; min-width: 0; padding: 0 12px 12px 0; }
.pane { background: var(--surface); border-radius: var(--radius-lg); border: 1px solid var(--line); display: flex; flex-direction: column; min-width: 0; overflow: hidden; }
.list-pane { width: var(--list-w, 42%); min-width: 340px; max-width: 66%; flex: none; }
.list-pane.full { width: auto; max-width: none; flex: 1; }
.reader-pane { flex: 1; container-type: inline-size; }
.splitter { width: 12px; flex: none; cursor: col-resize; position: relative; touch-action: none; border-radius: 6px; }
.splitter::after { content: ""; position: absolute; left: 4px; top: 50%; width: 4px; height: 40px; margin-top: -20px; border-radius: 4px; background: var(--line-2); opacity: 0; transition: opacity .15s; }
.splitter:hover::after, .splitter:focus-visible::after, .splitter.drag::after { opacity: 1; }
.splitter.drag::after { background: var(--accent); }
.dragging-split { cursor: col-resize; user-select: none; }
.dragging-split iframe { pointer-events: none; }

/* Labeled toolbar buttons: names while there is room, icons when the pane is narrow. */
.tb { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 10px; border: 0; border-radius: var(--radius-sm); background: none; color: var(--text-2); font-weight: 600; font-size: 13px; cursor: pointer; white-space: nowrap; flex: none; }
.tb:hover { background: var(--hover); color: var(--text); }
.tb.danger:hover { color: var(--bad); }
@container (max-width: 620px) { .tb span { display: none; } .tb { padding: 0 8px; } }

/* ---------- list ---------- */
.toolbar { display: flex; align-items: center; gap: 2px; padding: 8px 10px; border-bottom: 1px solid var(--line); min-height: 51px; flex: none; }
.toolbar .title { font-weight: 700; font-size: 16px; padding: 0 6px; letter-spacing: -0.005em; display: inline-flex; align-items: center; gap: 8px; }
.toolbar .pick-all { margin: 0 8px 0 9px; width: 16px; height: 16px; accent-color: var(--accent-solid); cursor: pointer; flex: none; }
.tabs { display: flex; gap: 2px; padding: 0 8px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; flex: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { display: flex; align-items: center; gap: 7px; padding: 11px 11px 9px; border: 0; background: none; cursor: pointer; color: var(--text-2); font-weight: 600; border-bottom: 2px solid transparent; white-space: nowrap; margin-bottom: -1px; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent-ink); border-bottom-color: var(--accent); }
.tab .badge { height: 18px; min-width: 18px; font-size: 11px; }
.list { overflow-y: auto; overflow-x: hidden; flex: 1; overscroll-behavior: contain; }
.grp { position: sticky; top: 0; z-index: 3; padding: 6px 16px 5px; font-size: 12px; font-weight: 700; color: var(--text-3); background: color-mix(in srgb, var(--surface) 90%, transparent); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.msg-row { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; column-gap: 12px; align-items: start; padding: 10px 14px; border-bottom: 1px solid var(--line); cursor: pointer; position: relative; outline-offset: -2px; touch-action: pan-y; background: var(--surface); }
.msg-row:hover { background-image: linear-gradient(var(--hover), var(--hover)); }
.msg-row.selected, .msg-row.active { background-color: var(--selected); }
.msg-row.active::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--accent); }
.msg-row .lead { position: relative; width: 36px; height: 36px; display: grid; place-items: center; }
.msg-row .lead .avatar { transition: opacity .1s; }
.msg-row .lead .pick { position: absolute; inset: 0; margin: auto; width: 18px; height: 18px; opacity: 0; accent-color: var(--accent-solid); cursor: pointer; z-index: 1; }
.msg-row:hover .lead .avatar, .msg-row.checked .lead .avatar, .list.selecting .lead .avatar, .msg-row .lead:focus-within .avatar { opacity: 0; }
.msg-row:hover .lead .pick, .msg-row.checked .lead .pick, .list.selecting .lead .pick, .msg-row .lead .pick:focus-visible { opacity: 1; }
.msg-row .who { display: flex; align-items: center; gap: 6px; min-width: 0; }
.msg-row .who .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); font-weight: 550; }
.msg-row .who .n { color: var(--text-3); font-size: 12px; font-variant-numeric: tabular-nums; flex: none; }
.msg-row .who .chip { flex: none; height: 20px; font-size: 11.5px; padding: 0 7px; }
.msg-row .udot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); flex: none; display: none; }
.msg-row.unread .udot { display: block; }
.msg-row .line2 { display: flex; gap: 6px; align-items: center; min-width: 0; margin-top: 1px; }
.msg-row .subj { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); min-width: 0; }
.msg-row .prev { color: var(--text-3); font-size: 13px; margin-top: 1px; }
.msg-row .prev .icon { vertical-align: -2px; color: var(--qi); }
.msg-row .meta { display: flex; flex-direction: column; align-items: flex-end; gap: 1px; font-size: 12px; color: var(--text-3); white-space: nowrap; font-variant-numeric: tabular-nums; padding-top: 1px; }
.msg-row.unread .name { font-weight: 750; color: var(--unread); }
.msg-row.unread .subj { font-weight: 650; color: var(--unread); }
.msg-row.unread .meta .time { color: var(--accent-ink); font-weight: 700; }
.msg-row .tags { display: flex; gap: 4px; flex: none; margin-left: auto; padding-left: 4px; }
.msg-row .tags .chip { height: 20px; font-size: 11.5px; padding: 0 7px; }
.msg-row .tags .chip.icon-only { padding: 0 5px; }
.msg-row .star { color: var(--text-3); margin-right: -6px; }
.msg-row .star.on { color: var(--star); }
.msg-row .quick { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); display: none; gap: 1px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-2); padding: 2px; z-index: 2; }
.msg-row:hover .quick, .msg-row:focus-within .quick { display: flex; }
.msg-row:hover .meta, .msg-row:focus-within .meta, .msg-row:hover .tags, .msg-row:focus-within .tags { visibility: hidden; }
.msg-row .swipe { position: absolute; top: 0; bottom: 0; width: 100%; display: none; align-items: center; color: #fff; font-weight: 650; gap: 8px; padding: 0 22px; }
.msg-row .swipe.l { right: 100%; justify-content: flex-end; background: var(--accent-solid); }
.msg-row .swipe.r { left: 100%; justify-content: flex-start; background: #c62323; }
.msg-row.swiping { transition: none; z-index: 4; }
.msg-row.swiping .swipe { display: flex; }
.msg-row.settle { transition: transform .22s var(--ease); }
.msg-row.settle .swipe { display: flex; }
.compact .msg-row { padding-top: 7px; padding-bottom: 7px; }
.compact .msg-row .prev { display: none; }
.compact .msg-row .lead, .compact .msg-row .lead .avatar { width: 30px; height: 30px; font-size: 11.5px; }
.compact .msg-row { grid-template-columns: 30px minmax(0, 1fr) auto; align-items: center; }
.list-empty { padding: 56px 28px 40px; text-align: center; color: var(--text-2); display: flex; flex-direction: column; align-items: center; gap: 8px; }
.list-empty .art { color: var(--line-2); margin-bottom: 8px; }
.list-empty b { color: var(--text); font-size: 15.5px; font-weight: 700; }
.list-empty p { margin: 0; max-width: 340px; }
.list-empty .btn { margin-top: 10px; }
.list-empty .big { font-size: 40px; margin-bottom: 10px; }
.load-more { padding: 14px; text-align: center; display: grid; place-items: center; }
.skel { display: grid; grid-template-columns: 36px 1fr; column-gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--line); align-items: center; }
.skel .av { width: 34px; height: 34px; border-radius: 50%; background: var(--surface-3); }
.skel .ln { display: flex; flex-direction: column; gap: 8px; }

/* ---------- QI brief ---------- */
.brief { margin: 12px 12px 6px; border-radius: 12px; padding: 11px 12px 12px 17px; background: var(--qi-soft); position: relative; }
.brief::before { content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px; border-radius: 3px; background: var(--qi); }
.brief h3 { margin: 0; font-size: 13.5px; display: flex; align-items: center; gap: 7px; color: var(--qi-ink); font-weight: 700; min-height: 28px; }
.brief h3 .when { color: var(--text-3); font-weight: 500; font-size: 12.5px; }
.brief .headline { margin: 4px 0 2px; font-weight: 600; color: var(--text); }
.brief .sect { margin-top: 10px; }
.brief .sect > b { font-size: 12.5px; color: var(--text-2); font-weight: 700; }
.brief ul { margin: 3px 0 0; padding-left: 18px; }
.brief li { margin: 3px 0; cursor: pointer; }
.brief li b { font-weight: 650; }
.brief li:hover { color: var(--accent-ink); }
.brief.collapsed .sect { display: none; }
.brief.collapsed .headline { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ---------- reader ---------- */
.reader { overflow-y: auto; flex: 1; padding: 0 0 36px; }
.reader-head { padding: 20px 26px 8px; }
.reader-head h1 { font-size: 21px; margin: 0 0 8px; line-height: 1.28; letter-spacing: -0.012em; font-weight: 700; overflow-wrap: anywhere; }
.qi-card { margin: 8px 26px 14px; border-radius: 12px; background: var(--qi-soft); padding: 12px 16px 12px 19px; position: relative; }
.qi-card::before { content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px; border-radius: 3px; background: var(--qi); }
.qi-card .hd { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--qi-ink); }
.qi-card p { margin: 8px 0; }
.qi-card ul { margin: 6px 0; padding-left: 20px; }
.qi-card li { margin: 3px 0; }
.qi-card .grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 8px; }
.risk-banner { margin: 6px 26px 12px; padding: 12px 16px 12px 19px; border-radius: 12px; display: flex; gap: 12px; align-items: flex-start; position: relative; }
.risk-banner::before { content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px; border-radius: 3px; background: currentColor; }
.risk-banner.danger { background: var(--bad-soft); color: var(--bad); }
.risk-banner.caution { background: var(--warn-soft); color: var(--warn); }
.risk-banner .txt { color: var(--text); }
.risk-banner .btn { color: var(--text); }
.risk-banner .btn.danger { color: var(--bad); }
.message { margin: 0 26px 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); overflow: hidden; }
.message.collapsed { cursor: pointer; }
.message.collapsed:hover { background: var(--surface-2); }
.message .mh { display: flex; align-items: flex-start; gap: 12px; padding: 13px 14px 12px 16px; }
.message .mh .from { font-weight: 700; }
.message .mh .addr { color: var(--text-3); font-family: var(--mono); font-size: 12.5px; overflow-wrap: anywhere; }
.message .mh .to { color: var(--text-3); font-size: 12.5px; margin-top: 2px; }
.message .mbody { padding: 0 16px 16px 62px; }
.message .snippet { color: var(--text-3); padding: 0 16px 13px 62px; margin-top: -8px; }
.email-frame { width: 100%; border: 0; display: block; min-height: 60px; background: #fff; border-radius: 8px; }
.text-body { white-space: pre-wrap; word-wrap: break-word; font-size: 14.5px; line-height: 1.6; max-width: 76ch; }
.text-body .quote { color: var(--text-3); border-left: 3px solid var(--line-2); padding-left: 10px; }
.img-bar { display: flex; align-items: center; gap: 10px; padding: 8px 12px; margin-bottom: 10px; border-radius: var(--radius); background: var(--surface-2); font-size: 12.5px; color: var(--text-2); }
.attachments { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.att { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--radius); min-width: 200px; max-width: 280px; background: var(--surface-2); text-decoration: none; color: var(--text); }
.att:hover { border-color: var(--accent); text-decoration: none; }
.att .ext { width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center; font-size: 10.5px; font-weight: 800; color: #fff; background: #5b6478; text-transform: uppercase; flex: none; }
.att .ext.pdf { background: #d6383d; } .att .ext.doc, .att .ext.docx { background: #2b62d9; } .att .ext.xls, .att .ext.xlsx, .att .ext.csv { background: #19894a; } .att .ext.img { background: #7c5cf7; } .att .ext.zip { background: #a8480b; }
.att .ext.pptx, .att .ext.ppt { background: #cf4410; }
.att .nm { font-weight: 600; font-size: 13px; }
.att-wrap { display: inline-flex; align-items: center; gap: 6px; }
.att-wrap .att-qi { height: 30px; padding: 0 10px; border-radius: var(--radius); }
.reply-bar { display: flex; gap: 8px; margin: 8px 26px 18px; flex-wrap: wrap; }
.smart-replies { display: flex; gap: 8px; margin: 2px 26px 12px; flex-wrap: wrap; }
.smart-replies .chip { height: 32px; padding: 0 14px; font-size: 13px; cursor: pointer; border: 1px solid color-mix(in srgb, var(--qi) 40%, var(--line)); background: var(--surface); color: var(--text); font-weight: 550; }
.smart-replies .chip:hover { background: var(--qi-soft); border-color: var(--qi); }
.reader-empty { flex: 1; display: grid; place-items: center; color: var(--text-2); padding: 32px; overflow-y: auto; }
.reader-empty .art { width: 120px; height: 120px; border-radius: 32px; background: var(--surface-3); margin: 0 auto 18px; }
.today { width: min(430px, 100%); }
.today .stamp { color: color-mix(in srgb, var(--accent) 34%, var(--line-2)); margin: 0 0 20px -6px; }
.today h2 { font-size: 23px; margin: 0; letter-spacing: -0.015em; color: var(--text); font-weight: 750; }
.today .date { color: var(--text-3); margin: 3px 0 20px; }
.jumps { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.jump { display: flex; align-items: center; gap: 10px; height: 44px; padding: 0 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); cursor: pointer; text-align: left; color: var(--text); font-weight: 550; min-width: 0; }
.jump:hover { border-color: var(--line-2); background: var(--surface-2); }
.jump .icon { color: var(--text-3); }
.jump.qi .icon { color: var(--qi); }
.jump .v { margin-left: auto; font-weight: 750; font-variant-numeric: tabular-nums; }
.jump .v.zero { color: var(--text-3); font-weight: 500; }
.today .acts { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.today .keys { margin-top: 22px; color: var(--text-3); font-size: 12.5px; line-height: 2.1; }
.sel-panel { text-align: center; }
.sel-panel .count { font-size: 44px; font-weight: 750; letter-spacing: -0.03em; color: var(--text); line-height: 1; font-variant-numeric: tabular-nums; }
.sel-panel .acts { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 18px; }

/* ---------- security panel ---------- */
.xray { display: flex; flex-direction: column; gap: 8px; }
.xray .item { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border-radius: var(--radius); background: var(--surface-2); }
.xray .item .st { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; flex: none; color: #fff; font-size: 12px; font-weight: 800; }
.xray .st.pass { background: #177a3c; } .xray .st.warn { background: #a8480b; } .xray .st.fail { background: #c62323; } .xray .st.info { background: #676f88; }

/* ---------- overlays ---------- */
.overlay { position: fixed; inset: 0; background: rgba(9, 12, 26, 0.5); display: grid; place-items: center; z-index: 100; animation: fade .12s ease-out; padding: 20px; -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
.modal { background: var(--surface); border-radius: var(--radius-xl); box-shadow: var(--shadow-3); width: min(560px, 100%); max-height: calc(100vh - 40px); max-height: calc(100dvh - 40px); overflow: auto; animation: pop .18s var(--ease); border: 1px solid var(--line); }
.modal.wide { width: min(820px, 100%); }
.modal .mhd { display: flex; align-items: center; gap: 10px; padding: 18px 16px 6px 22px; }
.modal .mhd h2 { margin: 0; font-size: 17.5px; font-weight: 700; letter-spacing: -0.005em; }
.modal .mbd { padding: 10px 22px 18px; }
.modal .mft { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 22px 18px; flex-wrap: wrap; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(.985); } to { opacity: 1; transform: none; } }
.menu { position: fixed; z-index: 120; min-width: 210px; max-width: min(340px, calc(100vw - 16px)); max-height: calc(100vh - 16px); overflow-y: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-2); padding: 5px; animation: pop .1s ease-out; }
.menu button, .menu a { display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 10px; border: 0; background: none; border-radius: var(--radius-sm); cursor: pointer; text-align: left; color: var(--text); text-decoration: none; min-height: 34px; }
.menu button:hover, .menu a:hover, .menu button:focus-visible { background: var(--hover); text-decoration: none; }
.menu button .icon { color: var(--text-3); }
.menu .sep { height: 1px; background: var(--line); margin: 5px 4px; }
.menu .hd { padding: 6px 10px 4px; font-size: 12px; font-weight: 700; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; }
.toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: 22px; display: flex; flex-direction: column; gap: 8px; z-index: 200; align-items: center; pointer-events: none; }
.toasts > * { pointer-events: auto; }
@media (min-width: 861px) { .toasts { left: 24px; transform: none; align-items: flex-start; } }
.toast { display: flex; align-items: center; gap: 14px; background: #171c33; color: #fff; padding: 10px 12px 10px 16px; border-radius: 12px; box-shadow: var(--shadow-3); animation: pop .18s var(--ease); font-weight: 550; min-width: 260px; max-width: min(560px, calc(100vw - 24px)); border: 1px solid rgba(255, 255, 255, .08); }
.toast.bad { background: #7d1818; }
.toast button { background: none; border: 0; color: #b3bcff; font-weight: 750; cursor: pointer; padding: 4px 6px; border-radius: 6px; display: inline-grid; place-items: center; }
.toast button:hover { background: rgba(255, 255, 255, .12); }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid color-mix(in srgb, currentColor 22%, transparent); border-top-color: currentColor; color: var(--accent); animation: spin .7s linear infinite; flex: none; }
.btn.primary .spinner, .btn.qi .spinner, .compose-btn .spinner { color: currentColor; }
.spinner.lg { width: 30px; height: 30px; border-width: 3px; }
@keyframes spin { to { transform: rotate(360deg); } }
.center { display: grid; place-items: center; padding: 40px; }
.shimmer { background: linear-gradient(90deg, var(--surface-3) 0%, var(--surface-2) 50%, var(--surface-3) 100%); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: 6px; height: 11px; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ---------- compose ---------- */
.composer-dock { position: fixed; right: 20px; bottom: 0; display: flex; gap: 12px; align-items: flex-end; z-index: 90; }
.composer { width: 600px; max-width: calc(100vw - 24px); height: min(640px, calc(100vh - 80px)); background: var(--surface); border-radius: 14px 14px 0 0; box-shadow: var(--shadow-3); display: flex; flex-direction: column; border: 1px solid var(--line-2); border-bottom: 0; overflow: hidden; animation: pop .18s var(--ease); position: relative; }
.composer.min { height: 46px; width: 320px; }
.composer.max { position: fixed; inset: 40px 8% 0; width: auto; height: auto; }
.composer .chd { display: flex; align-items: center; gap: 2px; padding: 0 8px 0 16px; height: 46px; background: var(--surface-2); border-bottom: 1px solid var(--line); cursor: pointer; flex: none; }
.composer .chd b { flex: 1; font-size: 14px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.composer .rcpt { display: flex; align-items: flex-start; gap: 8px; padding: 4px 16px; border-bottom: 1px solid var(--line); min-height: 42px; }
.composer .rcpt > label { color: var(--text-3); width: 44px; padding-top: 9px; font-size: 13px; flex: none; }
.chips-input { display: flex; flex-wrap: wrap; gap: 6px; flex: 1; padding: 5px 0; position: relative; }
.chips-input input { border: 0; outline: none; background: none; flex: 1; min-width: 140px; height: 28px; }
.rchip { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 4px 0 10px; border-radius: 14px; background: var(--surface-3); font-size: 13px; max-width: 100%; }
.rchip.bad { background: var(--bad-soft); color: var(--bad); }
.rchip.ext { box-shadow: inset 0 0 0 1px var(--warn); }
.rchip button { border: 0; background: none; cursor: pointer; color: var(--text-3); display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; }
.rchip button:hover { background: var(--line-2); color: var(--text); }
.suggest { position: absolute; top: 100%; left: 0; z-index: 10; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-2); padding: 4px; min-width: 300px; max-width: calc(100vw - 40px); }
.suggest div { padding: 7px 10px; border-radius: var(--radius-sm); cursor: pointer; display: flex; gap: 10px; align-items: center; }
.suggest div.on, .suggest div:hover { background: var(--hover); }
.composer .subject { border: 0; outline: none; padding: 0 16px; height: 44px; border-bottom: 1px solid var(--line); font-weight: 650; background: none; width: 100%; }
.editor { flex: 1; overflow-y: auto; padding: 14px 16px; outline: none; line-height: 1.6; font-size: 14.5px; }
.editor:empty::before { content: attr(data-placeholder); color: var(--text-3); }
.editor blockquote { margin: 8px 0; padding-left: 12px; border-left: 3px solid var(--line-2); color: var(--text-2); }
.editor img { max-width: 100%; }
.fmt { display: flex; gap: 2px; padding: 4px 10px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.cfoot { display: flex; align-items: center; gap: 6px; padding: 10px 12px; border-top: 1px solid var(--line); flex: none; }
.send-group { display: inline-flex; }
.send-group .btn:first-child { border-radius: var(--radius) 0 0 var(--radius); }
.send-group .btn:last-child { border-radius: 0 var(--radius) var(--radius) 0; padding: 0 8px; border-left: 1px solid rgba(255, 255, 255, .28); }
.att-list { display: flex; flex-wrap: wrap; gap: 6px; padding: 6px 16px; }
.att-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 6px 4px 10px; border-radius: var(--radius); background: var(--surface-3); font-size: 12.5px; }
.qi-panel { border-top: 1px solid var(--line); padding: 12px 14px; background: var(--qi-soft); }
.qi-panel .textarea { min-height: 64px; }
.tone-row { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0; }
.dropzone { position: absolute; inset: 0; background: color-mix(in srgb, var(--accent) 12%, var(--surface)); border: 2px dashed var(--accent); border-radius: 14px; display: grid; place-items: center; font-weight: 700; color: var(--accent-ink); z-index: 5; }

/* ---------- ask QI ---------- */
.ask-panel { position: fixed; right: 12px; top: calc(var(--topbar) + 4px); bottom: 12px; width: min(440px, calc(100vw - 24px)); background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--radius-lg); box-shadow: var(--shadow-3); z-index: 95; display: flex; flex-direction: column; animation: pop .18s var(--ease); overflow: hidden; }
.ask-panel .hd { display: flex; align-items: center; gap: 8px; padding: 13px 12px 13px 16px; border-bottom: 1px solid var(--line); font-weight: 700; }
.ask-panel .body { flex: 1; overflow-y: auto; padding: 14px 16px; display: flex; flex-direction: column; gap: 12px; }
.ask-panel .ft { padding: 12px; border-top: 1px solid var(--line); display: flex; gap: 8px; }
.bubble { padding: 9px 13px; border-radius: 14px; max-width: 92%; white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble.me { align-self: flex-end; background: var(--accent-solid); color: var(--on-accent); border-bottom-right-radius: 4px; }
.bubble.qi { align-self: flex-start; background: var(--qi-soft); border-bottom-left-radius: 4px; }
.sources { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.source { display: flex; gap: 8px; align-items: center; padding: 7px 10px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); cursor: pointer; font-size: 12.5px; }
.source:hover { border-color: var(--accent); }
.source .n { width: 20px; height: 20px; border-radius: 6px; background: var(--accent-soft); color: var(--accent-ink); font-weight: 800; display: grid; place-items: center; font-size: 11px; flex: none; }

/* ---------- palette ---------- */
.palette { width: min(620px, 100%); }
.palette input { border: 0; outline: none; width: 100%; padding: 18px 22px; font-size: 16px; background: none; border-bottom: 1px solid var(--line); }
.palette .items { max-height: 380px; overflow-y: auto; padding: 6px; }
.palette .it { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: var(--radius-sm); cursor: pointer; }
.palette .it .icon { color: var(--text-3); }
.palette .it.on { background: var(--hover); }
.palette .it kbd, kbd { font-family: var(--mono); font-size: 11.5px; padding: 1px 6px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--line-2); border-bottom-width: 2px; color: var(--text-2); white-space: nowrap; }

/* ---------- settings / admin pages ---------- */
.page { flex: 1; overflow-y: auto; padding: 24px 32px 60px; }
.page-head { display: flex; align-items: flex-end; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { margin: 0; font-size: 24px; letter-spacing: -0.015em; font-weight: 750; }
.page-head p { margin: 4px 0 0; color: var(--text-2); }
.settings-grid { display: grid; grid-template-columns: 216px minmax(0, 1fr); gap: 28px; align-items: start; }
.subnav { display: flex; flex-direction: column; gap: 1px; position: sticky; top: 0; }
.subnav a { padding: 8px 10px; border-radius: var(--radius-sm); color: var(--text-2); font-weight: 550; display: flex; gap: 10px; align-items: center; white-space: nowrap; }
.subnav a:hover { background: var(--hover); text-decoration: none; color: var(--text); }
.subnav a.active { background: var(--selected); color: var(--accent-ink); font-weight: 700; }
.stack { display: flex; flex-direction: column; gap: 16px; max-width: 860px; }
.setting-row { display: flex; align-items: center; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.setting-row:last-child { border-bottom: 0; }
.setting-row .txt { flex: 1; min-width: 0; }
.setting-row .txt b { display: block; font-weight: 650; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.stat { padding: 14px 16px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); }
.stat .v { font-size: 26px; font-weight: 750; letter-spacing: -0.02em; margin-top: 2px; font-variant-numeric: tabular-nums; }
.stat .k { color: var(--text-3); font-size: 12.5px; font-weight: 650; }
table.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 12.5px; color: var(--text-3); font-weight: 700; padding: 9px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr.click:hover td { background: var(--hover); cursor: pointer; }
.dns-rec { display: grid; grid-template-columns: 70px 1fr 26px; gap: 10px; padding: 10px 12px; border-radius: var(--radius); background: var(--surface-2); align-items: start; margin-bottom: 8px; }
.dns-rec .ty { font-weight: 800; font-family: var(--mono); font-size: 12px; }
.dns-rec code { display: block; font-family: var(--mono); font-size: 12px; word-break: break-all; color: var(--text-2); }
.dns-rec .name { font-family: var(--mono); font-size: 12.5px; font-weight: 700; word-break: break-all; }
.callout { padding: 12px 14px; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--line); }
.callout.qi { background: var(--qi-soft); border-color: color-mix(in srgb, var(--qi) 32%, transparent); }
.callout.warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 32%, transparent); }
.callout.ok { background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 32%, transparent); }
.secret { font-family: var(--mono); font-size: 15px; padding: 10px 12px; border-radius: var(--radius); background: var(--surface-3); user-select: all; word-break: break-all; }
.progress { height: 8px; border-radius: 8px; background: var(--surface-3); overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--accent); transition: width .4s; border-radius: 8px; }

/* ---------- sign in / sign up ---------- */
.login { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); background: var(--surface); }
.login .art-side { background: #0a0e22; color: #fff; padding: 44px 52px 52px; display: flex; flex-direction: column; position: relative; overflow: hidden; isolation: isolate; }
.login .art-side::before { content: ""; position: absolute; inset: 0; z-index: -1; background: radial-gradient(760px 520px at 88% 4%, rgba(91, 91, 247, .42), transparent 62%), radial-gradient(620px 460px at 4% 108%, rgba(34, 199, 230, .2), transparent 60%); }
.login .art-side .brand { color: #fff; margin: 0; }
.login .art-side .brand small { color: #aeb5d8; }
.login .art-side .stamp { position: absolute; right: -40px; top: 86px; color: #8f97ff; opacity: .9; z-index: -1; }
.login .art-side h1 { font-size: clamp(32px, 3.3vw, 46px); line-height: 1.08; letter-spacing: -0.028em; font-weight: 750; margin: auto 0 16px; max-width: 13em; }
.login .art-side p { color: #c2c8e6; font-size: 16px; line-height: 1.5; max-width: 30em; margin: 0; }
.login .facts { list-style: none; padding: 0; margin: 28px 0 0; display: grid; gap: 11px; max-width: 30em; }
.login .facts li { display: grid; grid-template-columns: 22px 1fr; gap: 10px; color: #c2c8e6; font-size: 14.5px; line-height: 1.45; }
.login .facts li b { color: #fff; font-weight: 650; }
.login .facts .icon { color: #7deaf9; margin-top: 2px; }
.login .feats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 34px; max-width: 520px; }
.login .feat { padding: 14px; border-radius: 12px; background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .1); font-size: 13px; color: #dfe3ff; }
.login .feat b { display: block; color: #fff; margin-bottom: 2px; }
.login .form-side { display: grid; place-items: center; padding: 30px; background: var(--surface); }
.login form { width: min(380px, 100%); }
.login form h2 { font-size: 27px; margin: 0 0 6px; letter-spacing: -0.02em; font-weight: 750; }
.login form .brand { margin-bottom: 26px; color: var(--text); }
.login .input { height: 44px; border-radius: 11px; }
.login .pw-wrap .iconbtn { top: 5px; right: 5px; }
.login .err, .card .err { color: var(--bad); background: var(--bad-soft); padding: 10px 12px; border-radius: var(--radius); margin-bottom: 14px; font-size: 13px; }
.login .hint { display: flex; gap: 8px; align-items: flex-start; color: var(--text-3); font-size: 12.5px; margin-top: 14px; }
.login .hint .icon { margin-top: 1px; }
.login.signup .form-side { align-items: start; overflow-y: auto; max-height: 100vh; max-height: 100dvh; padding: 40px 30px; }
.login.signup form { width: min(440px, 100%); }
.addr-input { display: flex; align-items: center; border: 1px solid var(--line-2); border-radius: 11px; background: var(--surface); height: 44px; overflow: hidden; }
.addr-input:focus-within { border-color: var(--accent); box-shadow: var(--ring); }
.addr-input.ok { border-color: color-mix(in srgb, var(--ok) 60%, var(--line)); }
.addr-input.bad { border-color: color-mix(in srgb, var(--bad) 60%, var(--line)); }
.addr-input input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; padding: 0 12px; font: inherit; color: var(--text); height: 100%; }
.addr-input .suffix { padding: 0 12px; color: var(--text-2); background: var(--surface-2); height: 100%; display: flex; align-items: center; border-left: 1px solid var(--line); font-weight: 600; white-space: nowrap; font-family: var(--mono); font-size: 13px; }
.launch-item { display: flex; align-items: center; gap: 12px; padding: 12px 18px; border-top: 1px solid var(--line); }
.launch-mark { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--surface-3); color: var(--text-3); }
.launch-mark.ok { background: var(--ok-soft); color: var(--ok); }
.launch-mark.warn { background: var(--warn-soft); color: var(--warn); }
.launch-mark.bad { background: var(--bad-soft); color: var(--bad); }
.launch-mark.accent { background: var(--accent-soft); color: var(--accent-ink); }
.or-line { display: flex; align-items: center; gap: 10px; color: var(--text-3); font-size: 12.5px; margin: 18px 0 10px; }
.or-line::before, .or-line::after { content: ''; flex: 1; height: 1px; background: var(--line); }

/* ---------- responsive ---------- */
.mobile-only { display: none; }
.tabbar { display: none; }
.fab { display: none; }
@media (max-width: 1100px) {
  .list-pane { min-width: 310px; }
  /* the folded sidebar opens over the page instead of pushing it */
  .app.nav-open .sidebar { position: fixed; inset: 0 auto 0 0; width: 284px; background: var(--surface); z-index: 110; padding: 14px 10px 12px; box-shadow: var(--shadow-3); align-items: stretch; animation: slide-in .2s var(--ease); }
  .app.nav-open::after { content: ""; position: fixed; inset: 0; background: rgba(9, 12, 26, .45); z-index: 105; animation: fade .15s ease-out; }
}
@keyframes slide-in { from { transform: translateX(-24px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (max-width: 860px) {
  :root { --topbar: 56px; }
  .app { grid-template-columns: minmax(0, 1fr); grid-template-rows: var(--topbar) minmax(0, 1fr) auto; }
  .mobile-only { display: inline-grid; }
  .topbar { padding: 0 10px; gap: 10px; }
  .topbar .brand { width: auto; padding-left: 2px; }
  .topbar .brand > span:not(.mark), .topbar .brand small { display: none; }
  .top-actions { padding-left: 0; }
  .sidebar { display: none; }
  .app.nav-open .sidebar { display: flex; padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
  .side-foot .collapse { display: none; }
  .main { grid-column: 1 / -1; padding: 0; }
  .pane { border-radius: 0; border-left: 0; border-right: 0; border-bottom: 0; }
  .list-pane { width: 100%; min-width: 0; max-width: none; }
  .splitter { display: none; }
  .reader-pane { position: fixed; inset: 0; z-index: 80; border: 0; }
  .main.reading .list-pane { display: none; }
  .main:not(.reading) .reader-pane { display: none; }
  .search .input { padding-right: 46px; height: 40px; }
  .search > .icon { top: 11px; }
  .search .ask { top: 5px; right: 5px; padding: 0 8px; }
  .search .ask span { display: none; }
  .top-actions .hide-sm { display: none; }
  .reader-head, .qi-card, .risk-banner, .message, .reply-bar, .smart-replies { margin-left: 12px; margin-right: 12px; }
  .reader-head { padding: 16px 4px 6px; }
  .message .mbody { padding-left: 16px; }
  .message .mh .row > .chip { order: 1; }
  .message .mh .addr { order: 2; flex-basis: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; overflow-wrap: normal; }
  .message .snippet { padding-left: 16px; }
  .reader { padding-bottom: 0; }
  .reply-bar { position: sticky; bottom: 0; margin: 12px 0 0; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--surface) 92%, transparent); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); border-top: 1px solid var(--line); flex-wrap: nowrap; z-index: 2; }
  .reply-bar .btn { flex: 1; min-width: 0; height: 42px; padding: 0 8px; }
  .composer-dock { right: 0; left: 0; }
  .composer, .composer.max { position: fixed; inset: 0; width: 100%; height: 100%; max-width: none; border-radius: 0; border: 0; }
  .composer.min { inset: auto 0 calc(62px + env(safe-area-inset-bottom)) 0; height: 46px; width: 100%; border-top: 1px solid var(--line-2); }
  .ask-panel { inset: 0; width: 100%; border-radius: 0; border: 0; }
  .settings-grid { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .subnav { flex-direction: row; overflow-x: auto; position: static; scrollbar-width: none; margin: 0 -16px; padding: 0 16px; }
  .subnav::-webkit-scrollbar { display: none; }
  .page { padding: 18px 16px 40px; }
  .login { grid-template-columns: minmax(0, 1fr); }
  .login .art-side { display: none; }
  .login form .brand.mobile-only { display: flex; }
  .login .form-side { padding: 28px 22px; align-items: start; padding-top: 12vh; }
  .login.signup .form-side { padding-top: 28px; }
  .qi-card .grid { grid-template-columns: 1fr; }
  .msg-row { padding: 11px 14px; }
  .msg-row .quick { display: none !important; }
  .msg-row:hover .meta, .msg-row:hover .tags { visibility: visible; }
  .msg-row:hover { background-image: none; }
  .msg-row:hover .lead .avatar { opacity: 1; }
  .msg-row:hover .lead .pick { opacity: 0; }
  .msg-row.checked .lead .avatar, .list.selecting .lead .avatar { opacity: 0; }
  .msg-row.checked .lead .pick, .list.selecting .lead .pick { opacity: 1; }
  .jumps { grid-template-columns: 1fr; }
  .toasts { bottom: calc(74px + env(safe-area-inset-bottom)); }
  .modal { border-radius: 16px; }
  .overlay { padding: 12px; align-items: end; }
  .overlay .palette { align-self: start; }

  /* thumb bar */
  .tabbar { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); align-items: end; grid-column: 1 / -1; grid-row: 3; background: var(--surface); border-top: 1px solid var(--line); padding: 5px 6px calc(5px + env(safe-area-inset-bottom)); position: relative; z-index: 60; }
  .tabbar button { display: flex; flex-direction: column; align-items: center; gap: 2px; border: 0; background: none; color: var(--text-3); font-size: 11px; font-weight: 650; padding: 5px 0 3px; border-radius: 10px; cursor: pointer; position: relative; min-width: 0; }
  .tabbar button.active { color: var(--accent-ink); }
  .tabbar button.active .icon { stroke-width: 2.1; }
  .tabbar .n { position: absolute; top: 0; left: calc(50% + 4px); min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--accent-solid); color: var(--on-accent); font-size: 10px; font-weight: 700; display: grid; place-items: center; }
  .tabbar .write { color: var(--text-2); }
  .tabbar .write i { width: 46px; height: 46px; margin-top: -20px; border-radius: 15px; background: var(--accent-solid); color: var(--on-accent); display: grid; place-items: center; box-shadow: 0 0 0 4px var(--surface), 0 8px 18px -6px color-mix(in srgb, var(--accent-solid) 80%, transparent); }
  .main.reading ~ .tabbar { display: none; }
}
@media (max-width: 480px) {
  .topbar { gap: 8px; padding: 0 8px; }
  .login form h2 { font-size: 24px; }
}

/* ---------- motion and print ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
  .spinner { animation-duration: 1.4s !important; animation-iteration-count: infinite !important; }
}
@media print {
  .topbar, .sidebar, .list-pane, .splitter, .toolbar, .tabbar, .composer-dock, .ask-panel, .toasts, .reply-bar, .smart-replies, .qi-card, .risk-banner .row, .img-bar, .overlay { display: none !important; }
  html, body { height: auto; background: #fff !important; }
  .app, .main, .pane, .reader, .reader-pane { display: block !important; position: static !important; height: auto !important; overflow: visible !important; border: 0 !important; padding: 0 !important; }
  .message { break-inside: avoid; }
}
