/* inbox — токены и раскладка по мотивам Redakt (MIT). Только светлая тема. */
@font-face { font-family: "Inter Variable"; font-style: normal; font-weight: 100 900; font-display: swap; src: url("/static/fonts/inter-cyrillic-wght-normal.woff2") format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Inter Variable"; font-style: normal; font-weight: 100 900; font-display: swap; src: url("/static/fonts/inter-latin-wght-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  --color-1: oklch(0.141 0 0); --color-2: oklch(0.21 0 0); --color-3: oklch(0.51 0 0); --color-4: oklch(0.54 0 0);
  --color-5: oklch(0.871 0 0); --color-6: oklch(0.898 0 0); --color-7: oklch(0.92 0 0); --color-8: oklch(0.967 0 0); --color-9: oklch(1 0 0);
  --overlay-hover: color-mix(in oklch, var(--color-1) 5%, transparent);
  --overlay-active: color-mix(in oklch, var(--color-1) 8%, transparent);
  --accent: oklch(0.65 0.22 45); --accent-text: oklch(0.52 0.22 45); --accent-on-solid: oklch(1 0 0);
  --accent-soft: color-mix(in oklch, var(--accent) 22%, var(--color-9));
  --positive-text: oklch(0.43 0.13 150); --positive-soft: oklch(0.93 0.035 150);
  --danger-text: oklch(0.48 0.18 25); --danger-soft: oklch(0.95 0.03 25);
  --unread-dot: oklch(0.62 0.19 250);
  --cast-2: oklch(0.141 0 0 / 0.02); --cast-4: oklch(0.141 0 0 / 0.04); --cast-6: oklch(0.141 0 0 / 0.06); --cast-8: oklch(0.141 0 0 / 0.08);
  --ring: 0 0 0 0.75px var(--cast-4); --sheen-edge: oklch(1 0 0 / 0.5);
  --elevation-1: var(--ring), 0 0.5px 0.5px var(--cast-4), 0 1px 3px var(--cast-4);
  --elevation-2: 0 0.5px 0.5px var(--cast-6), 0 1px 3px var(--cast-4), 0 0 6px var(--cast-8);
  --elevation-3: inset 0 0.75px 0 var(--sheen-edge), var(--ring), 0 6px 32px var(--cast-4), 0 40px 56px -32px var(--cast-2);
  --r-sm: 6px; --r-md: 8px; --r-lg: 10px; --r-xl: 14px; --r-2xl: 20px; --r-3xl: 24px; --r-full: 999px;
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 20px; --s6: 32px; --s7: 48px;
  --font: "Inter Variable", "Inter", "Avenir Next", ui-sans-serif, system-ui, -apple-system, sans-serif;
  --fs-micro: 11px; --fs-caption: 12px; --fs-ui: 13px; --fs-reading: 15px; --fs-title: 15px; --fs-display: 22px;
  --acct-support: oklch(0.79 0.13 78); --acct-hello: oklch(0.72 0.12 235);
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--font); font-size: var(--fs-ui); line-height: 1.45; color: var(--color-1); background: var(--color-8); -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: 100%; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
.muted { color: var(--color-3); } .small { font-size: var(--fs-caption); } .spacer { flex: 1; }
.ico { display: inline-flex; align-items: center; }
.ico svg { display: block; }
.desktop-only { display: inline-flex; }

/* оболочка */
.shell { display: flex; height: 100vh; height: 100dvh; overflow: hidden; padding: var(--s2) var(--s2) var(--s2) 0; gap: var(--s1); background: var(--color-8); }
.sidebar { width: 216px; flex-shrink: 0; display: flex; flex-direction: column; min-height: 0; padding: var(--s2) var(--s2) var(--s2) var(--s3); gap: var(--s4); }
.sidebar-head { display: flex; flex-direction: column; gap: var(--s2); }
.identity { display: flex; align-items: center; min-height: 32px; padding-inline: 2px; }
.mark { font-size: var(--fs-micro); line-height: 1.3; letter-spacing: 0.04em; text-transform: uppercase; font-weight: 550; color: var(--color-4); }
.nav { display: flex; flex: 1; flex-direction: column; gap: var(--s4); min-height: 0; overflow: auto; padding-inline: 4px; margin-inline: -4px; }
.panel { display: flex; flex-direction: column; gap: 2px; }
.group-header { display: flex; align-items: center; gap: var(--s2); min-height: 24px; padding-inline: 8px; font-size: var(--fs-micro); letter-spacing: 0.04em; text-transform: uppercase; font-weight: 550; color: var(--color-4); }
.nav-item { display: flex; align-items: center; gap: 8px; min-height: 32px; padding: 0 8px; border: 0; border-radius: var(--r-lg); background: transparent; color: var(--color-2); text-decoration: none; cursor: pointer; width: 100%; text-align: left; font-weight: 450; }
.nav-item.static { cursor: default; }
@media (hover: hover) { .nav-item:not(.static):hover { background: var(--overlay-hover); color: var(--color-1); } }
.nav-item.active { background: var(--color-9); color: var(--color-1); box-shadow: var(--elevation-1); font-weight: 550; }
.nav-item .ico { color: var(--color-3); } .nav-item.active .ico { color: var(--accent-text); }
.nav-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-count { margin-left: auto; font-size: var(--fs-caption); color: var(--color-3); font-variant-numeric: tabular-nums; }
.badge { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding-inline: 5px; border-radius: var(--r-full); background: var(--accent); color: var(--accent-on-solid); font-size: var(--fs-micro); font-weight: 600; letter-spacing: 0; }
.sidebar-foot { margin-top: auto; }
.as-button { font-family: inherit; }
.acct-dot { width: 8px; height: 8px; border-radius: var(--r-full); background: var(--color-5); flex-shrink: 0; }
.acct-support { --acct: var(--acct-support); } .acct-hello { --acct: var(--acct-hello); }
.acct-dot.acct-support, .acct-dot.acct-hello { background: var(--acct); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.pane { flex: 1; min-height: 0; display: flex; flex-direction: column; background: var(--color-9); border-radius: var(--r-xl); box-shadow: var(--elevation-2); overflow: hidden; }
.pane-header { display: flex; align-items: center; gap: var(--s3); min-height: 44px; padding: var(--s2) var(--s4); border-bottom: 1px solid var(--color-7); }
.pane-title { margin: 0; font-size: var(--fs-title); line-height: 1.4; font-weight: 600; letter-spacing: -0.02em; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.actions { display: flex; gap: var(--s1); flex-wrap: wrap; justify-content: flex-end; }

/* кнопки */
.btn { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 12px; border: 0; border-radius: var(--r-lg); background: var(--color-9); color: var(--color-1); box-shadow: var(--elevation-1); text-decoration: none; cursor: pointer; font-weight: 500; white-space: nowrap; }
.btn:active { transform: scale(0.98); }
@media (hover: hover) { .btn:hover { background: var(--color-8); } }
.btn-accent { background: var(--accent); color: var(--accent-on-solid); box-shadow: 0 0 0 0.75px color-mix(in oklch, var(--accent) 40%, var(--cast-6)), 0 0.5px 0.5px var(--cast-4), inset 0 1px 0 oklch(1 0 0 / 0.35); }
@media (hover: hover) { .btn-accent:hover { background: var(--accent-text); } }
.btn-big { min-height: 40px; padding-inline: 16px; justify-content: center; font-size: 14px; }
.btn-small { min-height: 28px; padding-inline: 10px; font-size: var(--fs-caption); }
.compose-btn { justify-content: flex-start; padding-inline: 10px 12px; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border: 0; border-radius: var(--r-lg); background: transparent; color: var(--color-3); cursor: pointer; text-decoration: none; }
@media (hover: hover) { .icon-btn:hover { background: var(--overlay-hover); color: var(--color-1); } }

/* список */
.list-scroll { flex: 1; min-height: 0; overflow: auto; }
.list { display: flex; flex-direction: column; width: 100%; padding: var(--s1) var(--s2); }
.row { position: relative; display: flex; align-items: center; gap: var(--s3); width: 100%; min-height: 40px; padding: 10px var(--s3); border-radius: var(--r-lg); text-decoration: none; color: inherit; overflow: hidden; }
@media (hover: hover) { .row:hover { background: var(--overlay-hover); } }
.dot-slot { width: 8px; height: 8px; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; }
.dot { width: 8px; height: 8px; border-radius: var(--r-full); background: var(--unread-dot); }
.avatar { width: 24px; height: 24px; border-radius: var(--r-full); background: color-mix(in oklch, var(--acct, var(--color-6)) 45%, var(--color-9)); color: var(--color-2); font-size: var(--fs-micro); font-weight: 600; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.avatar.big { width: 28px; height: 28px; }
.sender { flex-shrink: 0; width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--color-3); font-weight: 450; }
.row.unread .sender, .row.unread .subject { color: var(--color-1); font-weight: 600; }
.body { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.subject { font-weight: 500; }
.count { font-size: var(--fs-micro); color: var(--color-3); padding: 1px 5px; border-radius: var(--r-full); background: var(--color-8); }
.preview { color: var(--color-3); }
.clip { color: var(--color-4); display: inline-flex; }
.chip { font-size: var(--fs-micro); font-weight: 550; letter-spacing: 0.02em; padding: 2px 7px; border-radius: var(--r-full); background: color-mix(in oklch, var(--acct, var(--color-6)) 35%, var(--color-9)); color: var(--color-2); flex-shrink: 0; }
.date { flex-shrink: 0; width: 64px; text-align: right; font-size: var(--fs-caption); color: var(--color-3); font-variant-numeric: tabular-nums; }
.row.unread .date { color: var(--color-2); }
.empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--s1); padding: var(--s7) var(--s6); color: var(--color-4); text-align: center; }
.empty-title { font-weight: 500; color: var(--color-3); }
.flash { padding: var(--s2) var(--s3); border-radius: var(--r-lg); background: var(--color-8); color: var(--color-2); font-size: var(--fs-ui); margin: var(--s2) var(--s3); }
.flash.ok { background: var(--positive-soft); color: var(--positive-text); }
.flash.danger { background: var(--danger-soft); color: var(--danger-text); }
.pane-header .flash { margin: 0; padding-block: 4px; }

/* тред */
.reader { flex: 1; min-height: 0; overflow: auto; padding: var(--s4); }
.stack { display: flex; flex-direction: column; gap: var(--s3); max-width: 760px; margin-inline: auto; width: 100%; }
.card { position: relative; display: flex; flex-direction: column; gap: var(--s3); padding: var(--s3) var(--s4); border-radius: var(--r-3xl); background: var(--color-9); box-shadow: var(--elevation-1); }
.card-head { display: flex; align-items: center; gap: var(--s2); min-width: 0; }
.who { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.card-sender { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.audience { font-size: var(--fs-caption); color: var(--color-4); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.when { flex-shrink: 0; font-size: var(--fs-caption); color: var(--color-4); font-variant-numeric: tabular-nums; }
.card-body { font-size: var(--fs-reading); line-height: 1.6; overflow-wrap: anywhere; }
.card-body.html { contain: content; }
.card-body.html img { max-width: 100%; height: auto; }
.card-body.html blockquote { margin: 0 0 0 4px; padding-left: 12px; border-left: 2px solid var(--color-6); color: var(--color-3); }
.card-body.html table { max-width: 100%; }
.card-body a { color: var(--accent-text); }
.tray { display: flex; flex-wrap: wrap; gap: var(--s2); }
.attachment { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: var(--r-lg); background: var(--color-8); text-decoration: none; font-size: var(--fs-caption); }
.card-foot { display: flex; gap: var(--s2); }

/* композер */
.composer { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: var(--s2); padding: var(--s3) var(--s4); overflow: auto; }
.field { display: grid; grid-template-columns: 64px 1fr; align-items: center; gap: var(--s2); }
.field > span { font-size: var(--fs-caption); color: var(--color-4); }
.field input, .field select { min-height: 34px; padding: 0 10px; border: 0; border-radius: var(--r-lg); background: var(--color-8); box-shadow: var(--ring); }
.field input:focus, .field select:focus, .composer textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.composer textarea { flex: 1; min-height: 240px; resize: vertical; padding: 12px; border: 0; border-radius: var(--r-xl); background: var(--color-8); box-shadow: var(--ring); font-size: var(--fs-reading); line-height: 1.55; }
.composer-foot { display: flex; align-items: center; gap: var(--s2); }

/* вход и setup */
.stage { min-height: 100vh; min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: var(--s6) var(--s5) 120px; background: var(--color-8); }
.stack-narrow { width: min(380px, 100%); display: flex; flex-direction: column; gap: var(--s4); }
.stack-narrow.wide { width: min(520px, 100%); }
.copy { display: flex; flex-direction: column; gap: var(--s3); }
.title { margin: 0; font-size: var(--fs-display); line-height: 1.15; font-weight: 500; letter-spacing: -0.03em; text-wrap: balance; }
.subtitle { margin: var(--s3) 0 0; font-size: var(--fs-title); font-weight: 600; letter-spacing: -0.02em; }
.lead { margin: 0; font-size: var(--fs-title); line-height: 1.55; color: var(--color-3); max-width: 46ch; text-wrap: pretty; }
.stage .flash { margin: 0; }
.recovery summary { cursor: pointer; color: var(--color-3); }
.recovery-form { display: flex; gap: var(--s2); margin-top: var(--s2); }
.recovery-form input { flex: 1; min-height: 36px; padding: 0 10px; border: 0; border-radius: var(--r-lg); background: var(--color-9); box-shadow: var(--ring); font-family: ui-monospace, Menlo, monospace; letter-spacing: 0.06em; }
.codes { columns: 2; margin: 0; padding-left: 22px; font-family: ui-monospace, Menlo, monospace; font-size: 14px; line-height: 1.9; letter-spacing: 0.06em; background: var(--color-9); border-radius: var(--r-xl); box-shadow: var(--elevation-1); padding: var(--s3) var(--s3) var(--s3) 36px; }
.row-actions { display: flex; flex-wrap: wrap; gap: var(--s2); }
.plain-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--s2); }
.plain-list .item { display: flex; align-items: center; gap: var(--s3); padding: var(--s2) var(--s3); border-radius: var(--r-lg); background: var(--color-8); }
.plain-list .item form { margin-left: auto; }
.settings { max-width: 640px; }

/* мобильная */
.mobile-bar { display: none; }
@media (max-width: 640px) {
  .shell { padding: 0; gap: 0; }
  .sidebar { display: none; }
  .shell.menu-open .sidebar { display: flex; position: fixed; inset: 0; z-index: 20; width: 100%; background: var(--color-8); padding-top: max(var(--s4), env(safe-area-inset-top)); }
  .main { padding-top: env(safe-area-inset-top); }
  .pane { border-radius: 0; box-shadow: none; }
  .mobile-bar { display: flex; align-items: center; gap: var(--s2); min-height: 48px; padding: 0 var(--s2); background: var(--color-8); }
  .mobile-title { flex: 1; text-align: center; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .desktop-only { display: none; }
  .pane-header { padding-inline: var(--s3); }
  .row { flex-wrap: wrap; gap: 6px 10px; padding: 10px var(--s2); }
  .sender { width: auto; flex: 1; }
  .body { flex-basis: 100%; order: 3; white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .avatar { display: none; }
  .date { width: auto; }
  .reader { padding: var(--s2); }
  .card { border-radius: var(--r-xl); }
  .field { grid-template-columns: 56px 1fr; }
  .stage { padding: var(--s5) var(--s4) var(--s6); align-items: flex-start; }
  .codes { columns: 1; }
}
@media (prefers-reduced-motion: no-preference) { .btn, .nav-item, .icon-btn { transition: background-color 150ms, color 150ms, transform 120ms; } }
