:root {
  --bg: #eef1f4;
  --surface: #ffffff;
  --surface-2: #f6f8fa;
  --ink: #18202b;
  --muted: #5e6b7a;
  --faint: #8a96a3;
  --line: #d9dfe6;
  --accent: #2747d8;
  --accent-ink: #ffffff;
  --accent-soft: #e4e9fd;
  --side: #142048;
  --side-ink: #dfe5fb;
  --side-muted: #8f9bc4;
  --side-hover: #1d2b5c;
  --side-active: #26387a;
  --danger: #c4321b;
  --danger-soft: #fbe7e3;
  --ok: #1d7a4b;
  --ok-soft: #e1f3e9;
  --warn: #9a6400;
  --warn-soft: #fbf0d9;
  --star: #e3a008;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow-pop: 0 12px 40px rgba(20, 32, 72, 0.18), 0 2px 6px rgba(20, 32, 72, 0.08);
  --font: 'Schibsted Grotesk', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #0f141b; --surface: #161d26; --surface-2: #1b2430; --ink: #e6ebf1; --muted: #9aa6b4; --faint: #6f7c8b;
    --line: #263142; --accent: #7a93ff; --accent-ink: #0f141b; --accent-soft: #1f2a52;
    --side: #0b1022; --side-ink: #d6ddf7; --side-muted: #7380a8; --side-hover: #151d38; --side-active: #1e2a55;
    --danger: #ff7a63; --danger-soft: #3a1c17; --ok: #5fd39a; --ok-soft: #12301f; --warn: #f0b851; --warn-soft: #33270f;
    --shadow-pop: 0 12px 40px rgba(0, 0, 0, 0.5); color-scheme: dark;
  }
}
:root[data-theme='dark'] {
  --bg: #0f141b; --surface: #161d26; --surface-2: #1b2430; --ink: #e6ebf1; --muted: #9aa6b4; --faint: #6f7c8b;
  --line: #263142; --accent: #7a93ff; --accent-ink: #0f141b; --accent-soft: #1f2a52;
  --side: #0b1022; --side-ink: #d6ddf7; --side-muted: #7380a8; --side-hover: #151d38; --side-active: #1e2a55;
  --danger: #ff7a63; --danger-soft: #3a1c17; --ok: #5fd39a; --ok-soft: #12301f; --warn: #f0b851; --warn-soft: #33270f;
  --shadow-pop: 0 12px 40px rgba(0, 0, 0, 0.5); color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
svg.i { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
[hidden] { display: none !important; }

/* ------------------------------------------------------------- controls */
.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);
  background: var(--surface); color: var(--ink); font-weight: 500; cursor: pointer; white-space: nowrap; text-decoration: none;
}
.btn:hover { background: var(--surface-2); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--danger); }
.btn.danger.solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 13.5px; }
.icon-btn {
  display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: var(--radius);
  border: 0; background: transparent; color: var(--muted); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn.on { color: var(--star); }
.icon-btn.on svg { fill: currentColor; }

.field { display: grid; gap: 6px; align-content: start; font-size: 13.5px; font-weight: 500; color: var(--muted); }
.field > span.hint { font-weight: 400; color: var(--faint); font-size: 12.5px; }
.input, select.input, textarea.input {
  width: 100%; height: 38px; padding: 0 11px; border-radius: var(--radius); border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); font-size: 15px;
}
textarea.input { height: auto; padding: 10px 11px; line-height: 1.5; resize: vertical; }
textarea.code { font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace; font-size: 13px; }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.check { display: flex; align-items: center; gap: 9px; font-size: 14.5px; color: var(--ink); cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }
.stack { display: grid; gap: 14px; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 13px; }
.error-text { color: var(--danger); font-size: 13.5px; }

.badge { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 99px; font-size: 12.5px; font-weight: 600; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.badge.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.badge.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge.danger { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.badge.accent { background: var(--accent-soft); color: var(--accent); border-color: transparent; }

/* ------------------------------------------------------------- auth */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); }
.auth-side { background: var(--side); color: var(--side-ink); padding: 48px; display: flex; flex-direction: column; justify-content: space-between; overflow: hidden; position: relative; }
.auth-side h1 { font-size: 40px; line-height: 1.1; letter-spacing: -0.02em; margin: 0; font-weight: 700; max-width: 12ch; }
.auth-side p { color: var(--side-muted); max-width: 38ch; margin: 16px 0 0; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; letter-spacing: -0.01em; }
.brand-mark { width: 30px; height: 30px; border-radius: 8px; background: var(--accent); display: grid; place-items: center; color: #fff; }
.brand-mark svg { width: 18px; height: 18px; }
.envelopes { position: absolute; right: -60px; bottom: 90px; display: grid; gap: 12px; transform: rotate(-8deg); opacity: .9; pointer-events: none; }
.envelope { width: 300px; padding: 14px 16px; border-radius: 10px; background: var(--side-hover); border: 1px solid var(--side-active); font-size: 13px; }
.envelope b { display: block; color: var(--side-ink); font-weight: 600; }
.envelope span { color: var(--side-muted); }
.auth-main { display: grid; place-items: center; padding: 32px 16px; }
.auth-card { width: 100%; max-width: 380px; }
.auth-card h2 { font-size: 24px; margin: 0 0 6px; letter-spacing: -0.01em; }
.auth-card p.lead { margin: 0 0 26px; color: var(--muted); }
@media (max-width: 820px) {
  .auth { grid-template-columns: 1fr; }
  .auth-side { padding: 24px 16px; }
  .auth-side h1, .auth-side p, .envelopes { display: none; }
}

/* ------------------------------------------------------------- shell */
.shell { height: 100vh; height: 100dvh; display: grid; grid-template-columns: 252px minmax(0, 1fr); }
.shell > [data-side] { display: contents; }
.scrim { display: none; }
.side { background: var(--side); color: var(--side-ink); display: flex; flex-direction: column; min-height: 0; }
.side-top { padding: 16px 14px 12px; display: grid; gap: 14px; }
.side .btn.primary { width: 100%; height: 40px; }
.side-scroll { flex: 1; overflow-y: auto; padding: 4px 8px 12px; }
.side h3 { font-size: 12.5px; font-weight: 600; color: var(--side-muted); margin: 18px 8px 6px; letter-spacing: 0.01em; }
.side a.nav {
  display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 7px; color: var(--side-ink);
  text-decoration: none; font-size: 14.5px; min-width: 0;
}
.side a.nav:hover { background: var(--side-hover); }
.side a.nav.active { background: var(--side-active); }
.side a.nav .count { margin-left: auto; font-size: 12.5px; font-weight: 600; color: var(--side-ink); background: var(--accent); color: var(--accent-ink); min-width: 22px; height: 20px; padding: 0 6px; border-radius: 99px; display: grid; place-items: center; }
.side a.nav svg { color: var(--side-muted); }
.side a.nav.active svg { color: var(--side-ink); }

/* Mailbox entries read like address labels: local part strong, domain quiet. */
.mbx { display: block; padding: 8px 10px; border-radius: 7px; text-decoration: none; color: var(--side-ink); }
.mbx:hover { background: var(--side-hover); }
.mbx .addr { display: flex; align-items: baseline; gap: 6px; min-width: 0; }
.mbx .local { font-weight: 600; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mbx .dom { color: var(--side-muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.mbx .count { margin-left: auto; font-size: 12px; font-weight: 600; background: var(--accent); color: var(--accent-ink); border-radius: 99px; padding: 0 7px; line-height: 19px; flex: none; }
.mbx.open { background: var(--side-hover); }
.folders { margin: 2px 0 8px 10px; padding-left: 8px; border-left: 1px solid var(--side-active); }
.folders a.nav { font-size: 14px; padding: 6px 10px; }

.side-foot { padding: 10px 8px 14px; border-top: 1px solid var(--side-active); display: flex; align-items: center; gap: 8px; }
.side-foot .who { min-width: 0; flex: 1; padding-left: 6px; }
.side-foot .who b { display: block; font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-foot .who span { display: block; font-size: 12px; color: var(--side-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-foot .icon-btn { color: var(--side-muted); }
.side-foot .icon-btn:hover { background: var(--side-hover); color: var(--side-ink); }

.main { min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.mobile-bar { display: none; }

/* ------------------------------------------------------------- mail */
.mail { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(300px, 400px) minmax(0, 1fr); }
.list-pane { border-right: 1px solid var(--line); background: var(--surface); display: flex; flex-direction: column; min-height: 0; }
.list-head { padding: 14px 14px 10px; border-bottom: 1px solid var(--line); display: grid; gap: 10px; }
.list-head h2 { margin: 0; font-size: 18px; letter-spacing: -0.01em; display: flex; align-items: baseline; gap: 8px; }
.list-head h2 small { font-size: 13px; color: var(--faint); font-weight: 500; }
.search { position: relative; }
.search svg { position: absolute; left: 10px; top: 10px; width: 17px; height: 17px; color: var(--faint); }
.search .input { padding-left: 34px; height: 36px; background: var(--surface-2); }
.list-tools { display: flex; align-items: center; gap: 2px; min-height: 34px; }
.list-tools .check { margin: 0 6px 0 4px; }
.msg-list { flex: 1; overflow-y: auto; }
.msg {
  display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 2px 10px; align-items: start;
  padding: 11px 14px 12px 12px; border-bottom: 1px solid var(--line); cursor: pointer; position: relative; text-decoration: none; color: inherit;
}
.msg:hover { background: var(--surface-2); }
.msg.active { background: var(--accent-soft); }
.msg.unread::before { content: ''; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
.msg input { margin-top: 3px; width: 15px; height: 15px; accent-color: var(--accent); }
.msg .who { font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg.unread .who, .msg.unread .subj { font-weight: 650; }
.msg .date { font-size: 12.5px; color: var(--faint); white-space: nowrap; display: flex; align-items: center; gap: 4px; }
.msg .date svg { width: 14px; height: 14px; }
.msg .subj { grid-column: 2 / 4; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg .snip { grid-column: 2 / 4; font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg .star { position: absolute; right: 8px; bottom: 6px; width: 26px; height: 26px; opacity: 0; }
.msg:hover .star, .msg .star.on { opacity: 1; }
.list-more { padding: 14px; text-align: center; }

.empty { display: grid; place-items: center; text-align: center; padding: 48px 24px; color: var(--muted); gap: 6px; align-content: center; }
.empty svg { width: 36px; height: 36px; color: var(--faint); stroke-width: 1.4; margin-bottom: 6px; }
.empty b { color: var(--ink); font-size: 16px; }
.empty p { margin: 0; max-width: 36ch; }

.reader { min-width: 0; min-height: 0; display: flex; flex-direction: column; background: var(--bg); }
.reader-bar { display: flex; align-items: center; gap: 2px; padding: 8px 12px; border-bottom: 1px solid var(--line); background: var(--surface); flex-wrap: wrap; }
.reader-bar .sep { width: 1px; height: 22px; background: var(--line); margin: 0 6px; }
.reader-body { flex: 1; overflow-y: auto; padding: 22px 26px 40px; }
.reader h1 { font-size: 22px; line-height: 1.25; letter-spacing: -0.015em; margin: 0 0 16px; overflow-wrap: anywhere; }
.letter { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; }
.letter-head { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.avatar { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 15px; color: #fff; background: var(--accent); }
.letter-head .from b { font-weight: 600; }
.letter-head .from span { color: var(--muted); font-size: 13.5px; }
.letter-head .to { font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.letter-head .when { font-size: 13px; color: var(--faint); white-space: nowrap; }
.images-note { display: flex; align-items: center; gap: 10px; padding: 8px 18px; background: var(--surface-2); border-bottom: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.letter iframe { display: block; width: 100%; border: 0; height: 70vh; min-height: 320px; background: #fff; }
.letter .plain { padding: 18px 20px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 15px; line-height: 1.6; }
.atts { display: flex; flex-wrap: wrap; gap: 8px; padding: 14px 18px; border-top: 1px solid var(--line); }
.att { display: inline-flex; align-items: center; gap: 8px; padding: 7px 11px; border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; color: var(--ink); font-size: 13.5px; max-width: 280px; background: var(--surface); }
.att:hover { background: var(--surface-2); }
.att span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att small { color: var(--faint); flex: none; }
.thread { margin-top: 18px; }
.thread h4 { font-size: 13.5px; color: var(--muted); font-weight: 600; margin: 0 0 8px; }
.thread a { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; padding: 9px 12px; border-radius: var(--radius); text-decoration: none; color: var(--ink); }
.thread a:hover { background: var(--surface); }
.thread a.current { background: var(--surface); outline: 1px solid var(--line); }
.thread a span { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ------------------------------------------------------------- pages */
.page { flex: 1; overflow-y: auto; }
.page-inner { max-width: 1080px; margin: 0 auto; padding: 28px 28px 60px; }
.page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h1 { font-size: 24px; letter-spacing: -0.02em; margin: 0; }
.page-head p { margin: 2px 0 0; color: var(--muted); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; }
.tabs a { padding: 9px 12px; color: var(--muted); text-decoration: none; font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a.active { color: var(--ink); border-color: var(--accent); }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); }
.panel + .panel { margin-top: 16px; }
.panel-pad { padding: 20px; }
.panel h2 { font-size: 16px; margin: 0 0 4px; }
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t th { text-align: left; font-weight: 600; font-size: 12.5px; color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.t td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.t tr:last-child td { border-bottom: 0; }
table.t tr.click { cursor: pointer; }
table.t tr.click:hover td { background: var(--surface-2); }
table.t td.num, table.t th.num { text-align: right; font-variant-numeric: tabular-nums; }
.cell-main { font-weight: 600; }
.cell-sub { color: var(--muted); font-size: 13px; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 14px; border-bottom: 1px solid var(--line); }
.pager { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-top: 1px solid var(--line); font-size: 13.5px; color: var(--muted); }

.progress { height: 10px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--line); overflow: hidden; display: flex; }
.progress i { display: block; height: 100%; background: var(--accent); }
.progress i.fail { background: var(--danger); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 1px; background: var(--line); border-radius: var(--radius-lg); overflow: hidden; border: 1px solid var(--line); }
.stat { background: var(--surface); padding: 14px 16px; }
.stat b { display: block; font-size: 24px; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.stat span { font-size: 13px; color: var(--muted); }
.editor-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
.preview-frame { width: 100%; height: 520px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { font-size: 12.5px; padding: 2px 8px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--line); cursor: pointer; font-family: ui-monospace, Menlo, monospace; color: var(--muted); }
.tag:hover { color: var(--ink); }
.notice { padding: 12px 14px; border-radius: var(--radius); background: var(--warn-soft); color: var(--warn); font-size: 14px; }
.notice.info { background: var(--accent-soft); color: var(--accent); }
.notice.error { background: var(--danger-soft); color: var(--danger); }
.steps { margin: 0; padding-left: 20px; display: grid; gap: 8px; color: var(--ink); }
.steps code, .notice code, p code { font-family: ui-monospace, Menlo, monospace; font-size: 13px; background: var(--surface-2); padding: 1px 5px; border-radius: 4px; border: 1px solid var(--line); }

/* ------------------------------------------------------------- dialog */
dialog.dlg { border: 0; padding: 0; border-radius: var(--radius-lg); background: var(--surface); color: var(--ink); box-shadow: var(--shadow-pop); width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 32px); }
dialog.dlg.wide { width: min(760px, calc(100vw - 24px)); }
dialog.dlg::backdrop { background: rgba(15, 22, 40, 0.42); }
.dlg-head { display: flex; align-items: center; gap: 8px; padding: 14px 14px 12px 20px; border-bottom: 1px solid var(--line); }
.dlg-head h2 { font-size: 17px; margin: 0; flex: 1; }
.dlg-body { padding: 18px 20px; overflow-y: auto; max-height: calc(100vh - 170px); }
.dlg-foot { display: flex; gap: 10px; justify-content: flex-end; align-items: center; padding: 12px 20px 16px; border-top: 1px solid var(--line); }
dialog[open] { animation: pop .16s ease-out; }
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(.985); } }

/* compose */
.compose .dlg-body { padding: 0; }
.cfield { display: flex; align-items: center; gap: 10px; padding: 0 20px; border-bottom: 1px solid var(--line); min-height: 44px; }
.cfield > span { color: var(--muted); font-size: 14px; width: 52px; flex: none; }
.cfield input, .cfield select { border: 0; background: transparent; flex: 1; min-width: 0; height: 42px; font-size: 15px; outline: none; }
.cfield .linkish { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 13.5px; padding: 4px; }
.cfield .linkish:hover { color: var(--accent); }
.rt-bar { display: flex; gap: 2px; padding: 6px 14px; border-bottom: 1px solid var(--line); }
.rt-bar .icon-btn { width: 30px; height: 30px; font-weight: 700; font-size: 14px; }
.rt { min-height: 260px; max-height: 50vh; overflow-y: auto; padding: 16px 20px; outline: none; line-height: 1.6; overflow-wrap: anywhere; }
.rt:empty::before { content: attr(data-placeholder); color: var(--faint); }
.rt blockquote { margin: 8px 0; padding-left: 12px; border-left: 3px solid var(--line); color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 20px 12px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 4px 4px 10px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--line); font-size: 13px; }
.chip button { width: 22px; height: 22px; }
.chip button svg { width: 14px; height: 14px; }

/* toasts */
#toasts { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); display: grid; gap: 8px; z-index: 1000; pointer-events: none; width: max-content; max-width: calc(100vw - 32px); }
.toast { background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: var(--radius); box-shadow: var(--shadow-pop); font-size: 14px; pointer-events: auto; animation: pop .18s ease-out; }
.toast.error { background: var(--danger); color: #fff; }

.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--accent); animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading { display: grid; place-items: center; padding: 48px; }

/* ------------------------------------------------------------- responsive */
@media (max-width: 1100px) {
  .mail { grid-template-columns: minmax(280px, 340px) minmax(0, 1fr); }
  .editor-grid { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: 280px; z-index: 50; transform: translateX(-100%); transition: transform .2s ease; }
  .shell.nav-open .side { transform: none; box-shadow: var(--shadow-pop); }
  .shell.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(15, 22, 40, .4); z-index: 40; }
  .mobile-bar { display: flex; align-items: center; gap: 8px; padding: 8px 10px; background: var(--surface); border-bottom: 1px solid var(--line); }
  .mobile-bar b { font-size: 15px; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .mail { grid-template-columns: 1fr; }
  .mail .reader { display: none; }
  .mail.reading .reader { display: flex; }
  .mail.reading .list-pane { display: none; }
  .reader-body { padding: 16px; }
  .reader-bar .sep { display: none; }
  .page-inner { padding: 20px 16px 48px; }
  .letter-head { grid-template-columns: 36px minmax(0, 1fr); }
  .letter-head .when { grid-column: 2; }
  .avatar { width: 36px; height: 36px; }
  table.t .hide-sm { display: none; }
}
@media (min-width: 861px) { .only-sm { display: none !important; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
