/* App shell and screen layouts. Uses tokens.css only. */

.app-body { min-height: 100dvh; }
#app { min-height: 100dvh; }

/* ---------- sidebar (desktop) ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100dvh; transition: grid-template-columns var(--dur-3) var(--ease); }
.shell.collapsed { grid-template-columns: var(--sidebar-w-collapsed) minmax(0, 1fr); }
.sidebar {
  position: sticky; top: 0; height: 100dvh; z-index: var(--z-sidebar);
  display: flex; flex-direction: column; gap: var(--s-1);
  padding: var(--s-4) var(--s-3); background: var(--bg-1); border-right: 1px solid var(--border); overflow: hidden;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 0 var(--s-2); min-height: 40px; color: var(--text); font-family: var(--font-display); font-weight: 700; font-size: var(--fs-18); letter-spacing: -0.02em; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand img { width: 30px; height: 30px; flex: none; }
.sidebar .brand-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--s-4); }
.nav-list { display: flex; flex-direction: column; gap: 2px; margin: 0; padding: 0; list-style: none; }
.nav-item {
  position: relative; display: flex; align-items: center; gap: var(--s-3); width: 100%; min-height: 40px; padding: 0 var(--s-3);
  border: 0; border-radius: var(--r-control); background: transparent; color: var(--text-2); font-size: var(--fs-14); font-weight: 550; text-align: left; white-space: nowrap;
  transition: background-color var(--dur-2), color var(--dur-2);
}
.nav-item svg { width: 18px; height: 18px; flex: none; }
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item[aria-current='page'] { background: var(--surface-3); color: var(--text); }
.nav-item[aria-current='page']::before { content: ''; position: absolute; left: -12px; top: 10px; bottom: 10px; width: 3px; border-radius: 0 3px 3px 0; background: var(--brand-gradient); }
.nav-item .lock-ico { margin-left: auto; color: var(--text-3); }
.nav-item .lock-ico svg { width: 14px; height: 14px; }
.nav-sep { height: 1px; background: var(--border); margin: var(--s-3) var(--s-2); }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 2px; }
.user-chip { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-2); border-radius: var(--r-control); min-width: 0; }
.user-chip .who { min-width: 0; }
.user-chip .who b { display: block; font-size: var(--fs-13); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-chip .who span { display: block; font-size: var(--fs-12); color: var(--text-3); }
.shell.collapsed .nav-item span, .shell.collapsed .brand span, .shell.collapsed .user-chip .who, .shell.collapsed .nav-item .lock-ico, .shell.collapsed .nav-sep { display: none; }
.shell.collapsed .nav-item { justify-content: center; padding: 0; }
.shell.collapsed .sidebar .brand-row { flex-direction: column; gap: var(--s-2); }
.shell.collapsed .user-chip { justify-content: center; }

/* ---------- top bar ---------- */
.main-col { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: var(--z-topbar); height: var(--topbar-h);
  display: flex; align-items: center; gap: var(--s-3); padding: 0 var(--gutter);
  background: color-mix(in srgb, var(--bg-0) 82%, transparent); backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--border);
}
.topbar .brand { display: none; padding: 0; }
.copier-status { display: flex; align-items: center; gap: var(--s-3); min-width: 0; font-size: var(--fs-13); }
.copier-status .cs-main { display: flex; align-items: center; gap: var(--s-2); font-weight: 600; white-space: nowrap; }
.copier-status .cs-meta { color: var(--text-2); white-space: nowrap; display: flex; gap: var(--s-3); align-items: center; }
.copier-status .cs-meta b { color: var(--text); font-weight: 600; font-family: var(--font-mono); }
.copier-status .sep { width: 1px; height: 16px; background: var(--border-strong); }
.search-btn { display: inline-flex; align-items: center; gap: var(--s-2); height: 36px; padding: 0 var(--s-2) 0 var(--s-3); border-radius: var(--r-control); border: 1px solid var(--border); background: var(--surface-1); color: var(--text-3); font-size: var(--fs-13); min-width: 200px; }
.search-btn svg { width: 15px; height: 15px; }
.search-btn kbd { margin-left: auto; }
.search-btn:hover { border-color: var(--border-strong); color: var(--text-2); }
.plan-chip { cursor: pointer; border: 0; }
.kill-btn { --btn-bg: var(--down-soft); --btn-fg: var(--down); --btn-border: rgba(255, 92, 108, 0.35); min-height: 36px; }
.kill-btn:hover { --btn-bg: var(--down); --btn-fg: var(--on-down); filter: none; }

/* ---------- content ---------- */
.content { width: 100%; max-width: var(--content-max); margin: 0 auto; padding: var(--s-6) var(--gutter) var(--s-14); }
.screen[hidden] { display: none; }
.screen.enter { animation: screen-in var(--dur-3) var(--ease); }
@keyframes screen-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.page-head { display: flex; align-items: flex-end; gap: var(--s-3); flex-wrap: wrap; margin-bottom: var(--s-5); }
.page-head h1 { font-size: var(--fs-28); margin: 0; }
.page-head .sub { color: var(--text-2); font-size: var(--fs-14); margin: 4px 0 0; }
.page-head .actions { margin-left: auto; display: flex; gap: var(--s-2); align-items: center; flex-wrap: wrap; }
.section-title { display: flex; align-items: center; gap: var(--s-3); margin: var(--s-8) 0 var(--s-3); }
.section-title h2 { margin: 0; font-size: var(--fs-18); }
.section-title .actions { margin-left: auto; display: flex; gap: var(--s-2); }

/* ---------- mobile tab bar ---------- */
.tabbar { display: none; }
.fab { display: none; }

@media (max-width: 900px) {
  .shell, .shell.collapsed { grid-template-columns: minmax(0, 1fr); }
  .sidebar { display: none; }
  .topbar .brand { display: flex; }
  .search-btn { min-width: 0; width: 36px; padding: 0; justify-content: center; }
  .search-btn .label, .search-btn kbd { display: none; }
  .copier-status .cs-meta { display: none; }
  .content { padding-bottom: calc(var(--tabbar-h) + var(--s-10) + env(safe-area-inset-bottom)); }
  .tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: var(--z-tabbar);
    display: grid; grid-template-columns: repeat(5, 1fr);
    height: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
    background: color-mix(in srgb, var(--bg-1) 88%, transparent); backdrop-filter: saturate(1.4) blur(16px); -webkit-backdrop-filter: saturate(1.4) blur(16px);
    border-top: 1px solid var(--border);
  }
  .tab-btn { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; border: 0; background: none; color: var(--text-3); font-size: 11px; font-weight: 600; min-height: 44px; }
  .tab-btn svg { width: 22px; height: 22px; transition: transform var(--dur-2) var(--ease-sheet); }
  .tab-btn[aria-current='page'] { color: var(--text); }
  .tab-btn[aria-current='page'] svg { color: var(--mint); transform: translateY(-1px) scale(1.06); }
  .fab {
    position: fixed; right: var(--s-4); bottom: calc(var(--tabbar-h) + var(--s-4) + env(safe-area-inset-bottom)); z-index: var(--z-fab);
    display: inline-flex; min-height: 52px; padding: 0 var(--s-5); border-radius: var(--r-pill); box-shadow: var(--shadow-pop), var(--brand-glow);
  }
  .fab.hidden { display: none; }
}
@media (max-width: 720px) {
  .topbar { gap: var(--s-2); }
  .topbar .brand span { display: none; }
  .plan-chip { display: none; }
  .kill-btn .lbl { display: none; }
  .kill-btn { width: 36px; padding: 0; }
  .page-head h1 { font-size: var(--fs-22); }
  .content { padding-top: var(--s-4); }
}

/* ---------- more sheet ---------- */
.more-list .nav-item { min-height: 52px; font-size: var(--fs-16); }
.more-list .nav-item svg { width: 20px; height: 20px; }

/* ---------- kill sheet ---------- */
.kill-hero { display: flex; gap: var(--s-4); align-items: flex-start; margin-bottom: var(--s-5); }
.kill-hero .k-ico { width: 48px; height: 48px; border-radius: 14px; background: var(--down-soft); color: var(--down); display: grid; place-items: center; flex: none; }
.kill-hero .k-ico svg { width: 24px; height: 24px; }
.kill-list { margin: 0 0 var(--s-5); padding: 0; list-style: none; display: flex; flex-direction: column; gap: var(--s-2); font-size: var(--fs-14); color: var(--text-2); }
.kill-list li { display: flex; gap: var(--s-2); align-items: center; }
.kill-list svg { width: 16px; height: 16px; color: var(--down); flex: none; }
.kill-hold { width: 100%; min-height: 56px; font-size: var(--fs-16); }

/* ---------- auth ---------- */
.auth-screen { min-height: 100dvh; display: grid; place-items: center; padding: var(--s-6) var(--s-4); background: radial-gradient(800px 400px at 70% -10%, rgba(78, 230, 166, 0.12), transparent 60%), radial-gradient(700px 400px at 10% 110%, rgba(106, 168, 255, 0.1), transparent 60%), var(--bg-0); }
.auth-card { width: min(420px, 100%); }
.auth-card .brand { justify-content: center; margin-bottom: var(--s-6); font-size: var(--fs-22); }
.auth-card .brand img { width: 40px; height: 40px; }
.auth-card .card { padding: var(--s-8) var(--s-6); }
.auth-card h1 { font-size: var(--fs-28); margin-bottom: var(--s-1); }
#auth-btn { width: 100%; margin-top: var(--s-2); }
.auth-perks { display: flex; gap: var(--s-4); justify-content: center; flex-wrap: wrap; margin-top: var(--s-5); color: var(--text-3); font-size: var(--fs-12); }
.auth-perks span { display: inline-flex; align-items: center; gap: 6px; }
.auth-perks svg { width: 14px; height: 14px; color: var(--up); }
@media (max-width: 520px) {
  .auth-card .card { padding: var(--s-6) var(--s-4); border: 0; background: transparent; box-shadow: none; }
  .auth-card input { min-height: 48px; font-size: var(--fs-16); }
}

/* 16px inputs on phones stop iOS from zooming */
@media (max-width: 720px) {
  input, select, textarea { font-size: var(--fs-16); min-height: 44px; }
  .btn { min-height: 44px; }
  .btn.small, .btn.sm { min-height: 36px; }
}

/* kill switch results */
.kill-done { display: flex; gap: var(--s-4); align-items: flex-start; margin-bottom: var(--s-4); }
.kill-done h2 { margin: 0 0 4px; }
.kill-done p { margin: 0; }
.kill-done .k-ico { width: 48px; height: 48px; border-radius: 14px; background: var(--down-soft); color: var(--down); display: grid; place-items: center; flex: none; }
.kill-done .k-ico.ok { background: var(--up-soft); color: var(--up); }
.kill-done .k-ico svg { width: 24px; height: 24px; }
.kill-row.bad { background: var(--down-soft); border-radius: 10px; padding-left: var(--s-3); padding-right: var(--s-3); border-bottom-color: transparent; margin-bottom: 4px; }
.kill-row .chip svg { width: 12px; height: 12px; }
.kill-warn { display: flex; gap: 6px; align-items: flex-start; color: var(--down); font-size: var(--fs-13); font-weight: 600; margin-top: 4px; }
.kill-warn svg { width: 14px; height: 14px; flex: none; margin-top: 2px; }

/* nudges (cool-down, walk-away) */
.nudge { position: fixed; z-index: 90; left: 50%; transform: translateX(-50%); bottom: var(--s-5); width: min(440px, calc(100vw - 32px)); display: flex; flex-wrap: wrap; align-items: flex-start; gap: var(--s-3); padding: var(--s-4); border-radius: var(--r-card); background: var(--surface-2); border: 1px solid var(--border-strong); box-shadow: var(--shadow-pop); animation: nudge-in var(--dur-3) var(--ease-sheet); }
@keyframes nudge-in { from { opacity: 0; transform: translate(-50%, 14px); } to { opacity: 1; transform: translate(-50%, 0); } }
.nudge .grow { flex: 1 1 200px; min-width: 0; }
.nudge b { font-size: var(--fs-14); }
.nudge p { margin: 2px 0 0; font-size: var(--fs-13); color: var(--text-2); }
.nd-ico { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; flex: none; background: var(--warn-soft); color: var(--warn); }
.nudge.walk .nd-ico { background: var(--up-soft); color: var(--up); }
.nudge.walk { border-color: color-mix(in srgb, var(--up) 40%, var(--border-strong)); }
.nudge.cool { border-color: color-mix(in srgb, var(--warn) 45%, var(--border-strong)); }
.nd-ico svg { width: 18px; height: 18px; }
.nd-actions { display: flex; gap: var(--s-2); margin-left: 48px; flex-basis: 100%; }
.nudge.cool.on b { font-variant-numeric: tabular-nums; }
@media (max-width: 900px) {
  .nudge { bottom: calc(var(--tabbar-h) + var(--s-3) + env(safe-area-inset-bottom)); }
}

/* Password reset page (public/reset.html): reuses the auth card. reset.js toggles .hidden and .bad. */
.rs-ico { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; background: var(--up-soft); color: var(--up); margin-bottom: var(--s-4); }
.rs-ico svg { width: 22px; height: 22px; }
.rs-btn { width: 100%; margin-top: var(--s-2); }
.rs-msg { margin: var(--s-4) 0 0; padding: var(--s-3); border-radius: 10px; background: var(--up-soft); color: var(--up); font-size: var(--fs-13); }
.rs-msg:empty { display: none; }
.rs-msg.bad { background: var(--down-soft); color: var(--down); }
.rs-foot { margin: var(--s-4) 0 0; }
.rs-foot a { color: var(--text-2); font-weight: 600; }
.rs-note { margin: var(--s-5) auto 0; max-width: 34ch; text-align: center; color: var(--text-3); font-size: var(--fs-12); }
.auth-forgot { display: flex; justify-content: flex-end; margin-top: 6px; font-size: var(--fs-13); }
.auth-forgot a { color: var(--text-2); }
.auth-forgot a:hover { color: var(--text); }

/* /waitlist (loads app.css only, so the message box styles are repeated here) */
.wl-screen .auth-card { width: min(460px, 100%); }
.wl-screen .card h1 { font-size: clamp(26px, 7vw, 32px); line-height: 1.1; letter-spacing: -0.03em; margin-bottom: var(--s-2); }
.wl-screen .auth-error { display: flex; flex-wrap: wrap; gap: 4px; padding: var(--s-3); border-radius: 10px; background: var(--down-soft); color: var(--down); font-size: var(--fs-13); margin: 0 0 var(--s-3); }
.wl-screen .auth-error.info { background: var(--info-soft); color: var(--info); }
.wl-screen .auth-error.ok { background: var(--up-soft); color: var(--up); }
.wl-screen .auth-error[hidden] { display: none; }
.wl-screen .auth-error a { color: inherit; font-weight: 700; text-decoration: underline; }
.wl-proof { display: flex; align-items: center; gap: var(--s-2); margin: var(--s-3) 0 0; font-size: var(--fs-13); color: var(--text-2); font-weight: 600; }
.wl-proof[hidden] { display: none; }
.wl-btn { width: 100%; margin-top: var(--s-2); }
.wl-acc button { font-variant-numeric: tabular-nums; }
.wl-acc button[aria-checked='true'] { background: var(--surface-1); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25); }
.wl-hi { margin: 0 0 var(--s-2); color: var(--text-2); font-weight: 600; text-align: center; }
.wl-pos { display: flex; flex-direction: column; align-items: center; margin: var(--s-2) 0 0; }
.wl-pos b { font-family: var(--font-display); font-size: clamp(64px, 22vw, 96px); line-height: 1; font-weight: 800; letter-spacing: -0.04em; background: var(--brand-gradient); -webkit-background-clip: text; background-clip: text; color: transparent; font-variant-numeric: tabular-nums; }
.wl-pos span { color: var(--text-3); font-size: var(--fs-13); font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; margin-top: 4px; }
.wl-ahead { text-align: center; font-size: var(--fs-16); font-weight: 600; margin: var(--s-3) 0 0; }
.wl-flash { text-align: center; margin: var(--s-2) auto 0; width: max-content; max-width: 100%; padding: 4px 12px; border-radius: var(--r-pill); background: var(--up-soft); color: var(--up); font-size: var(--fs-13); font-weight: 700; }
.wl-flash[hidden] { display: none; }
.wl-flash.go { animation: wl-pop 0.5s var(--ease); }
@keyframes wl-pop { 0% { transform: scale(0.8); opacity: 0; } 60% { transform: scale(1.06); opacity: 1; } 100% { transform: scale(1); } }
.wl-bar { position: relative; height: 8px; border-radius: 4px; background: var(--surface-3); margin: var(--s-5) 0 6px; overflow: hidden; }
.wl-bar i { display: block; height: 100%; width: 2%; border-radius: inherit; background: var(--brand-gradient); transition: width 0.8s var(--ease); }
.wl-bar-l { text-align: center; margin: 0; }
.wl-ref { margin-top: var(--s-6); padding-top: var(--s-5); border-top: 1px solid var(--border); }
.wl-ref h2 { font-size: var(--fs-18); margin: 0 0 4px; }
.wl-ref p { margin: 0 0 var(--s-3); }
.wl-ref-row { display: flex; gap: var(--s-2); }
.wl-ref-row input { flex: 1 1 auto; min-width: 0; font-size: var(--fs-13); }
.wl-ref-btns { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-2); margin-top: var(--s-2); }
.wl-ref-btns .btn { width: 100%; }
#wl-refs { margin: var(--s-3) 0 0; font-weight: 600; }
.wl-live { text-align: center; margin: var(--s-4) 0 0; }
.wl-done { text-align: center; }
.wl-done .btn { margin-top: var(--s-4); }
.wl-foot { display: flex; justify-content: center; gap: var(--s-2); margin-top: var(--s-5); color: var(--text-3); }
.wl-foot a { color: var(--text-2); }
@media (prefers-reduced-motion: reduce) { .wl-flash.go { animation: none; } .wl-bar i { transition: none; } }
.wl-acc { display: flex; width: 100%; }
.wl-acc button { flex: 1 1 0; min-height: 40px; }
.wl-screen .input-affix.has-pre input { padding-left: 30px; }
.wl-screen .input-affix .pre { left: 12px; }
.wl-legal { margin-top: 10px; text-align: center; line-height: 1.5; }
.wl-legal a { text-decoration: underline; }
