/* Mailroom. Warm paper, one signal colour (urgency only), a serif voice, tabular numerals. No inline styles anywhere (strict CSP). */
:root {
  --bg: #f6f4ef; --surface: #ffffff; --surface-2: #fbfaf6; --sunk: #efece4;
  --ink: #16181d; --ink-2: #3a3f49; --muted: #5d6370; --faint: #8a8f9a;
  --line: #e6e2d8; --line-2: #d9d4c7;
  --link: #2a4bd7; --focus: #2a4bd7;
  --urgent: #c43a17; --urgent-bg: #fdebe4; --urgent-line: #f3c4b4;
  --warn: #86560a; --warn-bg: #fdf1d3;
  --good: #1b7248; --good-bg: #e2f3e9;
  --bad: #a1205a; --bad-bg: #fbe5ef;
  --shadow: 0 1px 2px rgba(22,24,29,.05), 0 6px 20px -8px rgba(22,24,29,.12);
  --shadow-lg: 0 10px 40px -10px rgba(22,24,29,.28);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: ui-sans-serif, "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --r: 16px; --r-sm: 10px; --rail: 244px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0e0f12; --surface: #16181d; --surface-2: #1a1d23; --sunk: #12141a;
  --ink: #ece9e1; --ink-2: #cfccc3; --muted: #9ba1ad; --faint: #6f7581;
  --line: #262a32; --line-2: #343944;
  --link: #8ba2ff; --focus: #8ba2ff;
  --urgent: #ff7a58; --urgent-bg: #2c1913; --urgent-line: #5a2d20;
  --warn: #f0b95a; --warn-bg: #2a2110;
  --good: #5fd49a; --good-bg: #102319;
  --bad: #ff8dbd; --bad-bg: #2b1220;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 6px 20px -8px rgba(0,0,0,.5);
  --shadow-lg: 0 14px 50px -10px rgba(0,0,0,.7);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e0f12; --surface: #16181d; --surface-2: #1a1d23; --sunk: #12141a;
    --ink: #ece9e1; --ink-2: #cfccc3; --muted: #9ba1ad; --faint: #6f7581;
    --line: #262a32; --line-2: #343944; --link: #8ba2ff; --focus: #8ba2ff;
    --urgent: #ff7a58; --urgent-bg: #2c1913; --urgent-line: #5a2d20;
    --warn: #f0b95a; --warn-bg: #2a2110; --good: #5fd49a; --good-bg: #102319; --bad: #ff8dbd; --bad-bg: #2b1220;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 6px 20px -8px rgba(0,0,0,.5); --shadow-lg: 0 14px 50px -10px rgba(0,0,0,.7);
    color-scheme: dark;
  }
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 var(--sans); -webkit-font-smoothing: antialiased; font-variant-numeric: tabular-nums; }
h1, h2, h3, h4, p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--link); text-decoration-thickness: 1px; text-underline-offset: 3px; }
.sprite { position: absolute; width: 0; height: 0; }
.ic { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.ic.sm { width: 15px; height: 15px; } .ic.lg { width: 22px; height: 22px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: var(--bg); padding: 8px 12px; border-radius: 8px; z-index: 100; }
.skip:focus { left: 8px; }
[hidden] { display: none !important; }

/* shell */
.shell { display: grid; grid-template-columns: var(--rail) 1fr; min-height: 100vh; }
.rail { position: sticky; top: 0; height: 100vh; padding: 22px 14px 16px; display: flex; flex-direction: column; gap: 4px; border-right: 1px solid var(--line); background: var(--bg); }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; font-family: var(--serif); font-size: 21px; font-weight: 700; letter-spacing: -.01em; }
.brand-mark { width: 30px; height: 30px; border-radius: 9px; background: var(--ink); color: var(--bg); display: grid; place-items: center; position: relative; }
.brand-mark .dot { position: absolute; top: -3px; right: -3px; width: 11px; height: 11px; border-radius: 50%; background: #e8542b; border: 2px solid var(--bg); }
.nav-label { padding: 14px 12px 6px; font-size: 11px; font-weight: 650; letter-spacing: .09em; text-transform: uppercase; color: var(--faint); }
.nav { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 11px; color: var(--ink-2); text-decoration: none; font-weight: 550; position: relative; }
.nav:hover { background: var(--sunk); }
.nav[aria-current="page"] { background: var(--ink); color: var(--bg); }
.nav .n { margin-left: auto; font-size: 12px; font-weight: 700; padding: 1px 8px; border-radius: 99px; background: var(--sunk); color: var(--ink-2); }
.nav[aria-current="page"] .n { background: rgba(255,255,255,.2); color: inherit; }
.nav .n.hot { background: var(--urgent); color: #fff; }
.rail-foot { margin-top: auto; display: grid; gap: 10px; padding: 12px 6px 0; }
.status-pill { display: flex; align-items: center; gap: 9px; padding: 10px 12px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); font-size: 13px; color: var(--ink-2); }
.pulse { width: 9px; height: 9px; border-radius: 50%; background: var(--good); position: relative; flex: none; }
.pulse::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 2px solid var(--good); opacity: 0; animation: ping 2.4s ease-out infinite; }
.pulse.off { background: var(--faint); } .pulse.off::after { display: none; }
.pulse.bad { background: var(--urgent); } .pulse.bad::after { border-color: var(--urgent); }
@keyframes ping { 0% { transform: scale(.6); opacity: .7; } 80%, 100% { transform: scale(1.5); opacity: 0; } }
.body { min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 14px 32px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid transparent; }
.topbar.scrolled { border-bottom-color: var(--line); }
.search { flex: 1; max-width: 520px; display: flex; align-items: center; gap: 10px; padding: 9px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; color: var(--muted); cursor: text; text-align: left; }
.search:hover { border-color: var(--line-2); }
.search kbd { margin-left: auto; }
kbd { font: 600 11px/1 var(--sans); padding: 3px 6px; border-radius: 6px; border: 1px solid var(--line-2); background: var(--surface-2); color: var(--muted); }
.page { max-width: 980px; margin: 0 auto; padding: 8px 32px 80px; outline: none; }
.page.wide { max-width: 1180px; }

/* buttons & controls */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 15px; border-radius: 11px; border: 1px solid var(--line-2); background: var(--surface); font-weight: 600; font-size: 14px; white-space: nowrap; transition: transform .12s, background .15s, border-color .15s, box-shadow .15s; }
.btn:hover { border-color: var(--faint); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn.primary:hover { box-shadow: 0 4px 14px -4px rgba(22,24,29,.5); }
.btn.quiet { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn.quiet:hover { background: var(--sunk); }
.btn.danger { color: var(--urgent); }
.btn.sm { padding: 6px 11px; font-size: 13px; border-radius: 9px; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btn.busy { position: relative; color: transparent !important; pointer-events: none; }
.btn.busy::after { content: ""; position: absolute; width: 15px; height: 15px; border-radius: 50%; border: 2px solid var(--line-2); border-top-color: var(--ink); animation: spin .7s linear infinite; }
.btn.primary.busy::after { border-color: rgba(255,255,255,.3); border-top-color: var(--bg); }
@keyframes spin { to { transform: rotate(360deg); } }
.icon-btn { width: 36px; height: 36px; display: inline-grid; place-items: center; border-radius: 10px; border: 1px solid transparent; background: transparent; color: var(--ink-2); }
.icon-btn:hover { background: var(--sunk); }
.icon-btn.on { color: #b88200; }
.icon-btn.on .ic { fill: currentColor; }
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 650; background: var(--sunk); color: var(--ink-2); white-space: nowrap; }
.chip.urgent { background: var(--urgent-bg); color: var(--urgent); }
.chip.warn { background: var(--warn-bg); color: var(--warn); }
.chip.good { background: var(--good-bg); color: var(--good); }
.chip.bad { background: var(--bad-bg); color: var(--bad); }
.seg { display: inline-flex; padding: 3px; background: var(--sunk); border-radius: 12px; gap: 2px; }
.seg button { padding: 6px 13px; border: 0; background: transparent; border-radius: 9px; font-weight: 600; font-size: 13.5px; color: var(--muted); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.input, .textarea, select.input { width: 100%; padding: 10px 13px; border-radius: 11px; border: 1px solid var(--line-2); background: var(--surface); }
.textarea { min-height: 150px; resize: vertical; line-height: 1.55; }
.input:focus, .textarea:focus { border-color: var(--focus); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 22%, transparent); }
.switch { position: relative; width: 44px; height: 26px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
.switch i { position: absolute; inset: 0; border-radius: 99px; background: var(--line-2); transition: background .2s; }
.switch i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform .2s; }
.switch input:checked + i { background: var(--good); } .switch input:checked + i::after { transform: translateX(18px); }
.switch input:focus-visible + i { outline: 2px solid var(--focus); outline-offset: 2px; }
.row { display: flex; align-items: center; gap: 10px; } .between { justify-content: space-between; } .wrap { flex-wrap: wrap; } .grow { flex: 1; min-width: 0; }
.stack { display: grid; gap: 14px; } .stack.lg { gap: 28px; }
.muted { color: var(--muted); } .faint { color: var(--faint); } .small { font-size: 13px; } .xs { font-size: 12px; } .strong { font-weight: 650; }
.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.trunc { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); }
.pad { padding: 20px 22px; }

/* focus page */
.hero { padding: 26px 0 22px; }
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--faint); }
.hero h1 { font-family: var(--serif); font-size: clamp(30px, 4.4vw, 46px); line-height: 1.08; letter-spacing: -.02em; font-weight: 700; margin: 8px 0 12px; }
.hero h1 em { font-style: normal; color: var(--urgent); }
.hero p { font-size: 17px; color: var(--muted); max-width: 640px; }
.vitals { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.vital { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 99px; background: var(--surface); border: 1px solid var(--line); font-size: 13px; color: var(--ink-2); }
.vital.warn { border-color: var(--urgent-line); background: var(--urgent-bg); color: var(--urgent); }
.sec { margin-top: 30px; }
.sec-h { display: flex; align-items: baseline; gap: 10px; margin: 0 2px 12px; }
.sec-h h2 { font-size: 13px; font-weight: 750; letter-spacing: .09em; text-transform: uppercase; color: var(--ink-2); }
.sec-h .count { font-size: 13px; font-weight: 700; color: var(--faint); }
.sec-h .aside { margin-left: auto; font-size: 13px; }
.msg { position: relative; padding: 18px 20px 14px 24px; cursor: pointer; transition: transform .16s, box-shadow .16s, border-color .16s; overflow: hidden; }
.msg:hover { transform: translateY(-1px); border-color: var(--line-2); box-shadow: 0 2px 4px rgba(22,24,29,.05), 0 14px 30px -12px rgba(22,24,29,.2); }
.msg::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--line-2); }
.msg.urgent::before { background: var(--urgent); }
.msg.p3::before { background: #d9a21b; }
.msg.sel { outline: 2px solid var(--focus); outline-offset: 2px; }
.msg-top { display: flex; align-items: center; gap: 10px; font-size: 13.5px; }
.avatar { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-size: 12.5px; font-weight: 750; color: #fff; flex: none; }
.av0 { background: #4c6fe0; } .av1 { background: #c0562f; } .av2 { background: #2f8a63; } .av3 { background: #8a5cc7; } .av4 { background: #b0801b; } .av5 { background: #2f8aa3; } .av6 { background: #b8486f; } .av7 { background: #5b6472; }
.msg-sum { margin: 10px 0 12px; font-size: 17px; line-height: 1.45; letter-spacing: -.005em; color: var(--ink); }
.msg-meta { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; }
.msg-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.msg-actions .btn { padding: 7px 12px; font-size: 13.5px; }
.list { display: grid; }
.li { display: flex; align-items: center; gap: 14px; padding: 12px 18px 12px 20px; border-bottom: 1px solid var(--line); cursor: pointer; position: relative; background: var(--surface); }
.li:last-child { border-bottom: 0; }
.li:hover { background: var(--surface-2); }
.li.sel { background: color-mix(in srgb, var(--focus) 8%, var(--surface)); }
.li .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--line-2); flex: none; }
.li .dot.urgent { background: var(--urgent); } .li .dot.p3 { background: #d9a21b; }
.li .who { width: 170px; flex: none; font-weight: 650; }
.li .txt { min-width: 0; flex: 1; }
.li .when { font-size: 12.5px; color: var(--faint); flex: none; width: 64px; text-align: right; }
.card.listcard { overflow: hidden; }
.quiet-box { margin-top: 30px; padding: 18px 20px; display: flex; align-items: center; gap: 14px; border-radius: var(--r); background: var(--sunk); color: var(--ink-2); }
.empty { text-align: center; padding: 56px 24px; }
.empty svg.art { width: 120px; height: 120px; margin-bottom: 10px; }
.empty h3 { font-family: var(--serif); font-size: 26px; letter-spacing: -.01em; margin-bottom: 6px; }
.empty p { color: var(--muted); max-width: 440px; margin: 0 auto 16px; }
.page-h { padding: 26px 0 20px; display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap; }
.page-h h1 { font-family: var(--serif); font-size: 34px; letter-spacing: -.02em; line-height: 1.1; }
.page-h p { color: var(--muted); margin-top: 6px; }
.page-h .grow { min-width: 220px; }

/* mail page */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .input { max-width: 300px; }

/* drafts */
.split { display: grid; grid-template-columns: 330px 1fr; gap: 18px; align-items: start; }
.dlist .li { flex-direction: column; align-items: flex-start; gap: 3px; }
.editor { padding: 22px; position: sticky; top: 76px; }
.callout { display: flex; gap: 10px; padding: 11px 14px; border-radius: 12px; background: var(--good-bg); color: var(--good); font-size: 13.5px; font-weight: 550; }
.checks { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.checks li { display: flex; gap: 9px; font-size: 14px; color: var(--ink-2); }
.checks li::before { content: ""; width: 15px; height: 15px; margin-top: 3px; border-radius: 5px; border: 1.5px solid var(--faint); flex: none; }

/* flows */
.pipeline { display: grid; gap: 0; }
.stage { position: relative; padding-left: 64px; padding-bottom: 18px; }
.stage::before { content: ""; position: absolute; left: 25px; top: 50px; bottom: -4px; width: 2px; background: repeating-linear-gradient(to bottom, var(--line-2) 0 5px, transparent 5px 10px); }
.stage:last-child::before { display: none; }
.stage-ic { position: absolute; left: 0; top: 6px; width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); }
.stage-ic.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.stage-card { padding: 0; overflow: hidden; }
.stage-head { width: 100%; display: flex; align-items: center; gap: 16px; padding: 16px 20px; background: transparent; border: 0; text-align: left; }
.stage-head h3 { font-size: 17px; font-weight: 700; letter-spacing: -.005em; }
.stage-stat { margin-left: auto; text-align: right; }
.stage-stat b { display: block; font-family: var(--serif); font-size: 26px; line-height: 1; letter-spacing: -.02em; }
.stage-stat span { font-size: 12px; color: var(--muted); }
.stage-body { padding: 4px 20px 20px; border-top: 1px solid var(--line); display: grid; gap: 16px; }
.field-l { display: block; font-weight: 650; font-size: 13.5px; margin: 14px 0 6px; }
.hint { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.chips-edit { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; }
.chip-x { display: inline-flex; align-items: center; gap: 4px; padding: 4px 6px 4px 11px; border-radius: 99px; background: var(--sunk); font-size: 13px; font-weight: 600; }
.chip-x.fixed { padding-right: 11px; opacity: .75; }
.chip-x button { border: 0; background: transparent; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; color: var(--muted); padding: 0; }
.chip-x button:hover { background: var(--line-2); color: var(--ink); }
.add-row { display: flex; gap: 8px; margin-top: 8px; }
.add-row .input { max-width: 280px; padding: 7px 12px; }
.bar { height: 8px; border-radius: 99px; background: var(--sunk); overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 99px; background: var(--ink); transition: width .5s cubic-bezier(.2,.8,.2,1); }
.bar.warn i { background: var(--urgent); }
.spark { display: flex; align-items: flex-end; gap: 6px; height: 64px; }
.spark span { flex: 1; background: var(--line-2); border-radius: 5px 5px 2px 2px; min-height: 3px; }
.spark span.today { background: var(--ink); }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 6px 14px; font-size: 14px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; }
.tl { display: grid; gap: 0; }
.tl-i { display: flex; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.tl-i:last-child { border-bottom: 0; }
.acc { padding: 22px; display: grid; gap: 14px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }

/* drawer */
.scrim { position: fixed; inset: 0; background: rgba(14,15,18,.4); z-index: 40; animation: fade .2s; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100vw); z-index: 50; background: var(--bg); border-left: 1px solid var(--line); box-shadow: var(--shadow-lg); display: flex; flex-direction: column; animation: slide .26s cubic-bezier(.2,.8,.2,1); }
@keyframes slide { from { transform: translateX(40px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }
.d-head { padding: 16px 22px; display: flex; align-items: center; gap: 12px; border-bottom: 1px solid var(--line); }
.d-body { flex: 1; overflow: auto; padding: 22px; display: grid; gap: 20px; align-content: start; }
.d-foot { padding: 14px 22px; border-top: 1px solid var(--line); display: flex; gap: 8px; flex-wrap: wrap; background: var(--surface-2); }
.d-subject { font-family: var(--serif); font-size: 26px; line-height: 1.2; letter-spacing: -.015em; }
.why { padding: 16px 18px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); display: grid; gap: 10px; }
.why .big { font-size: 17px; line-height: 1.5; }
.note { display: flex; gap: 9px; font-size: 13.5px; color: var(--ink-2); }
.warnbox { display: flex; gap: 11px; padding: 13px 15px; border-radius: 13px; background: var(--bad-bg); color: var(--bad); font-weight: 600; font-size: 14px; }
.body-pre { white-space: pre-wrap; word-break: break-word; font: 14px/1.6 var(--sans); padding: 16px 18px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); max-height: 340px; overflow: auto; margin: 0; }
.skel { background: linear-gradient(90deg, var(--sunk) 25%, var(--surface-2) 50%, var(--sunk) 75%); background-size: 200% 100%; animation: shimmer 1.3s infinite; border-radius: 10px; height: 16px; }
@keyframes shimmer { to { background-position: -200% 0; } }
.skel.h { height: 96px; border-radius: 16px; }

/* palette, toasts */
.palette { position: fixed; inset: 0; z-index: 60; display: grid; place-items: start center; padding-top: 14vh; background: rgba(14,15,18,.45); animation: fade .15s; }
.pal { width: min(620px, 92vw); background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow-lg); overflow: hidden; }
.pal input { width: 100%; border: 0; padding: 18px 22px; font-size: 17px; background: transparent; border-bottom: 1px solid var(--line); outline: none; }
.pal ul { list-style: none; margin: 0; padding: 8px; max-height: 360px; overflow: auto; }
.pal li { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; cursor: pointer; }
.pal li[aria-selected="true"] { background: var(--sunk); }
.pal li small { margin-left: auto; color: var(--faint); }
.toasts { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); display: grid; gap: 8px; z-index: 80; width: min(460px, 92vw); }
.toast { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 14px; background: var(--ink); color: var(--bg); box-shadow: var(--shadow-lg); animation: pop .22s cubic-bezier(.2,.8,.2,1); font-weight: 550; }
.toast.bad { background: var(--urgent); color: #fff; }
.toast button { margin-left: auto; border: 0; background: transparent; color: inherit; font-weight: 750; text-decoration: underline; padding: 0 2px; }
@keyframes pop { from { transform: translateY(12px) scale(.97); opacity: 0; } }
.help-grid { display: grid; grid-template-columns: auto 1fr; gap: 9px 16px; font-size: 14px; align-items: center; }
.tabbar { display: none; }
.fade-in { animation: fade .3s; }

/* helpers used by app.js */
.block { display: block; }
.only-mobile { display: none; }
.center-row { justify-content: center; margin-top: 18px; }
.stage-ic.pos-static { position: static; width: 44px; height: 44px; border-radius: 13px; }
.skel-s { width: 150px; margin-bottom: 18px; }
.skel-l { width: 72%; height: 46px; margin-bottom: 22px; }
.set-top, .help-top { margin-top: 12px; }
.checks.safe li::before { background: var(--good); border-color: var(--good); border-radius: 50%; width: 9px; height: 9px; margin: 8px 3px 0 3px; }
.wide-row .input { max-width: none; flex: 1; }
@media (max-width: 960px) { .only-mobile { display: inline; } }

@media (max-width: 960px) {
  .shell { grid-template-columns: 1fr; }
  .rail { display: none; }
  .topbar { padding: 12px 16px; }
  .page { padding: 4px 16px 110px; }
  .split { grid-template-columns: 1fr; }
  .editor { position: static; }
  .li .who { width: 110px; }
  .tabbar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(12px); border-top: 1px solid var(--line); }
  .tabbar a { flex: 1; display: grid; justify-items: center; gap: 2px; padding: 7px 0; font-size: 11px; font-weight: 650; color: var(--muted); text-decoration: none; border-radius: 10px; position: relative; }
  .tabbar a[aria-current="page"] { color: var(--ink); background: var(--sunk); }
  .tabbar .n { position: absolute; top: 2px; right: calc(50% - 22px); background: var(--urgent); color: #fff; border-radius: 99px; font-size: 10px; padding: 0 5px; }
  .toasts { bottom: 84px; }
  .stage { padding-left: 0; padding-top: 0; }
  .stage-ic, .stage::before { display: none; }
  .li .who { display: none; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; } }

.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { width: min(100%, 360px); display: grid; gap: 10px; padding: 24px; }
.login-card input { padding: 10px 12px; border-radius: 10px; border: 1px solid currentColor; background: transparent; color: inherit; font: inherit; }
.login-card h1 { margin: 0; font-size: 1.4rem; }

/* Categories (dropdowns grouped by month) and inbox cleanup */
details.cat { border-bottom: 1px solid var(--line); }
details.cat:last-child { border-bottom: 0; }
details.cat > summary { display: flex; align-items: center; gap: 10px; padding: 14px 18px; cursor: pointer; list-style: none; font-weight: 650; min-height: 48px; }
details.cat > summary::-webkit-details-marker { display: none; }
details.cat > summary .cat-name { flex: 1; min-width: 0; }
details.cat > summary .ic { transition: transform .15s; color: var(--muted); }
details.cat[open] > summary .ic { transform: rotate(90deg); }
details.cat[open] > summary { background: var(--surface-2); }
.month-h { display: flex; justify-content: space-between; gap: 10px; padding: 8px 18px; font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); background: var(--sunk); }
.cleanup .junk { margin: 12px 0; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface-2); display: grid; gap: 8px; }
.cleanup .junk ul { margin: 0; padding-left: 18px; }
.cleanup .cu-actions { margin-top: 12px; gap: 8px; }
.cleanup select.input { max-width: 180px; }
.bad-text { color: var(--bad); }

/* Phones and small tablets */
html { -webkit-text-size-adjust: 100%; }
body { overflow-x: hidden; }
@media (max-width: 640px) {
  .page { padding: 0 14px 100px; }
  .topbar { padding: 10px 14px; gap: 8px; }
  .topbar .search { min-width: 0; flex: 1; }
  .topbar .search kbd, .topbar .search .grow { display: none; }
  .topbar .chip { display: none; }
  .hero { padding: 16px 0 14px; }
  .hero h1 { font-size: 30px; }
  .hero p { font-size: 15px; }
  .vitals { gap: 6px; }
  .page-h { padding: 16px 0 12px; }
  .page-h h1 { font-size: 26px; }
  .msg { padding: 14px 14px 12px 18px; }
  .msg-sum { font-size: 16px; }
  .msg-actions { gap: 6px; }
  .msg-actions .btn { flex: 1 1 auto; justify-content: center; }
  .seg { display: flex; overflow-x: auto; max-width: 100%; scrollbar-width: none; }
  .seg::-webkit-scrollbar { display: none; }
  .seg button { white-space: nowrap; flex: none; }
  .toolbar { gap: 8px; }
  .toolbar .input { max-width: none; width: 100%; }
  .li { padding: 12px 14px; gap: 8px; }
  .li .when { font-size: 12px; }
  details.cat > summary { padding: 14px; }
  .month-h { padding: 8px 14px; }
  .cleanup .cu-actions > * { flex: 1 1 100%; max-width: none; }
  .cleanup select.input { max-width: none; }
  .drawer { width: 100vw; border-left: 0; }
  .btn, .icon-btn { min-height: 44px; }
  .btn.sm { min-height: 38px; }
  input, select, textarea, .input { font-size: 16px; }
  .card.pad, .pad { padding-left: 14px; padding-right: 14px; }
  table { display: block; overflow-x: auto; }
  pre, code { white-space: pre-wrap; word-break: break-word; }
  .toasts { left: 12px; right: 12px; }
  .stack { gap: 10px; }
}
@media (max-width: 960px) {
  .trunc { min-width: 0; }
  img, svg { max-width: 100%; }
}
