/* Tinbox Mail — "Console". A full-width top bar, a slim icon rail, an inbox
   panel and a reader whose mail sits on a real white page. Deep navy, one
   electric-blue accent, monospace for anything machine-like (dates, counts,
   codes). Light theme shares every token. */

:root {
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --display: "Plus Jakarta Sans", "Inter", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --spring: cubic-bezier(0.34, 1.4, 0.64, 1);
  --top-h: 66px;
  --rail-w: 68px;
  --list-w: 400px;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #050a14;
  --top: #08101d;
  --rail: #070e1a;
  --panel: #0a1220;
  --panel-2: #0e1829;
  --panel-3: #142036;
  --hover: rgba(120, 160, 230, 0.06);
  --press: rgba(120, 160, 230, 0.1);
  --line: rgba(120, 160, 230, 0.1);
  --line-2: rgba(120, 160, 230, 0.18);
  --text: #e8eef8;
  --text-2: #b6c2d6;
  --muted: #7f8ea8;
  --faint: #55637d;
  --input: #0b1424;
  --pop: #0f1a2d;
  --paper: #ffffff;
  --shadow: 0 30px 80px -30px rgba(0, 0, 0, 0.9);
  --bad: #ff5d72;
  --good: #34d399;
  --warn: #fbbf24;
  --star: #fbbf24;
  --grid: rgba(80, 140, 255, 0.06);
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #e9eef6;
  --top: #ffffff;
  --rail: #f4f7fc;
  --panel: #ffffff;
  --panel-2: #f5f8fd;
  --panel-3: #eaf0f9;
  --hover: rgba(30, 60, 120, 0.05);
  --press: rgba(30, 60, 120, 0.09);
  --line: rgba(30, 60, 120, 0.1);
  --line-2: rgba(30, 60, 120, 0.17);
  --text: #0f1a2c;
  --text-2: #33425c;
  --muted: #637290;
  --faint: #9aa7bd;
  --input: #f3f6fb;
  --pop: #ffffff;
  --paper: #ffffff;
  --shadow: 0 24px 60px -30px rgba(20, 40, 90, 0.35);
  --bad: #e2364f;
  --good: #0f9f6e;
  --warn: #c98200;
  --star: #e3a008;
  --grid: rgba(30, 90, 220, 0.05);
}
:root,
:root[data-accent="violet"] { --a1: #7b5cff; --a2: #2f86ff; --accent: #4f7dff; }
:root[data-accent="blue"] { --a1: #2f86ff; --a2: #1fb6ff; --accent: #2f86ff; }
:root[data-accent="mint"] { --a1: #10b981; --a2: #22b8ff; --accent: #14b8a6; }
:root[data-accent="rose"] { --a1: #ff4f86; --a2: #9b5cff; --accent: #ff4f86; }
:root[data-accent="amber"] { --a1: #ff9b2f; --a2: #ff5c6c; --accent: #ff8a2f; }
:root {
  --grad: linear-gradient(110deg, var(--a1), var(--a2));
  --accent-soft: color-mix(in srgb, var(--accent) 15%, transparent);
  --accent-line: color-mix(in srgb, var(--accent) 50%, transparent);
  --accent-text: color-mix(in srgb, var(--accent) 72%, var(--text));
}

*,
*::before,
*::after { box-sizing: border-box; }
html,
body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
body { overflow: hidden; }
button,
input,
textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
button:disabled { cursor: default; opacity: 0.4; }
a { color: var(--accent-text); }
kbd {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 6px;
  border-radius: 6px;
  border: 1px solid var(--line-2);
  background: var(--panel-2);
  color: var(--muted);
  font: 500 10.5px/1 var(--mono);
  white-space: nowrap;
}
code { font-family: var(--mono); font-size: 12px; padding: 1px 5px; border-radius: 5px; background: var(--panel-3); }
.hidden { display: none !important; }
.grow { flex: 1; }
.ic { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
::selection { background: var(--accent-soft); }
* { scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
:focus-visible { outline: 2px solid var(--accent-line); outline-offset: 2px; border-radius: 8px; }

/* ---------- shared controls ---------- */

.icon-btn { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; color: var(--muted); transition: background 0.15s, color 0.15s; }
.icon-btn:hover { background: var(--hover); color: var(--text); }
.icon-btn.sm { width: 30px; height: 30px; border-radius: 8px; }
.icon-btn.sm .ic { width: 16px; height: 16px; }
.icon-btn.on { background: var(--accent-soft); color: var(--accent-text); }
.icon-btn.danger:hover { color: var(--bad); background: color-mix(in srgb, var(--bad) 12%, transparent); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: 11px; font-weight: 600; white-space: nowrap; transition: filter 0.15s, background 0.15s, transform 0.15s; }
.btn.sm { height: 34px; padding: 0 13px; border-radius: 10px; font-size: 13px; }
.btn.primary { background: var(--accent); color: #fff; box-shadow: 0 8px 22px -10px var(--accent); }
.btn.primary:hover { filter: brightness(1.1); }
.btn.primary:active { transform: scale(0.97); }
.btn.ghost { border: 1px solid var(--line-2); color: var(--text); background: var(--panel-2); }
.btn.ghost:hover { background: var(--panel-3); }
.btn.danger { background: var(--bad); color: #fff; }
.btn .ic { width: 16px; height: 16px; }

.input { width: 100%; height: 44px; padding: 0 14px; border-radius: 11px; border: 1px solid var(--line-2); background: var(--input); outline: none; transition: border-color 0.15s, box-shadow 0.15s; }
.input:focus { border-color: var(--accent-line); box-shadow: 0 0 0 3px var(--accent-soft); }

.tag { display: inline-flex; align-items: center; height: 22px; padding: 0 9px; border-radius: 7px; background: var(--accent-soft); color: var(--accent-text); font: 600 11px/1 var(--mono); letter-spacing: 0.02em; }
.tag.soft { background: var(--panel-3); color: var(--muted); }
.tag.draft { background: color-mix(in srgb, var(--bad) 14%, transparent); color: var(--bad); }

.av {
  --tone: var(--accent);
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: none;
  border-radius: 10px;
  background: var(--tone);
  color: #fff;
  font: 700 15px/1 var(--font);
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.18), 0 6px 16px -8px var(--tone);
}
.av.sm { width: 28px; height: 28px; border-radius: 8px; font-size: 12px; }
.av.xs { width: 24px; height: 24px; border-radius: 7px; font-size: 11px; box-shadow: none; }
.av.md { width: 40px; height: 40px; }

.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--accent-soft); border-top-color: var(--accent); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- logo ---------- */

.logo { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; }
.logo-mark { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; background: var(--grad); box-shadow: 0 8px 22px -8px var(--a2), inset 0 1px 0 rgba(255, 255, 255, 0.25); }
.logo-mark .ic { width: 22px; height: 22px; color: #fff; stroke-width: 2; }
.logo-word { font: 800 18px/1 var(--display); letter-spacing: -0.02em; }
.logo-word b { margin-left: 1px; color: var(--accent-text); font: 600 17px/1 var(--mono); letter-spacing: -0.04em; }

/* ---------- shell ---------- */

.app {
  position: fixed;
  inset: 0;
  display: grid;
  grid-template-columns: var(--rail-w) minmax(320px, var(--list-w)) minmax(0, 1fr);
  grid-template-rows: var(--top-h) minmax(0, 1fr);
}
.top {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 18px 0 16px;
  background:
    linear-gradient(var(--grid) 1px, transparent 1px) 0 0 / 24px 24px,
    linear-gradient(90deg, var(--grid) 1px, transparent 1px) 0 0 / 24px 24px,
    var(--top);
  border-bottom: 1px solid var(--line);
}
.top .logo { margin-right: 18px; }
.top-search {
  display: flex;
  align-items: center;
  gap: 10px;
  width: min(420px, 34vw);
  height: 40px;
  padding: 0 8px 0 12px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: var(--input);
  color: var(--muted);
  font-size: 13.5px;
  transition: border-color 0.15s;
}
.top-search:hover { border-color: var(--line-2); color: var(--text-2); }
.top-search span { flex: 1; text-align: left; }
.compose-top { height: 40px; }
.acct-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 10px 0 7px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  background: var(--panel-2);
  font-weight: 600;
  font-size: 13.5px;
}
.acct-pill:hover { border-color: var(--accent-line); }
.acct-pill .ic { width: 14px; height: 14px; color: var(--muted); }
#acct-mail { max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.signout { height: 40px; }
.only-mobile { display: none; }
.scrim { display: none; }
.tabbar { display: none; }

/* ---------- rail ---------- */

.rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-height: 0;
  padding: 14px 0 14px;
  background: var(--rail);
  border-right: 1px solid var(--line);
  overflow-y: auto;
  scrollbar-width: none;
}
.rail-nav { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.rail-item,
.rail-btn {
  position: relative;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: none;
  border-radius: 12px;
  color: var(--muted);
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}
.rail-item:hover,
.rail-btn:hover { background: var(--hover); color: var(--text); }
.rail-item.active { background: var(--accent-soft); color: var(--accent-text); box-shadow: inset 0 0 0 1px var(--accent-line); }
.rail-item.active::before { content: ""; position: absolute; left: -12px; top: 10px; bottom: 10px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
.rail-item .ic,
.rail-btn .ic { width: 20px; height: 20px; }
.rail-item[data-kind="codes"]:not(.active) { color: var(--warn); }
.rail-name { display: none; }
.rail-count {
  position: absolute;
  top: 2px;
  right: 0;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 99px;
  background: var(--accent);
  color: #fff;
  font: 700 10px/18px var(--mono);
  text-align: center;
  box-shadow: 0 0 0 2px var(--rail);
}
.rail-sep { width: 26px; height: 1px; margin: 6px 0; background: var(--line-2); flex: none; }
.live { display: grid; place-items: center; width: 44px; height: 30px; }
.live i { width: 9px; height: 9px; border-radius: 50%; background: var(--warn); }
.live[data-state="live"] i { background: var(--good); box-shadow: 0 0 0 4px color-mix(in srgb, var(--good) 18%, transparent); animation: breathe 3s ease-in-out infinite; }
.live[data-state="offline"] i { background: var(--bad); }
@keyframes breathe { 50% { box-shadow: 0 0 0 7px color-mix(in srgb, var(--good) 8%, transparent); } }

.tip { position: fixed; z-index: 200; padding: 6px 10px; border-radius: 8px; background: var(--text); color: var(--bg); font-size: 12px; font-weight: 600; white-space: pre; pointer-events: none; opacity: 0; transition: opacity 0.12s; }
.tip.on { opacity: 1; }

/* ---------- inbox panel ---------- */

.panel { min-width: 0; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.list-col { background: var(--panel); border-right: 1px solid var(--line); }
.list-head { padding: 18px 16px 6px; border-bottom: 1px solid var(--line); }
.list-title-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.list-title-row h1 { margin: 0; font: 800 22px/1.1 var(--display); letter-spacing: -0.02em; }
.count-pill { padding: 4px 10px; border-radius: 99px; background: var(--accent-soft); border: 1px solid var(--accent-line); color: var(--accent-text); font: 600 11.5px/1.2 var(--mono); }
.count-pill:empty { display: none; }
.list-tools { display: flex; gap: 6px; margin: 14px 0 12px; }
.tool-btn { display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--panel-2); color: var(--text-2); font-size: 13px; font-weight: 600; transition: all 0.15s; }
.tool-btn:hover { border-color: var(--accent-line); color: var(--text); }
.tool-btn .ic { width: 15px; height: 15px; }
.tool-btn.spin .ic { animation: spin 0.7s linear infinite; }
#sort-btn .ic { transition: transform 0.2s; }
#sort-btn.flip .ic { transform: rotate(180deg); }
.list-search { display: flex; align-items: center; gap: 10px; height: 42px; padding: 0 8px 0 12px; border-radius: 11px; border: 1px solid var(--line-2); background: var(--input); color: var(--muted); transition: border-color 0.15s, box-shadow 0.15s; }
.list-search:focus-within { border-color: var(--accent-line); box-shadow: 0 0 0 3px var(--accent-soft); }
.list-search input { flex: 1; min-width: 0; height: 100%; border: 0; outline: none; background: transparent; color: var(--text); }
.list-search input::-webkit-search-cancel-button { display: none; }
.list-search kbd { opacity: 0; transition: opacity 0.15s; }
.list-search:focus-within kbd { opacity: 1; }

.tabs { display: flex; gap: 2px; margin: 12px 0 0; }
.tab { position: relative; display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 10px; color: var(--muted); font-size: 13px; font-weight: 600; }
.tab .ic { width: 15px; height: 15px; }
.tab:hover { color: var(--text); }
.tab.on { color: var(--text); }
.tab.on::after { content: ""; position: absolute; left: 8px; right: 8px; bottom: -7px; height: 2px; border-radius: 2px; background: var(--accent); }
.tab b { min-width: 18px; padding: 0 5px; border-radius: 6px; background: var(--panel-3); color: var(--text-2); font: 600 10.5px/17px var(--mono); }
.tab.on b { background: var(--accent); color: #fff; }
.chips { display: flex; gap: 6px; padding: 12px 0 6px; overflow-x: auto; scrollbar-width: none; }
.tabs:not(.hidden) + .chips { padding-top: 14px; border-top: 1px solid var(--line); margin-top: 6px; }
.chip { height: 28px; padding: 0 11px; border-radius: 8px; border: 1px solid var(--line-2); color: var(--text-2); font-size: 12px; font-weight: 600; white-space: nowrap; transition: all 0.15s; }
.chip:hover { background: var(--hover); }
.chip.on { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent-text); }

.bulkbar { display: flex; align-items: center; gap: 2px; padding: 8px 10px 8px 16px; background: var(--accent); color: #fff; animation: pop 0.18s var(--ease); }
.bulk-n { margin-right: auto; font: 600 13px var(--mono); white-space: nowrap; }
.bulk-btn { display: grid; place-items: center; width: 34px; height: 32px; border-radius: 8px; }
.bulk-btn span { display: none; }
.bulk-btn:hover { background: rgba(255, 255, 255, 0.16); }
.bulk-btn .ic { width: 16px; height: 16px; }
.bulkbar .icon-btn { color: #fff; width: 32px; height: 32px; }
@keyframes pop { from { opacity: 0; transform: translateY(-4px); } }

.list { flex: 1; min-height: 0; overflow-y: auto; }
.day { position: sticky; top: 0; z-index: 2; padding: 10px 16px 6px; background: color-mix(in srgb, var(--panel) 92%, transparent); backdrop-filter: blur(6px); color: var(--faint); font: 600 10.5px/1 var(--mono); letter-spacing: 0.1em; text-transform: uppercase; }
.row {
  position: relative;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) 22px;
  gap: 12px;
  align-items: start;
  padding: 13px 14px 13px 16px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  transition: background 0.12s;
  touch-action: pan-y;
}
.row:hover { background: var(--hover); }
.row.cursor { box-shadow: inset 2px 0 0 var(--line-2); }
.row.active { background: var(--panel-3); box-shadow: inset 3px 0 0 var(--accent); }
.row.sel { background: var(--accent-soft); }
.row-av { position: relative; width: 38px; height: 38px; border-radius: 10px; }
.row-tick { position: absolute; inset: 0; display: none; place-items: center; border-radius: 10px; background: var(--accent); color: #fff; }
.row.sel .row-tick { display: grid; }
.selecting .row:not(.sel) .row-av .av { opacity: 0.35; }
.row-body { min-width: 0; }
.row-top { display: flex; align-items: baseline; gap: 8px; }
.row-from { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); font-weight: 600; font-size: 14px; }
.row-time { color: var(--faint); font: 500 11.5px var(--mono); white-space: nowrap; }
.row-subj { display: flex; align-items: center; gap: 6px; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); font-size: 13.5px; }
.row-att { display: inline-grid; color: var(--muted); }
.row-att .ic { width: 14px; height: 14px; }
.row-snip { display: flex; align-items: center; gap: 8px; margin-top: 3px; overflow: hidden; color: var(--muted); font-size: 12.5px; white-space: nowrap; text-overflow: ellipsis; }
.row.unread .row-from { color: var(--text); font-weight: 700; }
.row.unread .row-subj { color: var(--text); font-weight: 600; }
.row.unread .row-time { color: var(--accent-text); }
.row-side { display: flex; flex-direction: column; align-items: center; gap: 10px; padding-top: 2px; }
.row-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px var(--accent); }
.row-star { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; color: var(--faint); opacity: 0; transition: opacity 0.15s, color 0.15s; }
.row:hover .row-star,
.row-star.on { opacity: 1; }
.row-star .ic { width: 15px; height: 15px; }
.row-star.on { color: var(--star); }
.row-star.on .ic { fill: currentColor; }
.row-actions { position: absolute; right: 42px; bottom: 9px; display: flex; gap: 2px; padding: 3px; border-radius: 10px; background: var(--pop); border: 1px solid var(--line-2); box-shadow: var(--shadow); opacity: 0; pointer-events: none; transition: opacity 0.12s; }
.row:hover .row-actions { opacity: 1; pointer-events: auto; }
.row-act { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 7px; color: var(--text-2); }
.row-act:hover { background: var(--hover); color: var(--text); }
.row-act .ic { width: 15px; height: 15px; }
.row[data-swipe="archive"] { background: color-mix(in srgb, var(--good) 18%, var(--panel)); }
.row[data-swipe="read"] { background: var(--accent-soft); }
:root[data-density="compact"] .row { padding: 8px 14px 8px 16px; grid-template-columns: 28px minmax(0, 1fr) 22px; }
:root[data-density="compact"] .row .av,
:root[data-density="compact"] .row-av { width: 28px; height: 28px; border-radius: 8px; font-size: 12px; }
:root[data-density="compact"] .row-snip { display: none; }

.code-pill { display: inline-flex; align-items: center; gap: 5px; flex: none; height: 21px; padding: 0 7px; border-radius: 6px; background: color-mix(in srgb, var(--warn) 15%, transparent); color: var(--warn); font: 700 11.5px/1 var(--mono); letter-spacing: 0.08em; }
.code-pill .ic { width: 12px; height: 12px; }
.code-pill:hover { background: color-mix(in srgb, var(--warn) 25%, transparent); }

.code-grid { display: grid; gap: 10px; padding: 14px; }
.code-card { padding: 14px 16px 12px; border-radius: 14px; border: 1px solid var(--line); background: var(--panel-2); cursor: pointer; transition: border-color 0.15s; }
.code-card:hover { border-color: var(--line-2); }
.code-card.fresh { border-color: color-mix(in srgb, var(--warn) 45%, transparent); }
.code-main { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.code-from { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.code-age { color: var(--muted); font: 500 11.5px var(--mono); }
.code-card.fresh .code-age { color: var(--warn); }
.code-value { display: inline-flex; align-items: center; gap: 12px; margin: 12px 0 6px; padding: 9px 14px; border-radius: 10px; background: var(--input); border: 1px dashed var(--line-2); font: 700 26px/1 var(--mono); letter-spacing: 0.2em; }
.code-value .ic { width: 18px; height: 18px; color: var(--muted); }
.code-value:hover { border-color: var(--accent-line); }
.code-subj { margin: 0; color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.more { display: block; margin: 14px auto; padding: 8px 16px; border-radius: 10px; border: 1px solid var(--line-2); color: var(--text-2); font-size: 13px; }
.more:hover { background: var(--hover); }
.empty { display: flex; flex-direction: column; align-items: center; padding: 70px 24px; text-align: center; color: var(--muted); }
.empty strong { margin-top: 14px; color: var(--text); font: 700 16px/1.2 var(--display); }
.empty p { margin: 6px 0 0; max-width: 260px; font-size: 13px; }
.empty-ic { display: grid; place-items: center; width: 54px; height: 54px; border-radius: 15px; background: var(--accent-soft); color: var(--accent-text); }
.empty-ic .ic { width: 24px; height: 24px; }
.empty-ic.big { width: 72px; height: 72px; border-radius: 20px; background: var(--grad); color: #fff; box-shadow: 0 20px 40px -18px var(--a2); }
.empty-ic.big .ic { width: 30px; height: 30px; }
.skel-row { display: grid; grid-template-columns: 38px 1fr; gap: 12px; padding: 13px 16px; border-bottom: 1px solid var(--line); }
.skel i { display: block; border-radius: 6px; background: linear-gradient(90deg, var(--panel-2), var(--panel-3), var(--panel-2)); background-size: 200% 100%; animation: shimmer 1.2s infinite linear; }
.sk-av { width: 38px; height: 38px; border-radius: 10px !important; }
.sk-l { height: 10px; margin: 4px 0 8px; }
.sk-l.a { width: 40%; }
.sk-l.b { width: 75%; }
.sk-l.c { width: 60%; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- reader ---------- */

.read-col { background: var(--paper); }
.reader { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.read-head {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 18px 20px 16px 24px;
  background:
    linear-gradient(var(--grid) 1px, transparent 1px) 0 0 / 24px 24px,
    linear-gradient(90deg, var(--grid) 1px, transparent 1px) 0 0 / 24px 24px,
    var(--top);
  border-bottom: 1px solid var(--line);
}
.read-title { flex: 1; min-width: 0; }
.read-title h1 { margin: 2px 0 8px; font: 750 20px/1.3 var(--display); letter-spacing: -0.015em; word-break: break-word; }
.read-tags { display: flex; gap: 6px; }
.head-actions { display: flex; align-items: center; gap: 2px; flex: none; }
.head-btn { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; color: var(--muted); transition: background 0.15s, color 0.15s; }
.head-btn:hover { background: var(--hover); color: var(--text); }
.head-btn.danger:hover { color: var(--bad); background: color-mix(in srgb, var(--bad) 12%, transparent); }
.head-btn .ic { width: 17px; height: 17px; }
.reply-btn { margin-left: 8px; }
.read-scroll { flex: 1; min-height: 0; overflow-y: auto; background: var(--paper); color: #1b2333; }
.mail { border-bottom: 1px solid #e7ebf2; }
.mail-head { display: flex; align-items: center; gap: 12px; padding: 16px 24px; cursor: pointer; background: #f7f9fc; }
.mail.open .mail-head { background: #fff; }
.mail-who { flex: 1; min-width: 0; }
.mail-name { display: flex; align-items: center; gap: 8px; min-width: 0; }
.mail-name strong { white-space: nowrap; color: #111827; font-size: 14.5px; }
.mail-email { display: inline-flex; align-items: center; gap: 4px; min-width: 0; color: #64748b; font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-copy { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 5px; color: #94a3b8; }
.mini-copy:hover { background: #eef2f7; color: #334155; }
.mini-copy .ic { width: 12px; height: 12px; }
.mail-to { color: #64748b; font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-time { color: #64748b; font: 500 12px var(--mono); white-space: nowrap; }
.mail .row-star { opacity: 1; color: #a0aec0; }
.mail .row-star.on { color: var(--star); }
.mail-body { display: none; padding: 4px 24px 26px; }
.mail.open .mail-body { display: block; }
.body-frame { display: block; width: 100%; min-height: 60px; border: 0; }
.body-text { white-space: pre-wrap; word-wrap: break-word; }
.dots { display: inline-block; margin-top: 8px; padding: 0 10px; height: 20px; border-radius: 99px; background: #eef2f7; color: #64748b; font-size: 11px; letter-spacing: 0.1em; }
.code-banner { display: flex; align-items: center; gap: 12px; margin: 6px 0 16px; padding: 10px 10px 10px 14px; border-radius: 12px; background: #fff8e6; border: 1px solid #f6d68a; }
.code-ic { display: grid; color: #b7791f; }
.code-lab { flex: 1; color: #7c5a12; font-weight: 600; font-size: 13px; }
.code-copy { display: inline-flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 9px; background: #1b2333; color: #fff; font: 700 18px/1 var(--mono); letter-spacing: 0.18em; }
.code-copy .ic { width: 15px; height: 15px; opacity: 0.7; }
.code-copy:hover { background: var(--accent); }
.atts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.att { display: flex; align-items: center; gap: 10px; min-width: 210px; max-width: 290px; padding: 8px 10px 8px 8px; border-radius: 12px; border: 1px solid #e2e8f0; background: #f8fafc; color: #1b2333; text-decoration: none; }
.att:hover { border-color: var(--accent); }
.att-ext { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 9px; background: var(--accent); color: #fff; font: 700 10.5px/1 var(--mono); }
.att-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.att-info b { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-info small { color: #64748b; font: 500 11px var(--mono); }
.att-dl { color: #64748b; }
.unsub { margin-top: 18px; color: #64748b; font-size: 12.5px; }
.unsub a { color: var(--accent); font-weight: 600; }
.fold { position: relative; display: block; width: 100%; height: 40px; border-bottom: 1px solid #e7ebf2; background: #f7f9fc; color: #64748b; font: 600 12px var(--mono); }
.fold:hover { color: #1b2333; background: #eef2f7; }
.qr { position: sticky; bottom: 0; display: flex; align-items: flex-end; gap: 10px; margin: 18px 24px 22px; padding: 8px 8px 8px 16px; border-radius: 14px; border: 1px solid #dfe5ee; background: #fff; box-shadow: 0 14px 40px -18px rgba(15, 30, 60, 0.35); color: #1b2333; }
.qr:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft), 0 14px 40px -18px rgba(15, 30, 60, 0.35); }
.qr-input { flex: 1; min-height: 34px; max-height: 220px; padding: 7px 0; border: 0; outline: none; resize: none; background: transparent; color: #1b2333; line-height: 1.45; }
.qr-input::placeholder { color: #94a3b8; }
.qr-act { display: flex; gap: 4px; align-items: center; }
.qr .icon-btn { color: #64748b; }
.qr .icon-btn:hover { background: #eef2f7; color: #1b2333; }
.reader-empty { margin: auto; display: flex; flex-direction: column; align-items: center; padding: 40px; text-align: center; color: #64748b; }
.reader-empty strong { margin-top: 18px; color: #111827; font: 750 19px/1.2 var(--display); }
.reader-empty p { margin: 8px 0 0; max-width: 300px; line-height: 1.8; }
.reader-empty kbd { background: #f1f5f9; border-color: #e2e8f0; color: #475569; }
.reader-load { margin: auto; display: flex; align-items: center; gap: 10px; color: #475569; font: 500 13px var(--mono); }
:root[data-theme="dark"] .read-col:has(.reader-empty),
:root[data-theme="dark"] .read-col:has(.reader-load) { background: var(--panel); }
:root[data-theme="dark"] .reader-empty strong { color: var(--text); }
:root[data-theme="dark"] .reader-empty,
:root[data-theme="dark"] .reader-load { color: var(--muted); }
:root[data-theme="dark"] .reader-empty kbd { background: var(--panel-2); border-color: var(--line-2); color: var(--muted); }

/* ---------- composer ---------- */

.dock { position: fixed; right: 24px; bottom: 0; z-index: 50; }
.cw { position: relative; display: flex; flex-direction: column; width: 560px; height: min(620px, calc(100dvh - 90px)); border-radius: 16px 16px 0 0; background: var(--pop); border: 1px solid var(--line-2); border-bottom: 0; box-shadow: 0 30px 90px -20px rgba(0, 0, 0, 0.7); animation: rise 0.25s var(--ease); }
@keyframes rise { from { transform: translateY(24px); opacity: 0; } }
.cw.min { height: auto; }
.cw.min > :not(.cw-head) { display: none !important; }
.cw.full { position: fixed; inset: 6vh 8vw; width: auto; height: auto; border-radius: 16px; border-bottom: 1px solid var(--line-2); }
.cw-head { display: flex; align-items: center; gap: 2px; padding: 8px 8px 8px 16px; border-radius: 16px 16px 0 0; background: var(--top); border-bottom: 1px solid var(--line); }
.cw-head strong { font: 700 14px/1 var(--display); }
.cw-fields { padding: 2px 16px; }
.cw-row { display: flex; align-items: flex-start; gap: 10px; min-height: 44px; border-bottom: 1px solid var(--line); }
.cw-lab { padding-top: 12px; width: 30px; color: var(--muted); font: 500 12px var(--mono); }
.cw-field { position: relative; flex: 1; display: flex; align-items: flex-start; gap: 8px; min-width: 0; }
.chips-box { flex: 1; display: flex; flex-wrap: wrap; gap: 6px; padding: 7px 0; min-width: 0; cursor: text; }
.chips-box .chip { display: inline-flex; align-items: center; gap: 4px; height: 28px; padding: 0 4px 0 10px; border-radius: 8px; background: var(--panel-3); border: 0; color: var(--text); }
.chips-box .chip.bad { background: color-mix(in srgb, var(--bad) 16%, transparent); color: var(--bad); }
.chips-box .chip button { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 6px; color: var(--muted); }
.chips-box .chip button .ic { width: 13px; height: 13px; }
.chip-input { flex: 1; min-width: 120px; height: 30px; border: 0; outline: none; background: transparent; }
.cw-link { padding-top: 12px; color: var(--muted); font: 500 12px var(--mono); }
.cw-link:hover { color: var(--text); }
.cw-subject { width: 100%; height: 44px; border: 0; outline: none; background: transparent; font-weight: 600; font-size: 15px; }
.cw-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 14px 16px; }
.cw-body { min-height: 160px; outline: none; line-height: 1.6; font-size: 14.5px; }
.cw-body:empty::before { content: attr(data-placeholder); color: var(--faint); }
.cw-body blockquote { margin: 0 0 0 4px; padding-left: 12px; border-left: 3px solid var(--line-2); color: var(--text-2); }
.cw-quote { margin-top: 10px; color: var(--text-2); font-size: 13px; }
.cw-quote-wrap .dots { background: var(--panel-3); color: var(--muted); }
.cw-atts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.att-chip { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 6px 0 10px; border-radius: 10px; background: var(--panel-3); font-size: 12.5px; }
.att-chip small { color: var(--muted); font-family: var(--mono); }
.att-chip.loading { opacity: 0.6; }
.att-chip button { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 7px; color: var(--muted); }
.cw-fmt { display: flex; gap: 2px; margin: 0 12px; padding: 4px; border-radius: 10px; background: var(--panel-2); }
.cw-foot { display: flex; align-items: center; gap: 4px; padding: 12px; border-top: 1px solid var(--line); }
.cw-foot .btn.primary { margin-right: 6px; }
.cw-status { margin-left: 8px; color: var(--muted); font: 500 11.5px var(--mono); }
.cw-drop { position: absolute; inset: 0; z-index: 3; display: none; flex-direction: column; align-items: center; justify-content: center; gap: 10px; border-radius: inherit; background: color-mix(in srgb, var(--accent) 18%, var(--pop)); border: 2px dashed var(--accent-line); font-weight: 600; }
.cw.drop .cw-drop { display: flex; }
.suggest { position: absolute; left: 0; right: 0; top: 100%; z-index: 5; padding: 6px; border-radius: 12px; background: var(--pop); border: 1px solid var(--line-2); box-shadow: var(--shadow); }
.sug { display: flex; flex-direction: column; align-items: flex-start; width: 100%; padding: 8px 10px; border-radius: 8px; text-align: left; }
.sug small { color: var(--muted); font: 500 11.5px var(--mono); }
.sug.on,
.sug:hover { background: var(--accent-soft); }

/* ---------- menus, modals, palette, toasts ---------- */

.menu { position: fixed; z-index: 90; min-width: 230px; max-width: 320px; max-height: 70vh; overflow-y: auto; padding: 6px; border-radius: 14px; background: var(--pop); border: 1px solid var(--line-2); box-shadow: 0 24px 60px -16px rgba(0, 0, 0, 0.6); animation: pop 0.14s var(--ease); }
.menu-item { display: flex; align-items: center; gap: 10px; width: 100%; height: 38px; padding: 0 10px; border-radius: 9px; text-align: left; font-size: 13.5px; }
.menu-item:hover,
.menu-item:focus-visible { background: var(--hover); outline: none; }
.menu-item.danger { color: var(--bad); }
.menu-item.on { color: var(--accent-text); }
.mi-ic { display: grid; color: var(--muted); }
.menu-item.danger .mi-ic { color: var(--bad); }
.mi-text { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-sep { height: 1px; margin: 6px 4px; background: var(--line); }
.menu-head { padding: 8px 10px 4px; color: var(--faint); font: 600 10.5px/1 var(--mono); letter-spacing: 0.1em; text-transform: uppercase; }

.modal { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 16px; background: rgba(2, 6, 14, 0.66); backdrop-filter: blur(6px); animation: fade 0.15s; }
:root[data-theme="light"] .modal { background: rgba(20, 35, 70, 0.3); }
.modal.out { opacity: 0; transition: opacity 0.14s; }
@keyframes fade { from { opacity: 0; } }
.modal-card { width: min(440px, 100%); max-height: calc(100dvh - 32px); overflow-y: auto; padding: 22px; border-radius: 18px; background: var(--pop); border: 1px solid var(--line-2); box-shadow: 0 40px 100px -30px rgba(0, 0, 0, 0.8); animation: pop 0.2s var(--spring); }
.modal-card.wide { width: min(600px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.modal-head h2 { margin: 0; font: 750 19px/1.2 var(--display); }
.modal-text { margin: 0; color: var(--text-2); }
.modal-form { display: flex; flex-direction: column; gap: 10px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.join { display: flex; }
.join .input { border-radius: 11px 0 0 11px; }
.join-end { display: flex; align-items: center; padding: 0 12px; border: 1px solid var(--line-2); border-left: 0; border-radius: 0 11px 11px 0; background: var(--panel-2); color: var(--muted); font: 500 13px var(--mono); }
.settings { display: flex; flex-direction: column; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.set-row strong { display: block; font-size: 14px; }
.set-row small { display: block; color: var(--muted); font-size: 12.5px; }
.set-keys { margin: 16px 0 0; color: var(--muted); font-size: 12.5px; line-height: 2.1; }
.seg { display: inline-flex; padding: 3px; border-radius: 10px; background: var(--input); border: 1px solid var(--line); }
.seg button { height: 30px; padding: 0 12px; border-radius: 8px; color: var(--muted); font-size: 12.5px; font-weight: 600; }
.seg button.on { background: var(--panel-3); color: var(--text); }
.swatches { display: flex; gap: 8px; }
.swatch { width: 28px; height: 28px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 2px var(--pop), 0 0 0 3px transparent; }
.swatch.on { box-shadow: 0 0 0 2px var(--pop), 0 0 0 4px var(--c); }
.switch { position: relative; width: 44px; height: 26px; flex: none; border-radius: 99px; background: var(--panel-3); transition: background 0.2s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform 0.2s var(--spring); }
.switch[aria-checked="true"] { background: var(--accent); }
.switch[aria-checked="true"]::after { transform: translateX(18px); }
.addr-list { display: flex; flex-direction: column; gap: 6px; margin-top: 16px; }
.addr { display: flex; align-items: center; gap: 8px; padding: 8px 8px 8px 12px; border-radius: 10px; background: var(--panel-2); }
.addr-name { font: 500 13px var(--mono); }
.muted { color: var(--muted); }
.form-error { margin: 0; color: var(--bad); font-size: 13px; }

.pal { place-items: start center; padding-top: 12vh; }
.pal-card { width: min(640px, 100%); border-radius: 18px; background: var(--pop); border: 1px solid var(--line-2); box-shadow: 0 40px 120px -30px rgba(0, 0, 0, 0.85); overflow: hidden; animation: pop 0.18s var(--spring); }
.pal-box { display: flex; align-items: center; gap: 12px; padding: 0 16px; height: 58px; border-bottom: 1px solid var(--line); color: var(--muted); }
.pal-box .ic { width: 20px; height: 20px; }
.pal-input { flex: 1; height: 100%; border: 0; outline: none; background: transparent; font-size: 16px; color: var(--text); }
.pal-list { max-height: min(60vh, 460px); overflow-y: auto; padding: 8px; }
.pal-group { padding: 10px 10px 6px; color: var(--faint); font: 600 10.5px/1 var(--mono); letter-spacing: 0.1em; text-transform: uppercase; }
.pal-item { display: flex; align-items: center; gap: 12px; min-height: 42px; padding: 6px 10px; border-radius: 10px; cursor: pointer; }
.pal-item.on { background: var(--accent-soft); }
.pal-ic { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: var(--panel-3); color: var(--text-2); }
.pal-item.on .pal-ic { background: var(--accent); color: #fff; }
.pal-label { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow: hidden; }
.pal-label.row-label { flex-direction: row; }
.pal-msg .pal-label b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.pal-label small { color: var(--muted); font-size: 12px; }
.pal-item time { color: var(--muted); font: 500 11.5px var(--mono); }
.pal-none { padding: 24px; text-align: center; color: var(--muted); }
.pal-foot { display: flex; gap: 16px; padding: 10px 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.pal-foot span { display: inline-flex; align-items: center; gap: 4px; }

.toasts { position: fixed; left: 50%; bottom: 24px; z-index: 120; display: flex; flex-direction: column; align-items: center; gap: 8px; transform: translateX(-50%); pointer-events: none; }
.toast { display: flex; align-items: center; gap: 6px; min-height: 42px; max-width: min(520px, calc(100vw - 32px)); padding: 5px 5px 5px 16px; border-radius: 12px; background: var(--pop); border: 1px solid var(--line-2); color: var(--text); box-shadow: 0 20px 50px -14px rgba(0, 0, 0, 0.6); font: 500 13px var(--mono); pointer-events: auto; animation: rise 0.22s var(--ease); }
.toast::before { content: "●"; margin-right: 4px; color: var(--accent); font-size: 9px; }
.toast.ok { border-color: color-mix(in srgb, var(--good) 45%, transparent); color: var(--good); background: color-mix(in srgb, var(--good) 10%, var(--pop)); }
.toast.ok::before { content: "✓"; color: var(--good); font-size: 13px; }
.toast.bad { border-color: color-mix(in srgb, var(--bad) 45%, transparent); color: var(--bad); }
.toast.bad::before { content: "!"; color: var(--bad); font-weight: 700; font-size: 13px; }
.toast.code { border-color: color-mix(in srgb, var(--warn) 50%, transparent); }
.toast.code::before { content: "⚿"; color: var(--warn); font-size: 13px; }
.toast.out { opacity: 0; transform: translateY(8px); transition: all 0.2s; }
.toast > span { flex: 1; }
.toast-act { height: 30px; padding: 0 12px; border-radius: 8px; font: 700 12.5px var(--font); color: #fff; background: var(--accent); }
.toast-x { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; color: var(--muted); }
.toast-x .ic { width: 14px; height: 14px; }

/* ---------- sign in / sign up / gate ---------- */

.auth { position: fixed; inset: 0; display: grid; place-items: center; padding: 24px 16px; overflow-y: auto; background: radial-gradient(900px 600px at 50% -10%, color-mix(in srgb, var(--a1) 22%, transparent), transparent 70%), radial-gradient(700px 500px at 100% 100%, color-mix(in srgb, var(--a2) 16%, transparent), transparent 70%), var(--bg); }
.auth-grid { position: fixed; inset: 0; pointer-events: none; background: linear-gradient(var(--grid) 1px, transparent 1px) 0 0 / 32px 32px, linear-gradient(90deg, var(--grid) 1px, transparent 1px) 0 0 / 32px 32px; mask-image: radial-gradient(ellipse at 50% 30%, #000 20%, transparent 75%); -webkit-mask-image: radial-gradient(ellipse at 50% 30%, #000 20%, transparent 75%); }
.auth-wrap { position: relative; width: min(460px, 100%); display: flex; flex-direction: column; align-items: center; gap: 22px; }
.auth-logo { display: flex; align-items: center; gap: 10px; }
.auth-card { width: 100%; padding: 30px 30px 22px; border-radius: 24px; background: linear-gradient(180deg, color-mix(in srgb, var(--panel-2) 92%, transparent), color-mix(in srgb, var(--panel) 92%, transparent)); border: 1px solid var(--line-2); box-shadow: 0 50px 120px -40px rgba(0, 0, 0, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.04); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); }
.auth-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.eyebrow { color: var(--muted); font: 600 11px/1 var(--mono); letter-spacing: 0.14em; text-transform: uppercase; }
.auth-badge { display: inline-flex; align-items: center; gap: 6px; color: var(--good); font: 600 12px var(--font); }
.auth-badge .ic { width: 13px; height: 13px; }
.auth-card h1 { margin: 0; font: 800 34px/1.1 var(--display); letter-spacing: -0.03em; }
.auth-sub { margin: 8px 0 24px; color: var(--muted); }
.field { display: block; margin-bottom: 16px; }
.field > span:first-child { display: block; margin-bottom: 8px; color: var(--muted); font: 600 11px/1 var(--mono); letter-spacing: 0.12em; text-transform: uppercase; }
.field-box { display: flex; align-items: center; gap: 10px; height: 54px; padding: 0 8px 0 15px; border-radius: 14px; border: 1px solid var(--line-2); background: var(--input); transition: border-color 0.15s, box-shadow 0.15s; }
.field-box:focus-within { border-color: var(--accent-line); box-shadow: 0 0 0 3px var(--accent-soft); }
.field-box > .ic { color: var(--muted); }
.field-box input { flex: 1; min-width: 0; height: 100%; border: 0; outline: none; background: transparent; font-size: 15px; }
.field-box input::placeholder { color: var(--faint); }
.field-domain { color: var(--muted); font: 500 13px var(--mono); padding-right: 6px; }
.eye { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; color: var(--muted); }
.eye:hover,
.eye.on { color: var(--text); background: var(--hover); }
.divider { display: flex; align-items: center; gap: 12px; margin: 6px 0 14px; color: var(--faint); font-size: 12px; }
.divider::before,
.divider::after { content: ""; flex: 1; height: 1px; background: var(--line-2); }
.divider span { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.divider .ic { width: 14px; height: 14px; color: var(--good); }
.ts-wrap { display: flex; justify-content: center; min-height: 65px; margin: 0 0 16px; }
.ts-wrap:empty { display: none; }
.ts-wrap > div { width: 100%; }
.cta { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; height: 56px; border-radius: 15px; background: var(--grad); color: #fff; font-weight: 700; font-size: 16px; box-shadow: 0 18px 40px -16px var(--a2), inset 0 1px 0 rgba(255, 255, 255, 0.22); transition: filter 0.15s, transform 0.15s; }
.cta:hover { filter: brightness(1.08); }
.cta:hover .ic { transform: translateX(3px); }
.cta .ic { transition: transform 0.2s; }
.cta:active { transform: scale(0.985); }
.cta:disabled { opacity: 0.7; }
.auth-card .form-error { margin-top: 12px; text-align: center; }
.auth-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin: 18px 0 0; color: var(--muted); font-size: 13px; }
.auth-foot > span:first-child { display: inline-flex; align-items: center; gap: 6px; color: var(--faint); }
.auth-foot .ic { width: 14px; height: 14px; }
.auth-foot a { font-weight: 700; text-decoration: none; }
.link-btn { display: block; margin: 14px auto 0; color: var(--muted); font-size: 13px; }
.link-btn:hover { color: var(--text); }
.pw-meter { display: flex; gap: 4px; margin-top: 8px; }
.pw-meter i { flex: 1; height: 4px; border-radius: 4px; background: var(--panel-3); transition: background 0.2s; }
.pw-meter[data-s="1"] i:nth-child(-n + 1) { background: var(--bad); }
.pw-meter[data-s="2"] i:nth-child(-n + 2) { background: var(--warn); }
.pw-meter[data-s="3"] i:nth-child(-n + 3) { background: var(--good); }
.pw-meter[data-s="4"] i { background: var(--good); }

/* ---------- smaller screens ---------- */

@media (max-width: 1180px) {
  .top-search span,
  .top-search kbd { display: none; }
  .top-search { width: 40px; padding: 0; justify-content: center; }
  .compose-top span { display: none; }
  .compose-top { width: 40px; padding: 0; }
  #acct-mail { max-width: 160px; }
  .app { grid-template-columns: var(--rail-w) minmax(300px, 360px) minmax(0, 1fr); }
}
@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); grid-template-rows: 58px minmax(0, 1fr); }
  .only-mobile { display: inline-grid; }
  .top { padding: 0 10px; gap: 6px; }
  .top .logo { margin-right: auto; }
  .logo-word { font-size: 17px; }
  .logo-mark { width: 34px; height: 34px; }
  .acct-pill #acct-mail,
  .acct-pill .ic,
  .signout,
  .compose-top { display: none; }
  .acct-pill { padding: 0 7px; }
  .rail {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 60;
    width: 260px;
    align-items: stretch;
    padding: 16px 12px;
    transform: translateX(-100%);
    transition: transform 0.25s var(--ease);
    box-shadow: var(--shadow);
  }
  .app.side-open .rail { transform: none; }
  .app.side-open .scrim { display: block; position: fixed; inset: 0; z-index: 55; background: rgba(2, 6, 14, 0.55); }
  .rail-nav { align-items: stretch; }
  .rail-item,
  .rail-btn { display: flex; justify-content: flex-start; align-items: center; gap: 14px; width: 100%; padding: 0 12px; }
  .rail-btn::after { content: attr(data-tip); font-size: 14px; font-weight: 500; }
  .rail-name { display: block; flex: 1; font-size: 14px; font-weight: 500; }
  .rail-count { position: static; box-shadow: none; }
  .rail-item.active::before { display: none; }
  .rail-sep { width: auto; margin: 8px 6px; }
  .live { width: auto; justify-content: flex-start; padding-left: 16px; }
  .list-col { grid-column: 1; border-right: 0; padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
  .read-col { display: none; }
  .app.reading .read-col { display: flex; position: fixed; inset: 0; z-index: 40; }
  .app.reading .tabbar { display: none; }
  .read-head { padding: 12px 12px 12px 8px; flex-wrap: wrap; }
  .read-title { order: 2; flex-basis: 100%; padding-left: 8px; }
  .head-actions { order: 1; margin-left: auto; }
  .back-btn { order: 0; }
  .mail-head { padding: 14px 16px; }
  .mail-body { padding: 4px 14px 22px; }
  .mail-email { display: none; }
  .qr { margin: 14px 12px 16px; }
  .row-actions { display: none; }
  .row-star { opacity: 1; }
  .tabbar { position: fixed; left: 8px; right: 8px; bottom: calc(8px + env(safe-area-inset-bottom)); z-index: 30; display: flex; align-items: center; justify-content: space-around; height: 62px; border-radius: 18px; background: color-mix(in srgb, var(--top) 92%, transparent); border: 1px solid var(--line-2); box-shadow: var(--shadow); backdrop-filter: blur(16px); }
  .tabbar button { display: flex; flex-direction: column; align-items: center; gap: 2px; width: 60px; color: var(--muted); font: 600 10px var(--mono); }
  .tabbar button.on { color: var(--accent-text); }
  .tabbar .tab-main { width: 50px; height: 50px; border-radius: 15px; background: var(--grad); color: #fff; display: grid; place-items: center; box-shadow: 0 12px 26px -12px var(--a2); }
  .dock { left: 0; right: 0; }
  .cw,
  .cw.full { position: fixed; inset: 0; width: auto; height: auto; border-radius: 0; border: 0; }
  .cw-head { border-radius: 0; }
  .toasts { bottom: calc(84px + env(safe-area-inset-bottom)); }
  .auth-card { padding: 24px 20px 20px; }
  .auth-card h1 { font-size: 29px; }
  .pal { padding-top: 8px; }
}
@media (max-width: 480px) {
  .head-btn { width: 34px; }
  .reply-btn span { display: none; }
  .reply-btn { width: 36px; padding: 0; }
}
.mail-name strong { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
@media (max-width: 900px) { .mail-time { font-size: 10.5px; } }
.auth { grid-template-columns: minmax(0, 1fr); justify-items: center; }
.auth-wrap { min-width: 0; max-width: 100%; }
.auth-card { min-width: 0; overflow: hidden; }

/* ---------- clean pass: fewer things on screen ---------- */
.top { background: var(--top); }
.read-head { background: var(--top); padding: 16px 22px 14px 24px; flex-direction: column; align-items: stretch; gap: 12px; }
.read-row { display: flex; align-items: center; gap: 12px; min-width: 0; }
.read-subject { flex: 1; min-width: 0; margin: 0; font: 700 19px/1.3 var(--font); letter-spacing: -0.01em; word-break: break-word; }
.read-from .av { width: 36px; height: 36px; }
.read-who { display: flex; flex-direction: column; min-width: 0; }
.read-who strong { font-size: 14.5px; }
.read-email { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: 12.5px; }
.read-email .mini-copy { color: var(--accent-text); }
.read-email .mini-copy:hover { background: var(--hover); color: var(--text); }
.read-time { color: var(--muted); font: 500 12.5px var(--mono); white-space: nowrap; }
.head-actions .reply-btn { margin-left: 4px; }
.mail.solo > .mail-head { display: none; }
.mail.solo .mail-body { padding: 0; }
.mail.solo .code-banner { margin: 16px 24px 0; }
.mail.solo .atts,
.mail.solo .unsub { margin-left: 24px; margin-right: 24px; }
.mail.solo .atts { margin-bottom: 16px; }
.mail.solo { border-bottom: 0; }
.read-scroll { background: #fafafa; }
.mail-body .body-text { padding: 20px 24px; }

.row { grid-template-columns: 40px minmax(0, 1fr) 8px; align-items: center; padding: 12px 14px 12px 18px; gap: 12px; }
.row-av,
.row .av { width: 40px; height: 40px; border-radius: 10px; }
.row .av { box-shadow: none; font-size: 15px; }
.row-top { align-items: baseline; }
.row-from { color: var(--text); font-weight: 700; font-size: 14.5px; }
.row-time { color: var(--muted); font: 500 12px var(--mono); }
.row-subj { margin-top: 1px; color: var(--text-2); font-size: 14px; display: block; }
.row.unread .row-subj { color: var(--text); font-weight: 500; }
.row.unread .row-time { color: var(--muted); }
.row-dot { width: 6px; height: 6px; box-shadow: none; align-self: start; margin-top: 30px; }
.row.active { background: var(--panel-2); box-shadow: inset 3px 0 0 var(--accent); }

.list-head { padding: 16px 16px 0; border-bottom: 0; }
.list-title-row h1 { font: 700 19px/1.2 var(--font); }
.count-pill { font: 600 12px/1.2 var(--font); padding: 4px 11px; }
.list-tools { margin: 12px 0 12px; }
.list-search { margin: 0 -16px; padding: 0 16px; height: auto; border: 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); border-radius: 0; background: transparent; box-shadow: none !important; }
.list-search input { height: 40px; margin: 10px 0; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--input); font-size: 13.5px; }
.list-search input:focus { border-color: var(--accent-line); box-shadow: 0 0 0 3px var(--accent-soft); }
.list-search > .ic { display: none; }

.rail { gap: 8px; padding-top: 16px; }
.rail-compose { color: var(--accent-text); background: var(--accent-soft); margin-bottom: 6px; }
.rail-sep { display: none; }

.read-col:has(.reader-empty) { background: radial-gradient(800px 500px at 70% 10%, rgba(40, 90, 200, 0.12), transparent 70%), var(--panel) !important; }
.reader-empty { color: var(--muted); }
.quiet-ic { display: grid; place-items: center; color: var(--faint); opacity: 0.8; }
.quiet-ic .ic { width: 46px; height: 46px; stroke-width: 1.4; }
.reader-empty p { margin-top: 12px; font-size: 14.5px; color: var(--muted); }
.read-scroll { background: #fff; }
.mail.solo .mail-body .body-text { padding: 20px 24px; }
.mail:not(.solo) .mail-body { padding: 0 0 18px; } .mail:not(.solo) .code-banner, .mail:not(.solo) .atts, .mail:not(.solo) .unsub { margin-left: 24px; margin-right: 24px; }

/* ---------- tighter, flatter (owner 2026-10-11: "too big", "AI logos", "too round") ---------- */
:root {
  --top-h: 52px;
  --rail-w: 56px;
  --list-w: 360px;
  --grad: var(--accent);
}
:root,
:root[data-accent="violet"] { --accent: #3a6df0; }
html,
body { font-size: 13px; }

/* logo: flat tile, no glow, no gradient */
.logo { gap: 8px; }
.logo-mark { width: 28px; height: 28px; border-radius: 7px; background: var(--accent); box-shadow: none; }
.logo-mark .ic { width: 28px; height: 28px; stroke-width: 2.2; }
.logo-word { font: 700 15px/1 var(--font); letter-spacing: -0.01em; }
.logo-word b { color: var(--muted); font: 500 14px/1 var(--mono); letter-spacing: -0.03em; }

/* everything a little smaller and squarer */
.top { padding: 0 12px 0 14px; gap: 8px; }
.acct-pill { height: 32px; padding: 0 8px 0 5px; border-radius: 8px; font-size: 12.5px; font-weight: 500; }
.acct-pill .av.xs { width: 20px; height: 20px; border-radius: 5px; font-size: 10px; }
.btn { height: 32px; padding: 0 12px; border-radius: 7px; font-size: 12.5px; box-shadow: none !important; }
.btn.sm { height: 30px; padding: 0 11px; border-radius: 7px; font-size: 12.5px; }
.btn.primary { background: var(--accent); }
.signout { height: 32px; }
.icon-btn { width: 30px; height: 30px; border-radius: 7px; }
.icon-btn .ic { width: 16px; height: 16px; }

.rail { gap: 4px; padding: 10px 0; }
.rail-item,
.rail-btn { width: 36px; height: 36px; border-radius: 8px; }
.rail-item .ic,
.rail-btn .ic { width: 17px; height: 17px; }
.rail-item.active { box-shadow: none; }
.rail-item.active::before { left: -10px; top: 9px; bottom: 9px; width: 2px; }
.rail-compose { margin-bottom: 8px; }
.rail-count { top: 1px; right: -2px; min-width: 15px; height: 15px; padding: 0 4px; font-size: 9px; line-height: 15px; border-radius: 5px; }

.list-head { padding: 12px 12px 0; }
.list-title-row h1 { font: 650 15px/1.2 var(--font); letter-spacing: 0; }
.count-pill { padding: 2px 7px; border-radius: 5px; border: 0; font: 500 11px/1.4 var(--mono); }
.list-tools { gap: 4px; margin: 10px 0; }
.tool-btn { height: 28px; padding: 0 9px; gap: 5px; border-radius: 6px; font-size: 12px; font-weight: 500; }
.tool-btn .ic { width: 13px; height: 13px; }
.list-search { margin: 0 -12px; padding: 0 12px; }
.list-search input { height: 32px; margin: 8px 0; padding: 0 10px; border-radius: 6px; font-size: 12.5px; }

.row { grid-template-columns: 30px minmax(0, 1fr) 6px; gap: 10px; padding: 9px 12px 9px 14px; }
.row-av,
.row .av { width: 30px; height: 30px; border-radius: 6px; font-size: 12px; }
.row-tick { border-radius: 6px; }
.row-from { font-size: 13px; font-weight: 600; }
.row-time { font-size: 10.5px; }
.row-subj { font-size: 12.5px; margin-top: 0; }
.row-dot { width: 5px; height: 5px; margin-top: 22px; }
.row.active { box-shadow: inset 2px 0 0 var(--accent); }

.av { border-radius: 6px; box-shadow: none; font-size: 12px; }
.av.md,
.read-from .av { width: 30px; height: 30px; border-radius: 6px; }
.av.sm { width: 22px; height: 22px; border-radius: 5px; font-size: 10px; }

.read-head { padding: 12px 16px 12px 18px; gap: 10px; }
.read-subject { font: 600 15px/1.35 var(--font); letter-spacing: 0; }
.read-who strong { font-size: 13px; }
.read-email { font-size: 11.5px; }
.read-time { font-size: 11px; }
.head-btn { width: 30px; height: 30px; border-radius: 7px; }
.tag { height: 18px; padding: 0 6px; border-radius: 4px; font-size: 10px; }
.mail-head { padding: 10px 18px; gap: 10px; }
.mail-name strong { font-size: 13px; }
.mail-email,
.mail-to { font-size: 11.5px; }
.mail-time { font-size: 11px; }
.code-banner { padding: 7px 7px 7px 11px; border-radius: 6px; gap: 10px; }
.code-lab { font-size: 12px; }
.code-copy { padding: 6px 10px; border-radius: 5px; font-size: 15px; }
.mail.solo .code-banner { margin: 12px 18px 0; }
.att { border-radius: 6px; padding: 6px 8px 6px 6px; min-width: 180px; }
.att-ext { width: 32px; height: 32px; border-radius: 5px; font-size: 9.5px; }
.code-card { border-radius: 8px; }
.code-value { border-radius: 6px; font-size: 22px; }
.code-pill { border-radius: 4px; }

/* popups and panels: square-ish, solid, no blur */
.menu,
.suggest { border-radius: 8px; padding: 4px; backdrop-filter: none; }
.menu-item { height: 32px; border-radius: 5px; font-size: 12.5px; }
.menu-item .ic { width: 15px; height: 15px; }
.modal { backdrop-filter: none; }
.modal-card { border-radius: 10px; padding: 18px; }
.modal-head h2 { font: 650 16px/1.2 var(--font); }
.input { height: 34px; border-radius: 6px; font-size: 13px; }
.seg { border-radius: 7px; }
.seg button { height: 26px; border-radius: 5px; font-size: 12px; }
.set-row { padding: 11px 0; }
.set-row strong { font-size: 13px; }
.switch { width: 36px; height: 20px; }
.switch::after { width: 14px; height: 14px; }
.switch[aria-checked="true"]::after { transform: translateX(16px); }
.swatch { width: 22px; height: 22px; border-radius: 5px; }
.pal-card { border-radius: 10px; }
.pal-box { height: 48px; }
.pal-input { font-size: 14px; }
.pal-item { border-radius: 6px; min-height: 36px; }
.pal-ic { width: 26px; height: 26px; border-radius: 6px; }
.toast { min-height: 36px; border-radius: 7px; font-size: 12px; padding: 4px 4px 4px 12px; box-shadow: 0 12px 30px -12px rgba(0, 0, 0, 0.6); }
.toast-act { height: 26px; border-radius: 5px; font-size: 12px; }
.tip { border-radius: 5px; padding: 4px 8px; font-size: 11.5px; }
.cw { border-radius: 8px 8px 0 0; width: 520px; }
.cw-head { border-radius: 8px 8px 0 0; padding: 6px 6px 6px 14px; }
.cw.full { border-radius: 8px; }
.chips-box .chip { height: 24px; border-radius: 5px; }
.att-chip { border-radius: 6px; height: 30px; }
.bulkbar { padding: 6px 8px 6px 14px; }
.empty-ic { border-radius: 8px; width: 44px; height: 44px; }
.quiet-ic .ic { width: 36px; height: 36px; }
.reader-empty p { font-size: 13px; }
.live i { width: 7px; height: 7px; }
.live[data-state="live"] i { box-shadow: none; animation: none; }

/* sign-in pages: smaller, flat */
.auth { background: var(--bg); }
.auth-grid { display: none; }
.auth-wrap { width: min(380px, 100%); gap: 18px; }
.auth-card { padding: 24px 24px 18px; border-radius: 10px; background: var(--panel); box-shadow: 0 20px 50px -30px rgba(0, 0, 0, 0.8); backdrop-filter: none; -webkit-backdrop-filter: none; }
.auth-card h1 { font: 700 22px/1.2 var(--font); letter-spacing: -0.01em; }
.auth-sub { margin: 6px 0 18px; font-size: 13px; }
.eyebrow { font-size: 10px; }
.field { margin-bottom: 12px; }
.field > span:first-child { margin-bottom: 6px; font-size: 10px; }
.field-box { height: 40px; border-radius: 7px; padding: 0 6px 0 11px; gap: 8px; }
.field-box > .ic { width: 15px; height: 15px; }
.field-box input { font-size: 13.5px; }
.eye { width: 30px; height: 30px; border-radius: 6px; }
.divider { margin: 4px 0 12px; font-size: 11.5px; }
.ts-wrap { margin-bottom: 12px; }
.cta { height: 40px; border-radius: 7px; font-size: 13.5px; background: var(--accent); box-shadow: none; }
.auth-foot { font-size: 12px; margin-top: 14px; }
.pw-meter i { height: 3px; border-radius: 2px; }
@media (max-width: 900px) {
  .app { grid-template-rows: 50px minmax(0, 1fr); }
  .tabbar { height: 54px; border-radius: 10px; }
  .tabbar .tab-main { width: 40px; height: 40px; border-radius: 8px; background: var(--accent); box-shadow: none; }
  .rail-item,
  .rail-btn { width: 100%; height: 38px; }
}

/* smooth icons: standard 2px-on-24 weight, round everywhere */
.ic { stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.logo-mark .ic { stroke-width: 2.4; }
.row-star.on .ic,
.mail .row-star.on .ic { fill: currentColor; }

/* browser autofill must not paint its own box inside our fields */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
  -webkit-box-shadow: 0 0 0 1000px var(--input) inset !important;
  box-shadow: 0 0 0 1000px var(--input) inset !important;
  -webkit-text-fill-color: var(--text) !important;
  caret-color: var(--text);
  transition: background-color 99999s ease-out 0s;
}
.field-box input:-webkit-autofill { border-radius: 0; }

/* icons read smooth at small sizes: a touch bolder, never below 15px */
.ic { stroke-width: 2; }
.tool-btn .ic { width: 15px; height: 15px; }
#sort-btn.flip .ic { transform: scaleY(-1); }
.rail-item .ic,
.rail-btn .ic { width: 18px; height: 18px; stroke-width: 1.9; }
.icon-btn .ic,
.head-btn .ic,
.menu-item .ic { width: 16px; height: 16px; }
.mini-copy .ic { width: 13px; height: 13px; }
