/* Vocabloot Admin: the neutral shadcn/Vercel look (zinc palette), no build
   step. Spec: docs/superpowers/specs/2026-10-29-admin-dashboard-redesign-design.md.
   Every style lives here: the page has no inline styles, so a strict CSP fits. */

:root, :root[data-theme="light"] {
  --bg: #ffffff; --fg: #09090b; --muted: #71717a; --border: #e4e4e7;
  --subtle: #fafafa; --hover: #f4f4f5; --field: #ffffff;
  --primary: #18181b; --primary-fg: #fafafa;
  --ok-bg: #ecfdf5; --ok-border: #a7f3d0; --ok-fg: #065f46;
  --warn-bg: #fffbeb; --warn-border: #fde68a; --warn-fg: #92400e;
  --danger: #b91c1c;
  --skeleton: #f4f4f5;
  --shadow: 0 1px 2px rgb(0 0 0 / .04);
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #09090b; --fg: #fafafa; --muted: #a1a1aa; --border: #27272a;
  --subtle: #0f0f11; --hover: #18181b; --field: #09090b;
  --primary: #fafafa; --primary-fg: #18181b;
  --ok-bg: #052e16; --ok-border: #166534; --ok-fg: #86efac;
  --warn-bg: #422006; --warn-border: #a16207; --warn-fg: #fde68a;
  --danger: #f87171;
  --skeleton: #18181b;
  --shadow: 0 1px 2px rgb(0 0 0 / .4);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--fg);
  font: 14px/1.5 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
h1, h2, h3 { margin: 0; letter-spacing: -.02em; }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }
.muted { color: var(--muted); }
[hidden] { display: none !important; }

/* Icons */
.sprite { display: none; }
.icon { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
:root[data-theme="dark"] .icon-moon, :root:not([data-theme="dark"]) .icon-sun { display: none; }

/* Shell states: checking shows the shell with skeletons; signed-out and
   denied show only the sign-in card. */
.signin { display: none; min-height: 100vh; align-items: center; justify-content: center; padding: 16px; }
body[data-state="signed-out"] .signin, body[data-state="denied"] .signin, body[data-state="error"] .signin { display: flex; }
body[data-state="signed-out"] .shell, body[data-state="denied"] .shell, body[data-state="error"] .shell { display: none; }
body:not([data-state="signed-out"]) .signin-only, body:not([data-state="error"]) .error-only { display: none; }
body:not([data-state="denied"]):not([data-state="error"]) .denied-only { display: none; }
.signin-card .btn + .btn { margin-left: 8px; }
.signin-card { width: 100%; max-width: 360px; border: 1px solid var(--border); border-radius: 12px;
  padding: 28px 24px; text-align: center; box-shadow: var(--shadow); }
.signin-card h1 { font-size: 20px; }
.signin-card p { margin: 8px 0 20px; }

.shell { display: flex; min-height: 100vh; }
.sidebar { width: 240px; flex: none; border-right: 1px solid var(--border); background: var(--subtle);
  padding: 14px 10px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; padding: 6px 10px 14px; }
.brand-mark { width: 20px; height: 20px; border-radius: 6px; background: var(--primary); }
.sidebar nav a { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 6px;
  color: var(--muted); text-decoration: none; font-weight: 500; }
.sidebar nav a:hover { background: var(--hover); color: var(--fg); }
.sidebar nav a[aria-current="page"] { background: var(--hover); color: var(--fg); }
.nav-group { font-size: 12px; color: var(--muted); padding: 16px 10px 4px; font-weight: 500; }
.nav-backdrop { display: none; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { height: 56px; display: flex; align-items: center; gap: 8px;
  padding: 0 20px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--bg); z-index: 5; }
.topbar .menu-btn { display: none; }
.topbar-title { font-size: 16px; font-weight: 600; margin-right: auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.account { display: flex; align-items: center; gap: 4px; }
.who { display: flex; align-items: center; gap: 8px; margin-right: 6px; color: var(--muted); font-size: 13px; }
.badge:empty { display: none; }
.content { padding: 24px 28px 64px; max-width: 1080px; width: 100%; }
.page-head { margin-bottom: 20px; }
.page-head p { margin: 0; }

/* Page load states */
.page .page-body, .page .page-error { display: none; }
.page.is-loaded .page-body { display: block; }
.page.is-loaded .skeleton-stack, .page.has-error .skeleton-stack { display: none; }
.page.has-error .page-error { display: flex; }
.page.has-error .page-body { display: none; }
.page-error { align-items: center; justify-content: space-between; gap: 12px; border: 1px solid var(--border);
  border-radius: 10px; padding: 12px 16px; color: var(--danger); }
.page-error p { margin: 0; }
.skeleton-stack { display: grid; gap: 16px; }

/* Skeletons */
.skeleton { background: var(--skeleton); border-radius: 8px; animation: pulse 1.6s ease-in-out infinite; }
.skeleton-line { display: inline-block; height: 12px; vertical-align: middle; border-radius: 4px; }
.skeleton-tile { height: 92px; border-radius: 10px; }
.skeleton-card { height: 160px; border-radius: 10px; }
.skeleton-tall { height: 360px; }
.w-160 { width: 160px; }
@keyframes pulse { 50% { opacity: .55; } }
@media (prefers-reduced-motion: reduce) { .skeleton { animation: none; } }

/* Cards */
.card { border: 1px solid var(--border); border-radius: 10px; background: var(--bg); box-shadow: var(--shadow); margin-bottom: 16px; }
.card-header { display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 16px; border-bottom: 1px solid var(--border); }
.card-header h2 { font-size: 15px; font-weight: 600; }
.card-header p { margin: 2px 0 0; font-size: 13px; }
.card-body { padding: 16px; }
.card-footer { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 8px;
  padding: 12px 16px; border-top: 1px solid var(--border); }
.card-footer .status { margin-right: auto; }

/* Tiles */
.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile { display: block; border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px;
  text-decoration: none; box-shadow: var(--shadow); }
a.tile:hover { background: var(--subtle); }
.tile-label { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 13px; }
.tile-value { display: block; font-size: 22px; font-weight: 600; letter-spacing: -.02em; margin-top: 6px; overflow-wrap: anywhere; }
.tile-value small { font-size: 13px; font-weight: 400; color: var(--muted); }
.tile-sub { display: block; margin-top: 4px; font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }

/* Badges */
.badge { display: inline-flex; align-items: center; font-size: 12px; line-height: 20px; padding: 0 8px;
  border-radius: 999px; border: 1px solid var(--border); color: var(--fg); white-space: nowrap; }
.badge-ok { background: var(--ok-bg); border-color: var(--ok-border); color: var(--ok-fg); }
.badge-warn { background: var(--warn-bg); border-color: var(--warn-border); color: var(--warn-fg); }

/* Warnings */
.warnings { border: 1px solid var(--warn-border); background: var(--warn-bg); color: var(--warn-fg);
  border-radius: 10px; padding: 12px 16px; margin-bottom: 16px; }
.warnings ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.warnings li { display: flex; gap: 8px; align-items: flex-start; }
.warnings .icon { margin-top: 3px; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 14px;
  border-radius: 6px; border: 1px solid transparent; font: inherit; font-weight: 500; cursor: pointer;
  background: none; color: var(--fg); text-decoration: none; white-space: nowrap; }
.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible {
  outline: 2px solid var(--fg); outline-offset: 2px; }
.btn-primary { background: var(--primary); color: var(--primary-fg); }
.btn-primary:hover { opacity: .9; }
.btn-secondary { border-color: var(--border); background: var(--bg); }
.btn-secondary:hover, .btn-ghost:hover { background: var(--hover); }
.btn-icon { width: 36px; padding: 0; }
.btn:disabled { opacity: .5; cursor: default; }
.btn-sm { height: 30px; padding: 0 10px; font-size: 13px; }

/* Forms */
.field { display: grid; gap: 6px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.field:first-child { padding-top: 0; }
.field:last-child { border-bottom: none; padding-bottom: 0; }
.field-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.field label, .label { font-weight: 500; }
.help { color: var(--muted); font-size: 13px; line-height: 1.5; margin: 0; }
input[type="text"], input[type="number"], input[type="url"], input[type="search"], select, textarea {
  width: 100%; height: 36px; padding: 0 10px; border: 1px solid var(--border); border-radius: 6px;
  background: var(--field); color: var(--fg); font: inherit; }
input[type="number"] { max-width: 180px; }
textarea { height: auto; min-height: 240px; padding: 10px; resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; line-height: 1.55; }
select { padding-right: 28px; }
input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--primary); }
.check { display: flex; align-items: center; gap: 10px; padding: 4px 0; font-weight: 400; }

/* Switch: a checkbox with role="switch" */
input.switch { appearance: none; -webkit-appearance: none; flex: none; width: 36px; height: 20px; margin: 0;
  border-radius: 999px; background: var(--border); position: relative; cursor: pointer; transition: background .15s; }
input.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px;
  border-radius: 999px; background: var(--bg); box-shadow: 0 1px 2px rgb(0 0 0 / .2); transition: transform .15s; }
input.switch:checked { background: var(--primary); }
input.switch:checked::after { transform: translateX(16px); }
@media (prefers-reduced-motion: reduce) { input.switch, input.switch::after { transition: none; } }

/* Status next to Save */
.status { font-size: 13px; font-weight: 500; }
.status.ok { color: var(--ok-fg); }
.status.err { color: var(--danger); }

/* Tables */
.table-wrap { overflow: auto; max-height: 520px; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { text-align: left; padding: 10px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { position: sticky; top: 0; background: var(--subtle); color: var(--muted); font-weight: 500; z-index: 1; }
tbody tr:hover { background: var(--subtle); }
tbody tr:last-child td { border-bottom: none; }
td select { min-width: 120px; }

/* Link list (dashboards) */
.link-list { display: grid; }
.link-list a { display: grid; gap: 2px; padding: 12px 16px; border-bottom: 1px solid var(--border); text-decoration: none; }
.link-list a:last-child { border-bottom: none; }
.link-list a:hover { background: var(--subtle); }
.link-title { display: flex; align-items: center; gap: 6px; font-weight: 500; }
.link-title .icon { width: 14px; height: 14px; color: var(--muted); }
.link-list .help { font-size: 12.5px; }

/* Misc */
.pill { display: inline-block; font-size: 11px; line-height: 18px; padding: 0 8px; border-radius: 999px;
  border: 1px solid var(--border); color: var(--muted); }
.pill.on { background: var(--ok-bg); border-color: var(--ok-border); color: var(--ok-fg); }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.toolbar input { flex: 1; min-width: 200px; }
.preview { white-space: pre-wrap; word-break: break-word; max-height: 340px; overflow: auto; margin: 0;
  padding: 12px; border: 1px solid var(--border); border-radius: 6px; background: var(--subtle);
  font: 12px/1.55 ui-monospace, SFMono-Regular, Menlo, monospace; }
.prompt-shared { opacity: .55; }
.prompt-block { background: var(--ok-bg); color: var(--ok-fg); border-radius: 3px; }
.doc-list a { cursor: pointer; }
.disclosure summary { cursor: pointer; color: var(--muted); font-size: 13px; }
.doc-frame { width: 100%; height: 80vh; border: 1px solid var(--border); border-radius: 10px; background: #fff; }
.stack { display: grid; gap: 12px; }
.badge-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 4px 16px; }
.mt { margin-top: 12px; }

/* Creator outreach */
.cr-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.cr-head .help { margin-right: auto; }
.cr-seg { display: inline-flex; gap: 2px; padding: 2px; border: 1px solid var(--border); border-radius: 8px; background: var(--subtle); }
.cr-seg button { font: inherit; font-size: 13px; font-weight: 500; height: 28px; padding: 0 12px; border: 0; border-radius: 6px;
  background: none; color: var(--muted); cursor: pointer; }
.cr-seg button[aria-pressed="true"] { background: var(--bg); color: var(--fg); box-shadow: var(--shadow); }
.cr-seg button:focus-visible { outline: 2px solid var(--fg); outline-offset: 2px; }
.card-header .badge { flex: none; }
.cr-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.cr-grid > .card { margin-bottom: 16px; }
.cr-bars { display: grid; gap: 12px; }
.cr-bar { display: grid; gap: 6px; }
.cr-bar-top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; font-size: 13px; }
.cr-bar-num { display: inline-flex; gap: 10px; color: var(--muted); font-variant-numeric: tabular-nums; }
.cr-bar-num b { color: var(--fg); font-weight: 600; }
.cr-bad { color: var(--danger); }
.cr-track { height: 6px; border-radius: 3px; background: var(--hover); overflow: hidden; }
.cr-fill { height: 100%; border-radius: 3px; background: var(--primary); }
.cr-fill.cr-fill-bad { background: var(--danger); }
.cr-actions { display: flex; gap: 6px; justify-content: flex-end; }
.cr-nowrap { white-space: nowrap; }
.cr-muted-badge { color: var(--muted); }
.cr-sort { all: unset; cursor: pointer; }
.cr-sort:hover { color: var(--fg); }
.cr-sort:focus-visible { outline: 2px solid var(--fg); outline-offset: 2px; }
th.num, td.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ASO rankings (adminData/aso). Blue ramp = rank band (sequential, darker is
   better); orange = downloads, so the two measures never share a colour. */
:root, :root[data-theme="light"] {
  --aso-1: #cde2fb; --aso-2: #9ec5f4; --aso-3: #5598e7; --aso-4: #2a78d6; --aso-5: #184f95;
  --aso-dl: #eb6834; --aso-up: #047857; --aso-down: #b91c1c; --aso-ink-dark: #09090b; --aso-ink-light: #ffffff;
}
:root[data-theme="dark"] {
  --aso-1: #1b2f4a; --aso-2: #1c5cab; --aso-3: #2a78d6; --aso-4: #5598e7; --aso-5: #9ec5f4;
  --aso-dl: #d95926; --aso-up: #34d399; --aso-down: #f87171; --aso-ink-dark: #fafafa; --aso-ink-light: #09090b;
}
.aso-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.aso-head .help { margin-left: auto; }
.aso-storebar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.aso-storebar .help { margin-left: auto; }
.aso-store { font: inherit; font-size: 12px; font-weight: 600; letter-spacing: .04em; height: 24px; padding: 0 9px;
  border: 1px solid var(--border); border-radius: 999px; background: none; color: var(--muted); cursor: pointer; }
.aso-store:hover { background: var(--hover); color: var(--fg); }
.aso-store[aria-pressed="true"] { background: var(--primary); color: var(--primary-fg); border-color: var(--primary); }
.aso-tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.aso-delta { font-variant-numeric: tabular-nums; font-weight: 500; white-space: nowrap; }
.aso-delta.up { color: var(--aso-up); } .aso-delta.down { color: var(--aso-down); } .aso-delta.flat { color: var(--muted); }
.aso-kw { font-weight: 500; }
.aso-code { color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: .04em; margin-left: 4px; }
.aso-pop { color: var(--muted); font-size: 11px; margin-left: 6px; font-variant-numeric: tabular-nums; }
.aso-popbar { display: inline-flex; align-items: center; gap: 8px; font-variant-numeric: tabular-nums; }
.aso-popbar i { display: inline-block; height: 6px; border-radius: 3px; background: var(--aso-3); }
.aso-hbar { display: inline-flex; align-items: center; gap: 10px; min-width: 150px; font-variant-numeric: tabular-nums; }
.aso-hbar i { display: inline-block; height: 10px; border-radius: 3px; background: var(--aso-4); flex: none; }
.aso-hbar-dl i { background: var(--aso-dl); }
.aso-hbar > span { min-width: 3.5ch; text-align: right; }
.aso-row-link { cursor: pointer; }
.aso-store-cell { white-space: nowrap; }
tr.aso-sel td { background: var(--subtle); }
.aso-link { all: unset; cursor: pointer; color: var(--muted); font-size: 13px; }
.aso-link:hover { color: var(--fg); }
.aso-link:focus-visible { outline: 2px solid var(--fg); outline-offset: 2px; }
.aso-empty, .aso-more { padding: 14px 16px; }
.aso-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.aso-grid > .card { margin-bottom: 16px; }
.aso-legend { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; font-size: 12px; color: var(--muted); padding: 10px 16px 0; }
.aso-legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -2px; margin-right: 5px; }
.aso-legend .b1 { background: var(--aso-5); } .aso-legend .b2 { background: var(--aso-4); } .aso-legend .b3 { background: var(--aso-3); }
.aso-legend .b4 { background: var(--aso-2); } .aso-legend .b5 { background: var(--aso-1); } .aso-legend .none { box-shadow: inset 0 0 0 1px var(--border); }
.aso-legend .aso-link { margin-left: auto; }
.aso-heat { padding: 6px 16px 16px; overflow-x: auto; }
.aso-heattable { width: auto; min-width: 100%; font-size: 13px; }
.aso-heattable th, .aso-heattable td { border: 0; padding: 0; background: none; position: static; }
.aso-heattable th.aso-heatstore { text-align: center; padding: 8px 2px 6px; font-size: 11px; width: 42px; min-width: 42px; color: var(--muted); font-weight: 600; }
.aso-heattable th.aso-heatstore.active { color: var(--fg); }
.aso-heattable td.aso-heatkw { padding-right: 14px; white-space: nowrap; }
.aso-heattable tbody tr:hover { background: none; }
.aso-cell { width: 38px; height: 26px; margin: 2px; border-radius: 6px; display: flex; align-items: center; justify-content: center;
  font-size: 11.5px; font-weight: 600; font-variant-numeric: tabular-nums; cursor: default; }
.aso-cell.none { box-shadow: inset 0 0 0 1px var(--border); color: var(--muted); font-weight: 500; }
.aso-cell.blank { visibility: hidden; }
.aso-cell.b1 { background: var(--aso-5); color: var(--aso-ink-light); }
.aso-cell.b2 { background: var(--aso-4); color: var(--aso-ink-light); }
.aso-cell.b3 { background: var(--aso-3); color: var(--aso-ink-light); }
.aso-cell.b4 { background: var(--aso-2); color: var(--aso-ink-dark); }
.aso-cell.b5 { background: var(--aso-1); color: var(--aso-ink-dark); }
:root[data-theme="dark"] .aso-cell.b4 { color: var(--aso-ink-light); }
.aso-heatgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 2px 20px; padding: 6px 0 2px; }
.aso-heatitem { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-width: 0; font-size: 13px; }
.aso-heatitem .aso-kw { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.aso-heatitem .aso-cell { flex: none; margin: 2px 0; }
.aso-hbar-lt i { opacity: .45; }
.aso-daily { padding: 6px 16px 14px; position: relative; }
.aso-daily svg { display: block; width: 100%; height: 160px; overflow: visible; }
.aso-daily .aso-grid { stroke: var(--border); stroke-width: 1; }
.aso-daily .aso-axis { fill: var(--muted); font-size: 11px; }
.aso-daily .aso-line { fill: none; stroke: var(--aso-dl); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.aso-daily .aso-area { fill: var(--aso-dl); opacity: .10; }
.aso-daily .aso-cross { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 2 3; display: none; }
.aso-daily .aso-dot { fill: var(--aso-dl); stroke: var(--bg); stroke-width: 2; display: none; }
.aso-daily .aso-peak { fill: var(--muted); font-size: 11px; }
.aso-daily .aso-tip { position: absolute; top: 4px; background: var(--primary); color: var(--primary-fg); font-size: 12px; padding: 4px 8px; border-radius: 6px; pointer-events: none; white-space: nowrap; }
.aso-defs { display: grid; gap: 8px; }
.aso-defs p { margin: 0; }

/* Phones: the sidebar slides in behind the menu button */
@media (max-width: 767px) {
  .topbar .menu-btn { display: inline-flex; }
  .sidebar { position: fixed; left: 0; top: 0; z-index: 20; transform: translateX(-100%); visibility: hidden;
    transition: transform .2s ease-out, visibility .2s; }
  body.nav-open .sidebar { transform: none; visibility: visible; }
  body.nav-open .nav-backdrop { display: block; position: fixed; inset: 0; z-index: 15; background: rgb(0 0 0 / .4); }
  .topbar { padding: 0 12px; }
  .who-email { display: none; }
  .content { padding: 20px 16px 56px; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cr-grid { grid-template-columns: minmax(0, 1fr); }
  .aso-grid { grid-template-columns: minmax(0, 1fr); }
  .aso-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .field-row { flex-wrap: wrap; }
}
@media (max-width: 767px) and (prefers-reduced-motion: reduce) { .sidebar { transition: none; } }
