/* pvuv.ai console — shared design system (PROJECT_PLAN §19: plain HTML, no
 * framework). One dark theme, one set of tokens, one set of components; every
 * console page links this first and keeps only its page-specific rules.
 *
 *   tokens ─ colors / radii / type
 *   base   ─ reset, links, focus, header, main, headings
 *   parts  ─ buttons, controls, cards, panels, tables, badges, chips,
 *            tabs, modal, section nav, states (loading / empty)
 */

:root {
  color-scheme: dark;
  --bg: #0f1115;          /* page */
  --surface: #171a21;     /* cards, panels, header */
  --surface-2: #1d222c;   /* hover, nested */
  --surface-3: #222834;   /* active */
  --border: #262b36;
  --border-2: #313847;    /* controls, emphasised */
  --border-3: #3b4457;    /* hover */
  --text: #e6e8eb;
  --text-2: #cdd6e2;
  --text-3: #aeb6c2;      /* section titles */
  --muted: #8b93a1;
  --muted-2: #6b7280;
  --accent: #3b82f6;      /* fills, lines */
  --accent-2: #2563eb;    /* primary button */
  --accent-3: #1d4ed8;    /* primary hover */
  --link: #7ab3ff;
  --good: #34d399; --good-text: #6ee7a0; --good-bg: #14331f;
  --warn: #fbbf24; --warn-text: #e8d9a0; --warn-bg: #241f10; --warn-border: #4a3f1e;
  --bad: #f87171;  --bad-text: #f3b0b0;  --bad-bg: #241010;  --bad-border: #5a2020;
  --info: #93b4d6; --info-bg: #1d2733;
  --radius: 8px; --radius-lg: 10px; --radius-sm: 6px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", "PingFang SC", "Noto Sans CJK SC", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --hdr-h: 55px;
}

/* ── base ─────────────────────────────────────────────────────────────── */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 14px/1.5 var(--font); background: var(--bg); color: var(--text); }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: var(--mono); font-size: .92em; background: #0c1117; padding: 1px 5px; border-radius: 4px; }
::selection { background: rgba(59,130,246,.35); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .55; }
svg text { fill: var(--muted); font-size: 10px; }
.muted { color: var(--muted); }
.num, td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.nowrap, td.nowrap { white-space: nowrap; }

/* header: sticky so period / language / actions stay reachable on the long
   dashboard; translucent so content is felt scrolling underneath */
header {
  position: sticky; top: 0; z-index: 40; min-height: var(--hdr-h);
  display: flex; align-items: center; gap: 14px; padding: 10px 24px;
  background: rgba(23,26,33,.92); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
header b, header .brand { font-size: 16px; font-weight: 700; white-space: nowrap; }
header a { white-space: nowrap; }
header a:hover { text-decoration: none; color: #a9cbff; }
header .sub { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.hdr-right { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 720px) {
  header { flex-wrap: wrap; gap: 8px 10px; padding: 10px 14px; }
  .hdr-right { margin-left: 0; width: 100%; justify-content: flex-start; }
}

main { max-width: 1060px; margin: 22px auto; padding: 0 16px; }
main.narrow { max-width: 780px; }
main.medium { max-width: 960px; }
h1 { font-size: 20px; margin: 0 0 6px; }
h2 { font-size: 15px; margin: 26px 0 10px; color: var(--text-3); }
h3 { font-size: 13.5px; margin: 0 0 8px; }
.sec-head { display: flex; align-items: baseline; gap: 10px; margin: 26px 0 10px; flex-wrap: wrap; }
.sec-head h2 { margin: 0; }
.sec-head .tabs { margin-left: auto; }
.sec-desc { color: var(--muted); font-size: 12px; margin: -6px 0 10px; }
.chart-head { display: flex; align-items: center; gap: 12px; margin: 26px 0 10px; flex-wrap: wrap; }
.chart-head h2 { margin: 0; }
.chart-ctrls { margin-left: auto; display: flex; gap: 8px; }

/* ── controls ─────────────────────────────────────────────────────────── */
select, input:not([type="file"]):not([type="checkbox"]):not([type="radio"]), textarea {
  background: var(--surface); border: 1px solid var(--border-2); border-radius: var(--radius-sm);
  padding: 5px 9px; min-height: 32px; transition: border-color .12s, background .12s;
}
select { padding-right: 26px; appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path d='M1 1l4 4 4-4' fill='none' stroke='%238b93a1' stroke-width='1.5'/></svg>");
  background-repeat: no-repeat; background-position: right 9px center; }
select:hover, input:hover:not([type="file"]), textarea:hover { border-color: var(--border-3); }
select:focus, input:focus, textarea:focus { border-color: var(--accent); outline: none; }
textarea { min-height: 80px; line-height: 1.4; }
::placeholder { color: var(--muted-2); }
input[type="file"] { color: var(--muted); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 32px; padding: 5px 12px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 500;
  background: var(--surface); color: var(--text-2); border: 1px solid var(--border-2);
  white-space: nowrap; text-decoration: none; transition: background .12s, border-color .12s, color .12s;
}
.btn:hover { background: var(--surface-2); border-color: var(--border-3); color: var(--text); text-decoration: none; }
.btn.primary { background: var(--accent-2); border-color: var(--accent-2); color: #fff; font-weight: 600; }
.btn.primary:hover { background: var(--accent-3); border-color: var(--accent-3); }
.btn.danger { background: var(--bad-bg); border-color: var(--bad-border); color: var(--bad-text); }
.btn.danger:hover { background: #331616; }
.btn.warn { background: #b45309; border-color: #b45309; color: #fff; font-weight: 600; }
.btn.warn:hover { background: #92400e; border-color: #92400e; }
.btn.icon { width: 32px; padding: 0; font-size: 15px; }
.btn.sm { min-height: 26px; padding: 2px 9px; font-size: 12.5px; }
.btn.link { background: none; border-color: transparent; color: var(--link); padding-left: 4px; padding-right: 4px; }
.btn.link:hover { background: none; text-decoration: underline; }
.more-btn { display: block; width: 100%; margin-top: 8px; background: none; border: 1px dashed var(--border-2); color: var(--link); border-radius: var(--radius-sm); padding: 7px; font-size: 12.5px; }
.more-btn:hover { background: var(--surface-2); border-color: var(--border-3); }
.all-btn { background: none; border: 0; color: var(--link); font-size: 12.5px; padding: 2px 4px; }
.all-btn:hover { text-decoration: underline; }
.tabs { display: inline-flex; gap: 1px; flex-wrap: wrap; }
.tabs button { background: none; border: 0; color: var(--muted); font-size: 12.5px; padding: 2px 7px; border-radius: 5px; }
.tabs button:hover { color: var(--text-2); background: var(--surface-2); }
.tabs button.active { color: var(--link); font-weight: 600; }

/* ── surfaces ─────────────────────────────────────────────────────────── */
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; overflow-x: auto; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 800px) { .grid2 { grid-template-columns: 1fr; } }

/* KPI grid: fixed 6-up so rows always align; 3-up tablets, 2-up phones.
   Labels never wrap — the long explanation lives in the tooltip. */
.cards { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; }
.cards.cards-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.cards.cards-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.cards.cards-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 900px) { .cards, .cards.cards-5, .cards.cards-4 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 560px) { .cards, .cards.cards-5, .cards.cards-4, .cards.cards-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; min-width: 0; }
.card .v { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: -.01em; }
.card .k { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .h { color: var(--muted-2); font-size: 11px; margin-top: 2px; min-height: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card[title] { cursor: help; }
.card.card-warn { border-color: var(--warn-border); background: var(--warn-bg); }
.card.card-warn .v { color: var(--warn-text); }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; color: var(--muted); font-weight: 500; padding: 5px 8px; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 5px 8px; border-bottom: 1px solid #1d222c; }
tbody tr:last-child td, table > tr:last-child td { border-bottom: 0; }
tr.clickable { cursor: pointer; }
tr.clickable:hover { background: var(--surface-2); }
.drill { color: var(--muted); font-size: 11px; opacity: 0; transition: opacity .1s; }
tr.clickable:hover .drill { opacity: 1; }
/* proportion bar behind the first column (Plausible-style) */
td.lead { position: relative; }
td.lead .bar { position: absolute; left: 0; top: 3px; bottom: 3px; background: rgba(59,130,246,.13); border-radius: 3px; z-index: 0; }
td.lead .lead-in { position: relative; z-index: 1; display: inline-flex; align-items: center; gap: 7px; min-width: 0; max-width: 100%; }
td.lead .lead-in > .txt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.favi { width: 16px; height: 16px; border-radius: 3px; flex: 0 0 auto; object-fit: contain; }
.favi-generic { display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px; color: var(--muted); font-size: 12px; }
.flag { flex: 0 0 auto; font-size: 14px; }

.badge { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 12px; line-height: 1.5; white-space: nowrap; }
.b-clean { background: var(--good-bg); color: var(--good-text); }
.b-suspect { background: #33290f; color: var(--warn); }
.b-bot { background: #331414; color: var(--bad); }
.b-crawler { background: var(--info-bg); color: var(--info); }
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 0 7px; border-radius: 9px; font-size: 11.5px; line-height: 18px; background: var(--surface-3); color: var(--text-2); white-space: nowrap; }
.tag.good { background: var(--good-bg); color: var(--good-text); }
.tag.warn { background: #33290f; color: var(--warn); }
.tag.bad { background: #331414; color: var(--bad); }
.chip { display: inline-flex; align-items: center; gap: 7px; background: #1c2431; border: 1px solid #2f3a4d; color: var(--text-2); border-radius: 14px; padding: 3px 6px 3px 11px; font-size: 12.5px; }
.chip b { font-weight: 600; color: var(--text); }
.chip .x { background: #313d50; border: 0; color: var(--text-2); width: 17px; height: 17px; border-radius: 50%; line-height: 1; font-size: 13px; padding: 0; }
.chip .x:hover { background: #47566e; color: #fff; }

/* mobile record cards (replace wide tables under 720px; pages opt in with .mtable/.mcards) */
.mcard { display: grid; gap: 3px; border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; margin-bottom: 8px; font-size: 13px; color: var(--text); }
.mcard:hover { background: var(--surface-2); text-decoration: none; }
.mcard .row { display: flex; justify-content: space-between; gap: 8px; align-items: center; min-width: 0; }
.mcard .row > span, .mcard .row > b { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mcard .row.muted { font-size: 12.5px; }

/* notices */
.notice { display: flex; align-items: flex-start; gap: 10px; padding: 10px 14px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); font-size: 13px; }
.notice.warn { border-color: var(--warn-border); background: var(--warn-bg); color: var(--warn-text); }
.notice.bad { border-color: var(--bad-border); background: var(--bad-bg); color: var(--bad-text); }
.notice.good { border-color: #1f5136; background: #12331f; color: var(--good-text); }
.notice.info { border-color: #2a3550; background: #141a26; color: var(--text-2); }

/* modal */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 20px; }
.modal[hidden] { display: none; }
.modal-box { background: var(--surface); border: 1px solid var(--border-2); border-radius: var(--radius-lg); width: 660px; max-width: 100%; max-height: 82vh; display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0,0,0,.5); }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 13px 16px; border-bottom: 1px solid var(--border); }
.modal-head b { font-size: 14px; }
.modal-x { margin-left: auto; background: none; border: 0; color: var(--muted); font-size: 22px; line-height: 1; width: 28px; height: 28px; border-radius: 6px; }
.modal-x:hover { background: var(--surface-2); color: var(--text); }
.modal-body { padding: 10px 16px 16px; overflow: auto; }
.modal-body a { word-break: break-all; }

/* section nav (dashboard): sticky pill row under the header */
.secnav { position: sticky; top: var(--hdr-h); z-index: 30; margin: -8px -16px 14px; padding: 8px 16px; background: rgba(15,17,21,.9); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border-bottom: 1px solid var(--border); }
.secnav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.secnav ul::-webkit-scrollbar { display: none; }
.secnav a { display: inline-block; padding: 3px 10px; border-radius: 12px; font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.secnav a:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.secnav a.active { color: var(--text); background: var(--surface-3); }
[data-sec] { scroll-margin-top: calc(var(--hdr-h) + 48px); }

/* states */
.loading { color: var(--muted); font-size: 13px; display: inline-flex; align-items: center; gap: 8px; }
.loading::before { content: ''; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--border-2); border-top-color: var(--link); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty { color: var(--muted); font-size: 13px; padding: 6px 0; }
.empty b { color: var(--text-2); font-weight: 600; display: block; margin-bottom: 2px; }
.skel { background: linear-gradient(90deg, var(--surface) 25%, var(--surface-2) 50%, var(--surface) 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: 4px; color: transparent !important; }
@keyframes shimmer { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .loading::before, .skel { animation: none; } }

/* Private admin: shared scale, controls and responsive application shell. */
:root {
  --bg: #10141b; --surface: #171d27; --surface-2: #1f2835; --surface-3: #293447;
  --border: #303a4a; --border-2: #56647a; --border-3: #71829b;
  --text: #edf2fa; --text-2: #ced8e8; --text-3: #b9c6da; --muted: #9aaac0; --muted-2: #8e9db3;
  --accent: #75a8ff; --accent-2: #2563eb; --accent-3: #1d4ed8; --link: #93bbff;
  --radius: 10px; --radius-lg: 14px; --radius-sm: 8px; --hdr-h: 72px;
}
body { line-height: 1.6; }
[hidden] { display: none !important; }
button, input, select, textarea { accent-color: var(--accent-2); }
input, textarea { caret-color: var(--accent); }
* { scrollbar-color: var(--border-2) var(--bg); scrollbar-width: thin; }
button { border-radius: var(--radius-sm); }
button:not([class]) { background: var(--surface-2); border: 1px solid var(--border-2); padding: 8px 14px; }
button:disabled { opacity: .6; cursor: wait; }
a { text-underline-offset: .2em; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
select:focus-visible, input:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
select, input:not([type="file"]):not([type="checkbox"]):not([type="radio"]), textarea { min-height: 42px; padding: 9px 12px; font-size: 14px; }
select { padding-inline-end: 34px; }
header { min-height: var(--hdr-h); padding: 14px 28px; gap: 18px; background: var(--bg); backdrop-filter: none; -webkit-backdrop-filter: none; }
header .brand { font-size: 17px; letter-spacing: -.02em; }
.brand-lockup { display: inline-flex; gap: 10px; align-items: center; color: var(--text); font-weight: 700; }
.brand-lockup:hover { text-decoration: none; }
.brand-mark { width: 28px; height: 28px; color: var(--accent); flex: none; }
.hdr-right { gap: 10px; }
main { max-width: 1240px; margin: 32px auto 64px; padding-inline: 28px; }
h1 { font-size: 26px; line-height: 1.3; letter-spacing: -.025em; margin-block-end: 8px; }
h2 { font-size: 18px; color: var(--text); margin-block: 30px 14px; }
h3 { font-size: 15px; color: var(--text); }
.page-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 20px; margin-block-end: 24px; }
.page-head h1, .page-head p { margin: 0; }
.page-description { color: var(--muted); font-size: 14px; margin-block-start: 8px !important; max-width: 65ch; }
.btn, form.create button { min-height: 40px; padding: 8px 15px; font-size: 13px; border-radius: var(--radius-sm); }
.btn { font-weight: 600; }
.btn.icon { min-width: 40px; width: 40px; }
.btn.sm { min-height: 36px; padding: 6px 12px; }
.btn.primary { box-shadow: 0 2px 4px rgb(0 0 0 / .16); }
.btn.link { min-height: 40px; padding-inline: 8px; }
.panel { padding: 22px; border-radius: var(--radius-lg); }
.card { padding: 20px; }
.card .v { font-size: 26px; font-weight: 650; letter-spacing: -.025em; }
.card .k { font-size: 12px; margin-block-start: 5px; }
.card .h { font-size: 12px; }
.grid2 { gap: 24px; }
.cards { gap: 12px; }
.scards { gap: 18px !important; }
.scard { padding: 22px !important; }
.scard .name { font-size: 17px !important; }
.scard .dom { font-size: 13px !important; margin-block-start: 6px !important; }
.scard .stats { margin-block-start: 24px !important; }
.scard .stat .v { font-size: 24px !important; }
.scard .foot { margin-block-start: 22px !important; padding-block-start: 16px; border-top: 1px solid var(--border); }
.panel.form { padding: 24px !important; }
.panel .phead { margin-block-end: 22px !important; }
.panel .phead h3 { font-size: 18px !important; }
form.create { gap: 20px !important; }
form.create label { color: var(--text-2) !important; }
form.create input, form.create select, form.create textarea { margin-block-start: 7px !important; }
.form-note { color: var(--muted); font-size: 12px; margin: 7px 0 0; }
.form-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-block-start: 8px; }
.advanced-options { grid-column: 1 / -1; border-block: 1px solid var(--border); padding-block: 14px; }
.advanced-options summary { cursor: pointer; color: var(--text-2); font-weight: 600; }
.advanced-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-block-start: 18px; }
.tabs { gap: 4px; padding: 3px; background: var(--bg); border: 1px solid var(--border); border-radius: 9px; }
.tabs button { min-height: 34px; padding: 6px 11px; }
.tabs button.active { color: var(--text); background: var(--surface-3); }
th { padding: 12px 10px; font-size: 12px; }
td { padding: 11px 10px; border-bottom-color: var(--border); }
.table-scroll { overflow: auto; max-width: 100%; }
.table-scroll:focus-visible { outline-offset: -2px; }
.table-filter { display: flex; align-items: center; justify-content: space-between; gap: 12px; inline-size: 100%; border: 0; background: transparent; color: var(--text); padding: 0; text-align: start; }
.drill { opacity: 1; color: var(--link); font-size: 11px; }
tr.clickable:focus-within { background: var(--surface-2); }
.tag { padding: 3px 8px; border-radius: 5px; font-size: 12px; }
.notice { padding: 14px 16px; }
.empty { padding: 32px 20px; text-align: center; }
.empty b { font-size: 16px; margin-block-end: 8px; }
.ui-error { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin-block: 16px; padding: 16px; border: 1px solid var(--bad-border); background: var(--bad-bg); border-radius: var(--radius); color: var(--bad-text); }
.ui-error p { flex: 1 1 240px; margin: 0; }
.err:empty { display: none; }
.err { color: var(--bad); }
.modal-box { max-height: 88dvh; border-radius: 16px; }
.modal-head { padding: 18px 22px; }
.modal-head b { font-size: 17px; }
.modal-body { padding: 22px; }
.modal-x, .panel .close { min-width: 40px; min-height: 40px; }
.header-tools { display: flex; gap: 8px; }
.tools-trigger { display: none; }
body.dashboard main { max-width: 1470px; padding-inline-start: 252px; margin-block-start: 26px; }
.dashboard .secnav { position: fixed; inset-block: var(--hdr-h) 0; inset-inline-start: 0; width: 224px; margin: 0; padding: 28px 16px; background: var(--bg); border-inline-end: 1px solid var(--border); border-bottom: 0; overflow-y: auto; backdrop-filter: none; }
.nav-heading { display: block; margin: 18px 12px 8px; font-size: 11px; font-weight: 650; color: var(--muted); }
.nav-group:first-child .nav-heading { margin-block-start: 0; }
.secnav ul { display: block; overflow: visible; list-style: none; padding: 0; margin: 0; }
.secnav a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; margin-block: 3px; font-size: 13px; border-radius: 8px; min-height: 40px; }
.secnav a svg { width: 17px; height: 17px; flex: none; }
.secnav a.active { color: var(--text); background: var(--surface-3); font-weight: 650; }
.secnav a.active::after { content: ''; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); margin-inline-start: auto; }
.nav-trigger { display: none; }
.rt { min-height: 36px; margin-block-end: 20px !important; }
.rt .pulse { animation: none; box-shadow: none; width: 7px; height: 7px; }
.rt.stale { color: var(--warn-text); }
.rt.stale .pulse { background: var(--warn); }
.section-heading { display: flex; justify-content: space-between; align-items: center; margin-block: 28px 16px; gap: 12px; }
.section-heading h2 { margin: 0; font-size: 20px; }
.auth-page { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 32px 20px; }
.auth-layout { width: min(100%, 416px); padding: 0; margin: 0; }
.auth-card { padding: 32px; border: 1px solid var(--border); background: var(--surface); border-radius: 18px; }
.auth-card h1 { font-size: 24px; margin-block: 22px 8px; }
.auth-card .sub { margin: 0 0 28px; color: var(--muted); font-size: 14px; }
.auth-card .field { margin-block-end: 20px; }
.auth-card label { display: block; font-size: 13px; font-weight: 600; margin-block-end: 8px; color: var(--text-2); }
.auth-card input { width: 100%; min-height: 46px; font-size: 16px; background: var(--bg); }
.password-control { position: relative; }
.password-control input { padding-inline-end: 65px; }
.password-toggle { position: absolute; inset-inline-end: 4px; inset-block-start: 3px; min-height: 40px; border: 0; padding: 6px 10px; background: transparent; font-size: 12px; color: var(--link); }
.password-toggle:hover { background: var(--surface-2); }
.auth-card #code { letter-spacing: .22em; font-variant-numeric: tabular-nums; }
.auth-card .submit { width: 100%; min-height: 46px; font-size: 14px; margin-block-start: 4px; }
.auth-card .err { margin-block: 14px 0; font-size: 13px; }
.auth-footer { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-block-start: 22px; color: var(--muted); font-size: 12px; padding-inline: 4px; }
.prose { max-width: 70ch; }
.prose p { color: var(--text-2); margin-block: 16px; }
@media (max-width: 1100px) {
  .tools-trigger { display: inline-flex; }
  .header-tools[popover] { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px; inset: auto 20px auto auto; top: 76px; margin: 0; min-width: 190px; }
  .header-tools[popover]:popover-open { display: grid; }
}
@media (max-width: 800px) {
  header { position: static; padding: 16px 20px; gap: 12px; flex-wrap: wrap; }
  .hdr-right { width: 100%; margin: 0; justify-content: flex-start; gap: 8px; }
  main, body.dashboard main { margin-block: 24px 44px; padding-inline: 20px; }
  .dashboard .secnav { position: sticky; inset: auto; top: 0; width: auto; margin: -24px -20px 24px; padding: 10px 20px; border: 0; border-bottom: 1px solid var(--border); overflow: visible; z-index: 35; }
  .nav-trigger { display: flex; width: 100%; justify-content: space-between; }
  #secnav[popover] { position: fixed; inset: 72px 16px auto; width: calc(100% - 32px); padding: 16px; max-height: calc(100dvh - 100px); overflow-y: auto; border: 1px solid var(--border-2); border-radius: 12px; background: var(--surface); margin: 0; }
  #secnav[popover]:popover-open { display: block; }
  .panel { padding: 16px; }
  .card { padding: 16px; }
  .card .v { font-size: 23px; }
  select, input:not([type="file"]):not([type="checkbox"]):not([type="radio"]), textarea { font-size: 16px; min-height: 44px; }
  .btn, form.create button { min-height: 44px; }
  .toolbar { width: 100%; flex-wrap: wrap; }
  .scards { grid-template-columns: 1fr !important; }
  form.create, .advanced-grid { grid-template-columns: minmax(0, 1fr) !important; }
  form.create > *, form.create .full, form.create .actions { grid-column: 1 !important; }
  .panel.form { padding: 18px !important; }
  .tabs { max-width: 100%; }
  .grid2 { gap: 18px; }
  .rt { gap: 8px; }
}
@media (max-width: 420px) {
  .auth-page { padding: 24px 16px; }
  .auth-card { padding: 26px 22px; }
  .auth-card h1 { font-size: 23px; }
  .cards { gap: 8px; }
  .card { padding: 13px; }
}
@media (prefers-reduced-motion: reduce) {
  .rt .pulse, .skel, .loading::before { animation: none; }
  .scard { transform: none !important; }
  html { scroll-behavior: auto; }
}
@media (forced-colors: active) { .btn, .card, .panel, .secnav a.active { border: 1px solid ButtonText; } }
.source-avatar { display: inline-grid; place-items: center; inline-size: 22px; block-size: 22px; border-radius: 6px; background: var(--surface-3); color: var(--text-2); font-size: 11px; font-weight: 650; flex: none; }
.nav-group { margin-block-end: 20px; }
.table-filter .txt { min-inline-size: 0; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 1100px) { .header-tools[data-fallback] { position: absolute; top: 70px; right: 20px; background: var(--surface); border: 1px solid var(--border); padding: 12px; border-radius: 12px; z-index: 50; } }
@media (max-width: 800px) { #secnav[data-fallback] { position: absolute; inset: 64px 12px auto; padding: 16px; max-height: 70dvh; overflow-y: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; } }
@supports selector(:popover-open) { [popover]:not(:popover-open) { display: none; } }
.ui-error { grid-column: 1 / -1; }
.settings-nav { display: flex; gap: 6px; flex-wrap: wrap; padding-block-end: 20px; margin-block-end: 22px; border-block-end: 1px solid var(--border); }
.settings-nav .btn { border-color: transparent; background: transparent; color: var(--muted); }
.settings-nav .btn.active { color: var(--text); background: var(--surface-3); }
.settings-section > form.create:first-child { margin-block-start: 0 !important; border-block-start: 0 !important; padding-block-start: 0 !important; }
.journey-sites { list-style: none; margin: 0; padding: 0; }
.journey-sites li + li { border-top: 1px solid var(--border); }
.journey-sites a { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; min-height: 60px; padding: 14px 6px; }
.journey-sites a span { font-size: 13px; color: var(--muted); }
.visitor-site-select { max-width: 240px; }
.journey-actions-note { margin-block: 14px 22px; }
.scards { grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)) !important; }
.scard { display: flex !important; flex-direction: column; }
.site-card-main { flex: 1; }
@media (max-width: 800px) { .scards { grid-template-columns: minmax(0, 1fr) !important; } }
/* Diagnostics reuse the existing admin controls and palette. */
.error-toolbar { display: flex; align-items: center; gap: 16px; margin-block: 20px; flex-wrap: wrap; }
.journey-subnav { display: flex; flex-wrap: wrap; gap: 8px; margin-block-end: 24px; }
.tl li.error-focus { background: var(--info-bg); outline: 2px solid var(--info); outline-offset: 4px; border-radius: 8px; }
.error-toolbar label { display: flex; align-items: center; gap: 8px; }
.error-workspace { display: grid; grid-template-columns: minmax(260px, 1fr) minmax(0, 2fr); gap: 24px; }
.error-workspace > * { min-width: 0; align-self: start; }
.error-workspace h2 { margin-top: 0; }
.error-group-list { list-style: none; padding: 0; margin: 0; }
.error-group { display: grid; gap: 8px; width: 100%; padding: 16px 8px; text-align: start; border: 0; border-bottom: 1px solid var(--border); border-radius: 0; background: transparent; color: var(--text); overflow-wrap: anywhere; }
.error-group[aria-pressed="true"] { background: var(--info-bg); }
.error-group-count { color: var(--text-2); font-size: 14px; }
.error-sample { padding-block: 16px; border-bottom: 1px solid var(--border); overflow-wrap: anywhere; }
.error-sample summary { cursor: pointer; display: grid; grid-template-columns: minmax(0,1fr) 16px; gap: 4px 12px; list-style: none; }
.error-sample summary::-webkit-details-marker { display: none; }
.error-sample summary::after { content: ''; grid-column: 2; grid-row: 1 / 4; align-self: center; width: 7px; height: 7px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); }
.error-sample[open] summary::after { transform: rotate(225deg); }
.error-sample summary > * { grid-column: 1; display: block; margin-block: 0; }
.error-metadata { display: grid; grid-template-columns: max-content minmax(0,1fr); gap: 8px 16px; font-size: 14px; }
.error-metadata dt { color: var(--text-2); }
.error-metadata dd { margin: 0; overflow-wrap: anywhere; }
.error-stack { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 360px; overflow: auto; padding: 14px; background: var(--bg); color: var(--text); font-size: 13px; line-height: 1.6; }
.tl .error-sample { border: 0; padding-block: 2px 10px; }
@media (max-width: 800px) { .error-workspace { grid-template-columns: minmax(0,1fr); } }
