:root {
  --bg: #faf9f6; --fg: #1c1c1e; --muted: #6e6e73; --line: #e3e0d8; --card: #ffffff; --hover: #f2f0eb;
  --accent: #2c64d8; --accent-fg: #fff; --unread: #2c64d8; --wait: #b8860b; --wait-bg: #fdf6e3; --bad: #b3261e;
  --ok: #2fa84f; --warn: #d4a017;
  --radius: 10px; --shadow: 0 1px 2px rgba(0,0,0,.05), 0 4px 16px rgba(0,0,0,.04);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131315; --fg: #ececee; --muted: #9b9ba1; --line: #2b2b2f; --card: #1b1b1e; --hover: #222226;
    --accent: #7ea6ff; --accent-fg: #0d1117; --unread: #7ea6ff; --wait: #e3b341; --wait-bg: #2a2416; --bad: #ff8a80;
    --shadow: none;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, sans-serif; }
main { max-width: 920px; margin: 0 auto; padding: 0 20px 96px; }
button { font: inherit; }
.bar { position: sticky; top: 0; z-index: 5; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; padding: 14px 0;
  background: color-mix(in srgb, var(--bg) 90%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.bar h1 { font-size: 1.25rem; margin: 0; }
.chip { font-size: 12px; font-weight: 650; padding: 2px 8px; border-radius: 999px; background: var(--unread); color: var(--accent-fg); }
.live { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.live i { width: 8px; height: 8px; border-radius: 50%; background: var(--warn); }
.live.on i { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 25%, transparent); }
.spacer { flex: 1; }
.btn { border: 1px solid var(--line); background: var(--card); color: var(--fg); padding: 6px 11px; border-radius: 8px;
  font-size: 13px; font-weight: 600; cursor: pointer; box-shadow: var(--shadow); }
.btn:hover { border-color: var(--muted); }
.btn:focus-visible, .tab:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); padding: 9px 18px; font-size: 14px; }
.signin code { font: 13px ui-monospace, Menlo, monospace; background: var(--hover); padding: 1px 5px; border-radius: 4px; }
.btn.quiet { box-shadow: none; background: transparent; border-color: transparent; color: var(--muted); }
.btn.quiet:hover { color: var(--fg); background: var(--hover); }
.btn.danger:hover { color: var(--bad); }
h2 { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 26px 0 8px; font-weight: 650; }
.wait { display: grid; gap: 10px; }
.wait a.card { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: var(--radius);
  background: var(--wait-bg); border: 1px solid color-mix(in srgb, var(--wait) 40%, transparent); color: inherit; text-decoration: none; }
.wait .card:hover { border-color: var(--wait); }
.wait .icon { font-size: 18px; }
.wait .t { font-weight: 650; overflow-wrap: anywhere; }
.wait .m { font-size: 13px; color: var(--muted); }
.wait .go { margin-left: auto; font-size: 13px; font-weight: 650; color: var(--wait); white-space: nowrap; }
.tabs { display: flex; gap: 4px; margin: 22px 0 4px; }
.tab { border: 0; background: transparent; color: var(--muted); padding: 6px 10px; border-radius: 8px; cursor: pointer; font-weight: 600; font-size: 14px; }
.tab[aria-selected="true"] { background: var(--hover); color: var(--fg); }
.group { margin-top: 14px; }
.list { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.row { display: grid; grid-template-columns: 14px 1fr auto; align-items: center; gap: 12px; padding: 11px 14px; border-top: 1px solid var(--line); }
.row:first-child { border-top: 0; }
.row:hover { background: var(--hover); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--unread); visibility: hidden; }
.row.unread .dot { visibility: visible; }
.row a { color: inherit; text-decoration: none; min-width: 0; }
.row .t { font-weight: 450; overflow-wrap: anywhere; }
.row.unread .t { font-weight: 700; }
.row a:hover .t { text-decoration: underline; }
.meta { font-size: 13px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 1px; }
.from { font-weight: 600; color: var(--fg); opacity: .75; }
.badge { font-size: 11px; font-weight: 700; padding: 0 6px; border-radius: 5px; border: 1px solid var(--line); }
.badge.form { color: var(--wait); border-color: color-mix(in srgb, var(--wait) 45%, transparent); }
.soon { color: var(--bad); }
.actions { display: flex; gap: 2px; opacity: 0; transition: opacity .12s; }
.row:hover .actions, .row:focus-within .actions { opacity: 1; }
@media (hover: none) { .actions { opacity: 1; } }
.row.fresh { animation: fresh 2.4s ease-out; }
@keyframes fresh { from { background: color-mix(in srgb, var(--unread) 22%, var(--card)); } to { background: var(--card); } }
.empty { padding: 28px; text-align: center; color: var(--muted); }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, calc(100% + 48px)); transition: transform .3s; z-index: 20; max-width: calc(100vw - 32px);
  background: var(--fg); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-size: 14px; box-shadow: 0 8px 30px rgba(0,0,0,.25); }
.toast.show { transform: translate(-50%, 0); }
.signin { display: none; max-width: 440px; margin: 12vh auto 0; padding: 0 20px; text-align: center; }
.signin .card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 28px; box-shadow: var(--shadow); }
.signin h1 { font-size: 1.4rem; margin: 0 0 6px; }
.signin p { color: var(--muted); margin: 0 0 18px; }
.signin .problem { color: var(--bad); }
.cmd { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; justify-content: center; font: 600 17px/1.2 ui-monospace, Menlo, monospace;
  background: var(--hover); padding: 14px; border-radius: 10px; margin-bottom: 16px; user-select: all; }
.code { letter-spacing: .08em; color: var(--accent); }
.waiting { display: flex; gap: 8px; align-items: center; justify-content: center; color: var(--muted); font-size: 14px; }
.spin { width: 14px; height: 14px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spin, .row.fresh { animation: none; } .toast { transition: none; } }
body.loading main.inbox, body.signed-out main.inbox { display: none; }
body.signed-out .signin { display: block; }
