/* TubeMind design system — one typeface (Manrope), one action colour (blue), borders not shadows.
   Light is default; [data-theme=dark] overrides. Every token is documented in docs/UI-BRIEF-FOR-CHATGPT.md. */
:root {
  --ground: #F6F7F9; --panel: #FFFFFF; --line: #E4E8EF; --ink: #0F172A; --muted: #5B6472;
  --action: #1D4ED8; --action-ink: #FFFFFF; --action-soft: #EAF0FF; --action-line: #C7D7FE;
  --good: #15803D; --good-soft: #DCFCE7; --warn: #B45309; --warn-soft: #FEF3C7; --bad: #B91C1C; --bad-soft: #FEE2E2;
  --tag-bg: #EEF2FF; --tag-fg: #3730A3;
  --b2-bg: #DBEAFE; --b2-fg: #1E40AF; --b5-bg: #EDE9FE; --b5-fg: #5B21B6; --b10-bg: #FEE2E2; --b10-fg: #991B1B; --b0-bg: #EEF0F4; --b0-fg: #5B6472;
  --r-card: 14px; --r-btn: 10px; --r-pill: 999px; --sidebar: 236px; --content: 1180px;
  color-scheme: light;
}
[data-theme="dark"] {
  --ground: #0B0F14; --panel: #131A24; --line: #223044; --ink: #EEF2F7; --muted: #93A0B4;
  --action-soft: #14213A; --action-line: #1E3A8A;
  --good: #4ADE80; --good-soft: #052E16; --warn: #FCD34D; --warn-soft: #451A03; --bad: #FCA5A5; --bad-soft: #450A0A;
  --tag-bg: #1E293B; --tag-fg: #C7D2FE;
  --b2-bg: #1E3A8A; --b2-fg: #93C5FD; --b5-bg: #3B0764; --b5-fg: #D8B4FE; --b10-bg: #7F1D1D; --b10-fg: #FCA5A5; --b0-bg: #223044; --b0-fg: #93A0B4;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--ground); color: var(--ink); font-family: Manrope, system-ui, -apple-system, "Segoe UI", sans-serif; font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { margin: 0; font-weight: 800; letter-spacing: -0.01em; line-height: 1.25; }
h1 { font-size: 27px; } h2 { font-size: 17px; } h3 { font-size: 15px; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.good { color: var(--good); } .warn { color: var(--warn); } .bad { color: var(--bad); } .action { color: var(--action); }
:focus-visible { outline: 2px solid var(--action); outline-offset: 2px; border-radius: 6px; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }

/* boot */
.boot { min-height: 100vh; display: grid; place-items: center; } .boot-mark { width: 36px; height: 36px; border-radius: 10px; background: var(--action); opacity: .4; }

/* layout */
.shell { display: flex; min-height: 100vh; }
.sidebar { flex: 0 0 var(--sidebar); position: sticky; top: 0; height: 100vh; overflow-y: auto; border-right: 1px solid var(--line); background: var(--panel); padding: 18px 14px; display: flex; flex-direction: column; gap: 3px; }
.logo { display: flex; align-items: center; gap: 9px; padding: 4px 8px 16px; font-weight: 800; font-size: 19px; }
.logo-mark { width: 30px; height: 30px; border-radius: 9px; background: var(--action); display: grid; place-items: center; flex: none; }
.workspace { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: 11px; margin-bottom: 12px; background: var(--ground); }
.workspace .avatar { width: 30px; height: 30px; border-radius: 8px; background: var(--action-soft); color: var(--action); font-weight: 800; display: grid; place-items: center; flex: none; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px; font-weight: 600; color: var(--ink); }
.nav-item:hover { background: var(--ground); }
.nav-item.active { background: var(--action-soft); color: var(--action); }
.nav-item .badge { margin-left: auto; font-size: 11px; font-weight: 800; color: var(--action); background: var(--action-soft); padding: 1px 7px; border-radius: var(--r-pill); }
.nav-item.active .badge { background: var(--panel); }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 6px; padding-top: 12px; }
.plan-card { padding: 12px; border-radius: 11px; background: var(--action-soft); font-size: 12px; }
.plan-card strong { color: var(--action); }
.ic { width: 18px; height: 18px; flex: none; }
.ic-sm { width: 15px; height: 15px; flex: none; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 14px; padding: 12px 36px; border-bottom: 1px solid var(--line); background: var(--panel); position: sticky; top: 0; z-index: 5; }
.crumbs { font-size: 13px; color: var(--muted); white-space: nowrap; } .crumbs b { color: var(--ink); } .crumbs span { margin: 0 6px; }
.topbar .search { flex: 1; max-width: 560px; position: relative; margin-left: 8px; }
.topbar .search svg { position: absolute; left: 12px; top: 10px; width: 16px; height: 16px; color: var(--muted); pointer-events: none; }
.topbar .search input { width: 100%; padding: 9px 12px 9px 36px; border-radius: var(--r-btn); border: 1px solid var(--line); background: var(--ground); font-size: 13px; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.verified { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); white-space: nowrap; }
.verified::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #16A34A; }
.verified.stale::before { background: var(--warn); }
.icon-btn { width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--line); background: var(--panel); display: grid; place-items: center; position: relative; }
.icon-btn .dot { position: absolute; top: 6px; right: 7px; width: 7px; height: 7px; border-radius: 50%; background: var(--bad); }
.content { padding: 26px 36px 48px; display: flex; flex-direction: column; gap: 18px; max-width: var(--content); width: 100%; }
.page-head { display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap; }
.page-head > div:first-child { flex: 1; min-width: 260px; }
.page-head .sub { color: var(--muted); margin-top: 3px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* buttons, chips, pills */
.btn { display: inline-flex; align-items: center; gap: 7px; padding: 9px 14px; border-radius: var(--r-btn); border: 1px solid var(--line); background: var(--panel); font-weight: 700; white-space: nowrap; }
.btn:hover { background: var(--ground); }
.btn-primary { background: var(--action); border-color: var(--action); color: var(--action-ink); } .btn-primary:hover { background: #1A44C2; }
.btn-sm { padding: 7px 11px; font-size: 12px; border-radius: 8px; }
.btn-link { border: 0; background: none; padding: 0; color: var(--action); font-weight: 700; }
.btn[disabled] { opacity: .5; cursor: default; }
.pill { display: inline-flex; align-items: center; gap: 7px; padding: 7px 13px; border-radius: var(--r-pill); border: 1px solid var(--line); background: transparent; font-weight: 700; font-size: 12px; color: var(--ink); white-space: nowrap; }
.pill.on { border-color: var(--action); background: var(--action-soft); color: var(--action); }
.pill.dashed { border-style: dashed; color: var(--muted); }
.tag { display: inline-block; padding: 3px 9px; border-radius: var(--r-pill); background: var(--tag-bg); color: var(--tag-fg); font-size: 12px; font-weight: 700; }
.badge-v { display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px; border-radius: var(--r-pill); font-weight: 800; font-size: 12px; }
.badge-v.enter { background: var(--good-soft); color: var(--good); } .badge-v.wait { background: var(--warn-soft); color: var(--warn); } .badge-v.avoid { background: var(--bad-soft); color: var(--bad); }
.beta { font-size: 11px; font-weight: 800; padding: 2px 8px; border-radius: var(--r-pill); border: 1px solid var(--line); color: var(--muted); }
.mult { display: inline-block; min-width: 44px; text-align: center; padding: 4px 9px; border-radius: 8px; font-weight: 800; font-size: 13px; }
.mult.b0 { background: var(--b0-bg); color: var(--b0-fg); } .mult.b2 { background: var(--b2-bg); color: var(--b2-fg); } .mult.b5 { background: var(--b5-bg); color: var(--b5-fg); } .mult.b10 { background: var(--b10-bg); color: var(--b10-fg); }
.q { display: inline-grid; place-items: center; width: 15px; height: 15px; border-radius: 50%; font-size: 10px; font-weight: 800; background: var(--line); color: var(--muted); margin-left: 5px; cursor: help; position: relative; vertical-align: middle; }
.q::after { content: attr(data-tip); position: absolute; left: 50%; bottom: 130%; transform: translateX(-50%); width: max-content; max-width: 280px; padding: 8px 10px; border-radius: 8px; background: var(--ink); color: var(--ground); font-size: 11px; font-weight: 600; line-height: 1.4; text-align: left; white-space: normal; opacity: 0; pointer-events: none; transition: opacity .12s; z-index: 20; }
.q:hover::after, .q:focus::after { opacity: 1; }

/* cards & grids */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-card); padding: 16px 18px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.hero { background: var(--action-soft); border: 1px solid var(--action-line); border-left: 4px solid var(--action); border-radius: var(--r-card); padding: 20px 22px; display: flex; flex-direction: column; gap: 10px; }
.hero-eyebrow { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; }
.hero-eyebrow .kicker { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--action); font-size: 13px; }
.hero h2 { font-size: 24px; }
.hero .body { color: var(--muted); max-width: 760px; }
.hero .cta { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin-top: 4px; }
.hero .cta .note { margin-left: auto; font-size: 12px; color: var(--muted); }
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } .g6 { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; }
.g32 { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.tile .k { font-size: 12px; color: var(--muted); font-weight: 600; display: flex; align-items: center; gap: 6px; }
.tile .v { font-size: 22px; font-weight: 800; margin-top: 2px; display: flex; align-items: baseline; gap: 8px; }
.tile .v .delta { font-size: 13px; font-weight: 800; }
.tile .s { font-size: 11px; color: var(--muted); }
.row { display: flex; align-items: center; gap: 12px; padding: 9px 0; border-top: 1px solid var(--line); }
.row:first-of-type { border-top: 0; }
.thumb { flex: none; aspect-ratio: 16/9; border-radius: 7px; background: var(--b0-bg); object-fit: cover; position: relative; overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .dur { position: absolute; right: 5px; bottom: 5px; padding: 1px 5px; border-radius: 4px; background: rgba(0,0,0,.75); color: #fff; font-size: 10px; font-weight: 700; }
.avatar-img { width: 34px; height: 34px; border-radius: 50%; background: var(--b0-bg); object-fit: cover; flex: none; }
.bar { flex: 1; height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; } .bar > i { display: block; height: 100%; background: var(--action); }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-card); background: var(--panel); }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th { text-align: left; padding: 10px 14px; font-size: 12px; color: var(--muted); font-weight: 700; }
td { padding: 10px 14px; border-top: 1px solid var(--line); vertical-align: middle; }
td.r, th.r { text-align: right; }
.table-foot { padding: 10px 16px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); font-weight: 600; }
.field input, .field select, .field textarea { padding: 9px 12px; border-radius: 9px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); font-weight: 600; font-size: 13px; min-width: 0; }
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--action); outline-offset: 0; border-color: transparent; }
.form { display: flex; flex-direction: column; gap: 12px; max-width: 420px; }
.alert { padding: 10px 12px; border-radius: 10px; font-size: 13px; }
.alert.error { background: var(--bad-soft); color: var(--bad); } .alert.ok { background: var(--good-soft); color: var(--good); } .alert.info { background: var(--action-soft); color: var(--action); }
.empty { padding: 28px; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: var(--r-card); }
.empty strong { display: block; color: var(--ink); font-size: 15px; margin-bottom: 4px; }
.skel { background: linear-gradient(90deg, var(--line), var(--ground), var(--line)); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: 10px; min-height: 18px; }
@keyframes sk { from { background-position: 200% 0 } to { background-position: -200% 0 } }
.foot-note { font-size: 12px; color: var(--muted); }
.collapse summary { cursor: pointer; font-weight: 700; color: var(--action); font-size: 13px; list-style: none; } .collapse summary::before { content: "▸ "; } .collapse[open] summary::before { content: "▾ "; }
.collapse .inner { margin-top: 10px; font-size: 13px; color: var(--muted); display: flex; flex-direction: column; gap: 6px; }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--ground); padding: 10px 16px; border-radius: 10px; font-weight: 700; font-size: 13px; z-index: 50; }
.outlier-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-card); overflow: hidden; display: flex; flex-direction: column; }
.outlier-card .top { display: flex; gap: 14px; padding: 14px; }
.outlier-card .bottom { padding: 12px 14px; border-top: 1px solid var(--line); background: var(--ground); display: flex; flex-direction: column; gap: 8px; }
.outlier-card h3 { font-size: 15px; line-height: 1.3; }
.stats-inline { display: flex; gap: 14px; font-size: 12px; color: var(--muted); flex-wrap: wrap; } .stats-inline b { color: var(--ink); }

/* landing */
.landing { max-width: 1100px; margin: 0 auto; padding: 0 24px 60px; }
.landing-nav { display: flex; align-items: center; gap: 18px; padding: 18px 0; }
.landing-nav .links { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.landing-hero { padding: 48px 0 28px; display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 32px; align-items: center; }
.landing-hero h1 { font-size: 42px; line-height: 1.1; letter-spacing: -0.02em; }
.landing-hero .lead { font-size: 17px; color: var(--muted); margin-top: 14px; max-width: 480px; }
.landing-section { padding: 36px 0; border-top: 1px solid var(--line); }
.price { display: flex; flex-direction: column; gap: 8px; }
.price .amount { font-size: 32px; font-weight: 800; } .price .amount small { font-size: 13px; color: var(--muted); font-weight: 600; }
.price ul { margin: 0; padding-left: 18px; color: var(--muted); font-size: 13px; }
.price.featured { border-color: var(--action); background: var(--action-soft); }
.prose { max-width: 760px; display: flex; flex-direction: column; gap: 12px; line-height: 1.6; } .prose h2 { margin-top: 10px; } .prose ul { margin: 0; padding-left: 20px; }

/* tabs (mobile) */
.tabbar { display: none; }
.menu-btn { display: none; }
@media (max-width: 900px) {
  .sidebar { display: none; }
  .topbar { padding: 10px 16px; } .topbar .search { max-width: none; } .crumbs { display: none; }
  .content { padding: 16px 16px 90px; }
  .g2, .g3, .g4, .g6, .g32 { grid-template-columns: 1fr; }
  .g6 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero h2 { font-size: 20px; } h1 { font-size: 23px; }
  .tabbar { display: grid; position: fixed; left: 0; right: 0; bottom: 0; grid-template-columns: repeat(5, 1fr); border-top: 1px solid var(--line); background: var(--panel); padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); z-index: 10; }
  .tabbar a { display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 10px; font-weight: 700; color: var(--muted); padding: 6px 0; border-radius: 10px; }
  .tabbar a.active { color: var(--action); background: var(--action-soft); }
  .menu-btn { display: grid; }
  .landing-hero { grid-template-columns: 1fr; padding-top: 24px; } .landing-hero h1 { font-size: 30px; }
}
.drawer { position: fixed; inset: 0; z-index: 30; background: rgba(0,0,0,.35); display: none; }
.drawer.open { display: block; }
.drawer .sidebar { display: flex; width: 280px; height: 100%; }
html { overflow-x: hidden; }
@media (max-width: 900px) {
  .landing { padding: 0 16px 40px; }
  .landing-nav .links a { display: none; } .landing-nav .links a[href="/login"], .landing-nav .links a[href="/signup"] { display: inline-flex; }
  .outlier-card .top { flex-direction: column; } .outlier-card .top .thumb { width: 100% !important; }
  .page-head .actions { width: 100%; }
  .topbar .search input { font-size: 16px; }
}
