/* Visual layer only: no query, metric or map animation overrides. */
.mobile-dock { display:none; }
.account-key { display:flex; align-items:center; justify-content:space-between; gap:16px; padding:12px 0; border-bottom:1px solid var(--ui-border); }
.account-key span { overflow-wrap:anywhere; min-width:0; }
#account .panel { margin-bottom:16px; }
#account .button { margin:4px 4px 4px 0; }
#account-qr { display:block; max-width:100%; height:auto; background:#fff; border:12px solid #fff; }
#account-recovery-codes { white-space:pre-wrap; overflow-wrap:anywhere; font-size:15px; line-height:1.8; }
#account [hidden], .auth-page [hidden], #password-code-label[hidden] { display:none; }
.login-second-factor summary { cursor:pointer; min-height:44px; padding:12px 0; font-size:13px; }
.auth-page #login-message { overflow-wrap:anywhere; margin-top:16px; }
@media(max-width:620px) { .account-key { align-items:stretch; flex-direction:column; gap:8px; } #account .button { width:100%; margin-inline:0; } }
.dashboard-ui { --gafam-0:#39ff88; --gafam-1:#21e7ff; --gafam-2:#b66bff; --gafam-3:#ffb52e; --gafam-4:#ff3b81; --gafam-5:#60798e; }
.encrypted-client { display:inline-block; margin-right:6px; font-size:12px; line-height:1; vertical-align:-1px; }
.gafam-panel { margin-top:16px; }
.gafam-layout { display:flex; align-items:center; justify-content:center; gap:clamp(24px,5vw,80px); padding:24px 0; }
.gafam-donut { width:240px; height:240px; flex-shrink:0; border-radius:50%; display:grid; place-items:center; }
.gafam-center { width:172px; height:172px; border-radius:50%; background:var(--ui-surface); display:flex; flex-direction:column; align-items:center; justify-content:center; }
.gafam-center strong { font:600 30px monospace; color:var(--ui-text); text-shadow:none; }
.gafam-center span,.gafam-note { color:var(--ui-muted); font-size:11px; }
.gafam-legend { width:min(100%,480px); }
.gafam-row { display:grid; grid-template-columns:10px 1fr 65px 70px; gap:12px; align-items:center; padding:10px 0; border-bottom:1px solid var(--ui-border); font-size:12px; }
.gafam-row i { width:9px; height:9px; border-radius:50%; }
.gafam-row strong,.gafam-row small { text-align:right; font-variant-numeric:tabular-nums; }
.gafam-row small { color:var(--ui-muted); }
.gafam-note { line-height:1.6; margin-bottom:0; }
@media(prefers-color-scheme:light) { .dashboard-ui { --gafam-0:#00b85b; --gafam-1:#00b8dc; --gafam-2:#9745f5; --gafam-3:#f5a000; --gafam-4:#f22576; --gafam-5:#9baeba; } }
@media(max-width:620px) { .gafam-layout { flex-direction:column; gap:18px; } .gafam-row { gap:8px; grid-template-columns:9px 1fr 56px 60px; } }

/* Compact interaction layer: preserve the OS-driven color themes while reducing visual density. */
:is(.dashboard-ui, .auth-page) { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
.dashboard-ui .sidebar { width: 204px; padding: 20px 11px 14px; }
.dashboard-ui main { margin-left: 204px; padding: 22px 24px 40px; }
.dashboard-ui .logo { padding-bottom: 22px; }
.dashboard-ui .nav { margin: 1px 0; padding: 8px 10px; min-height: 35px; }
.dashboard-ui .nav-title { padding-top: 18px; }
.dashboard-ui header { min-height: 50px; padding-bottom: 14px; margin-bottom: 16px; }
.dashboard-ui h1 { font-size: 23px; }
.dashboard-ui .metrics { gap: 9px; margin-bottom: 14px; }
.dashboard-ui .metrics article { padding: 13px; }
.dashboard-ui .metrics strong { margin: 8px 0 4px; font-size: 24px; }
.dashboard-ui .metric-chart { height: 62px; margin-top: 8px; }
.dashboard-ui .panel, .dashboard-ui .cards > article { padding: 15px; }
.dashboard-ui .panel { margin-bottom: 12px; }
.dashboard-ui .panel-head { margin-bottom: 10px; }
.dashboard-ui .grid { gap: 12px; }
.dashboard-ui .rank-row { padding: 7px 0; }
.dashboard-ui th, .dashboard-ui td { padding: 8px 9px; }
.dashboard-ui .toolbar { margin-bottom: 10px; gap: 8px; }
.dashboard-ui input, .dashboard-ui textarea, .dashboard-ui select { padding: 8px 10px; }
.dashboard-ui .button, .dashboard-ui .icon-button { min-height: 34px; padding: 7px 11px; }
.dashboard-ui .page { transition: opacity .14s ease, transform .14s ease; }
.dashboard-ui .chart-point { opacity: 0; transition: opacity .12s ease, r .12s ease; }
.dashboard-ui .metric-chart:hover .chart-point, .dashboard-ui .metric-chart.chart-hovering .chart-point { opacity: .65; }
.dashboard-ui .metric-chart.chart-hovering .chart-point { opacity: 0; }
.dashboard-ui .metric-chart.chart-hovering .chart-point.active { opacity: 1; r: 4; }
.dashboard-ui .chart-hover-line { display: none; stroke: currentColor; stroke-width: 1; stroke-dasharray: 2 2; opacity: .7; vector-effect: non-scaling-stroke; pointer-events: none; }
.dashboard-ui .metric-chart.chart-hovering .chart-hover-line { display: block; }
.dashboard-ui .chart-tooltip { display: none; position: absolute; z-index: 3; top: 2px; min-width: 0; width: max-content; max-width: 112px; margin: 0; padding: 2px 4px; color: var(--ui-text); background: var(--ui-surface); border: 1px solid currentColor; border-radius: 3px; box-shadow: 0 2px 7px #0003; pointer-events: none; white-space: nowrap; }
.dashboard-ui .chart-tooltip strong, .dashboard-ui .chart-tooltip span { display: block; }
.dashboard-ui .chart-tooltip strong { display: block; margin: 0; font-size: 9px !important; line-height: 1.15; font-weight: 600; }
.dashboard-ui .chart-tooltip span { display: block; margin-top: 1px; color: var(--ui-muted); font-size: 7px !important; line-height: 1.1; }
.dashboard-ui .metric-chart.chart-hovering .chart-tooltip { display: block; }
.dashboard-ui tbody tr { transition: background-color .16s ease; }
.dashboard-ui .nav, .dashboard-ui .button, .dashboard-ui .icon-button, .dashboard-ui input, .dashboard-ui select, .dashboard-ui textarea { transition: color .16s ease, background-color .16s ease, border-color .16s ease, transform .16s ease; }
.auth-page .network-emblem::before { transform-origin: 50% 50%; animation: emblem-spin-cw 18s linear infinite; }
.auth-page .network-emblem::after { transform-origin: 50% 50%; animation: emblem-spin-ccw 11s linear infinite; }
@keyframes emblem-spin-cw { to { transform: rotate(360deg); } }
@keyframes emblem-spin-ccw { to { transform: rotate(-360deg); } }
@media (prefers-reduced-motion: reduce) {
  .auth-page .network-emblem::before, .auth-page .network-emblem::after { animation: none; }
  .dashboard-ui .page, .dashboard-ui tbody tr, .dashboard-ui .nav, .dashboard-ui .button, .dashboard-ui .icon-button { transition: none; }
}

.dashboard-ui .blocklist-refresh-status {
  margin: 14px 0;
  padding: 11px 14px;
  color: var(--ui-muted);
  background: var(--ui-panel, rgba(255,255,255,.035));
  border: 1px solid var(--ui-border);
  border-left: 3px solid var(--ui-accent);
  border-radius: 8px;
  font-size: .9rem;
  overflow-wrap: anywhere;
}

.dashboard-ui .blocklist-refresh-status.has-error {
  color: var(--ui-danger, #ff8391);
  border-left-color: var(--ui-danger, #ff6578);
}

.dashboard-ui .query-filter-link {
  display: inline;
  padding: 0;
  color: inherit;
  font: inherit;
  text-align: left;
  background: none;
  border: 0;
  border-bottom: 1px dotted transparent;
  cursor: pointer;
}

.dashboard-ui .query-filter-link:hover,
.dashboard-ui .query-filter-link:focus-visible {
  color: var(--ui-accent);
  border-bottom-color: currentColor;
  outline: none;
}

.dashboard-ui .query-source .copy-value-button {
  min-width: 22px;
  min-height: 22px;
  margin-inline-start: 3px;
  padding: 0 4px;
  vertical-align: middle;
}

.dashboard-ui .settings-save-status {
  color: var(--ui-muted);
  font-size: 11px;
  white-space: nowrap;
}

@media (max-width: 760px) {
}
@media (max-width: 900px) {
  .dashboard-ui main { margin-left: 0; padding: 16px 14px calc(92px + env(safe-area-inset-bottom)); }
  .dashboard-ui .panel, .dashboard-ui .cards > article { padding: 13px; }
}

/* Calm dashboard theme: neutral surfaces and restrained accents instead of the
   former cyber-console treatment. The system color preference remains the source
   of truth for both dashboard and authentication surfaces. */
.dashboard-ui {
  --ui-bg: #f6f8fa;
  --ui-surface: #ffffff;
  --ui-input: #f8fafc;
  --ui-border: #dbe3ea;
  --ui-text: #17212b;
  --ui-muted: #657482;
  --ui-accent: #1677a8;
  --ui-selected: #e7f3f8;
  color-scheme: light;
  background: var(--ui-bg);
  color: var(--ui-text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: normal;
}
.dashboard-ui .sidebar {
  width: 224px;
  padding: 20px 12px 16px;
  background: var(--ui-surface);
  border-right: 1px solid var(--ui-border);
  box-shadow: 2px 0 12px rgba(23, 33, 43, .04);
}
.dashboard-ui .logo { padding: 0 10px 24px; }
.dashboard-ui .logo-mark {
  width: 36px; height: 36px; border-radius: 8px;
  color: #fff; background: var(--ui-accent); border: 0; box-shadow: none;
}
.dashboard-ui .logo strong { color: var(--ui-text); letter-spacing: .02em; }
.dashboard-ui .logo small, .dashboard-ui .nav-title { color: var(--ui-muted); }
.dashboard-ui .nav-title { padding: 22px 12px 7px; letter-spacing: .08em; }
.dashboard-ui .nav {
  margin: 2px 0; min-height: 36px; padding: 8px 11px;
  color: var(--ui-muted); border-radius: 7px; font-size: 13px;
}
.dashboard-ui .nav:hover { color: var(--ui-text); background: #f1f5f8; border-color: transparent; }
.dashboard-ui .nav.active {
  color: var(--ui-accent); background: var(--ui-selected);
  border-color: transparent; box-shadow: none; font-weight: 600;
}
.dashboard-ui .nav.active::after { width: 6px; height: 6px; background: var(--ui-accent); }
.dashboard-ui main { margin-left: 224px; padding: 26px 32px 48px; }
.dashboard-ui header { border-color: var(--ui-border); padding-bottom: 18px; margin-bottom: 20px; }
.dashboard-ui h1 { font-size: 26px; font-weight: 650; letter-spacing: -.025em; }
.dashboard-ui h2 { font-size: 15px; font-weight: 650; letter-spacing: -.01em; }
.dashboard-ui #subtitle, .dashboard-ui .section-intro p, .dashboard-ui .form-panel > p { color: var(--ui-muted); }
.dashboard-ui .metrics { gap: 12px; }
.dashboard-ui .metrics article, .dashboard-ui .panel, .dashboard-ui .cards > article {
  background: var(--ui-surface); border: 1px solid var(--ui-border);
  border-radius: 10px; box-shadow: 0 2px 8px rgba(23, 33, 43, .035);
}
.dashboard-ui .metrics article { padding: 15px; }
.dashboard-ui .metrics article::before, .dashboard-ui .panel::before, .dashboard-ui .cards > article::before { display: none; }
.dashboard-ui .metrics article > span, .dashboard-ui .metrics article > small { color: var(--ui-muted); }
.dashboard-ui .metrics strong { font-size: 25px; }
.dashboard-ui .panel, .dashboard-ui .cards > article { padding: 18px; }
.dashboard-ui .panel-head { border-bottom: 1px solid var(--ui-border); padding-bottom: 11px; }
.dashboard-ui .panel h2::before { display: none; }
.dashboard-ui .rank-row { border-color: var(--ui-border); padding: 8px 0; }
.dashboard-ui .bar { height: 5px; background: #edf1f4; border-radius: 5px; }
.dashboard-ui .bar i { background: var(--ui-accent); box-shadow: none; border-radius: 5px; }
.dashboard-ui .blocked-list .bar i { background: var(--red); }
.dashboard-ui .table-wrap { border-color: var(--ui-border); border-radius: 8px; }
.dashboard-ui th { background: #f3f6f8; color: var(--ui-muted); border-color: var(--ui-border); }
.dashboard-ui td { border-color: var(--ui-border); }
.dashboard-ui tbody tr:nth-child(even) { background: #fafcfd; }
.dashboard-ui tbody tr:hover { background: var(--ui-selected); }
.dashboard-ui input, .dashboard-ui textarea, .dashboard-ui select {
  color: var(--ui-text); background: var(--ui-input); border-color: var(--ui-border); border-radius: 7px;
}
.dashboard-ui input:focus, .dashboard-ui textarea:focus, .dashboard-ui select:focus {
  outline: 2px solid color-mix(in srgb, var(--ui-accent) 28%, transparent);
  border-color: var(--ui-accent);
}
.dashboard-ui .button, .dashboard-ui .icon-button {
  color: var(--ui-text); background: var(--ui-surface); border-color: var(--ui-border);
  border-radius: 7px; font-weight: 550;
}
.dashboard-ui .button:hover, .dashboard-ui .icon-button:hover {
  color: var(--ui-accent); background: var(--ui-selected); border-color: #a9cbd9;
}
.dashboard-ui .button.primary { color: #fff; background: var(--ui-accent); border-color: var(--ui-accent); }
.dashboard-ui .button.primary:hover { color: #fff; background: #12658e; border-color: #12658e; }
.dashboard-ui .hint, .dashboard-ui .actionbar { background: var(--ui-surface); border-color: var(--ui-border); border-left-color: var(--ui-accent); }
.dashboard-ui dialog { background: var(--ui-surface); border-color: var(--ui-border); border-radius: 12px; }
.dashboard-ui .gafam-panel { margin-top: 12px; }
.dashboard-ui .gafam-center { background: var(--ui-surface); }

@media (prefers-color-scheme: dark) {
  .dashboard-ui {
    --ui-bg: #11171d;
    --ui-surface: #182129;
    --ui-input: #121a21;
    --ui-border: #2b3944;
    --ui-text: #e6edf2;
    --ui-muted: #9aaab6;
    --ui-accent: #58b9df;
    --ui-selected: #203844;
  }
  .dashboard-ui .sidebar { background: var(--ui-surface); box-shadow: 2px 0 12px #0002; }
  .dashboard-ui .logo-mark { color: #0f1a21; background: var(--ui-accent); }
  .dashboard-ui .nav:hover { background: #202c35; }
  .dashboard-ui .metrics article, .dashboard-ui .panel, .dashboard-ui .cards > article { box-shadow: 0 2px 10px #0003; }
  .dashboard-ui th { background: #202b33; }
  .dashboard-ui tbody tr:nth-child(even) { background: #141d24; }
  .dashboard-ui .bar { background: #27343d; }
}

.auth-page {
  color-scheme: light;
  background: #f6f8fa;
  color: #17212b;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
.auth-page::before { color: #657482; }
.auth-page .auth-card {
  background: #fff;
  border: 1px solid #dbe3ea;
  border-radius: 12px;
  box-shadow: 0 12px 35px rgba(23, 33, 43, .08);
}
.auth-page .auth-card::after { background: #1677a8; }
.auth-page .logo-mark { background: #1677a8; color: #fff; border: 0; border-radius: 8px; }
.auth-page .logo strong, .auth-page h1, .auth-page h2, .auth-page label { color: #17212b; }
.auth-page p, .auth-page .logo small, .auth-page .auth-caption { color: #657482; }
.auth-page input, .auth-page select, .auth-page textarea { background: #f8fafc; color: #17212b; border-color: #dbe3ea; border-radius: 7px; }
.auth-page input:focus, .auth-page select:focus, .auth-page textarea:focus { outline-color: #1677a8; border-color: #1677a8; }
.auth-page .button { background: #fff; color: #17212b; border-color: #dbe3ea; border-radius: 7px; }
.auth-page .button.primary { background: #1677a8; color: #fff; border-color: #1677a8; }
.auth-page .button:hover { background: #e7f3f8; color: #1677a8; border-color: #a9cbd9; }
.auth-page .button.primary:hover { background: #12658e; color: #fff; border-color: #12658e; }
.auth-page .network-emblem { border-color: #c6dce5; background: radial-gradient(circle, #e7f3f8, #fff 65%); box-shadow: none; }
.auth-page .network-emblem::before { border-color: #7fb9cc; }
.auth-page .network-emblem::after { border-color: #1677a8; box-shadow: 0 0 18px #1677a822, inset 0 0 18px #1677a811; }
.auth-page .network-emblem span { color: #12658e; text-shadow: none; }

@media (prefers-color-scheme: dark) {
  .auth-page { color-scheme: dark; background: #11171d; color: #e6edf2; }
  .auth-page::before { color: #9aaab6; }
  .auth-page .auth-card { background: #182129; border-color: #2b3944; box-shadow: 0 14px 38px #0004; }
  .auth-page .logo-mark { background: #203844; color: #58b9df; }
  .auth-page .logo strong, .auth-page h1, .auth-page h2, .auth-page label { color: #e6edf2; }
  .auth-page p, .auth-page .logo small, .auth-page .auth-caption { color: #9aaab6; }
  .auth-page input, .auth-page select, .auth-page textarea { background: #121a21; color: #e6edf2; border-color: #2b3944; }
  .auth-page .button { background: #182129; color: #e6edf2; border-color: #2b3944; }
  .auth-page .button.primary { background: #58b9df; color: #0f1a21; border-color: #58b9df; }
  .auth-page .button:hover { background: #203844; color: #58b9df; border-color: #58b9df; }
  .auth-page .button.primary:hover { background: #78c9e8; color: #0f1a21; border-color: #78c9e8; }
  .auth-page .network-emblem { border-color: #36505d; background: radial-gradient(circle, #203844, #121a21 65%); }
  .auth-page .network-emblem::before { border-color: #58b9df; }
  .auth-page .network-emblem::after { border-color: #58b9df; box-shadow: 0 0 18px #58b9df22, inset 0 0 18px #58b9df11; }
  .auth-page .network-emblem span { color: #bde8f5; }
}

/* Final neutral pass: remove remaining console/cyber ornament from the
   earlier theme layers while retaining the automatic light/dark palettes. */
.dashboard-ui {
  background-image: none;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
.dashboard-ui h1,
.dashboard-ui h2,
.dashboard-ui .metrics strong,
.dashboard-ui th,
.dashboard-ui .nav,
.dashboard-ui .button,
.dashboard-ui .icon-button,
.dashboard-ui .badge {
  font-family: inherit;
  text-transform: none;
  letter-spacing: normal;
}
.dashboard-ui h1 { font-size: 25px; font-weight: 650; }
.dashboard-ui .sidebar::before,
.dashboard-ui header::before,
.dashboard-ui header::after,
.dashboard-ui .header-title::before,
.dashboard-ui .panel > h2::before,
.dashboard-ui .metrics article::before,
.dashboard-ui .panel::before,
.dashboard-ui .cards > article::before {
  display: none;
}
.dashboard-ui .sidebar {
  border-radius: 0;
  background: var(--ui-surface);
  box-shadow: 2px 0 12px rgba(23, 33, 43, .04);
}
.dashboard-ui header {
  border-top: 0;
  padding-top: 0;
}
.dashboard-ui .metrics article,
.dashboard-ui .panel,
.dashboard-ui .cards > article {
  background-image: none;
}
.dashboard-ui .metrics strong {
  text-shadow: none;
}
.dashboard-ui .panel h2 {
  text-transform: none;
  letter-spacing: normal;
}
.dashboard-ui .button,
.dashboard-ui .icon-button {
  box-shadow: none;
}
.dashboard-ui .metric-chart svg {
  filter: none;
}
.dashboard-ui #user-role {
  color: var(--ui-text);
  border: 1px solid transparent;
  background:
    linear-gradient(var(--ui-surface), var(--ui-surface)) padding-box,
    linear-gradient(90deg, #ef476f, #f7b32b, #06d6a0, #118ab2, #8338ec, #ef476f) border-box;
  background-size: 100% 100%, 300% 100%;
  animation: role-badge-shift 4s linear infinite;
}
@keyframes role-badge-shift {
  from { background-position: 0 0, 0% 50%; }
  to { background-position: 0 0, 100% 50%; }
}
@media (prefers-reduced-motion: reduce) {
  .dashboard-ui #user-role { animation: none; }
}

@media (prefers-color-scheme: dark) {
  .dashboard-ui .sidebar { box-shadow: 2px 0 12px #0003; }
}

/* Clean administrative UI: this final visual layer intentionally overrides
   historical console treatments without changing the application structure. */
:is(.dashboard-ui, .auth-page) {
  --ui-bg: #f7f8fa;
  --ui-surface: #ffffff;
  --ui-input: #ffffff;
  --ui-border: #e4e7ec;
  --ui-text: #20242c;
  --ui-muted: #6b7280;
  --ui-accent: #5b4cdb;
  --ui-selected: #f0efff;
  color-scheme: light;
  background: var(--ui-bg);
  color: var(--ui-text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.dashboard-ui .sidebar {
  inset: 0 auto 0 0;
  width: 236px;
  padding: 24px 14px 18px;
  background: var(--ui-surface);
  border: 0;
  border-right: 1px solid var(--ui-border);
  border-radius: 0;
  box-shadow: none;
}
.dashboard-ui .logo { gap: 10px; padding: 0 10px 28px; }
.dashboard-ui .logo-mark,
:is(.dashboard-ui, .auth-page) .logo-mark {
  width: 34px;
  height: 34px;
  color: #fff;
  background: var(--ui-accent);
  border: 0;
  border-radius: 9px;
  box-shadow: none;
  font-family: inherit;
  font-size: 16px;
}
.dashboard-ui .logo strong { color: var(--ui-text); font-size: 14px; font-weight: 700; letter-spacing: -.02em; }
.dashboard-ui .logo small { color: var(--ui-muted); font-size: 11px; }
.dashboard-ui .nav-title { padding: 25px 11px 7px; color: #9aa0aa; font-size: 10px; font-weight: 650; letter-spacing: .06em; }
.dashboard-ui .nav {
  min-height: 38px;
  margin: 2px 0;
  padding: 8px 11px;
  color: #586170;
  border: 0;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 500;
}
.dashboard-ui .nav span { color: currentColor; }
.dashboard-ui .nav:hover { color: var(--ui-text); background: #f7f7fa; border: 0; }
.dashboard-ui .nav.active {
  color: var(--ui-accent);
  background: var(--ui-selected);
  border: 0;
  box-shadow: none;
  font-weight: 650;
}
.dashboard-ui .nav.active::after { display: none; }
.dashboard-ui .nav.sub { padding-left: 11px; }

.dashboard-ui main { margin-left: 236px; max-width: none; padding: 32px 40px 56px; }
.dashboard-ui header { min-height: 54px; margin-bottom: 26px; padding: 0 0 20px; border-color: var(--ui-border); }
.dashboard-ui .header-title::before { display: none; }
.dashboard-ui h1 { color: var(--ui-text); font-size: 25px; font-weight: 700; letter-spacing: -.035em; text-transform: none; }
.dashboard-ui h2 { color: var(--ui-text); font-size: 15px; font-weight: 650; letter-spacing: -.015em; }
.dashboard-ui #subtitle,
.dashboard-ui p,
.dashboard-ui .section-intro p { color: var(--ui-muted); }

.dashboard-ui .metrics { gap: 14px; margin-bottom: 20px; }
.dashboard-ui .metrics article,
.dashboard-ui .panel,
.dashboard-ui .cards > article {
  background: var(--ui-surface);
  background-image: none;
  border: 1px solid var(--ui-border);
  border-radius: 9px;
  box-shadow: none;
}
.dashboard-ui .metrics article { min-height: 128px; padding: 17px; }
.dashboard-ui .metrics article::before,
.dashboard-ui .panel::before,
.dashboard-ui .cards > article::before { display: none; }
.dashboard-ui .metrics article > span,
.dashboard-ui .metrics article > small { color: var(--ui-muted); font-size: 11px; letter-spacing: 0; text-transform: none; }
.dashboard-ui .metrics strong { margin: 10px 0 5px; color: var(--ui-text); font-size: 26px; text-shadow: none; }
.dashboard-ui .metrics strong.metric-total,
.dashboard-ui .metrics strong.metric-cached { color: var(--ui-text); }
.dashboard-ui .metrics .danger strong { color: #d84d58; }
.dashboard-ui .metrics .warning strong { color: #bc7614; }
.dashboard-ui .metric-chart { border-color: var(--ui-border); }
.dashboard-ui .heartbeat-line { display: none; }
.dashboard-ui .panel,
.dashboard-ui .cards > article { padding: 20px; }
.dashboard-ui .panel-head { margin-bottom: 14px; padding-bottom: 13px; border-bottom: 1px solid var(--ui-border); }
.dashboard-ui .rank-row { border-color: var(--ui-border); }
.dashboard-ui .bar { background: #eef0f4; }
.dashboard-ui .bar i { background: var(--ui-accent); box-shadow: none; }
.dashboard-ui .blocked-list .bar i { background: #dc5963; }
.dashboard-ui .gafam-center { background: var(--ui-surface); }
.dashboard-ui .gafam-center strong { color: var(--ui-text); font-family: inherit; }

.dashboard-ui .table-wrap { border: 1px solid var(--ui-border); border-radius: 8px; }
.dashboard-ui th { color: var(--ui-muted); background: #f8f9fb; border-color: var(--ui-border); font-size: 10px; font-weight: 650; letter-spacing: .04em; }
.dashboard-ui td { color: #3d4551; border-color: #edf0f2; }
.dashboard-ui tbody tr:nth-child(even) { background: #fcfcfd; }
.dashboard-ui tbody tr:hover { background: #f5f4ff; }
.dashboard-ui .badge { min-height: 23px; color: #586170; background: #f7f8fa; border: 1px solid var(--ui-border); border-radius: 999px; font-size: 10px; font-weight: 600; letter-spacing: 0; text-transform: none; }
.dashboard-ui .badge.good { color: #167347; background: #edf9f1; border-color: #ccebd8; }
.dashboard-ui .badge.blocked { color: #b4232e; background: #fff1f2; border-color: #ffd5da; }
.dashboard-ui .badge.servfail { color: #9a610c; background: #fff8e7; border-color: #f5dfab; }
.dashboard-ui .badge.cached { color: #226c9d; background: #edf7fd; border-color: #cde8f8; }
.dashboard-ui .badge.category { color: #b85b00; background: #fff3e8; border-color: #ff8a00; }
.dashboard-ui .badge.no-fsk18,
.dashboard-ui .badge.safesearch { color: #fff; background: #5b6472; border-color: #fff; box-shadow: 0 0 8px rgb(255 255 255 / 28%); text-shadow: 0 0 6px rgb(255 255 255 / 35%); }

.dashboard-ui input,
.dashboard-ui textarea,
.dashboard-ui select {
  color: var(--ui-text);
  background: var(--ui-input);
  border-color: #d8dde5;
  border-radius: 7px;
  box-shadow: none;
}
.dashboard-ui input:hover,
.dashboard-ui textarea:hover,
.dashboard-ui select:hover { border-color: #b9c1cc; }
.dashboard-ui input:focus,
.dashboard-ui textarea:focus,
.dashboard-ui select:focus { outline: 3px solid rgb(91 76 219 / 14%); outline-offset: 0; border-color: var(--ui-accent); }
.dashboard-ui label { color: #424a55; font-size: 12px; font-weight: 550; }
.dashboard-ui label small { color: var(--ui-muted); font-weight: 400; }
.dashboard-ui .button,
.dashboard-ui .icon-button {
  color: #3d4551;
  background: #fff;
  border-color: #d8dde5;
  border-radius: 7px;
  box-shadow: none;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
}
.dashboard-ui .button:hover,
.dashboard-ui .icon-button:hover { color: var(--ui-accent); background: #f7f6ff; border-color: #c8c2f1; }
.dashboard-ui .button.primary { color: #fff; background: var(--ui-accent); border-color: var(--ui-accent); }
.dashboard-ui .button.primary:hover { color: #fff; background: #493bc4; border-color: #493bc4; }
.dashboard-ui .danger-button { color: #bd3541; background: #fff; border-color: #f0c9cd; }
.dashboard-ui .danger-button:hover { color: #a32430; background: #fff4f5; border-color: #eaaab1; }
.dashboard-ui .hint,
.dashboard-ui .actionbar { color: #53606d; background: #f8f9fb; border: 1px solid var(--ui-border); border-left: 3px solid var(--ui-accent); border-radius: 7px; box-shadow: none; }
.dashboard-ui .warning-hint { color: #815b1a; background: #fffbf1; border-color: #f0e0b7; border-left-color: #d49a28; }
.dashboard-ui .notice { border-radius: 7px; }
.dashboard-ui dialog { color: var(--ui-text); background: #fff; border-color: var(--ui-border); border-radius: 10px; box-shadow: 0 18px 46px rgb(23 33 43 / 16%); }
.dashboard-ui dialog::backdrop { background: rgb(23 33 43 / 30%); backdrop-filter: blur(2px); }
.dashboard-ui #user-role { color: #4c3cc8; background: #f0efff; border-color: transparent; animation: none; }

.auth-page {
  display: grid;
  grid-template-columns: minmax(280px, 420px) minmax(380px, 500px);
  justify-content: center;
  align-items: center;
  gap: clamp(48px, 8vw, 120px);
  min-height: 100vh;
  padding: 48px 28px;
}
.auth-page::before { display: none; }
.auth-page .auth-intro { display: block; }
.auth-page .auth-eyebrow { color: var(--ui-accent); font-size: 11px; font-weight: 700; letter-spacing: .08em; }
.auth-page .auth-intro h2 { margin: 16px 0 12px; color: var(--ui-text); font-size: clamp(28px, 3vw, 40px); font-weight: 700; letter-spacing: -.045em; line-height: 1.12; }
.auth-page .auth-intro h2 span { color: var(--ui-accent); }
.auth-page .auth-intro p { max-width: 355px; color: var(--ui-muted); font-size: 15px; }
.auth-page .network-emblem { display: none; }
.auth-page .auth-caption { display: block; margin-top: 24px; color: var(--ui-muted); font-size: 11px; font-weight: 600; letter-spacing: .06em; }
.auth-page main.auth-card {
  width: 100%;
  margin: 0;
  padding: 32px;
  background: #fff;
  border: 1px solid var(--ui-border);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgb(23 33 43 / 7%);
}
.auth-page .auth-card::after { display: none; }
.auth-page .auth-card .logo { padding-bottom: 28px; }
.auth-page .auth-card h1 { color: var(--ui-text); font-size: 25px; font-weight: 700; letter-spacing: -.035em; text-transform: none; }
.auth-page .auth-card h2,
.auth-page .auth-card h3,
.auth-page .auth-card label { color: #424a55; }
.auth-page .auth-card p,
.auth-page .auth-card small { color: var(--ui-muted); }
.auth-page input,
.auth-page textarea,
.auth-page select { color: var(--ui-text); background: #fff; border-color: #d8dde5; border-radius: 7px; }
.auth-page input:focus,
.auth-page textarea:focus,
.auth-page select:focus { outline: 3px solid rgb(91 76 219 / 14%); outline-offset: 0; border-color: var(--ui-accent); }
.auth-page .button { color: #3d4551; background: #fff; border-color: #d8dde5; border-radius: 7px; box-shadow: none; font-weight: 600; text-transform: none; }
.auth-page .button.primary { color: #fff; background: var(--ui-accent); border-color: var(--ui-accent); }
.auth-page .button:hover { color: var(--ui-accent); background: #f7f6ff; border-color: #c8c2f1; }
.auth-page .button.primary:hover { color: #fff; background: #493bc4; border-color: #493bc4; }
.auth-page .setup-section { border-color: var(--ui-border); }
.auth-page .step { color: var(--ui-accent); background: var(--ui-selected); border: 0; border-radius: 50%; box-shadow: none; }
.auth-page .security-note { color: #53606d; background: #f8f9fb; border: 1px solid var(--ui-border); border-left: 3px solid var(--ui-accent); border-radius: 7px; }
.auth-page .optional { color: var(--ui-muted); border-color: var(--ui-border); border-radius: 999px; text-transform: none; }

@media (max-width: 900px) {
  .dashboard-ui .sidebar { inset: 0 auto 0 0; width: min(310px, 88vw); padding: 20px 13px calc(18px + env(safe-area-inset-bottom)); border-right: 1px solid var(--ui-border); border-radius: 0; }
  .dashboard-ui main { margin-left: 0; padding: 22px 20px 44px; }
  .auth-page { grid-template-columns: minmax(0, 500px); padding: 32px 18px; }
  .auth-page .auth-intro { display: none; }
}

@media (max-width: 620px) {
  .dashboard-ui main { padding: 18px 12px 34px; }
  .dashboard-ui header { margin-bottom: 18px; }
  .dashboard-ui .panel,
  .dashboard-ui .cards > article { padding: 14px; }
  .dashboard-ui .metrics article { padding: 14px; }
  .auth-page { display: block; padding: 22px 12px; }
  .auth-page main.auth-card { padding: 24px 18px; }
}

@media (prefers-color-scheme: dark) {
  :is(.dashboard-ui, .auth-page) {
    --ui-bg: #000;
    --ui-surface: #202126;
    --ui-input: #292a30;
    --ui-border: #363840;
    --ui-text: #f1f2f4;
    --ui-muted: #a5a8b1;
    --ui-accent: #8b7df0;
    --ui-selected: #302d52;
    color-scheme: dark;
  }
  .dashboard-ui,
  .auth-page { background: #000; }

  .dashboard-ui .sidebar { background: #1c1d22; border-color: var(--ui-border); }
  .dashboard-ui .logo-mark,
  :is(.dashboard-ui, .auth-page) .logo-mark { background: var(--ui-accent); color: #181628; }
  .dashboard-ui .nav { color: #b8bac2; }
  .dashboard-ui .nav:hover { color: var(--ui-text); background: #292a31; }
  .dashboard-ui .nav.active { color: #d8d3ff; background: var(--ui-selected); }
  .dashboard-ui td { color: #d4d6dc; border-color: #303139; }
  .dashboard-ui th { background: #292a30; }
  .dashboard-ui tbody tr:nth-child(even) { background: #1d1e23; }
  .dashboard-ui tbody tr:hover { background: #29263f; }
  .dashboard-ui .bar { background: #363740; }
  .dashboard-ui input,
  .dashboard-ui textarea,
  .dashboard-ui select { border-color: #454750; }
  .dashboard-ui .button,
  .dashboard-ui .icon-button { color: #dfe1e6; background: #292a30; border-color: #454750; }
  .dashboard-ui .button:hover,
  .dashboard-ui .icon-button:hover { color: #d8d3ff; background: #302d52; border-color: #6259a8; }
  .dashboard-ui .button.primary { color: #181628; background: var(--ui-accent); border-color: var(--ui-accent); }
  .dashboard-ui .button.primary:hover { color: #181628; background: #a398f5; border-color: #a398f5; }
  .dashboard-ui .danger-button { color: #ffb5bc; background: #2b2226; border-color: #694249; }
  .dashboard-ui .danger-button:hover { color: #ffd9dd; background: #42282e; border-color: #9b5660; }
  .dashboard-ui .hint,
  .dashboard-ui .actionbar { color: #c2c5cc; background: #25262c; border-color: var(--ui-border); }
  .dashboard-ui .warning-hint { color: #e4c783; background: #2d291f; border-color: #635637; }
  .dashboard-ui .badge { color: #c4c7ce; background: #292a30; border-color: #454750; }
  .dashboard-ui .badge.good { color: #8ee0ad; background: #213329; border-color: #3b6749; }
  .dashboard-ui .badge.blocked { color: #ffb1b9; background: #392328; border-color: #70414a; }
  .dashboard-ui .badge.servfail { color: #f0cf86; background: #3a3020; border-color: #755e32; }
  .dashboard-ui .badge.cached { color: #9bd7ff; background: #1f313e; border-color: #3d6178; }
  .dashboard-ui .badge.category { color: #ffb25c; background: #211408; border-color: #ff8a00; }
  .dashboard-ui .badge.no-fsk18,
  .dashboard-ui .badge.safesearch { color: #fff; background: #242932; border-color: #fff; box-shadow: 0 0 9px rgb(255 255 255 / 30%); text-shadow: 0 0 7px rgb(255 255 255 / 45%); }
  .dashboard-ui dialog { background: var(--ui-surface); border-color: var(--ui-border); }
  .dashboard-ui #user-role { color: #d8d3ff; background: var(--ui-selected); }

  .auth-page main.auth-card { background: var(--ui-surface); border-color: var(--ui-border); box-shadow: 0 12px 32px rgb(0 0 0 / 24%); }
  .auth-page .auth-intro h2,
  .auth-page .auth-card h1 { color: var(--ui-text); }
  .auth-page .auth-card h2,
  .auth-page .auth-card h3,
  .auth-page .auth-card label { color: #dfe1e6; }
  .auth-page input,
  .auth-page textarea,
  .auth-page select { color: var(--ui-text); background: var(--ui-input); border-color: #454750; }
  .auth-page .button { color: #dfe1e6; background: #292a30; border-color: #454750; }
  .auth-page .button.primary { color: #181628; background: var(--ui-accent); border-color: var(--ui-accent); }
  .auth-page .button:hover { color: #d8d3ff; background: var(--ui-selected); border-color: #6259a8; }
  .auth-page .button.primary:hover { color: #181628; background: #a398f5; border-color: #a398f5; }
  .auth-page .step { color: #d8d3ff; background: var(--ui-selected); }
  .auth-page .security-note { color: #c2c5cc; background: #25262c; border-color: var(--ui-border); border-left-color: var(--ui-accent); }
  .auth-page .optional { border-color: #454750; }
}
:is(.dashboard-ui, .auth-page) {
  color-scheme: dark;
  --ui-bg: #000; --ui-surface: #090f19; --ui-input: #050910;
  --ui-border: #1e2b3e; --ui-text: #e5eefb; --ui-muted: #94a5bd;
  --ui-accent: #41d9fa; --ui-selected: #102234;
  background: #000; color: var(--ui-text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
.dashboard-ui .sidebar {
  inset: 16px auto 16px 16px; width: 216px; padding: 24px 12px 16px;
  background: linear-gradient(165deg, #0d1522, #05090f 70%);
  border: 1px solid #1e2b3e; border-radius: 16px;
}
:is(.dashboard-ui, .auth-page) .logo-mark {
  background: linear-gradient(145deg, #103b50, #181333); color: #69e3ff;
  border: 1px solid #346078; border-radius: 12px; box-shadow: inset 0 0 18px #38c9ff12;
  font-family: monospace;
}
.dashboard-ui .logo { gap: 10px; padding: 0 9px 30px; }
.dashboard-ui .sidebar nav { min-height: 0; overflow-y: auto; flex: 1; scrollbar-width: thin; }
.dashboard-ui .logo strong { letter-spacing: .09em; font-size: 12px; }
.dashboard-ui .nav { border-radius: 8px; margin-block: 5px; font-size: 12px; }
.dashboard-ui .nav.active {
  background: linear-gradient(90deg, #122e43, #151630);
  border: 1px solid #29445e; color: #adf0ff;
  box-shadow: inset 3px 0 #41d9fa;
}
.dashboard-ui .nav span { display: inline-grid; place-items: center; }
.dashboard-ui .nav span svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.dashboard-ui .nav-title { font-size: 9px; letter-spacing: .18em; padding-top: 26px; }
.dashboard-ui main { margin-left: 248px; padding: 26px 28px 48px; }
.dashboard-ui header { border-bottom: 1px solid #1e2b3e; padding-bottom: 24px; margin-bottom: 20px; }
.dashboard-ui .header-title::before { content: ""; width: 3px; align-self: stretch; background: linear-gradient(#41d9fa, #8764ff); border-radius: 3px; }
.dashboard-ui h1 { font-size: 29px; font-weight: 600; letter-spacing: -.04em; }
.dashboard-ui #subtitle { color: #8f9fb6; font-size: 12px; }
.dashboard-ui .header-actions .button { font-size: 11px; }
.dashboard-ui .metrics { gap: 12px; }
.dashboard-ui .metrics article, .dashboard-ui .panel, .dashboard-ui .cards > article {
  background: linear-gradient(145deg, #101927, #080d16 72%);
  border: 1px solid #1c2a3d; border-radius: 12px;
  box-shadow: inset 0 1px #ffffff04;
}
.dashboard-ui .metrics article { padding: 18px 15px 12px; }
.dashboard-ui .metrics article::before { content: ""; inset: 0 18px auto; height: 1px; background: linear-gradient(90deg, #41d9fa90, #8566ff50, transparent); }
.dashboard-ui .metrics article > span { font-size: 10px; letter-spacing: .09em; }
.dashboard-ui .panel h2, .dashboard-ui .section-intro h2 { color: #dceaff; font-weight: 550; }
.dashboard-ui .panel .panel-head { padding-bottom: 12px; border-bottom: 1px solid #1e2b3e; }
.dashboard-ui .rank-row { padding-block: 9px; border-color: #1a2738; }
.dashboard-ui .table-wrap { border-color: #1b293b; border-radius: 8px; }
.dashboard-ui th { background: #080e18; font-size: 9px; letter-spacing: .12em; color: #93a8c3; }
.dashboard-ui td { font-size: 12px; border-color: #182333; }
.dashboard-ui .badge { border-radius: 4px; font-size: 9px; letter-spacing: .06em; }
:is(.dashboard-ui, .auth-page) .button.primary {
  background: linear-gradient(110deg, #40dafa, #65aeff); color: #03141f;
  border: 1px solid #73dbff; box-shadow: 0 3px 16px #24caff12;
}
:is(.dashboard-ui, .auth-page) input:focus, :is(.dashboard-ui, .auth-page) select:focus, :is(.dashboard-ui, .auth-page) textarea:focus { outline: 2px solid #41d9fa; outline-offset: 2px; }
.dashboard-ui .actionbar { background: #0b1320; border-color: #294059; box-shadow: 0 8px 32px #0008; }
.dashboard-ui dialog { background: linear-gradient(150deg, #111c2c, #080d16); border-color: #2a405b; }
.dashboard-ui .switch span { border-radius: 20px; background: #070c14; border-color: #30405a; }
.dashboard-ui .switch span::after { border-radius: 50%; }
.dashboard-ui .switch input:checked + span { background: #123542; border-color: #41d9fa; }
.dashboard-ui .switch input:checked + span::after { background: #41d9fa; }

/* Authentication has its own editorial layout, using the existing forms. */
.auth-page { display: grid; grid-template-columns: minmax(300px, 1fr) minmax(360px, 460px); gap: 7vw; align-items: center; max-width: 1240px; margin: auto; padding: 72px 48px; min-height: 100dvh; }
.auth-page::before { content: "MRHO / NETWORK CONSOLE"; top: 24px; left: 32px; font-size: 10px; color: #8496af; }
.auth-page .auth-card { width: 100%; padding: 32px; border-radius: 16px; background: linear-gradient(145deg, #111c2a, #080d16 80%); border: 1px solid #293b53; box-shadow: 0 20px 80px #0008; }
.auth-page .auth-card::after { background: #41d9fa; right: 20px; top: 20px; width: 5px; height: 5px; }
.auth-page .auth-card h1 { font-size: 28px; font-weight: 550; }
.auth-page .auth-card .logo { padding-bottom: 30px; }
.login-holzmannhilft-logo { position: fixed; z-index: 2; top: max(24px, calc(50dvh - 350px)); left: 50%; width: min(310px, calc(100dvw - 48px)); aspect-ratio: 1101 / 78; transform: translateX(-50%); pointer-events: none; }
.login-holzmannhilft-logo img { display: block; width: 100%; height: 100%; }
.login-holzmannhilft-logo .login-holzmannhilft-white { display: none; }
.auth-page .auth-card > p { font-size: 13px; color: #94a5bd; }
.auth-page .auth-card label { margin-block: 18px; font-size: 12px; }
.auth-page .auth-card input, .auth-page .auth-card select { background: #050a12; border-color: #293b53; margin-top: 7px; }
.auth-intro { min-width: 0; }
.auth-eyebrow { display: block; font-family: monospace; font-size: 11px; color: #41d9fa; letter-spacing: .2em; margin-bottom: 24px; }
.auth-intro h2 { font-size: clamp(36px, 4.5vw, 62px); line-height: 1.07; letter-spacing: -.05em; font-weight: 550; margin: 0 0 24px; }
.auth-intro h2 span { color: #65dafa; }
.auth-intro p { max-width: 360px; font-size: 14px; line-height: 1.8; color: #94a5bd; }
.network-emblem { position: relative; display: grid; place-items: center; width: 240px; height: 240px; margin: 34px 0; border: 1px solid #183144; border-radius: 50%; background: radial-gradient(circle, #15304760, transparent 68%); }
.network-emblem::before { content: ""; position: absolute; inset: 23px; border: 1px dashed #285165; border-radius: 50%; }
.network-emblem::after { content: ""; position: absolute; inset: 51px; border: 1px solid #41d9fa; border-bottom-color: #8764ff; border-radius: 28px; transform: rotate(45deg); box-shadow: 0 0 30px #41d9fa12, inset 0 0 24px #8764ff0d; }
.network-emblem span { color: #cef5ff; font-family: monospace; font-size: 23px; letter-spacing: .16em; }
.auth-caption { font-family: monospace; color: #7b8fa9; font-size: 10px; letter-spacing: .1em; }
.auth-page.setup-page { max-width: 1440px; grid-template-columns: 300px minmax(0, 1fr); align-items: start; gap: 48px; }
.setup-page .auth-intro { position: sticky; top: 72px; }
.setup-page .auth-intro h2 { font-size: 40px; }
.setup-page .setup-section { grid-template-columns: 36px minmax(0, 1fr); gap: 16px; border-color: #25354b; padding-block: 26px; }
.setup-page .step { width: 32px; height: 32px; color: #41d9fa; background: #0c2331; border: 1px solid #2a4b62; font-family: monospace; }
.setup-page .step-content h2 { font-size: 16px; }
.setup-page .step-content h3 { font-size: 13px; color: #94a5bd; }
.setup-page .security-note { border-left-color: #8764ff; }
@media (max-width: 1100px) { .auth-page { gap: 36px; padding-inline: 28px; } .auth-page.setup-page { grid-template-columns: 220px minmax(0, 1fr); gap: 28px; } .setup-page .auth-intro h2 { font-size: 32px; } }
@media (max-width: 900px) {
  .dashboard-ui .sidebar { inset: 0 auto 0 0; width: min(290px, 88vw); border-radius: 0 16px 16px 0; }
  .dashboard-ui main { margin-left: 0; padding: 20px 16px; }
  .auth-page, .auth-page.setup-page { display: flex; flex-direction: column; align-items: stretch; max-width: 720px; gap: 24px; padding: 70px 24px 32px; }
  .auth-page .auth-intro { position: static; }
  .auth-intro h2, .setup-page .auth-intro h2 { font-size: 34px; margin-bottom: 12px; }
  .auth-intro .network-emblem, .auth-caption { display: none; }
  .auth-eyebrow { margin-bottom: 12px; }
  .auth-intro p { max-width: none; }
}
@media (max-width: 620px) {
  .dashboard-ui main { padding: 16px 12px; }
  .dashboard-ui h1 { font-size: 25px; }
  .dashboard-ui .metrics article { padding: 13px 11px; }
  .auth-page, .auth-page.setup-page { padding: 64px 16px 24px; }
  .auth-page .auth-card { padding: 24px 18px; }
  .auth-page::before { left: 18px; font-size: 9px; }
  .login-holzmannhilft-logo { top: 46px; width: min(250px, calc(100dvw - 48px)); }
  .setup-page .setup-section { grid-template-columns: 1fr; gap: 12px; }
}

@media (prefers-color-scheme: dark) {
  .login-holzmannhilft-logo .login-holzmannhilft-white { display: block; position: absolute; inset: 0; filter: brightness(0) invert(1); clip-path: inset(0 28.2% 0 0); }
}

/* Instrument-panel framing: all ornament is static and carries no live data. */
:is(.dashboard-ui, .auth-page) { --ui-accent: #48edff; --ui-border: #224656; --ui-selected: #07303e; }
.dashboard-ui .sidebar {
  border-radius: 2px; border-color: #285364;
  background: linear-gradient(90deg, #07151d, #02080d);
  box-shadow: inset 3px 0 #0c2835, 0 0 22px #17dfff08;
}
.dashboard-ui .sidebar::before { content: ""; position: absolute; top: -1px; left: 12px; width: 70px; height: 2px; background: #48edff; box-shadow: 0 0 9px #48edff66; }
.dashboard-ui .logo strong { color: #c4f7ff; letter-spacing: .15em; }
.dashboard-ui .nav { font-family: "SFMono-Regular", Consolas, monospace; border-radius: 0; font-size: 11px; }
.dashboard-ui .nav.active { background: linear-gradient(90deg, #0c3946, #07121c); border-color: #367182; box-shadow: inset 3px 0 #48edff; }
.dashboard-ui header { position: relative; border-top: 1px solid #244652; border-bottom-color: #244652; padding-top: 16px; }
.dashboard-ui header::before { content: ""; position: absolute; left: 0; top: -2px; width: 94px; height: 3px; background: #48edff; box-shadow: 0 0 12px #48edff66; }
.dashboard-ui header::after { content: ""; position: absolute; right: 0; bottom: -2px; width: 120px; height: 3px; background: repeating-linear-gradient(90deg, #48edff 0 20px, transparent 20px 28px); }
.dashboard-ui h1 { font-family: "SFMono-Regular", Consolas, monospace; font-size: 26px; letter-spacing: .08em; text-transform: uppercase; color: #ccf8ff; }
.dashboard-ui .header-title::before { display: none; }
.dashboard-ui .metrics article, .dashboard-ui .panel, .dashboard-ui .cards > article, .auth-page .auth-card {
  border-radius: 2px; border: 1px solid #244757;
  background-color: #030a10;
  background-image: linear-gradient(90deg, #48edff99 18px, transparent 18px), linear-gradient(#48edff99 18px, transparent 18px), linear-gradient(270deg, #48edff88 18px, transparent 18px), linear-gradient(0deg, #48edff88 18px, transparent 18px), linear-gradient(140deg, #0c202c88, #02070c 70%);
  background-size: 100% 1px, 1px 100%, 100% 1px, 1px 100%, 100% 100%;
  background-position: top left, top left, bottom right, bottom right, center;
  background-repeat: no-repeat;
  box-shadow: inset 0 0 24px #14bdff04, 0 0 12px #14bdff05;
}
.dashboard-ui .metrics article::before { inset: 5px 6px auto auto; width: 30px; height: 3px; background: repeating-linear-gradient(90deg, #3ba4b9 0 3px, transparent 3px 6px); }
.dashboard-ui .metrics article > span { font-family: monospace; letter-spacing: .12em; color: #92c3d3; }
.dashboard-ui .panel h2 { font-family: monospace; text-transform: uppercase; letter-spacing: .08em; font-size: 13px; color: #a6ecf7; }
.dashboard-ui .panel > h2::before { content: ""; display: inline-block; width: 5px; height: 10px; margin-right: 9px; background: #48edff; vertical-align: -1px; }
.dashboard-ui .table-wrap { border-radius: 0; border-color: #1d3a49; }
.dashboard-ui th { font-family: monospace; background: #081923; color: #8cb8c8; }
.dashboard-ui .button, .dashboard-ui .icon-button, .auth-page .button { border-radius: 2px; font-family: monospace; letter-spacing: .04em; }
:is(.dashboard-ui, .auth-page) .button.primary { background: #08323f; color: #8df4ff; border-color: #3acadd; box-shadow: inset 0 0 14px #48edff0d; }
:is(.dashboard-ui, .auth-page) .button.primary:hover { background: #105164; color: #fff; }
.dashboard-ui input, .dashboard-ui select, .dashboard-ui textarea, .auth-page .auth-card input, .auth-page .auth-card select { border-radius: 2px; border-color: #284654; background: #02090f; }
.dashboard-ui .hint, .dashboard-ui .actionbar, .dashboard-ui dialog { border-radius: 2px; }
.auth-page .auth-intro h2 { font-family: monospace; font-weight: 500; font-size: clamp(30px, 3.8vw, 49px); letter-spacing: -.045em; }
.auth-page .auth-eyebrow { color: #48edff; border-top: 2px solid #48edff; padding-top: 12px; width: fit-content; }
.auth-page .auth-card h1 { font-family: monospace; font-size: 25px; letter-spacing: -.02em; }
.auth-page .network-emblem {
  width: 280px; height: 280px; border: 1px solid #307382;
  background: repeating-conic-gradient(from 0deg, #39e4ff55 0deg 1deg, transparent 1deg 10deg), radial-gradient(circle, #082e3c 0 34%, #02090f 35% 54%, #103441 55% 56%, #02090f 57% 66%, transparent 67%);
  box-shadow: 0 0 32px #00cfff12, inset 0 0 28px #00cfff12;
}
.auth-page .network-emblem::before { inset: 22px; border: 2px solid #55eaff; border-left-color: #c48742; border-right-color: #285263; box-shadow: 0 0 12px #24dfff30; }
.auth-page .network-emblem::after { inset: 72px; border-radius: 50%; border-color: #48edff; background: radial-gradient(circle, #35dcff18, transparent); box-shadow: 0 0 25px #41d9fa44, inset 0 0 22px #41d9fa33; }
.auth-page .network-emblem span { z-index: 1; color: #beffff; font-size: 24px; text-shadow: 0 0 12px #41d9fa; }
.auth-page .step { border-radius: 0; }
@media (max-width: 1100px) { .setup-page .network-emblem { width: 200px; height: 200px; } .setup-page .network-emblem::after { inset: 50px; } }
@media (max-width: 620px) { .dashboard-ui h1 { font-size: 21px; } .auth-page .auth-intro h2 { font-size: 30px; } }

.dashboard-ui {
  --green: #39ff88;
  --cyan: #21e7ff;
  --red: #ff3b81;
  --amber: #ffb52e;
}

.dashboard-ui .metrics strong.metric-total {
  color: #39ff88;
  text-shadow: none;
}

.dashboard-ui .metrics strong.metric-cached {
  color: #21e7ff;
  text-shadow: none;
}

.dashboard-ui .metrics .danger strong {
  color: #ff3b81;
  text-shadow: none;
}

.dashboard-ui .metrics .warning strong {
  color: #ffb52e;
  text-shadow: none;
}

.dashboard-ui .metric-chart svg path,
.dashboard-ui .metric-chart svg polyline {
  filter: none;
}

.dashboard-ui .badge.good {
  color: #39ff88;
  background: #062619;
  border-color: #1c9d5d;
  box-shadow: 0 0 8px #39ff8830;
}

.dashboard-ui .badge.cached {
  color: #21e7ff;
  background: #052631;
  border-color: #168fa2;
  box-shadow: 0 0 8px #21e7ff30;
}

.dashboard-ui .badge.blocked {
  color: #ff3b81;
  background: #2b0718;
  border-color: #a41f55;
  box-shadow: 0 0 8px #ff3b8130;
}

.dashboard-ui .badge.category {
  color: #ffb25c;
  background: #211408;
  border-color: #ff8a00;
  box-shadow: 0 0 8px #ff8a0030;
}

.dashboard-ui .badge.no-fsk18,
.dashboard-ui .badge.safesearch {
  color: #fff;
  background: #181d27;
  border-color: #fff;
  box-shadow: 0 0 10px #ffffff45;
  text-shadow: 0 0 8px #ffffff78;
}

.dashboard-ui .badge.servfail {
  color: #ffb52e;
  background: #2d1a04;
  border-color: #a86d0c;
  box-shadow: 0 0 8px #ffb52e30;
}

#query-body tr.query-new,
#recent-body tr.query-new {
  --query-flash: 57,255,136;
}

#query-body tr.query-new-cached,
#recent-body tr.query-new-cached {
  --query-flash: 33,231,255;
}

#query-body tr.query-new-blocked,
#recent-body tr.query-new-blocked {
  --query-flash: 255,59,129;
}

#query-body tr.query-new-failed,
#recent-body tr.query-new-failed {
  --query-flash: 255,181,46;
}

/* Follow the OS appearance live; the existing dark theme above stays unchanged. */
@media (prefers-color-scheme: light) {
  :is(.dashboard-ui, .auth-page) {
    color-scheme: light;
    --ui-bg: #fff; --ui-surface: #fff; --ui-input: #f4f8fb;
    --ui-border: #b9cdd8; --ui-text: #152c3b; --ui-muted: #526b7c;
    --ui-accent: #00778e; --ui-selected: #e3f4f8;
    --text: #152c3b; --muted: #526b7c;
    --green: #087943; --cyan: #00778e; --red: #be2258; --amber: #946000;
    background: var(--ui-bg); color: var(--ui-text);
  }
  .dashboard-ui .sidebar {
    background: linear-gradient(90deg, #f1f8fb, #fff);
    border-color: var(--ui-border); box-shadow: inset 3px 0 #d9edf4;
  }
  :is(.dashboard-ui, .auth-page) .logo-mark {
    background: #e3f4f8; color: #00778e; border-color: #a4c9d6; box-shadow: none;
  }
  .dashboard-ui .logo strong, .dashboard-ui h1,
  .dashboard-ui .panel h2, .dashboard-ui .section-intro h2 { color: #153d51; }
  .dashboard-ui #subtitle, .dashboard-ui .metrics article > span,
  .auth-page::before, .auth-page .auth-card > p, .auth-page p,
  .auth-page .logo small, .auth-page .auth-caption,
  .auth-page .step-content small, .setup-page .step-content h3 { color: var(--ui-muted); }
  .dashboard-ui .nav.active {
    background: linear-gradient(90deg, #d9f0f6, #f4fafc);
    border-color: #9fc5d3; color: #006b82; box-shadow: inset 3px 0 #008aa5;
  }
  .dashboard-ui .nav.active span { color: inherit; }
  .dashboard-ui header, .dashboard-ui .panel .panel-head,
  .dashboard-ui .rank-row, .dashboard-ui .table-wrap,
  .dashboard-ui td, .dashboard-ui .metric-chart { border-color: var(--ui-border); }
  .dashboard-ui .metrics article, .dashboard-ui .panel,
  .dashboard-ui .cards > article, .auth-page .auth-card {
    border-color: var(--ui-border); background-color: #fff;
    background-image: linear-gradient(90deg, #008aa5 18px, transparent 18px), linear-gradient(#008aa5 18px, transparent 18px), linear-gradient(270deg, #008aa5 18px, transparent 18px), linear-gradient(0deg, #008aa5 18px, transparent 18px), linear-gradient(140deg, #f0f8fc, #fff 70%);
    box-shadow: 0 4px 18px #173c5010;
  }
  .dashboard-ui th { background: #eaf3f8; color: #466274; }
  .dashboard-ui .metric-chart > span { color: var(--ui-muted); }
  .dashboard-ui .bar { background: #e2edf3; }
  :is(.dashboard-ui, .auth-page) input,
  :is(.dashboard-ui, .auth-page) select,
  :is(.dashboard-ui, .auth-page) textarea,
  .auth-page .auth-card input, .auth-page .auth-card select {
    background: var(--ui-input); color: var(--ui-text); border-color: var(--ui-border);
  }
  :is(.dashboard-ui, .auth-page) input::placeholder,
  :is(.dashboard-ui, .auth-page) textarea::placeholder { color: #617889; opacity: 1; }
  .auth-page label { color: var(--ui-text); }
  :is(.dashboard-ui, .auth-page) input:focus,
  :is(.dashboard-ui, .auth-page) select:focus,
  :is(.dashboard-ui, .auth-page) textarea:focus { outline-color: #00778e; border-color: #00778e; }
  :is(.dashboard-ui, .auth-page) .button.primary {
    background: #00778e; color: #fff; border-color: #00778e; box-shadow: none;
  }
  :is(.dashboard-ui, .auth-page) .button.primary:hover { background: #005c71; color: #fff; border-color: #005c71; }
  .dashboard-ui .actionbar, .dashboard-ui dialog {
    background: #fff; border-color: var(--ui-border); box-shadow: 0 12px 36px #173c5020;
  }
  .dashboard-ui .switch span { background: #e2edf3; border-color: #94adbc; }
  .dashboard-ui .switch span::after { background: #617889; }
  .dashboard-ui .switch input:checked + span { background: #daf0f5; border-color: #00778e; }
  .dashboard-ui .switch input:checked + span::after { background: #00778e; }
  .dashboard-ui .metrics strong.metric-total { color: var(--green); }
  .dashboard-ui .metrics strong.metric-cached { color: var(--cyan); }
  .dashboard-ui .metrics .danger strong { color: var(--red); }
  .dashboard-ui .metrics .warning strong { color: var(--amber); }
  .dashboard-ui .badge { background: #edf3f7; color: #40596a; border-color: #bcced9; }
  .dashboard-ui .badge.good { color: #087943; background: #e7f8ee; border-color: #8dcba8; box-shadow: none; }
  .dashboard-ui .badge.cached { color: #00778e; background: #e3f7fc; border-color: #87c6d5; box-shadow: none; }
  .dashboard-ui .badge.blocked { color: #be2258; background: #fff0f5; border-color: #e5a0ba; box-shadow: none; }
  .dashboard-ui .badge.category { color: #b85b00; background: #fff3e8; border-color: #ff8a00; box-shadow: none; }
  .dashboard-ui .badge.no-fsk18,
  .dashboard-ui .badge.safesearch { color: #fff; background: #5b6472; border-color: #fff; box-shadow: 0 0 8px rgb(255 255 255 / 28%); text-shadow: 0 0 6px rgb(255 255 255 / 35%); }
  .dashboard-ui .badge.servfail { color: #946000; background: #fff5df; border-color: #dab96e; box-shadow: none; }
  .auth-page .auth-intro h2 span, .auth-page .auth-eyebrow { color: #00778e; }
  .auth-page .auth-eyebrow { border-color: #008aa5; }
  .auth-page .setup-section { border-color: var(--ui-border); }
  .auth-page .step { background: #e3f4f8; color: #00778e; border-color: #a4c9d6; }
  .auth-page .optional { color: var(--ui-muted); border-color: var(--ui-border); }
  .auth-page .security-note { background: #f0f7fb; color: #466274; border-color: var(--ui-border); border-left-color: #00778e; }
  .auth-page .network-emblem {
    border-color: #a4c9d6;
    background: repeating-conic-gradient(from 0deg, #008aa540 0deg 1deg, transparent 1deg 10deg), radial-gradient(circle, #daf2f8 0 34%, #fff 35% 54%, #b8dde8 55% 56%, #f4fafc 57% 66%, transparent 67%);
    box-shadow: none;
  }
  .auth-page .network-emblem::before { border-color: #008aa5; border-left-color: #a46924; border-right-color: #9abcc9; box-shadow: none; }
  .auth-page .network-emblem::after { border-color: #008aa5; background: radial-gradient(circle, #008aa51a, transparent); box-shadow: none; }
  .auth-page .network-emblem span { color: #006b82; text-shadow: none; }
}

/* Mobile app shell. Desktop keeps the instrument-console layout. */
@media (max-width:900px) {
  .dashboard-ui main { padding:16px 12px calc(100px + env(safe-area-inset-bottom)); }
  .dashboard-ui header { padding:12px 0; gap:12px; margin-bottom:16px; }
  .dashboard-ui header::before, .dashboard-ui header::after { display:none; }
  .dashboard-ui .header-title { width:100%; gap:10px; }
  .dashboard-ui h1 { font-size:20px; letter-spacing:.025em; }
  .dashboard-ui #subtitle { font-size:11px; }
  .dashboard-ui .header-actions { width:100%; gap:8px; }
  .dashboard-ui .tenant-switch { flex:1 1 100%; width:100%; }
  .dashboard-ui .header-actions .button { font-size:12px; }
  .dashboard-ui .header-actions form { margin-left:auto; }
  .dashboard-ui .mobile-dock {
    display:grid; grid-template-columns:repeat(4,minmax(0,1fr));
    position:fixed; z-index:10; left:50%; right:auto;
    bottom:max(8px,env(safe-area-inset-bottom));
    width:min(520px,calc(100vw - 24px - env(safe-area-inset-left) - env(safe-area-inset-right)));
    padding:3px 5px; gap:2px; transform:translateX(-50%);
    background:var(--ui-surface); border:1px solid var(--ui-border);
    border-radius:18px; box-shadow:0 4px 20px #0003;
  }
  .mobile-dock button { display:flex; flex-direction:column; align-items:center; justify-content:center; gap:2px; min-height:44px; min-width:0; padding:3px 2px; border:0; border-radius:14px; background:transparent; color:var(--ui-muted); font:500 clamp(9px,2.8vw,11px) -apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif; white-space:nowrap; }
  .mobile-dock button span { font-size:18px; line-height:1; }
  .mobile-dock button[aria-current], .mobile-dock button:active { color:var(--ui-accent); background:var(--ui-selected); }
  .dashboard-ui .sidebar {
    inset:auto 0 0; width:100%; height:auto; max-height:85dvh;
    padding:20px 16px calc(20px + env(safe-area-inset-bottom));
    border:1px solid var(--ui-border); border-radius:24px 24px 0 0;
    background:var(--ui-surface); transform:translateY(105%); visibility:hidden;
  }
  .dashboard-ui.mobile-nav-open .sidebar { transform:translateY(0); visibility:visible; }
  .dashboard-ui .sidebar::before { width:40px; height:4px; top:8px; left:calc(50% - 20px); background:var(--ui-muted); border-radius:4px; box-shadow:none; }
  .dashboard-ui .sidebar .nav, .dashboard-ui .sidebar .nav:not(.active) { min-height:46px; font-size:14px; border-radius:12px; }
  .dashboard-ui .sidebar .nav-title { padding-top:12px; }
  .dashboard-ui .panel, .dashboard-ui .cards > article, .dashboard-ui .metrics article { border-radius:16px; background-image:none; }
  .dashboard-ui .panel, .dashboard-ui .cards > article { padding:16px; }
  .dashboard-ui .button, .dashboard-ui .icon-button { min-height:44px; border-radius:12px; }
  .dashboard-ui .toolbar { display:flex; flex-wrap:wrap; gap:8px; }
  .dashboard-ui .toolbar input { flex:1 1 100%; min-width:0; }
  .dashboard-ui .toolbar select { flex:1 1 140px; width:auto; min-width:0; }
  .dashboard-ui .actionbar { position:static; border-radius:16px; }
  .dashboard-ui dialog { width:calc(100% - 20px); max-width:560px; max-height:85dvh; overflow:auto; border-radius:20px; padding:20px; }
  .auth-page, .auth-page.setup-page { padding:40px 16px 24px; gap:16px; }
  .auth-page::before { position:absolute; top:16px; }
  .auth-page .auth-card { border-radius:20px; background-image:none; padding:24px 20px; }
  .auth-page .auth-intro h2 { font-size:28px; }
  .auth-page .auth-eyebrow { margin-bottom:12px; font-size:10px; }
  .auth-page .auth-intro p { font-size:12px; line-height:1.5; margin-bottom:0; }
  .auth-page .button { border-radius:12px; min-height:48px; }
  /* Explicit size beats inherited label fonts and avoids iOS focus zoom. */
  .dashboard-ui input, .dashboard-ui textarea, .dashboard-ui select,
  .auth-page .auth-card input, .auth-page .auth-card textarea, .auth-page .auth-card select {
    font-size:16px; line-height:1.4; min-height:48px; border-radius:12px;
  }
  .dashboard-ui button, .auth-page button { touch-action:manipulation; }
}

/* Consistent touch geometry, including small phones and landscape keyboards. */
@media (max-width:900px) {
  :is(.dashboard-ui,.auth-page) { -webkit-text-size-adjust:100%; text-size-adjust:100%; }
  .dashboard-ui main { padding-left:max(12px,env(safe-area-inset-left)); padding-right:max(12px,env(safe-area-inset-right)); }
  .dashboard-ui .header-title > div, .dashboard-ui .page,
  .dashboard-ui .panel, .dashboard-ui .cards > article,
  .dashboard-ui .form-grid > *, .auth-page .step-content { min-width:0; }
  .dashboard-ui h1 { overflow-wrap:anywhere; font-size:clamp(17px,4.5vw,22px); }
  .dashboard-ui #subtitle { max-width:none; }
  .dashboard-ui .button, .dashboard-ui .icon-button,
  .dashboard-ui .link, .auth-page .button { min-height:48px; }
  .dashboard-ui .icon-button { min-width:48px; width:48px; height:48px; flex-shrink:0; }
  .dashboard-ui .mobile-nav-toggle { flex-basis:48px; }
  .dashboard-ui .button, .auth-page .button { white-space:normal; overflow-wrap:anywhere; line-height:1.35; padding:12px 14px; }
  .dashboard-ui .link { display:inline-flex; align-items:center; justify-content:center; padding:8px 12px; }
  .dashboard-ui .mobile-dock { gap:2px; }
  .dashboard-ui .mobile-dock button { min-height:44px; min-width:0; padding:3px 2px; font-size:clamp(9px,2.8vw,11px); }
  .dashboard-ui .sidebar { max-height:calc(100dvh - max(12px,env(safe-area-inset-top))); padding-left:max(16px,env(safe-area-inset-left)); padding-right:max(16px,env(safe-area-inset-right)); }
  .dashboard-ui .sidebar nav { flex:1 1 auto; min-height:0; }
  .dashboard-ui .sidebar .nav, .dashboard-ui .sidebar .nav:not(.active) { min-height:48px; padding:12px; line-height:1.4; }
  .dashboard-ui .header-actions { align-items:center; }
  .dashboard-ui .header-actions .button { min-width:80px; }
  .dashboard-ui select { padding-right:28px; max-width:100%; }
  .dashboard-ui .form-grid, .dashboard-ui .form-grid.four { grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; }
  .dashboard-ui .switch { display:flex; align-items:center; justify-content:flex-end; min-width:56px; min-height:48px; padding:8px 4px; }
  .dashboard-ui .switch span { flex-shrink:0; }
  .dashboard-ui input:not([type=checkbox]):not([type=radio]):not([type=hidden]),
  .dashboard-ui select, .dashboard-ui textarea,
  .auth-page .auth-card input, .auth-page .auth-card select, .auth-page .auth-card textarea { min-width:0; max-width:100%; scroll-margin-block:80px; }
  .dashboard-ui input[type=checkbox], .dashboard-ui input[type=radio] { min-height:24px; width:24px; }
  .dashboard-ui .table-wrap { max-width:100%; overflow-x:auto; overscroll-behavior-x:contain; }
  .dashboard-ui .hint, .dashboard-ui .notice, .dashboard-ui dd,
  .dashboard-ui label small, .auth-page .security-note { overflow-wrap:anywhere; }
  .dashboard-ui dialog { max-height:calc(100dvh - 24px); padding:clamp(14px,4vw,24px); overscroll-behavior:contain; }
  .dashboard-ui .dialog-head { gap:12px; align-items:center; }
  .dashboard-ui .dialog-head h2 { min-width:0; overflow-wrap:anywhere; }
  .dashboard-ui .dialog-actions { gap:10px; }
  .dashboard-ui .dialog-actions .button { flex:1; }
  .auth-page, .auth-page.setup-page { padding-left:max(16px,env(safe-area-inset-left)); padding-right:max(16px,env(safe-area-inset-right)); padding-bottom:max(24px,env(safe-area-inset-bottom)); }
  .auth-page .auth-card { min-width:0; width:100%; }
}
@media (max-width:620px) {
  .dashboard-ui .form-grid, .dashboard-ui .form-grid.four,
  .dashboard-ui .grid.two, .auth-page .grid.two { grid-template-columns:minmax(0,1fr); }
  .dashboard-ui .toolbar > .button { flex:1 1 100%; }
  .dashboard-ui .panel-head { flex-direction:row; flex-wrap:wrap; align-items:center; }
  .dashboard-ui .panel-head h2 { flex:1 1 160px; }
  .dashboard-ui .gafam-donut { width:min(240px,100%); aspect-ratio:1; height:auto; }
  .dashboard-ui .gafam-center { width:72%; height:72%; }
  .dashboard-ui .gafam-row { grid-template-columns:9px minmax(0,1fr) auto auto; gap:8px; }
  .dashboard-ui .gafam-row > span { overflow-wrap:anywhere; }
}
@media (max-width:360px) {
  .dashboard-ui .header-actions { gap:6px; }
  .dashboard-ui .header-actions .button { min-width:0; padding-inline:10px; }
  .dashboard-ui .metrics { grid-template-columns:minmax(0,1fr); }
  .dashboard-ui .mobile-dock button { font-size:11px; }
}
@media (max-width:900px) and (max-height:500px) {
  .dashboard-ui .sidebar { padding-top:20px; }
  .auth-page .auth-intro { display:none; }
}

/* Touch devices can have wide landscape/tablet/desktop-mode viewports. */
@media (max-width:900px), (any-pointer:coarse) {
  .dashboard-ui input:not([type=checkbox]):not([type=radio]):not([type=hidden]),
  .dashboard-ui select, .dashboard-ui textarea,
  .auth-page .auth-card input, .auth-page .auth-card select, .auth-page .auth-card textarea {
    font-size:17px;
    line-height:1.4;
    min-height:48px;
  }
  :is(.dashboard-ui,.auth-page) { -webkit-text-size-adjust:100%; text-size-adjust:100%; }
}

/* Unified editorial UI: the dashboard, login and setup screens share the
   same calm admin-console visual language in both system color modes. */
:is(.dashboard-ui, .auth-page) {
  --ui-bg: #f4f6f8;
  --ui-surface: #ffffff;
  --ui-input: #f8fafb;
  --ui-border: #d8e0e6;
  --ui-text: #26323b;
  --ui-muted: #6c7a85;
  --ui-accent: #287eaa;
  --ui-selected: #e9f3f8;
  color-scheme: light;
  color: var(--ui-text);
  background: var(--ui-bg);
  background-image: none;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
:is(.dashboard-ui, .auth-page) *,
:is(.dashboard-ui, .auth-page) h1,
:is(.dashboard-ui, .auth-page) h2,
:is(.dashboard-ui, .auth-page) h3,
:is(.dashboard-ui, .auth-page) button,
:is(.dashboard-ui, .auth-page) input,
:is(.dashboard-ui, .auth-page) select,
:is(.dashboard-ui, .auth-page) textarea {
  font-family: inherit;
  letter-spacing: normal;
  text-transform: none;
}
.dashboard-ui .sidebar {
  inset: 0 auto 0 0;
  width: 236px;
  padding: 22px 14px 18px;
  background: var(--ui-surface);
  border: 0;
  border-right: 1px solid var(--ui-border);
  border-radius: 0;
  box-shadow: 2px 0 14px #1a34400b;
}
.dashboard-ui .sidebar > .logo { display: none !important; }
.dashboard-ui .logo { padding: 0 10px 24px; }
.dashboard-ui .logo-mark,
:is(.dashboard-ui, .auth-page) .logo-mark {
  width: 36px;
  height: 36px;
  color: #fff;
  background: var(--ui-accent);
  border: 0;
  border-radius: 8px;
  box-shadow: none;
  font-family: inherit;
}
.dashboard-ui .logo strong { color: var(--ui-text); letter-spacing: .02em; }
.dashboard-ui .logo small,
.dashboard-ui .nav-title { color: var(--ui-muted); }
.dashboard-ui .nav-title { padding: 22px 12px 7px; font-size: 10px; }
.dashboard-ui .nav {
  min-height: 42px;
  margin: 2px 0;
  padding: 10px 12px;
  color: var(--ui-muted);
  border: 1px solid transparent;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 400;
  line-height: 1.35;
}
.dashboard-ui .nav:hover { color: var(--ui-text); background: #f0f4f6; border-color: transparent; }
.dashboard-ui .sidebar-icon {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  color: inherit;
}
.dashboard-ui .sidebar-icon svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.dashboard-ui .nav:hover .sidebar-icon svg,
.dashboard-ui .nav:focus-visible .sidebar-icon svg {
  animation: sidebar-icon-pop 1.8s ease both;
}
.dashboard-ui .nav:hover .sidebar-icon svg path,
.dashboard-ui .nav:focus-visible .sidebar-icon svg path,
.dashboard-ui .nav:hover .sidebar-icon svg circle,
.dashboard-ui .nav:focus-visible .sidebar-icon svg circle {
  stroke-dasharray: 80;
  animation: sidebar-icon-draw 1.8s ease both;
}
@keyframes sidebar-icon-pop {
  0%, 100% { transform: scale(1) rotate(0); }
  45% { transform: scale(1.12) rotate(-4deg); }
  75% { transform: scale(1.04) rotate(2deg); }
}
@keyframes sidebar-icon-draw {
  from { stroke-dashoffset: 80; }
  to { stroke-dashoffset: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .dashboard-ui .nav:hover .sidebar-icon svg,
  .dashboard-ui .nav:focus-visible .sidebar-icon svg,
  .dashboard-ui .nav:hover .sidebar-icon svg path,
  .dashboard-ui .nav:focus-visible .sidebar-icon svg path,
  .dashboard-ui .nav:hover .sidebar-icon svg circle,
  .dashboard-ui .nav:focus-visible .sidebar-icon svg circle {
    animation: none;
  }
}

.dashboard-ui .nav.active {
  color: var(--ui-accent);
  background: var(--ui-selected);
  border-color: transparent;
  box-shadow: none;
  font-weight: 600;
}
.dashboard-ui .nav.active::after { content: none; }
.dashboard-ui main { margin-left: 248px; padding: 28px 34px 50px; }
.dashboard-ui header { border-top: 0; border-bottom: 1px solid var(--ui-border); padding: 0 0 18px; }
.dashboard-ui .header-title::before,
.dashboard-ui header::before,
.dashboard-ui header::after,
.dashboard-ui .sidebar::before,
.dashboard-ui .panel > h2::before { display: none; }
.dashboard-ui h1 { color: var(--ui-text); font-size: 26px; font-weight: 650; }
.dashboard-ui h2 { color: var(--ui-text); font-size: 15px; font-weight: 650; }
.dashboard-ui #subtitle,
.dashboard-ui .section-intro p,
.dashboard-ui .form-panel > p { color: var(--ui-muted); }
.dashboard-ui .metrics article,
.dashboard-ui .panel,
.dashboard-ui .cards > article {
  background: var(--ui-surface);
  background-image: none;
  border: 1px solid var(--ui-border);
  border-radius: 10px;
  box-shadow: 0 2px 8px #1a344008;
}
.dashboard-ui .metrics article::before,
.dashboard-ui .panel::before,
.dashboard-ui .cards > article::before { display: none; }
.dashboard-ui .metrics strong { text-shadow: none; }
.dashboard-ui .metrics .dnssec-metric strong { color: var(--green); }
.dashboard-ui .dnssec-state {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 54px;
  color: var(--ui-muted);
  border-top: 1px dashed var(--ui-border);
}
.dashboard-ui .dnssec-state span {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  color: #fff;
  background: var(--ui-muted);
  border-radius: 50%;
  font-size: 14px;
  font-weight: 700;
}
.dashboard-ui .dnssec-state.enabled span { background: var(--green); }
.dashboard-ui .dnssec-state small { color: inherit; font-size: 10px; }
.dashboard-ui .panel-head { border-bottom: 1px solid var(--ui-border); }
.dashboard-ui .rank-row,
.dashboard-ui td,
.dashboard-ui .table-wrap { border-color: var(--ui-border); }
.dashboard-ui .bar { background: #e9eef1; border-radius: 5px; }
.dashboard-ui .bar i { background: var(--ui-accent); box-shadow: none; border-radius: 5px; }
.dashboard-ui th { background: #f1f4f6; color: var(--ui-muted); border-color: var(--ui-border); }
.dashboard-ui tbody tr:nth-child(even) { background: #fafbfc; }
.dashboard-ui tbody tr:hover { background: var(--ui-selected); }
.dashboard-ui .cache-domain { font-weight: 600; }
.dashboard-ui .cache-tld {
  display: inline-block;
  min-width: 48px;
  padding: 3px 7px;
  color: var(--ui-accent);
  background: var(--ui-selected);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 650;
  text-align: center;
}
.dashboard-ui .cache-ttl {
  display: inline-block;
  min-width: 68px;
  color: #197047;
  font-size: 13px;
  text-align: right;
}
.dashboard-ui .cache-ttl.soon { color: #9a6517; }
.dashboard-ui .cache-ttl.urgent { color: #b33939; }
.dashboard-ui .cache-metrics {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin: 0 0 14px;
}
.dashboard-ui .cache-metrics span {
  display: grid;
  gap: 3px;
  padding: 9px;
  color: var(--ui-muted);
  background: var(--ui-input);
  border-radius: 7px;
  font-size: 11px;
}
.dashboard-ui .cache-metrics strong { color: var(--ui-text); font-size: 16px; }
@media (max-width: 620px) {
  .dashboard-ui .cache-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
:is(.dashboard-ui, .auth-page) input,
:is(.dashboard-ui, .auth-page) select,
:is(.dashboard-ui, .auth-page) textarea {
  color: var(--ui-text);
  background: var(--ui-input);
  border-color: var(--ui-border);
  border-radius: 7px;
}
:is(.dashboard-ui, .auth-page) input:focus,
:is(.dashboard-ui, .auth-page) select:focus,
:is(.dashboard-ui, .auth-page) textarea:focus {
  outline: 2px solid color-mix(in srgb, var(--ui-accent) 28%, transparent);
  border-color: var(--ui-accent);
}
:is(.dashboard-ui, .auth-page) .button,
:is(.dashboard-ui, .auth-page) .icon-button {
  color: var(--ui-text);
  background: var(--ui-surface);
  border-color: var(--ui-border);
  border-radius: 7px;
  box-shadow: none;
  font-weight: 550;
}
:is(.dashboard-ui, .auth-page) .button:hover,
:is(.dashboard-ui, .auth-page) .icon-button:hover {
  color: var(--ui-accent);
  background: var(--ui-selected);
  border-color: #a9cbd9;
}
:is(.dashboard-ui, .auth-page) .button.primary {
  color: #fff;
  background: var(--ui-accent);
  border-color: var(--ui-accent);
}
:is(.dashboard-ui, .auth-page) .button.primary:hover { color: #fff; background: #216b91; }
.dashboard-ui dialog {
  color: var(--ui-text);
  background: var(--ui-surface);
  border-color: var(--ui-border);
  border-radius: 12px;
  box-shadow: 0 12px 36px #173c5020;
}

.auth-page {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(360px, 460px);
  gap: 7vw;
  align-items: center;
  max-width: 1180px;
  min-height: 100dvh;
  margin: auto;
  padding: 64px 40px;
}
.auth-page::before { color: var(--ui-muted); font-family: inherit; }
.auth-intro { min-width: 0; }
.auth-page .auth-eyebrow {
  display: block;
  width: fit-content;
  margin-bottom: 20px;
  padding: 0;
  border: 0;
  color: var(--ui-accent);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: .08em;
}
.auth-intro h2,
.auth-page .auth-intro h2 {
  margin: 0 0 20px;
  color: var(--ui-text);
  font-size: clamp(34px, 4vw, 54px);
  font-weight: 650;
  line-height: 1.08;
  letter-spacing: -.045em;
}
.auth-intro h2 span { color: var(--ui-accent); }
.auth-intro p { max-width: 390px; color: var(--ui-muted); line-height: 1.7; }
.auth-page .network-emblem,
.auth-page .auth-caption { display: none; }
.auth-page .auth-intro h2 span {
  display: inline-block;
  animation: auth-hero-breathe 6s ease-in-out infinite;
}
.stale-types { display:flex; flex-wrap:wrap; gap:12px; margin:16px 0 0; padding:12px; border:1px solid var(--ui-border); }
.stale-types legend { padding:0 5px; color:var(--ui-muted); font-size:11px; }
.stale-types label { display:flex; align-items:center; gap:6px; margin:0; }
.stale-types input { width:auto; min-height:auto; }
.login-brand {
  display: inline-flex !important;
  align-items: center;
}
.login-brand-wordmark {
  display: block;
  width: 96px;
  height: auto;
}
.login-brand-dns {
  color: var(--login-text);
  font: 700 15px/1 var(--product-font);
  letter-spacing: .02em;
}
@keyframes auth-hero-breathe {
  0%, 100% { opacity: .82; transform: translateX(0); }
  50% { opacity: 1; transform: translateX(4px); }
}
.login-check { display:flex; align-items:center; gap:10px; min-height:28px; margin:-2px 0 12px; color:#9aa8b8; font-size:12px; }
.login-check-icon { position:relative; display:grid; place-items:center; width:21px; height:21px; border:2px solid currentColor; border-radius:50%; }
.login-check-icon::before { content:""; width:9px; height:5px; border-left:2px solid currentColor; border-bottom:2px solid currentColor; transform:rotate(-45deg) translate(1px,-1px); }
.login-check[data-state="checking"] .login-check-icon { animation:login-check-spin 1s linear infinite; }
.login-check[data-state="checking"] .login-check-icon::before { display:none; }
.login-check[data-state="success"] { color:#39ff88; }
.login-check[data-state="error"] { color:#ff3b81; }
.login-check[data-state="error"] .login-check-icon::before { width:10px; height:2px; border:0; background:currentColor; transform:rotate(45deg); box-shadow:0 0 0 0 currentColor; }
.login-check[data-state="error"] .login-check-icon::after { content:""; position:absolute; width:10px; height:2px; background:currentColor; transform:rotate(-45deg); }
@keyframes login-check-spin { to { transform:rotate(360deg); } }
.login-second-factor[hidden] { display:none; }

@keyframes auth-card-enter {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.auth-page .auth-card {
  width: 100%;
  padding: 32px;
  color: var(--ui-text);
  background: var(--ui-surface);
  background-image: none;
  border: 1px solid var(--ui-border);
  border-radius: 12px;
  box-shadow: 0 12px 35px #173c5014;
}
.auth-page .auth-card::after { display: none; }
.auth-page .logo { padding-bottom: 24px; }
.auth-page .logo strong,
.auth-page .auth-card h1,
.auth-page .auth-card h2,
.auth-page label { color: var(--ui-text); }
.auth-page .logo small,
.auth-page .auth-card > p,
.auth-page p { color: var(--ui-muted); }
.auth-page .step {
  color: var(--ui-accent);
  background: var(--ui-selected);
  border-color: #a9cbd9;
  border-radius: 50%;
  font-family: inherit;
}
.auth-page .setup-section { border-color: var(--ui-border); }
.auth-page .security-note {
  color: var(--ui-muted);
  background: var(--ui-input);
  border-color: var(--ui-border);
  border-left-color: var(--ui-accent);
}
.auth-page .optional { color: var(--ui-muted); border-color: var(--ui-border); }
.auth-page.setup-page {
  grid-template-columns: 280px minmax(0, 1fr);
  max-width: 1280px;
  align-items: start;
  gap: 52px;
}
.setup-page .auth-intro { position: sticky; top: 64px; }
.setup-page .auth-intro h2 { font-size: 38px; }

@media (min-width: 901px) {
  .dashboard-ui .sidebar {
    width: 68px;
    overflow-x: hidden;
    transition: width .22s ease, box-shadow .22s ease;
  }
  .dashboard-ui .sidebar:hover,
  .dashboard-ui .sidebar:focus-within {
    width: 236px;
    box-shadow: 8px 0 24px #1a34401a;
  }
  .dashboard-ui main {
    margin-left: 68px;
    transition: margin-left .22s ease;
  }
  .dashboard-ui:has(.sidebar:hover) main,
  .dashboard-ui:has(.sidebar:focus-within) main {
    margin-left: 236px;
    transition: margin-left .22s ease;
  }
  .dashboard-ui .nav {
    box-sizing: border-box;
    width: 42px;
    min-height: 42px;
    margin: 2px -1px;
    padding: 10px 12px;
    justify-content: center;
    white-space: nowrap;
    font-size: 0;
    transition: color .16s ease, background-color .16s ease, border-color .16s ease, font-size .22s ease;
  }
  .dashboard-ui .nav span {
    flex: 0 0 22px;
    font-size: 18px;
  }
  .dashboard-ui .sidebar:hover .nav,
  .dashboard-ui .sidebar:focus-within .nav {
    width: 100%;
    margin: 2px 0;
    justify-content: flex-start;
    font-size: 13px;
  }
  .dashboard-ui .nav-title {
    overflow: hidden;
    height: 34px;
    padding: 18px 10px 5px;
    box-sizing: border-box;
    font-size: 0;
    white-space: nowrap;
    transition: font-size .22s ease;
  }
  .dashboard-ui .sidebar:hover .nav-title,
  .dashboard-ui .sidebar:focus-within .nav-title {
    font-size: 9px;
  }
}

@media (prefers-color-scheme: light) {
  .dashboard-ui .sidebar {
    background: #3d454c;
    border-right-color: #30373d;
  }
  .dashboard-ui .logo strong,
  .dashboard-ui .logo small,
  .dashboard-ui .nav,
  .dashboard-ui .nav-title,
  .dashboard-ui .nav:hover {
    color: #fff;
    background: rgba(255, 255, 255, .12);
  }
  .dashboard-ui .nav.active {
    color: #fff;
    background: rgba(255, 255, 255, .20);
  }
}

@media (prefers-color-scheme: dark) {
  :is(.dashboard-ui, .auth-page) {
    --ui-bg: #000000;
    --ui-surface: #0b0b0b;
    --ui-input: #050505;
    --ui-border: #2a2f33;
    --ui-text: #e6edf1;
    --ui-muted: #9eacb5;
    --ui-accent: #67b9dc;
    --ui-selected: #172b37;
    color-scheme: dark;
  }
  .dashboard-ui,
  .auth-page {
    background: #000000;
  }
  .dashboard-ui .sidebar,
  .auth-page .auth-card {
    background: #0b0b0b;
  }
  .dashboard-ui .sidebar { box-shadow: 2px 0 14px #0003; }
  .dashboard-ui .nav:hover { background: #263139; }
  .dashboard-ui th { background: #273239; }
  .dashboard-ui tbody tr:nth-child(even) { background: #192228; }
  .dashboard-ui .bar { background: #2b3941; }
  .dashboard-ui .metrics article,
  .dashboard-ui .panel,
  .dashboard-ui .cards > article,
  .auth-page .auth-card { box-shadow: 0 2px 10px #0003; }
  .auth-page .step { border-color: #456576; }
}

@media (max-width: 900px) {
  .dashboard-ui main { margin-left: 0; }
  .auth-page,
  .auth-page.setup-page {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    max-width: 720px;
    gap: 24px;
    padding: 64px 24px 32px;
  }
  .auth-page .auth-intro { position: static; }
  .auth-intro h2,
  .setup-page .auth-intro h2 { font-size: 34px; }
  .auth-page .auth-card { padding: 26px 22px; }
}

@media (max-width: 620px) {
  .auth-page,
  .auth-page.setup-page { padding: 58px 16px 24px; }
  .auth-page .auth-card { padding: 24px 18px; }
  .setup-page .setup-section { grid-template-columns: 1fr; gap: 12px; }
}

/* Mobile data views keep only the information needed for a quick scan. */
@media (max-width: 620px) {
  .dashboard-ui #queries .table-wrap,
  .dashboard-ui #audit .table-wrap,
  .dashboard-ui #cache .table-wrap {
    overflow-x: hidden;
  }
  .dashboard-ui #queries table,
  .dashboard-ui #audit table,
  .dashboard-ui #cache table {
    min-width: 0;
    table-layout: fixed;
    font-size: 11px;
  }
  .dashboard-ui #queries th,
  .dashboard-ui #queries td,
  .dashboard-ui #audit th,
  .dashboard-ui #audit td,
  .dashboard-ui #cache th,
  .dashboard-ui #cache td {
    padding: 8px 6px;
  }
  .dashboard-ui #queries th:nth-child(2),
  .dashboard-ui #queries td:nth-child(2),
  .dashboard-ui #queries th:nth-child(4),
  .dashboard-ui #queries td:nth-child(4),
  .dashboard-ui #queries th:nth-child(6),
  .dashboard-ui #queries td:nth-child(6),
  .dashboard-ui #audit th:nth-child(3),
  .dashboard-ui #audit td:nth-child(3) {
    display: none;
  }
  .dashboard-ui #queries th:nth-child(1) { width: 26%; }
  .dashboard-ui #queries th:nth-child(3) { width: 40%; }
  .dashboard-ui #queries th:nth-child(5) { width: 22%; }
  .dashboard-ui #queries th:nth-child(7) { width: 12%; }
  .dashboard-ui #audit th:nth-child(1) { width: 25%; }
  .dashboard-ui #audit th:nth-child(2) { width: 18%; }
  .dashboard-ui #audit th:nth-child(4) { width: 26%; }
  .dashboard-ui #audit th:nth-child(5) { width: 31%; }
  .dashboard-ui #cache th:nth-child(1) { width: 46%; }
  .dashboard-ui #cache th:nth-child(2),
  .dashboard-ui #cache th:nth-child(3) { width: 16%; }
  .dashboard-ui #cache th:nth-child(4) { width: 22%; }
  .dashboard-ui #queries td,
  .dashboard-ui #audit td,
  .dashboard-ui #cache td {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .dashboard-ui #audit td:nth-child(5) {
    white-space: normal;
    overflow-wrap: anywhere;
  }
  .dashboard-ui #queries .badge {
    min-height: 18px;
    padding: 2px 4px;
    font-size: 9px;
  }
  .dashboard-ui #cache .cache-tld {
    min-width: 0;
    padding: 2px 4px;
    font-size: 10px;
  }
  .dashboard-ui #cache .cache-ttl {
    min-width: 0;
    font-size: 12px;
  }
}

/* Final layout pass: keep the navigation permanently readable and use a
   spacious, conventional administration layout at every desktop width. */
@media (min-width: 901px) {
  .dashboard-ui .sidebar {
    inset: 0 auto 0 0;
    width: 236px;
    overflow: visible;
    border-radius: 0;
    box-shadow: none;
    transition: none;
  }
  .dashboard-ui .sidebar:hover,
  .dashboard-ui .sidebar:focus-within { width: 236px; box-shadow: none; }
  .dashboard-ui main,
  .dashboard-ui:has(.sidebar:hover) main,
  .dashboard-ui:has(.sidebar:focus-within) main {
    margin-left: 236px;
    width: calc(100vw - 236px);
    max-width: none;
    transition: none;
  }
  .dashboard-ui .nav,
  .dashboard-ui .sidebar:hover .nav,
  .dashboard-ui .sidebar:focus-within .nav {
    width: 100%;
    min-height: 38px;
    margin: 2px 0;
    padding: 8px 11px;
    justify-content: flex-start;
    font-size: 13px;
  }
  .dashboard-ui .nav-title,
  .dashboard-ui .sidebar:hover .nav-title,
  .dashboard-ui .sidebar:focus-within .nav-title {
    height: auto;
    padding: 25px 11px 7px;
    font-size: 10px;
  }
}

:is(.dashboard-ui, .auth-page) {
  --ui-bg: #f7f8fa;
  --ui-surface: #fff;
  --ui-input: #fff;
  --ui-border: #e4e7ec;
  --ui-text: #20242c;
  --ui-muted: #6b7280;
  --ui-accent: #5b4cdb;
  --ui-selected: #f0efff;
  color-scheme: light;
  background: var(--ui-bg);
  color: var(--ui-text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
.dashboard-ui .sidebar { background: var(--ui-surface); border-right: 1px solid var(--ui-border); }
.dashboard-ui .logo-mark,
:is(.dashboard-ui, .auth-page) .logo-mark { color: #fff; background: var(--ui-accent); border: 0; border-radius: 9px; box-shadow: none; }
.dashboard-ui .logo strong { color: var(--ui-text); letter-spacing: -.02em; }
.dashboard-ui .logo small,
.dashboard-ui .nav-title { color: var(--ui-muted); }
.dashboard-ui .nav { color: #586170; border: 0; border-radius: 7px; font-weight: 500; }
.dashboard-ui .nav:hover { color: var(--ui-text); background: #f7f7fa; border: 0; }
.dashboard-ui .nav.active { color: var(--ui-accent); background: var(--ui-selected); border: 0; box-shadow: none; font-weight: 650; }
.dashboard-ui .nav.active::after { display: none; }
.dashboard-ui main { max-width: 1560px; padding: 34px 42px 56px; }
.dashboard-ui header { margin-bottom: 28px; padding-bottom: 20px; border-color: var(--ui-border); }
.dashboard-ui .header-title::before { display: none; }
.dashboard-ui h1 { color: var(--ui-text); font-size: 26px; letter-spacing: -.035em; text-transform: none; }
.dashboard-ui h2 { color: var(--ui-text); font-size: 16px; letter-spacing: -.015em; text-transform: none; }
.dashboard-ui #subtitle,
.dashboard-ui p { color: var(--ui-muted); }
.dashboard-ui .metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 22px; }
.dashboard-ui .metrics article,
.dashboard-ui .panel,
.dashboard-ui .cards > article { background: var(--ui-surface); background-image: none; border: 1px solid var(--ui-border); border-radius: 9px; box-shadow: none; }
.dashboard-ui .metrics article { min-height: 138px; padding: 18px; }
.dashboard-ui .metrics article::before,
.dashboard-ui .panel::before,
.dashboard-ui .cards > article::before { display: none; }
.dashboard-ui .metrics article > span,
.dashboard-ui .metrics article > small { color: var(--ui-muted); letter-spacing: 0; text-transform: none; }
.dashboard-ui .metrics strong { margin: 12px 0 6px; color: var(--ui-text); font-size: 27px; text-shadow: none; }
.dashboard-ui .metrics strong.metric-total,
.dashboard-ui .metrics strong.metric-cached { color: var(--ui-text); }
.dashboard-ui .metrics .danger strong { color: #d84d58; }
.dashboard-ui .metrics .warning strong { color: #b87512; }
.dashboard-ui .metric-chart { border-color: var(--ui-border); }
.dashboard-ui .heartbeat-line { display: none; }
.dashboard-ui .panel,
.dashboard-ui .cards > article { padding: 20px; }
.dashboard-ui .panel-head { padding-bottom: 13px; border-bottom: 1px solid var(--ui-border); }
.dashboard-ui .rank-row { border-color: var(--ui-border); }
.dashboard-ui .bar { background: #eef0f4; }
.dashboard-ui .bar i { background: var(--ui-accent); box-shadow: none; }
.dashboard-ui .blocked-list .bar i { background: #dc5963; }
.dashboard-ui .table-wrap { border-color: var(--ui-border); border-radius: 8px; }
.dashboard-ui th { color: var(--ui-muted); background: #f8f9fb; border-color: var(--ui-border); letter-spacing: .04em; }
.dashboard-ui td { color: #3d4551; border-color: #edf0f2; }
.dashboard-ui tbody tr:nth-child(even) { background: #fcfcfd; }
.dashboard-ui tbody tr:hover { background: #f5f4ff; }
.dashboard-ui input,
.dashboard-ui textarea,
.dashboard-ui select { color: var(--ui-text); background: var(--ui-input); border-color: #d8dde5; border-radius: 7px; }
.dashboard-ui input:focus,
.dashboard-ui textarea:focus,
.dashboard-ui select:focus { outline: 3px solid rgb(91 76 219 / 14%); outline-offset: 0; border-color: var(--ui-accent); }
.dashboard-ui .button,
.dashboard-ui .icon-button { color: #3d4551; background: #fff; border-color: #d8dde5; border-radius: 7px; box-shadow: none; font-weight: 600; letter-spacing: 0; text-transform: none; }
.dashboard-ui .button:hover,
.dashboard-ui .icon-button:hover { color: var(--ui-accent); background: #f7f6ff; border-color: #c8c2f1; }
.dashboard-ui .button.primary { color: #fff; background: var(--ui-accent); border-color: var(--ui-accent); }
.dashboard-ui .button.primary:hover { color: #fff; background: #493bc4; border-color: #493bc4; }
.dashboard-ui .danger-button { color: #bd3541; background: #fff; border-color: #f0c9cd; }
.dashboard-ui .danger-button:hover { color: #a32430; background: #fff4f5; border-color: #eaaab1; }
.dashboard-ui .hint,
.dashboard-ui .actionbar { background: #f8f9fb; border: 1px solid var(--ui-border); border-left: 3px solid var(--ui-accent); border-radius: 7px; box-shadow: none; }
.dashboard-ui dialog { color: var(--ui-text); background: #fff; border-color: var(--ui-border); border-radius: 10px; box-shadow: 0 18px 46px rgb(23 33 43 / 16%); }
.dashboard-ui #user-role { color: #4c3cc8; background: #f0efff; border-color: transparent; animation: none; }

@media (prefers-color-scheme: dark) {
  :is(.dashboard-ui, .auth-page) {
    --ui-bg: #17181d;
    --ui-surface: #202126;
    --ui-input: #292a30;
    --ui-border: #363840;
    --ui-text: #f1f2f4;
    --ui-muted: #a5a8b1;
    --ui-accent: #8b7df0;
    --ui-selected: #302d52;
    color-scheme: dark;
  }
  .dashboard-ui .sidebar { background: #1c1d22; }
  .dashboard-ui .logo-mark,
  :is(.dashboard-ui, .auth-page) .logo-mark { color: #181628; }
  .dashboard-ui .nav { color: #b8bac2; }
  .dashboard-ui .nav:hover { color: var(--ui-text); background: #292a31; }
  .dashboard-ui .nav.active { color: #d8d3ff; background: var(--ui-selected); }
  .dashboard-ui .metrics article,
  .dashboard-ui .panel,
  .dashboard-ui .cards > article { background: var(--ui-surface); }
  .dashboard-ui .bar { background: #363740; }
  .dashboard-ui th { background: #292a30; }
  .dashboard-ui td { color: #d4d6dc; border-color: #303139; }
  .dashboard-ui tbody tr:nth-child(even) { background: #1d1e23; }
  .dashboard-ui tbody tr:hover { background: #29263f; }
  .dashboard-ui input,
  .dashboard-ui textarea,
  .dashboard-ui select { border-color: #454750; }
  .dashboard-ui .button,
  .dashboard-ui .icon-button { color: #dfe1e6; background: #292a30; border-color: #454750; }
  .dashboard-ui .button:hover,
  .dashboard-ui .icon-button:hover { color: #d8d3ff; background: #302d52; border-color: #6259a8; }
  .dashboard-ui .button.primary { color: #181628; background: var(--ui-accent); border-color: var(--ui-accent); }
  .dashboard-ui .button.primary:hover { color: #181628; background: #a398f5; border-color: #a398f5; }
  .dashboard-ui .danger-button { color: #ffb5bc; background: #2b2226; border-color: #694249; }
  .dashboard-ui .danger-button:hover { color: #ffd9dd; background: #42282e; border-color: #9b5660; }
  .dashboard-ui .hint,
  .dashboard-ui .actionbar { color: #c2c5cc; background: #25262c; border-color: var(--ui-border); }
  .dashboard-ui dialog { background: var(--ui-surface); border-color: var(--ui-border); }
  .dashboard-ui #user-role { color: #d8d3ff; background: var(--ui-selected); }
}

@media (min-width: 901px) and (max-width: 1250px) {
  .dashboard-ui .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-ui main { padding-inline: 28px; }
}

/* Responsive refinement for the clean dashboard shell. */
@media (min-width: 1600px) {
  .dashboard-ui main { padding-left: 56px; padding-right: 56px; }
  .dashboard-ui .metrics article { min-height: 148px; padding: 21px; }
  .dashboard-ui .panel,
  .dashboard-ui .cards > article { padding: 24px; }
}

@media (min-width: 901px) and (max-width: 1100px) {
  .dashboard-ui .sidebar { width: 214px; }
  .dashboard-ui main,
  .dashboard-ui:has(.sidebar:hover) main,
  .dashboard-ui:has(.sidebar:focus-within) main {
    margin-left: 214px;
    width: calc(100vw - 214px);
  }
  .dashboard-ui main { padding-inline: 24px; }
  .dashboard-ui .grid.two { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .dashboard-ui .sidebar {
    inset: 0 auto 0 0;
    width: min(320px, 88vw);
    height: 100dvh;
    padding: 20px 13px calc(18px + env(safe-area-inset-bottom));
    background: var(--ui-surface);
    border: 0;
    border-right: 1px solid var(--ui-border);
    border-radius: 0;
    box-shadow: 12px 0 32px rgb(23 33 43 / 16%);
    transform: translateX(-105%);
  }
  .dashboard-ui.mobile-nav-open .sidebar { transform: translateX(0); }
  .dashboard-ui .sidebar .nav,
  .dashboard-ui .sidebar:hover .nav,
  .dashboard-ui .sidebar:focus-within .nav {
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    justify-content: flex-start;
    font-size: 14px;
  }
  .dashboard-ui .sidebar .nav-title,
  .dashboard-ui .sidebar:hover .nav-title,
  .dashboard-ui .sidebar:focus-within .nav-title { padding-top: 20px; font-size: 10px; }
  .dashboard-ui main,
  .dashboard-ui:has(.sidebar:hover) main,
  .dashboard-ui:has(.sidebar:focus-within) main {
    width: 100%;
    max-width: none;
    margin-left: 0;
    padding: 22px 20px calc(42px + env(safe-area-inset-bottom));
  }
  .dashboard-ui header { gap: 14px; margin-bottom: 22px; }
  .dashboard-ui .mobile-nav-toggle { display: grid; place-items: center; }
  .dashboard-ui .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-ui .grid.two,
  .dashboard-ui .cards { grid-template-columns: 1fr; }
  .dashboard-ui .form-grid.four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-ui .toolbar { gap: 10px; }
  .dashboard-ui .toolbar input { min-height: 44px; }
  .dashboard-ui .toolbar select { min-height: 44px; }
}

@media (max-width: 620px) {
  .dashboard-ui main { padding: 16px 12px calc(34px + env(safe-area-inset-bottom)); }
  .dashboard-ui header { align-items: flex-start; min-height: 50px; margin-bottom: 18px; padding-bottom: 16px; }
  .dashboard-ui .header-title { gap: 9px; }
  .dashboard-ui h1 { font-size: 22px; }
  .dashboard-ui header p { max-width: 45vw; font-size: 11px; line-height: 1.35; }
  .dashboard-ui .header-actions { gap: 6px; }
  .dashboard-ui .header-actions .badge { display: none; }
  .dashboard-ui .header-actions .button { padding-inline: 10px; }
  .dashboard-ui .metrics { grid-template-columns: 1fr; gap: 10px; }
  .dashboard-ui .metrics article { min-height: 128px; padding: 15px; }
  .dashboard-ui .metrics strong { font-size: 28px; }
  .dashboard-ui .panel,
  .dashboard-ui .cards > article { padding: 15px; border-radius: 8px; }
  .dashboard-ui .panel-head,
  .dashboard-ui .section-intro,
  .dashboard-ui .client-title,
  .dashboard-ui .actionbar { align-items: stretch; flex-direction: column; gap: 12px; }
  .dashboard-ui .section-intro > .button,
  .dashboard-ui .actionbar .button { width: 100%; }
  .dashboard-ui .toolbar { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .dashboard-ui .toolbar input { grid-column: 1 / -1; min-width: 0; }
  .dashboard-ui .toolbar select { width: 100%; min-width: 0; }
  .dashboard-ui .toolbar .danger-button { grid-column: 1 / -1; width: 100%; }
  .dashboard-ui .form-grid,
  .dashboard-ui .form-grid.four { grid-template-columns: 1fr; }
  .dashboard-ui input,
  .dashboard-ui textarea,
  .dashboard-ui select { min-height: 44px; font-size: 16px; }
  .dashboard-ui textarea { min-height: 112px; }
  .dashboard-ui .button,
  .dashboard-ui .icon-button { min-height: 44px; }
  .dashboard-ui .client-title > div:last-child { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .dashboard-ui .gafam-layout { padding-block: 16px; }
  .dashboard-ui .gafam-donut { width: 190px; height: 190px; }
  .dashboard-ui .gafam-center { width: 136px; height: 136px; }
  .dashboard-ui dialog { width: calc(100% - 16px); max-height: calc(100dvh - 16px); margin: 8px; padding: 18px; }
}

@media (max-width: 390px) {
  .dashboard-ui .toolbar { grid-template-columns: 1fr; }
  .dashboard-ui .toolbar input,
  .dashboard-ui .toolbar .danger-button { grid-column: auto; }
  .dashboard-ui header p { display: none; }
  .dashboard-ui .header-actions .button { font-size: 0; min-width: 44px; }
  .dashboard-ui .header-actions .button::after { content: "↪"; font-size: 17px; }
}

@media (min-width: 1101px) {
  .dashboard-ui main {
    width: calc(100vw - 236px);
    max-width: none;
  }
}

@media (prefers-color-scheme: dark) {
  html,
  body,
  body.dashboard-ui,
  body.auth-page,
  .auth-page {
    background: #000 !important;
  }
}


/* Final compact blue UI layer. Presentation only; application behavior is unchanged. */
:is(.dashboard-ui, .auth-page) {
  --ui-bg: #f5f8fa;
  --ui-surface: #ffffff;
  --ui-input: #ffffff;
  --ui-border: #dbe5ea;
  --ui-text: #18242d;
  --ui-muted: #627481;
  --ui-accent: #1598d0;
  --ui-selected: #e8f6fc;
}
.dashboard-ui { --gafam-2: #3c9bdd; }

.dashboard-ui .sidebar {
  width: 208px;
  padding: 14px 10px 12px;
}
.dashboard-ui .logo { padding: 0 8px 16px; }
.dashboard-ui .logo-mark { width: 32px; height: 32px; border-radius: 7px; font-size: 18px; }
.dashboard-ui .nav-title { padding: 16px 10px 5px; font-size: 9px; }
.dashboard-ui .nav { min-height: 32px; margin: 1px 0; padding: 6px 9px; font-size: 12px; }
.dashboard-ui .nav:hover { background: #f1f8fb; }
.dashboard-ui main,
.dashboard-ui:has(.sidebar:hover) main,
.dashboard-ui:has(.sidebar:focus-within) main {
  width: calc(100vw - 208px);
  max-width: none;
  margin-left: 208px;
  padding: 20px 24px 36px;
}
.dashboard-ui header { min-height: 44px; margin-bottom: 14px; padding-bottom: 12px; }
.dashboard-ui h1 { font-size: 23px; }
.dashboard-ui h2 { font-size: 14px; }
.dashboard-ui .metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 12px; }
.dashboard-ui .metrics article { min-height: 112px; padding: 12px; }
.dashboard-ui .metrics strong { margin: 6px 0 3px; font-size: 23px; }
.dashboard-ui .metric-chart { height: 54px; margin-top: 5px; }
.dashboard-ui .panel,
.dashboard-ui .cards > article { padding: 14px; border-radius: 8px; }
.dashboard-ui .panel { margin-bottom: 10px; }
.dashboard-ui .panel-head { margin-bottom: 8px; padding-bottom: 8px; }
.dashboard-ui .grid { gap: 10px; }
.dashboard-ui .rank-row { padding: 6px 0; }
.dashboard-ui th,
.dashboard-ui td { padding: 7px 8px; }
.dashboard-ui .toolbar { gap: 7px; margin-bottom: 8px; }
.dashboard-ui input,
.dashboard-ui textarea,
.dashboard-ui select { padding: 7px 9px; }
.dashboard-ui .button,
.dashboard-ui .icon-button { min-height: 32px; padding: 6px 10px; }
.dashboard-ui .button:hover,
.dashboard-ui .icon-button:hover { color: var(--ui-accent); background: var(--ui-selected); border-color: #a8d8e9; }
.dashboard-ui .button.primary:hover { color: #fff; background: #087db3; border-color: #087db3; }
.dashboard-ui tbody tr:hover { background: var(--ui-selected); }
.dashboard-ui #user-role { color: #087db3; background: var(--ui-selected); }

.auth-page .auth-card { padding: 26px; border-radius: 10px; }
.auth-page .auth-card .logo { padding-bottom: 18px; }
.auth-page h1 { font-size: 24px; }
.auth-page h2 { font-size: 16px; }
.auth-page .auth-card > p { margin-bottom: 18px; }
.auth-page input,
.auth-page select,
.auth-page textarea { padding: 10px; }
.auth-page .button { min-height: 40px; margin-top: 9px; }
.auth-page .setup-section { gap: 14px; padding: 18px 0; }
.auth-page .step { width: 34px; height: 34px; }
.auth-page .security-note { margin-top: 9px; padding: 10px 11px; }

.switch span { width: 42px; height: 22px; border-color: var(--ui-border); border-radius: 12px; background: #dfe9ee; }
.switch span::after { width: 16px; height: 16px; top: 2px; background: #fff; border-radius: 50%; }
.switch input:checked + span { background: #1598d0; border-color: #1598d0; }
.switch input:checked + span::after { transform: translateX(18px); background: #fff; }

@media (prefers-color-scheme: dark) {
  :is(.dashboard-ui, .auth-page) {
    --ui-bg: #000;
    --ui-surface: #121b21;
    --ui-input: #0d151a;
    --ui-border: #273943;
    --ui-text: #e8f1f5;
    --ui-muted: #98adba;
    --ui-accent: #48c0ea;
    --ui-selected: #102e3b;
  }
  .dashboard-ui { --gafam-2: #3c9bdd; }
  .dashboard-ui .sidebar { background: #0b1115; }
  .dashboard-ui .nav:hover { background: #101d23; }
  .dashboard-ui .nav.active { color: #8cddf5; background: var(--ui-selected); }
  .dashboard-ui .button.primary { color: #06202a; }
  .dashboard-ui .button.primary:hover { color: #06202a; background: #7cdbf5; border-color: #7cdbf5; }
  .dashboard-ui #user-role { color: #8cddf5; background: var(--ui-selected); }
  .switch span { background: #1b2a31; }
  .switch input:checked + span { background: #48c0ea; border-color: #48c0ea; }
}

@media (max-width: 900px) {
  .dashboard-ui .sidebar { width: min(288px, 84vw); padding: 14px 10px calc(12px + env(safe-area-inset-bottom)); }
  .dashboard-ui main,
  .dashboard-ui:has(.sidebar:hover) main,
  .dashboard-ui:has(.sidebar:focus-within) main {
    width: 100%;
    margin-left: 0;
    padding: 14px 12px calc(28px + env(safe-area-inset-bottom));
  }
  .dashboard-ui header { margin-bottom: 12px; padding-bottom: 10px; }
  .dashboard-ui .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
  .dashboard-ui .metrics article { min-height: 106px; padding: 11px; }
  .dashboard-ui .metrics strong { font-size: 22px; }
  .dashboard-ui .panel,
  .dashboard-ui .cards > article { padding: 12px; }
  .auth-page { padding: 30px 12px 18px; }
  .auth-page .auth-card { padding: 20px 16px; }
  .auth-page .setup-section { padding: 16px 0; }
}

@media (max-width: 390px) {
  .dashboard-ui .metrics { grid-template-columns: 1fr; }
}

/* Keep the dashboard shell stable while navigating: hover must not resize it. */
@media (min-width: 901px) {
  .dashboard-ui .sidebar,
  .dashboard-ui .sidebar:hover,
  .dashboard-ui .sidebar:focus-within {
    width: 208px;
    transition: none;
  }
  .dashboard-ui .sidebar .nav,
  .dashboard-ui .sidebar:hover .nav,
  .dashboard-ui .sidebar:focus-within .nav {
    width: 100%;
    min-height: 32px;
    margin: 1px 0;
    padding: 6px 9px;
    font-size: 12px;
    transition: color .14s ease, background-color .14s ease;
  }
  .dashboard-ui .sidebar .nav-title,
  .dashboard-ui .sidebar:hover .nav-title,
  .dashboard-ui .sidebar:focus-within .nav-title {
    height: auto;
    padding: 16px 10px 5px;
    font-size: 9px;
  }
  .dashboard-ui .metrics { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}

/* Final interaction layer must follow legacy overrides. */
.context-help {
  position: relative;
  display: inline-flex;
  vertical-align: middle;
}
.context-help-button {
  width: 19px;
  height: 19px;
  margin-left: 5px;
  padding: 0;
  border: 1px solid var(--cyan);
  border-radius: 50%;
  background: transparent;
  color: var(--cyan);
  font: 700 12px/17px ui-monospace, SFMono-Regular, Menlo, monospace;
  text-align: center;
  cursor: help;
}
.context-help-button:hover,
.context-help-button:focus-visible,
.context-help.open .context-help-button {
  outline: none;
  color: var(--bg);
  background: var(--cyan);
  box-shadow: 0 0 12px color-mix(in srgb, var(--cyan) 55%, transparent);
}
.context-help-popover {
  position: fixed;
  z-index: 2147483647;
  inset: auto;
  top: 0;
  left: 0;
  width: min(320px, calc(100vw - 40px));
	max-width: calc(100dvw - 24px);
  max-height: min(320px, calc(100dvh - 24px));
	margin: 0;
	box-sizing: border-box;
  overflow: auto;
	overscroll-behavior: contain;
	-webkit-overflow-scrolling: touch;
  padding: 10px 12px;
  border: 1px solid color-mix(in srgb, var(--cyan) 55%, var(--line));
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  box-shadow: 0 12px 32px rgba(0, 0, 0, .35);
  font: 500 12px/1.5 system-ui, sans-serif;
  text-align: left;
  white-space: normal;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(-4px);
  transition: opacity .14s ease, transform .14s ease, visibility .14s;
}
.context-help.open .context-help-popover {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
}
@media (min-width: 641px) {
  .context-help-popover {
    transition: opacity .22s ease, transform .22s ease, visibility 0s linear .22s;
  }
  .context-help.open .context-help-popover {
    transition: opacity .22s ease, transform .22s ease, visibility 0s;
  }
}
.context-help-control { margin-right: 3px; }
.toolbar > .context-help-control {
  flex: 0 0 auto;
  align-self: center;
}
@media (max-width: 640px) {
  .context-help-popover {
    position: fixed;
    top: 0;
    right: auto;
    bottom: auto;
    left: 0;
    width: min(320px, calc(100dvw - 24px));
	max-width: calc(100dvw - 24px);
    max-height: min(280px, calc(100dvh - 24px));
    transform: translateY(8px);
	transition: opacity .28s ease, transform .28s ease, visibility 0s linear .28s;
  }
  .context-help.open .context-help-popover {
	transform: translateY(0);
	transition: opacity .18s ease, transform .18s ease, visibility 0s;
  }
}
.dashboard-ui .metrics article { min-height: 124px; }
.dashboard-ui .metric-chart {
  height: 60px;
  margin-top: 2px;
  padding-bottom: 15px;
}
.dashboard-ui .metric-chart svg { height: 42px; }
.dashboard-ui .metric-chart > span {
  right: 4px;
  bottom: 0;
  font-size: 8px;
  line-height: 12px;
}
html:has(.dashboard-ui),
html:has(.auth-page) { scroll-behavior: smooth; }
:is(.dashboard-ui, .auth-page) .button,
:is(.dashboard-ui, .auth-page) .icon-button,
.dashboard-ui .nav {
  transition: color .16s ease, background-color .16s ease, border-color .16s ease, box-shadow .16s ease, transform .12s ease;
}
:is(.dashboard-ui, .auth-page) .button:active,
:is(.dashboard-ui, .auth-page) .icon-button:active,
.dashboard-ui .nav:active { transform: scale(.98); }
:is(.dashboard-ui, .auth-page) input,
:is(.dashboard-ui, .auth-page) select,
:is(.dashboard-ui, .auth-page) textarea {
  transition: color .16s ease, background-color .16s ease, border-color .16s ease, box-shadow .16s ease;
}
.auth-page .auth-card { animation: auth-card-enter .28s cubic-bezier(.2, .8, .2, 1) both; }
@media (prefers-reduced-motion: reduce) {
  html:has(.dashboard-ui),
  html:has(.auth-page) { scroll-behavior: auto; }
  .auth-page .auth-card { animation: none; }
  :is(.dashboard-ui, .auth-page) .button,
  :is(.dashboard-ui, .auth-page) .icon-button,
  .dashboard-ui .nav,
  :is(.dashboard-ui, .auth-page) input,
  :is(.dashboard-ui, .auth-page) select,
  :is(.dashboard-ui, .auth-page) textarea { transition: none; }
  .auth-page .auth-intro h2 span,
  .login-check[data-state="checking"] .login-check-icon { animation: none; }
}

.login-page {
  grid-template-columns: minmax(0, 460px);
  justify-content: center;
}

.login-page .button.primary:hover,
.login-page #login-passkey:hover {
  color: #06200b;
  background: #7dff4f;
  border-color: #7dff4f;
  box-shadow: 0 0 0 3px rgb(125 255 79 / 18%), 0 6px 16px rgb(59 200 40 / 22%);
}

.login-page .login-second-factor {
  display: grid;
  justify-items: center;
  gap: 10px;
  margin: 18px 0;
  text-align: center;
}
.login-page .login-second-factor[hidden] { display: none !important; }
.login-page .login-second-factor > span:first-child {
  color: var(--ui-text);
  font-size: 13px;
  font-weight: 600;
}
.login-page .otp-code {
  display: grid;
  grid-template-columns: repeat(6, 42px);
  gap: 8px;
}
.login-page .otp-code .otp-digit {
  width: 42px;
  min-height: 50px;
  margin: 0;
  padding: 0;
  color: var(--ui-text);
  background: var(--ui-input);
  border: 1px solid var(--ui-border);
  border-radius: 9px;
  font-size: 22px;
  font-weight: 650;
  line-height: 1;
  text-align: center;
}
.login-page .otp-code .otp-digit:focus {
  border-color: #7dff4f;
  outline: 3px solid rgb(125 255 79 / 18%);
  outline-offset: 1px;
}
.login-page .otp-code .otp-digit:not(:placeholder-shown) {
  color: #104c1b;
  background: #ecffe7;
  border-color: #7dff4f;
}
@media (prefers-color-scheme: dark) {
  .login-page .otp-code .otp-digit:not(:placeholder-shown) {
    color: #baff9f;
    background: #102b16;
    border-color: #7dff4f;
  }
}
@media (max-width: 390px) {
  .login-page .otp-code { grid-template-columns: repeat(6, minmax(0, 1fr)); width: 100%; gap: 5px; }
  .login-page .otp-code .otp-digit { width: 100%; min-height: 46px; }
}

/* Login-only liquid glass surface. */
.login-page {
  background:
    radial-gradient(circle at 18% 16%, rgb(78 205 255 / 24%), transparent 31%),
    radial-gradient(circle at 82% 86%, rgb(125 255 79 / 16%), transparent 29%),
    #eaf1f5 !important;
}
.login-page .auth-card {
  background: rgb(255 255 255 / 62%);
  border-color: rgb(255 255 255 / 82%);
  box-shadow: 0 22px 52px rgb(36 75 96 / 16%), inset 0 1px 0 rgb(255 255 255 / 92%);
  -webkit-backdrop-filter: blur(26px) saturate(150%);
  backdrop-filter: blur(26px) saturate(150%);
}
.login-page .auth-card input,
.login-page .otp-code .otp-digit {
  background: rgb(255 255 255 / 58%);
  border-color: rgb(202 220 230 / 84%);
  box-shadow: inset 0 1px 1px rgb(255 255 255 / 72%);
}
.login-page #login-passkey {
  background: rgb(255 255 255 / 45%);
  border-color: rgb(202 220 230 / 82%);
}
@media (prefers-color-scheme: dark) {
  .login-page {
    background:
      radial-gradient(circle at 16% 13%, rgb(47 180 234 / 20%), transparent 30%),
      radial-gradient(circle at 84% 88%, rgb(65 181 115 / 14%), transparent 28%),
      #000 !important;
  }
  .login-page .auth-card {
    background: rgb(19 35 43 / 62%);
    border-color: rgb(161 218 239 / 25%);
    box-shadow: 0 24px 60px rgb(0 0 0 / 48%), inset 0 1px 0 rgb(225 248 255 / 16%);
  }
  .login-page .auth-card input,
  .login-page .otp-code .otp-digit,
  .login-page #login-passkey {
    background: rgb(6 18 24 / 48%);
    border-color: rgb(142 205 229 / 24%);
    box-shadow: inset 0 1px 0 rgb(225 248 255 / 8%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .login-page .auth-card:has(#login-2fa:not([hidden]))::before {
    transition: none;
  }
}

.login-page .auth-card:has(#login-2fa:not([hidden]))::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: inherit;
  background: rgb(255 255 255 / 8%);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  transition: backdrop-filter .22s ease, -webkit-backdrop-filter .22s ease;
}
.login-page .auth-card:has(#login-2fa:not([hidden])) #login-2fa {
  position: relative;
  z-index: 2;
}
.login-page .auth-card:focus { outline: none; }

/* The desktop login background belongs to the full viewport, not the card column. */
@media (min-width: 901px) {
  body.login-page {
    width: 100%;
    max-width: none;
    margin: 0;
  }
}

/* The bottom dock is the sole mobile navigation control. */
@media (max-width: 900px) {
  .dashboard-ui .mobile-nav-toggle { display: none; }
  .dashboard-ui main,
  .dashboard-ui:has(.sidebar:hover) main,
  .dashboard-ui:has(.sidebar:focus-within) main {
    padding-top: 10px;
  }
  .dashboard-ui header {
    margin-bottom: 6px;
    padding-block: 8px;
  }
  .dashboard-ui .metrics { margin-top: 0; }
}

/* Compact phone layout; tablet and desktop geometry remain unchanged. */
@media (max-width: 620px) {
  .dashboard-ui main,
  .dashboard-ui:has(.sidebar:hover) main,
  .dashboard-ui:has(.sidebar:focus-within) main {
    padding: 8px 10px calc(84px + env(safe-area-inset-bottom));
  }
  .dashboard-ui header { gap: 8px; margin-bottom: 4px; padding-block: 6px; }
  .dashboard-ui h1 { font-size: 19px; }
  .dashboard-ui #subtitle { font-size: 10px; line-height: 1.35; }
  .dashboard-ui .header-actions { gap: 6px; }
  .dashboard-ui .header-actions .button,
  .dashboard-ui .header-actions .icon-button { min-height: 40px; }
  .dashboard-ui .section-intro { gap: 8px; margin-bottom: 8px; }
  .dashboard-ui .section-intro h2 { font-size: 16px; }
  .dashboard-ui .section-intro p { margin-top: 2px; font-size: 11px; line-height: 1.4; }
  .dashboard-ui .metrics { gap: 6px; margin-bottom: 8px; }
  .dashboard-ui .metrics article { min-height: 102px; padding: 10px; border-radius: 10px; }
  .dashboard-ui .metrics article > span,
  .dashboard-ui .metrics article > small { font-size: 10px; }
  .dashboard-ui .metrics strong { margin: 4px 0 2px; font-size: 21px; }
  .dashboard-ui .metric-chart { height: 46px; margin-top: 2px; padding-bottom: 12px; }
  .dashboard-ui .metric-chart svg { height: 34px; }
  .dashboard-ui .metric-chart > span { font-size: 7px; line-height: 10px; }
  .dashboard-ui .grid { gap: 8px; }
  .dashboard-ui .panel,
  .dashboard-ui .cards > article { padding: 12px; border-radius: 10px; }
  .dashboard-ui .panel { margin-bottom: 8px; }
  .dashboard-ui .panel-head { gap: 8px; margin-bottom: 7px; padding-bottom: 7px; }
  .dashboard-ui .panel h2 { font-size: 13px; }
  .dashboard-ui .panel p,
  .dashboard-ui .hint { font-size: 11px; line-height: 1.45; }
  .dashboard-ui .toolbar { gap: 6px; margin-bottom: 7px; }
  .dashboard-ui .toolbar input,
  .dashboard-ui .toolbar select { min-height: 40px; }
  .dashboard-ui th,
  .dashboard-ui td { padding: 6px 7px; }
  .dashboard-ui .gafam-layout { gap: 12px; padding-block: 10px; }
  .dashboard-ui .gafam-donut { width: 168px; height: 168px; }
  .dashboard-ui .gafam-center { width: 120px; height: 120px; }
  .dashboard-ui .gafam-row { padding: 7px 0; font-size: 11px; }
  .dashboard-ui .mobile-dock button { min-height: 44px; font-size: clamp(9px,2.8vw,11px); }
}

@media (max-width: 390px) {
  .dashboard-ui .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-ui .metrics article { min-height: 98px; padding: 9px; }
  .dashboard-ui .metrics strong { font-size: 20px; }
  .dashboard-ui .gafam-donut { width: 154px; height: 154px; }
  .dashboard-ui .gafam-center { width: 110px; height: 110px; }
}

/* Keep mobile navigation hit areas stationary when items change state. */
@media (max-width: 620px) {
  .dashboard-ui .sidebar .nav,
  .dashboard-ui .sidebar .nav:not(.active),
  .dashboard-ui .sidebar:hover .nav,
  .dashboard-ui .sidebar:focus-within .nav,
  .dashboard-ui .sidebar .nav:hover,
  .dashboard-ui .sidebar .nav:focus-within {
    box-sizing: border-box;
    flex: 0 0 48px;
    width: 100%;
    min-height: 48px;
    height: 48px;
    max-height: 48px;
    margin: 2px 0;
    padding: 10px 12px;
    transform: none;
  }
  .dashboard-ui .sidebar .nav-title,
  .dashboard-ui .sidebar:hover .nav-title,
  .dashboard-ui .sidebar:focus-within .nav-title {
    box-sizing: border-box;
    height: 42px;
    margin: 0;
    padding: 20px 12px 7px;
  }
}

/* Ultra-simple layout layer: structure/spacing/typography only. */
:is(.auth-page, .dashboard-ui) {
  letter-spacing: 0;
}

.auth-page {
  gap: 34px;
  max-width: 1040px;
  padding: 42px 26px;
}

.auth-page .auth-intro h2 {
  font-size: clamp(30px, 3.5vw, 44px);
  line-height: 1.16;
}

.auth-page .auth-intro p {
  max-width: 360px;
  line-height: 1.55;
}

.auth-page .auth-card {
  padding: 24px;
  border-radius: 10px;
}

.auth-page.setup-page {
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 30px;
}

.setup-page .auth-intro {
  top: 34px;
}

.dashboard-ui main {
  padding: 16px 18px 28px;
}

.dashboard-ui header {
  gap: 10px;
  margin-bottom: 12px;
}

.dashboard-ui h1 {
  font-size: clamp(24px, 2.4vw, 30px);
}

.dashboard-ui #subtitle {
  line-height: 1.4;
}

.dashboard-ui .metrics,
.dashboard-ui .grid,
.dashboard-ui .cards {
  gap: 10px;
}

.dashboard-ui .metrics article,
.dashboard-ui .panel,
.dashboard-ui .cards > article {
  padding: 14px;
  border-radius: 10px;
}

.dashboard-ui .panel-head {
  margin-bottom: 10px;
  padding-bottom: 8px;
}

.dashboard-ui .toolbar {
  gap: 8px;
  margin-bottom: 10px;
}

@media (max-width: 900px) {
  .auth-page,
  .auth-page.setup-page {
    gap: 18px;
    padding: 52px 18px 24px;
  }

  .auth-page .auth-intro h2,
  .setup-page .auth-intro h2 {
    font-size: 30px;
  }

  .auth-page .auth-card {
    padding: 22px 18px;
  }
}

.query-favicon { width: 16px; height: 16px; margin-right: 6px; vertical-align: -3px; object-fit: contain; }

/* Root-cause fix: this file's late global spacing layer re-expanded mobile gaps.
   Keep mobile spacing definitions after that layer, with normal cascade (no !important). */
@media (max-width: 900px) {
  .dashboard-ui .panel-head,
  .dashboard-ui .section-intro,
  .dashboard-ui .dialog-head,
  .dashboard-ui .actionbar {
    gap: 6px;
    margin-bottom: 6px;
    padding-bottom: 6px;
  }

  .dashboard-ui .panel > h2 {
    margin: 0 0 6px;
  }

  .dashboard-ui .panel > h2 + *,
  .dashboard-ui .panel > .panel-head + * {
    margin-top: 0;
    padding-top: 0;
  }

  .dashboard-ui .form-panel > p {
    margin-bottom: 8px;
  }

  .dashboard-ui .ranking {
    min-height: 0;
    height: auto;
    max-height: none;
  }
}

/* Text contrast normalization: keep all UI copy readable in both system themes.
   Uses existing theme tokens only (no effect/color-system changes). */
.dashboard-ui,
.auth-page,
.dashboard-ui dialog,
.auth-page dialog {
  color: var(--ui-text);
}

.dashboard-ui :is(h1, h2, h3, h4, h5, h6, p, li, label, legend, dt, dd),
.auth-page :is(h1, h2, h3, h4, h5, h6, p, li, label, legend) {
  color: inherit;
}

.dashboard-ui :is(input, textarea, select, option),
.auth-page :is(input, textarea, select, option) {
  color: var(--ui-text);
}

.dashboard-ui :is(#subtitle, .section-intro p, .form-panel > p, .client-meta, .query-source, .hint, label small, dt),
.auth-page :is(.security-note, .optional, label small) {
  color: var(--ui-muted);
}

.dashboard-ui .metrics strong.metric-total { color: var(--green); }
.dashboard-ui .metrics strong.metric-cached { color: var(--cyan); }
.dashboard-ui #top-domains .bar i { background: var(--green); }
.dashboard-ui .sidebar-version { margin-top: auto; min-width: 0; overflow: hidden; padding: 12px 10px 0; color: var(--ui-muted); font: 10px/1.3 "SFMono-Regular", Consolas, monospace; opacity: .8; text-overflow: ellipsis; white-space: nowrap; }

/* Desktop navigation rail: compact by default, expanded on pointer or keyboard focus. */
@media (min-width: 901px) {
  .dashboard-ui .sidebar {
    width: 64px !important;
    padding-inline: 10px !important;
    overflow: hidden;
    transition: width .42s cubic-bezier(.16,1,.3,1) !important;
  }
  .dashboard-ui .sidebar:hover,
  .dashboard-ui .sidebar:focus-within { width: 208px !important; }
  .dashboard-ui .sidebar .nav-title {
    opacity: 0;
    visibility: hidden;
    transform: translateX(-8px);
    transition: opacity .18s ease, transform .28s cubic-bezier(.16,1,.3,1), visibility 0s linear .28s;
  }
  .dashboard-ui .sidebar .sidebar-version {
    padding-inline: 0;
    text-align: center;
    transform: none;
    transition: opacity .18s ease, transform .28s cubic-bezier(.16,1,.3,1), padding .42s cubic-bezier(.16,1,.3,1);
  }
  .dashboard-ui .sidebar .nav-title {
    max-height: 0;
    margin: 0;
    padding: 0;
    overflow: hidden;
    transition: max-height .42s cubic-bezier(.16,1,.3,1), padding .42s cubic-bezier(.16,1,.3,1), margin .42s cubic-bezier(.16,1,.3,1), opacity .18s ease, transform .28s cubic-bezier(.16,1,.3,1), visibility 0s linear .28s;
  }
  .dashboard-ui .sidebar .nav {
    /* Keep the glyph anchored to the same x-position in both rail states. */
    justify-content: flex-start;
    gap: 10px;
    padding-inline: 8px;
    font-size: 0;
    transition: justify-content .42s cubic-bezier(.16,1,.3,1), gap .42s cubic-bezier(.16,1,.3,1), padding .42s cubic-bezier(.16,1,.3,1), font-size .18s ease .1s;
  }
  .dashboard-ui .sidebar .nav .sidebar-icon { flex: 0 0 18px; width: 18px; font-size: 16px; }
  .dashboard-ui .sidebar .nav.active::after { display: none; }
  .dashboard-ui .sidebar:hover .nav-title,
  .dashboard-ui .sidebar:focus-within .nav-title,
  .dashboard-ui .sidebar:hover .sidebar-version,
  .dashboard-ui .sidebar:focus-within .sidebar-version {
    opacity: 1;
    pointer-events: auto;
    visibility: visible;
    transform: translateX(0);
    transition-delay: .12s, .12s, 0s;
  }
  .dashboard-ui .sidebar:hover .sidebar-version,
  .dashboard-ui .sidebar:focus-within .sidebar-version {
    padding-inline: 10px;
    text-align: left;
  }
  .dashboard-ui .sidebar:hover .nav-title,
  .dashboard-ui .sidebar:focus-within .nav-title { max-height: 42px; margin: initial; padding: 18px 12px 8px; }
  .dashboard-ui .sidebar:hover .nav,
  .dashboard-ui .sidebar:focus-within .nav { justify-content: flex-start; gap: 10px; padding-inline: 10px; font-size: 12px; }
  .dashboard-ui .sidebar:hover .nav.active::after,
  .dashboard-ui .sidebar:focus-within .nav.active::after { display: block; }
  .dashboard-ui main,
  .dashboard-ui:has(.sidebar:hover) main,
  .dashboard-ui:has(.sidebar:focus-within) main {
    width: calc(100vw - 80px) !important;
    max-width: none !important;
    margin-left: 80px !important;
    transition: margin-left .42s cubic-bezier(.16,1,.3,1), width .42s cubic-bezier(.16,1,.3,1) !important;
  }
  .dashboard-ui:has(.sidebar:hover) main,
  .dashboard-ui:has(.sidebar:focus-within) main {
    width: calc(100vw - 224px) !important;
    margin-left: 224px !important;
  }
}

/* Keep every overview metric on the same chart track at each viewport size.
   The fixed flex basis prevents content differences (for example the cache
   rate label) from changing one chart's rendered height. */
.dashboard-ui .metrics article {
  display: flex;
  flex-direction: column;
}
.dashboard-ui .metrics .metric-chart {
  box-sizing: border-box;
  flex: 0 0 60px;
  min-height: 60px;
}
.dashboard-ui .metrics .metric-chart svg {
  box-sizing: border-box;
  min-height: 42px;
  height: 42px;
}
@media (max-width: 620px) {
  .dashboard-ui .metrics .metric-chart {
    flex-basis: 46px;
    min-height: 46px;
  }
  .dashboard-ui .metrics .metric-chart svg {
    min-height: 34px;
    height: 34px;
  }
}

/* Tablet metric cards can wrap labels to different heights. Anchor the fixed
   chart track to the bottom of each stretched card so all sparklines in a grid
   row share the same vertical alignment. */
@media (min-width: 621px) and (max-width: 1250px) {
  .dashboard-ui .metrics .metric-chart { margin-top: auto; }
}

/* v6.3.44 minimalist surface: one calm visual system for setup and every
   dashboard area. This layer is presentation-only; behaviour, IDs, forms and
   role-dependent visibility remain unchanged. */
:is(.dashboard-ui, .auth-page.setup-page) {
  --ui-bg: #f5f7f9;
  --ui-surface: #ffffff;
  --ui-input: #fbfcfd;
  --ui-border: #dfe6eb;
  --ui-text: #18232d;
  --ui-muted: #6d7c88;
  --ui-accent: #1688b5;
  --ui-selected: #e9f5f9;
  color-scheme: light;
}

html:has(body.dashboard-ui),
html:has(body.auth-page.setup-page) {
  background: #f5f7f9 !important;
}

body.dashboard-ui,
body.auth-page.setup-page {
  background: #f5f7f9 !important;
}

.dashboard-ui {
  min-height: 100vh;
  color: var(--ui-text);
  background-image: none;
  letter-spacing: normal;
}

.dashboard-ui .sidebar {
  background: var(--ui-surface);
  border-right: 1px solid var(--ui-border);
  box-shadow: 1px 0 8px rgb(24 35 45 / 4%);
}

.dashboard-ui .logo-mark {
  background: var(--ui-accent);
  color: #fff;
  border: 0;
  border-radius: 9px;
  box-shadow: none;
}

.dashboard-ui .logo strong,
.dashboard-ui h1,
.dashboard-ui h2,
.dashboard-ui h3,
.dashboard-ui label,
.dashboard-ui dt,
.dashboard-ui dd,
.dashboard-ui td,
.dashboard-ui th { color: var(--ui-text); }

.dashboard-ui .logo small,
.dashboard-ui .nav-title,
.dashboard-ui p,
.dashboard-ui label small,
.dashboard-ui dt,
.dashboard-ui #subtitle,
.dashboard-ui .client-meta,
.dashboard-ui .query-source { color: var(--ui-muted); }

.dashboard-ui .nav {
  color: var(--ui-muted);
  border: 1px solid transparent;
  border-radius: 8px;
  font-weight: 500;
}

.dashboard-ui .nav:hover {
  color: var(--ui-text);
  background: var(--ui-selected);
  border-color: transparent;
}

.dashboard-ui .nav.active {
  color: var(--ui-accent);
  background: var(--ui-selected);
  border-color: transparent;
  box-shadow: none;
}

.dashboard-ui main { color: var(--ui-text); }
.dashboard-ui header { border-color: var(--ui-border); }
.dashboard-ui h1 { font-weight: 650; letter-spacing: -.025em; }
.dashboard-ui h2 { font-weight: 650; letter-spacing: -.01em; }

.dashboard-ui .metrics article,
.dashboard-ui .panel,
.dashboard-ui .cards > article {
  background: var(--ui-surface);
  border: 1px solid var(--ui-border);
  border-radius: 10px;
  box-shadow: 0 1px 3px rgb(24 35 45 / 4%);
}

.dashboard-ui .metrics article::before,
.dashboard-ui .panel::before,
.dashboard-ui .cards > article::before { display: none; }

.dashboard-ui .metrics strong.metric-total { color: var(--green) !important; text-shadow: none; }
.dashboard-ui .metrics strong.metric-cached { color: var(--cyan) !important; text-shadow: none; }
.dashboard-ui .metrics .danger strong { color: var(--red); text-shadow: none; }
.dashboard-ui .metrics .warning strong { color: var(--amber); text-shadow: none; }
.dashboard-ui .metric-chart { border-color: var(--ui-border); }
.dashboard-ui .panel-head { border-color: var(--ui-border); }
.dashboard-ui .rank-row { border-color: var(--ui-border); }
.dashboard-ui #top-domains .bar i { background: var(--green); box-shadow: none; }
.dashboard-ui .bar { background: #edf1f4; border-radius: 999px; }
.dashboard-ui .bar i { border-radius: 999px; box-shadow: none; }

.dashboard-ui .table-wrap { border-color: var(--ui-border); border-radius: 8px; }
.dashboard-ui th { background: #f6f8fa; color: var(--ui-muted); border-color: var(--ui-border); }
.dashboard-ui td { color: var(--ui-text); border-color: #edf0f2; }
.dashboard-ui tbody tr:nth-child(even) { background: #fbfcfd; }
.dashboard-ui tbody tr:hover { background: var(--ui-selected); }

.dashboard-ui :is(input, textarea, select) {
  color: var(--ui-text);
  background: var(--ui-input);
  border-color: var(--ui-border);
  border-radius: 8px;
}

.dashboard-ui :is(input, textarea, select):focus {
  outline: 2px solid color-mix(in srgb, var(--ui-accent) 24%, transparent);
  outline-offset: 1px;
  border-color: var(--ui-accent);
}

.dashboard-ui .button,
.dashboard-ui .icon-button {
  color: var(--ui-text);
  background: var(--ui-surface);
  border-color: var(--ui-border);
  border-radius: 8px;
  box-shadow: none;
  text-transform: none;
  letter-spacing: normal;
}

.dashboard-ui .button:hover,
.dashboard-ui .icon-button:hover {
  color: var(--ui-accent);
  background: var(--ui-selected);
  border-color: #a8cddb;
}

.dashboard-ui .button.primary {
  color: #fff;
  background: var(--ui-accent);
  border-color: var(--ui-accent);
}

.dashboard-ui .button.primary:hover { color: #fff; background: #126d91; border-color: #126d91; }
.dashboard-ui .danger-button { color: #b53140; background: #fff; border-color: #efcbd0; }
.dashboard-ui .hint,
.dashboard-ui .actionbar { background: #f8fafb; border-color: var(--ui-border); border-left-color: var(--ui-accent); border-radius: 8px; box-shadow: none; }
.dashboard-ui dialog { color: var(--ui-text); background: var(--ui-surface); border-color: var(--ui-border); border-radius: 12px; box-shadow: 0 18px 55px rgb(24 35 45 / 15%); }

.auth-page.setup-page {
  min-height: 100vh;
  color: var(--ui-text);
  background: var(--ui-bg) !important;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.setup-page .auth-intro h2 { color: var(--ui-text); font-weight: 650; letter-spacing: -.035em; }
.setup-page .auth-intro h2 span { color: var(--ui-accent); }
.setup-page .auth-intro p,
.setup-page .auth-caption { color: var(--ui-muted); }
.setup-page .auth-card { background: var(--ui-surface); border: 1px solid var(--ui-border); border-radius: 12px; box-shadow: 0 8px 28px rgb(24 35 45 / 7%); }
.setup-page .logo strong,
.setup-page h1,
.setup-page h2,
.setup-page h3,
.setup-page label { color: var(--ui-text); }
.setup-page .logo small,
.setup-page p,
.setup-page label small { color: var(--ui-muted); }
.setup-page .setup-section { border-color: var(--ui-border); }
.setup-page .step { color: var(--ui-accent); background: var(--ui-selected); border: 1px solid #b8dce7; border-radius: 9px; box-shadow: none; }
.setup-page .optional { color: var(--ui-muted); border-color: var(--ui-border); border-radius: 999px; }
.setup-page :is(input, textarea, select) { color: var(--ui-text); background: var(--ui-input); border-color: var(--ui-border); border-radius: 8px; }
.setup-page :is(input, textarea, select):focus { outline: 2px solid color-mix(in srgb, var(--ui-accent) 24%, transparent); border-color: var(--ui-accent); }
.setup-page .button { color: var(--ui-text); background: var(--ui-surface); border-color: var(--ui-border); border-radius: 8px; text-transform: none; letter-spacing: normal; }
.setup-page .button.primary { color: #fff; background: var(--ui-accent); border-color: var(--ui-accent); }
.setup-page .security-note { color: var(--ui-muted); background: #f8fafb; border-color: var(--ui-border); border-left-color: var(--ui-accent); border-radius: 8px; }

@media (prefers-color-scheme: dark) {
  :is(.dashboard-ui, .auth-page.setup-page) {
    --ui-bg: #10161b;
    --ui-surface: #182129;
    --ui-input: #121a21;
    --ui-border: #2b3a44;
    --ui-text: #e8f0f4;
    --ui-muted: #9aaab4;
    --ui-accent: #55bfe5;
    --ui-selected: #203b48;
    color-scheme: dark;
  }
  html:has(body.dashboard-ui),
  html:has(body.auth-page.setup-page),
  body.dashboard-ui,
  body.auth-page.setup-page { background: #10161b !important; }
  .dashboard-ui .sidebar { background: var(--ui-surface); box-shadow: 1px 0 8px #0003; }
  .dashboard-ui .nav:hover { background: #20313b; }
  .dashboard-ui .metrics article,
  .dashboard-ui .panel,
  .dashboard-ui .cards > article { box-shadow: 0 2px 10px #0003; }
  .dashboard-ui .bar { background: #2a3840; }
  .dashboard-ui th { background: #202c34; }
  .dashboard-ui td { border-color: #2b3943; }
  .dashboard-ui tbody tr:nth-child(even) { background: #141d24; }
  .dashboard-ui .hint,
  .dashboard-ui .actionbar { background: #141e25; }
  .dashboard-ui .danger-button { color: #ffb6bd; background: #211b1e; border-color: #633a42; }
  .setup-page .auth-card { box-shadow: 0 14px 40px #0004; }
  .setup-page .step { background: #203b48; border-color: #365766; }
  .setup-page .security-note { background: #121a21; }
}

@media (max-width: 900px) {
  .setup-page .auth-intro { display: block; position: static; }
  .setup-page .auth-intro h2 { font-size: 30px; margin-bottom: 8px; }
  .setup-page .auth-intro p { max-width: 600px; font-size: 13px; }
  .setup-page .auth-card { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .dashboard-ui .page,
  .dashboard-ui .sidebar,
  .dashboard-ui .button,
  .dashboard-ui .icon-button,
  .dashboard-ui .nav { transition: none !important; }
}

/* Smooth desktop rail: avoid animating font-size and keep the layout changes
   on one coordinated easing curve. The collapsed rail still exposes icons and
   expands on hover/focus exactly as before. */
@media (min-width: 901px) {
  .dashboard-ui .sidebar {
    contain: layout paint;
    will-change: width;
    transition: width .36s cubic-bezier(.22, 1, .36, 1), box-shadow .24s ease !important;
    backface-visibility: hidden;
  }

  .dashboard-ui main,
  .dashboard-ui:has(.sidebar:hover) main,
  .dashboard-ui:has(.sidebar:focus-within) main {
    will-change: margin-left;
    /* Width adapts immediately to the new available space; only the offset
       animates, avoiding a zoom-like continuous squeeze of the dashboard. */
    transition: margin-left .36s cubic-bezier(.22, 1, .36, 1) !important;
  }

  .dashboard-ui .sidebar .nav,
  .dashboard-ui .sidebar:hover .nav,
  .dashboard-ui .sidebar:focus-within .nav {
    font-size: 12px;
    gap: 10px;
    overflow: hidden;
    white-space: nowrap;
    transition: color .2s ease, background-color .2s ease, border-color .2s ease;
  }

  .dashboard-ui:not(.sidebar-pinned) .sidebar:not(:hover):not(:focus-within) .nav {
    justify-content: flex-start;
    gap: 10px;
    color: var(--ui-muted);
    font-size: 0;
  }

  .dashboard-ui .sidebar .nav .sidebar-icon {
    color: var(--ui-muted);
    transition: color .2s ease;
  }

  .dashboard-ui .sidebar .nav.active .sidebar-icon,
  .dashboard-ui .sidebar:not(:hover):not(:focus-within) .nav.active .sidebar-icon {
    color: var(--ui-accent);
  }

  .dashboard-ui .sidebar:hover .nav,
  .dashboard-ui .sidebar:focus-within .nav {
    color: var(--ui-muted);
  }

  .dashboard-ui .sidebar:hover .nav:hover,
  .dashboard-ui .sidebar:focus-within .nav:hover,
  .dashboard-ui .sidebar:hover .nav.active,
  .dashboard-ui .sidebar:focus-within .nav.active {
    color: var(--ui-accent);
  }
}

@media (prefers-reduced-motion: reduce) and (min-width: 901px) {
  .dashboard-ui .sidebar,
  .dashboard-ui main,
  .dashboard-ui .sidebar .nav,
  .dashboard-ui .sidebar .nav .sidebar-icon { transition: none !important; }
}

/* v6.3.50 sidebar readability: typography and icon treatment only. The
   desktop rail width/position transitions above intentionally remain unchanged. */
.dashboard-ui .sidebar .nav,
.dashboard-ui .sidebar .nav-title {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: .01em;
}

.dashboard-ui .sidebar .nav-title {
  font-size: 10px;
  font-weight: 650;
  letter-spacing: .12em;
}

.dashboard-ui .sidebar .sidebar-icon {
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
}

.dashboard-ui .sidebar .sidebar-icon svg {
  width: 19px;
  height: 19px;
  stroke-width: 1.8;
  shape-rendering: geometricPrecision;
}

@keyframes sidebar-icon-pop-v650 {
  0%, 100% { transform: scale(1) rotate(0); }
  38% { transform: scale(1.13) rotate(-3deg); }
  72% { transform: scale(1.04) rotate(1.5deg); }
}

@keyframes sidebar-icon-draw-v650 {
  from { stroke-dashoffset: 90; }
  to { stroke-dashoffset: 0; }
}

.dashboard-ui .sidebar .nav:hover .sidebar-icon svg,
.dashboard-ui .sidebar .nav:focus-visible .sidebar-icon svg {
  animation: sidebar-icon-pop-v650 1.1s cubic-bezier(.22, 1, .36, 1) both;
}

.dashboard-ui .sidebar .nav:hover .sidebar-icon :is(path, circle, rect, line, polyline, polygon),
.dashboard-ui .sidebar .nav:focus-visible .sidebar-icon :is(path, circle, rect, line, polyline, polygon) {
  stroke-dasharray: 90;
  animation: sidebar-icon-draw-v650 1.1s ease-out both;
}

@media (min-width: 901px) {
  /* Keep icon and row geometry identical in the compact and expanded states.
     Only the sidebar/main widths animate; text fades without reflowing rows. */
  .dashboard-ui .sidebar .nav,
  .dashboard-ui .sidebar:hover .nav,
  .dashboard-ui .sidebar:focus-within .nav {
    width: 100%;
    justify-content: flex-start;
    gap: 10px;
    padding-inline: 10px;
    font-size: 12px;
  }

  .dashboard-ui:not(.sidebar-pinned) .sidebar:not(:hover):not(:focus-within) .nav {
    color: transparent;
  }

  .dashboard-ui .sidebar .nav-title,
  .dashboard-ui .sidebar:hover .nav-title,
  .dashboard-ui .sidebar:focus-within .nav-title {
    box-sizing: border-box;
    height: 34px;
    max-height: 34px;
    margin: 0;
    padding: 18px 12px 5px;
    overflow: hidden;
    font-size: 10px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transform: none;
    transition: opacity .18s ease, visibility 0s linear .18s;
  }

  .dashboard-ui .sidebar:hover .nav-title,
  .dashboard-ui .sidebar:focus-within .nav-title {
    opacity: 1;
    visibility: visible;
    transition-delay: 0s;
  }

  /* Briefly bridge the physical gap between the rail and dashboard. The
     pointer-exit class is removed shortly afterward unless the rail is re-entered. */
  .dashboard-ui .sidebar.sidebar-pointer-grace {
    width: 208px !important;
  }

  .dashboard-ui .sidebar.sidebar-pointer-grace .nav-title {
    opacity: 1;
    visibility: visible;
    transition-delay: 0s;
  }

  .dashboard-ui .sidebar.sidebar-pointer-grace .sidebar-version {
    padding-inline: 10px;
    text-align: left;
    opacity: 1;
    visibility: visible;
  }

  .dashboard-ui:not(.sidebar-pinned) .sidebar.sidebar-pointer-grace:not(:hover):not(:focus-within) .nav {
    color: var(--ui-muted);
    justify-content: flex-start;
    gap: 10px;
    padding-inline: 10px;
    font-size: 12px;
  }

  .dashboard-ui:not(.sidebar-pinned) .sidebar.sidebar-pointer-grace:not(:hover):not(:focus-within) .nav.active,
  .dashboard-ui:not(.sidebar-pinned) .sidebar.sidebar-pointer-grace:not(:hover):not(:focus-within) .nav:hover {
    color: var(--ui-accent);
  }

  .dashboard-ui:has(.sidebar.sidebar-pointer-grace) main {
    width: calc(100vw - 224px) !important;
    margin-left: 224px !important;
  }

  .dashboard-ui .sidebar:hover .nav,
  .dashboard-ui .sidebar:focus-within .nav {
    color: var(--ui-muted);
  }

  .dashboard-ui .sidebar:hover .nav:hover,
  .dashboard-ui .sidebar:focus-within .nav:hover,
  .dashboard-ui .sidebar:hover .nav.active,
  .dashboard-ui .sidebar:focus-within .nav.active {
    color: var(--ui-accent);
  }
}

@media (prefers-reduced-motion: reduce) {
  .dashboard-ui .sidebar .nav:hover .sidebar-icon svg,
  .dashboard-ui .sidebar .nav:focus-visible .sidebar-icon svg,
  .dashboard-ui .sidebar .nav:hover .sidebar-icon :is(path, circle, rect, line, polyline, polygon),
  .dashboard-ui .sidebar .nav:focus-visible .sidebar-icon :is(path, circle, rect, line, polyline, polygon) {
    animation: none;
  }
}

/* Reserve the expanded desktop rail width in every state. Keeping the dashboard
   clear of the overlay avoids a false "zoom" when the rail opens or closes. */
@media (min-width: 901px) {
  .dashboard-ui:not(.sidebar-pinned) main,
  .dashboard-ui:not(.sidebar-pinned):has(.sidebar:hover) main,
  .dashboard-ui:not(.sidebar-pinned):has(.sidebar:focus-within) main,
  .dashboard-ui:not(.sidebar-pinned):has(.sidebar.sidebar-pointer-grace) main {
    width: calc(100% - 224px) !important;
    max-width: none !important;
    margin-left: 224px !important;
    padding: 28px 32px 48px !important;
    transition: none !important;
  }

  .dashboard-ui.sidebar-pinned main {
    width: calc(100% - 224px) !important;
    max-width: none !important;
    margin-left: 224px !important;
    padding: 28px 32px 48px !important;
    transition: none !important;
  }
}

/* Calm, informative feedback for first load and small dashboard actions. */
.dashboard-ui.dashboard-loading .metric-total,
.dashboard-ui.dashboard-loading .metric-cached,
.dashboard-ui.dashboard-loading .metric-blocked,
.dashboard-ui.dashboard-loading .metric-denied {
  color: transparent !important;
  border-radius: 6px;
  background: linear-gradient(100deg, color-mix(in srgb, var(--ui-border) 45%, transparent) 20%, color-mix(in srgb, var(--ui-border) 88%, transparent) 38%, color-mix(in srgb, var(--ui-border) 45%, transparent) 56%);
  background-size: 220% 100%;
  animation: dashboard-skeleton 1.25s ease-in-out infinite;
}

@keyframes dashboard-skeleton {
  to { background-position-x: -220%; }
}

.dashboard-ui .empty-state {
  padding: 22px 14px !important;
  color: var(--ui-muted) !important;
  text-align: center;
}

.dashboard-ui .empty-client-state {
  padding: 24px !important;
  text-align: center;
  border: 1px dashed var(--ui-border);
}

.dashboard-ui .empty-client-state p {
  color: var(--ui-muted);
}

.dashboard-ui .copy-value {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.dashboard-ui .copy-value-button {
  flex: 0 0 auto;
  min-width: 26px;
  min-height: 26px;
  padding: 2px 6px;
  color: var(--ui-muted);
  background: transparent;
  border: 1px solid var(--ui-border);
  border-radius: 6px;
  cursor: pointer;
  transition: color .16s ease, border-color .16s ease, background .16s ease;
}

.dashboard-ui .copy-value-button:hover,
.dashboard-ui .copy-value-button:focus-visible,
.dashboard-ui .copy-value-button.copied {
  color: var(--ui-accent);
  border-color: var(--ui-accent);
  outline: none;
}

.dashboard-ui button[aria-busy="true"] {
  cursor: progress;
  opacity: .78;
}

.dashboard-ui .query-live.fallback {
  color: var(--ui-warning, #e6b85c);
}

@media (prefers-reduced-motion: reduce) {
  .dashboard-ui.dashboard-loading .metric-total,
  .dashboard-ui.dashboard-loading .metric-cached,
  .dashboard-ui.dashboard-loading .metric-blocked,
  .dashboard-ui.dashboard-loading .metric-denied {
    animation: none;
    background-position: 50% 0;
  }
}
