/* GO Maps admin. No build step; served from /maps-assets/admin.css under a strict CSP. */
:root {
  --bg: #f8fafc; --surface: #ffffff; --surface-2: #f1f5f9; --border: #e2e5ea; --border-strong: #cfd4dc;
  --text: #0f172a; --muted: #475569; --faint: #94a3b8;
  --brand: #1f5eff; --brand-ink: #ffffff; --brand-soft: #eff6ff;
  --ok: #059669; --ok-soft: #ecfdf5; --warn: #d97706; --warn-soft: #fffbeb; --bad: #dc2626; --bad-soft: #fef2f2; --info-soft: #e8f1fb;
  --radius: 12px; --shadow: 0 1px 3px rgba(15,23,42,.06), 0 1px 2px rgba(15,23,42,.04);
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0f19; --surface: #111827; --surface-2: #1e293b; --border: rgba(255,255,255,0.08); --border-strong: rgba(255,255,255,0.15);
    --text: #f8fafc; --muted: #94a3b8; --faint: #64748b;
    --brand: #3b82f6; --brand-ink: #0b1120; --brand-soft: rgba(59,130,246,0.15);
    --ok: #10b981; --ok-soft: rgba(16,185,129,0.15); --warn: #f59e0b; --warn-soft: rgba(245,158,11,0.15); --bad: #ef4444; --bad-soft: rgba(239,68,68,0.15); --info-soft: rgba(59,130,246,0.12);
    --shadow: 0 4px 20px rgba(0,0,0,0.3); color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
code, .mono { font-family: var(--mono); font-size: 12.5px; }
h1 { font-size: 22px; margin: 0; letter-spacing: -.02em; font-weight: 750; }
h2 { font-size: 16px; margin: 0 0 12px; font-weight: 700; }
h3 { font-size: 12.5px; margin: 0 0 8px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; font-weight: 700; }
p { margin: 0 0 10px; }
.muted { color: var(--muted); } .faint { color: var(--faint); } .small { font-size: 12.5px; }
.nowrap { white-space: nowrap; } .right { text-align: right; } .grow { flex: 1; }

/* Shell */
.shell { display: grid; grid-template-columns: 256px 1fr; min-height: 100vh; background: var(--bg); }
.side { background: var(--surface); border-right: 1px solid var(--border); padding: 20px 14px 16px; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand-link { text-decoration: none; color: inherit; display: block; margin-bottom: 20px; }
.brand-link:hover { text-decoration: none; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px; font-weight: 650; }
.brand img { display: block; }
.gm-pill-sm {
  display: inline-flex; align-items: center; gap: 4px; font-size: 10px; font-weight: 750;
  letter-spacing: .08em; text-transform: uppercase; padding: 2px 7px; border-radius: 999px;
  background: rgba(252, 194, 0, 0.14); border: 1px solid rgba(252, 194, 0, 0.35); color: #fcc200;
}
.nav-section-title {
  font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--faint); padding: 16px 10px 6px;
}
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 9px;
  color: var(--muted); font-weight: 550; font-size: 13.5px; transition: all .15s ease;
}
.nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav a.on { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.nav-icon { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; flex-shrink: 0; color: inherit; }
.nav .sep { height: 1px; background: var(--border); margin: 12px 6px; }

/* Sidebar User & Health */
.side .me { margin-top: auto; border-top: 1px solid var(--border); padding: 14px 6px 0; font-size: 12.5px; }
.me-user-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.me-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), #4f46e5); color: #fff;
  display: grid; place-items: center; font-weight: 700; font-size: 13px; flex-shrink: 0;
}
.me-details { overflow: hidden; line-height: 1.35; flex: 1; min-width: 0; }
.me-name { display: block; font-size: 13.5px; font-weight: 650; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-email { display: block; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--muted); }
.me-role-row { margin-bottom: 10px; }
.me-actions { display: flex; gap: 6px; }
.sidebar-status-beacon {
  display: flex; align-items: center; gap: 7px; margin-top: 12px; padding-top: 10px;
  border-top: 1px dashed var(--border); font-size: 11px; color: var(--faint);
}

/* Main Area & Topbar */
.main { padding: 24px 32px 64px; max-width: 1440px; width: 100%; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  margin-bottom: 24px; padding-bottom: 16px; border-bottom: 1px solid var(--border); flex-wrap: wrap;
}
.topbar-breadcrumb {
  display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--faint);
  margin-bottom: 4px; font-weight: 500;
}
.breadcrumb-current { color: var(--muted); font-weight: 600; }
.topbar-heading-row h1 { font-size: 22px; font-weight: 750; letter-spacing: -0.02em; margin: 0; color: var(--text); }
.topbar-heading-row .sub { font-size: 13px; color: var(--muted); margin-top: 3px; display: block; }
.topbar-actions-cluster { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.topbar-badge { padding: 5px 11px; font-size: 12px; font-weight: 600; }
.icon-only { width: 34px; height: 34px; padding: 0; display: grid; place-items: center; }
.menu-btn { display: none; }

/* Hero Overview Banner */
.gm-hero-banner {
  background: linear-gradient(135deg, rgba(31, 94, 255, 0.08), rgba(252, 194, 0, 0.05)), var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 24px;
  margin-bottom: 22px; box-shadow: var(--shadow); display: flex; align-items: center;
  justify-content: space-between; gap: 20px; flex-wrap: wrap;
}
.gm-hero-content h2 {
  font-size: 17px; font-weight: 750; margin: 0 0 5px; color: var(--text);
  display: flex; align-items: center; gap: 8px;
}
.gm-hero-content p {
  font-size: 13.5px; color: var(--muted); margin: 0; max-width: 650px; line-height: 1.5;
}
.gm-hero-chips { display: flex; gap: 8px; flex-wrap: wrap; }

/* Surfaces & Cards */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.card + .card { margin-top: 16px; }
.card.flush { padding: 0; overflow: hidden; }
.card .card-h { display: flex; align-items: center; gap: 10px; padding: 14px 20px; border-bottom: 1px solid var(--border); }
.card .card-h h2 { margin: 0; font-size: 15px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-side { grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr); }

/* Stats Grid */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 22px; }
@media (max-width: 1100px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .stats { grid-template-columns: 1fr; } }
.stat {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow); transition: transform .15s ease, box-shadow .15s ease;
  display: flex; flex-direction: column; justify-content: space-between;
}
.stat:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(0,0,0,.08); }
.stat-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.stat .k { color: var(--muted); font-size: 13px; font-weight: 600; }
.stat-icon {
  width: 30px; height: 30px; border-radius: 8px; background: var(--surface-2);
  color: var(--muted); display: grid; place-items: center;
}
.stat .v {
  font-size: 26px; font-weight: 750; color: var(--text); font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em; line-height: 1.2;
}
.stat-sub { font-size: 12px; color: var(--faint); margin-top: 6px; font-weight: 500; }
.stat.ok .v { color: var(--ok); }
.stat.ok .stat-icon { background: var(--ok-soft); color: var(--ok); }
.stat.bad .v { color: var(--bad); }
.stat.bad .stat-icon { background: var(--bad-soft); color: var(--bad); }
.stat.warn .v { color: var(--warn); }
.stat.warn .stat-icon { background: var(--warn-soft); color: var(--warn); }
dl.kv { display: grid; grid-template-columns: 150px 1fr; gap: 8px 14px; margin: 0; }
dl.kv dt { color: var(--muted); } dl.kv dd { margin: 0; word-break: break-word; }

/* Buckets progress */
.bucket-row { padding: 10px 0; }
.bucket-row + .bucket-row { border-top: 1px solid var(--border); }
.bucket-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.bucket-name { font-weight: 650; color: var(--text); font-size: 13.5px; }
.bucket-meta { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.bar { height: 7px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--brand), #60a5fa); }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 11px 16px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: 12px; font-weight: 650; color: var(--muted); background: var(--surface-2); white-space: nowrap; letter-spacing: .03em; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: var(--surface-2); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.empty { padding: 36px; text-align: center; color: var(--muted); }

/* Pills */
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--surface-2); color: var(--muted); white-space: nowrap; border: 1px solid transparent; }
.pill.ok { background: var(--ok-soft); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 25%, transparent); }
.pill.bad { background: var(--bad-soft); color: var(--bad); border-color: color-mix(in srgb, var(--bad) 30%, transparent); }
.pill.warn { background: var(--warn-soft); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 30%, transparent); }
.pill.info { background: var(--brand-soft); color: var(--brand); border-color: color-mix(in srgb, var(--brand) 25%, transparent); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }

/* Forms */
label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 13px; }
.field { margin-bottom: 16px; }
.hint { color: var(--muted); font-size: 12.5px; margin-top: 4px; font-weight: 400; }
input:not([type]), input[type=text], input[type=email], input[type=password], input[type=date], input[type=search], input[type=number], input[type=url], input[type=tel], select, textarea {
  width: 100%; padding: 9px 12px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface); color: var(--text); font: inherit; font-size: 13.5px;
}
input[type=file] { font: inherit; color: var(--muted); }
textarea { min-height: 80px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: 0; border-color: transparent; }
.check { display: flex; gap: 9px; align-items: flex-start; font-weight: 400; margin-bottom: 8px; cursor: pointer; }
.check input { margin-top: 3px; accent-color: var(--brand); }
.check b { font-weight: 550; display: block; }
.error-text { color: var(--bad); font-size: 12.5px; margin-top: 4px; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.filters > * { flex: 0 1 auto; } .filters input[type=search] { min-width: 220px; }
.filters select, .filters input { width: auto; }
.form-actions { display: flex; gap: 8px; align-items: center; margin-top: 18px; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font: inherit; font-weight: 550; cursor: pointer; white-space: nowrap; transition: all .15s ease; }
.btn:hover { background: var(--surface-2); text-decoration: none; border-color: var(--border-strong); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.primary:hover { filter: brightness(1.08); box-shadow: 0 2px 8px rgba(31,94,255,.3); }
.btn.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, var(--border)); }
.btn.danger:hover { background: var(--bad-soft); }
.btn.sm { padding: 5px 11px; font-size: 12.5px; }
.btn.link { border: 0; background: none; padding: 0; color: var(--brand); font-weight: 550; }
.btn-row { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
form.inline { display: inline; }

/* Notices */
.flash { display: flex; align-items: flex-start; gap: 10px; padding: 12px 16px; border-radius: var(--radius); margin-bottom: 18px; border: 1px solid transparent; font-size: 13.5px; line-height: 1.45; }
.flash.ok { background: var(--ok-soft); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 30%, transparent); }
.flash.bad { background: var(--bad-soft); color: var(--bad); border-color: color-mix(in srgb, var(--bad) 30%, transparent); }
.flash.warn { background: var(--warn-soft); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 30%, transparent); }
.flash.info { background: var(--info-soft); color: var(--brand); border-color: color-mix(in srgb, var(--brand) 25%, transparent); }
.secret { display: flex; gap: 8px; align-items: center; background: var(--surface-2); border: 1px dashed var(--border-strong); border-radius: 8px; padding: 12px; }
.secret code { flex: 1; word-break: break-all; font-size: 13.5px; user-select: all; }

/* Preview */
.preview { background: var(--surface-2); border-radius: 8px; display: grid; place-items: center; min-height: 160px; overflow: hidden; }
.preview img, .preview video { max-width: 100%; max-height: 520px; display: block; }
.preview iframe { width: 100%; height: 600px; border: 0; background: #fff; }
.preview audio { width: 100%; margin: 20px; }
details.danger-zone { border: 1px solid color-mix(in srgb, var(--bad) 35%, var(--border)); border-radius: var(--radius); padding: 12px 16px; margin-top: 16px; }
details.danger-zone summary { cursor: pointer; color: var(--bad); font-weight: 600; }

/* Pagination */
.pager { display: flex; gap: 6px; justify-content: space-between; align-items: center; padding: 12px 18px; border-top: 1px solid var(--border); color: var(--muted); }

/* Login */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.auth-card { width: 100%; max-width: 380px; }
.auth-card .brand { justify-content: center; padding-bottom: 20px; font-size: 16px; }

/* Explicit theme data-attribute overrides */
html[data-theme="dark"] {
  --bg: #0f1115; --surface: #171a20; --surface-2: #1d2128; --border: #2a2f38; --border-strong: #3a414c;
  --text: #e8eaee; --muted: #a3abb7; --faint: #77808c;
  --brand: #6d9bff; --brand-ink: #0b1020; --brand-soft: #1a2540;
  --ok: #5fd08f; --ok-soft: #12291c; --warn: #f0c060; --warn-soft: #2d2410; --bad: #ff8a80; --bad-soft: #321615; --info-soft: #142233;
  --shadow: none; color-scheme: dark;
}
html[data-theme="light"] {
  --bg: #f5f6f8; --surface: #fff; --surface-2: #f0f2f5; --border: #e2e5ea; --border-strong: #cfd4dc;
  --text: #171a1f; --muted: #5d6673; --faint: #8a93a0;
  --brand: #1f5eff; --brand-ink: #fff; --brand-soft: #e8efff;
  --ok: #117a43; --ok-soft: #e3f5ea; --warn: #8a5a00; --warn-soft: #fdf1d8; --bad: #b42318; --bad-soft: #fde8e6; --info-soft: #e8f1fb;
  --radius: 10px; --shadow: 0 1px 2px rgba(16,24,40,.05), 0 1px 3px rgba(16,24,40,.06);
  color-scheme: light;
}

/* ==========================================================================
   Vault Auth & Login Redesign
   ========================================================================== */
.auth-page {
  min-height: 100vh;
  margin: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

.auth-split {
  display: grid;
  grid-template-columns: minmax(420px, 1.15fr) 1fr;
  min-height: 100vh;
  width: 100%;
}

/* Brand Showcase Side */
.auth-brand-side {
  position: relative;
  background:
    radial-gradient(ellipse 60% 50% at 20% 100%, rgba(252, 194, 0, 0.16), transparent 60%),
    radial-gradient(ellipse 70% 60% at 90% 10%, rgba(31, 94, 255, 0.35), transparent 65%),
    radial-gradient(circle at 50% 50%, rgba(15, 23, 42, 0.7), transparent 100%),
    #0b101e;
  color: #f1f5f9;
  padding: 48px 56px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.auth-brand-side::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 36px 36px;
  pointer-events: none;
  mask-image: radial-gradient(ellipse at 50% 50%, black 40%, transparent 80%);
  -webkit-mask-image: radial-gradient(ellipse at 50% 50%, black 40%, transparent 80%);
}

.brand-showcase-header {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-showcase-logo {
  height: 38px;
  width: auto;
  display: block;
}

.gm-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(252, 194, 0, 0.12);
  border: 1px solid rgba(252, 194, 0, 0.35);
  color: #fcc200;
}

.brand-showcase-hero {
  position: relative;
  z-index: 2;
  max-width: 520px;
  margin: 40px 0;
}

.hero-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: #93c5fd;
  margin-bottom: 16px;
}

.brand-showcase-title {
  font-size: 32px;
  line-height: 1.25;
  font-weight: 750;
  letter-spacing: -0.02em;
  color: #ffffff;
  margin: 0 0 16px;
}

.brand-showcase-lead {
  font-size: 15px;
  line-height: 1.6;
  color: #94a3b8;
  margin: 0 0 32px;
}

.gm-features {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.gm-feature-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.feature-icon-box {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  display: grid;
  place-items: center;
  color: #fcc200;
}

.feature-title {
  font-size: 14px;
  font-weight: 650;
  color: #f8fafc;
  margin: 0 0 3px;
}

.feature-desc {
  font-size: 12.5px;
  line-height: 1.45;
  color: #94a3b8;
  margin: 0;
}

.brand-showcase-footer {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 12.5px;
  color: #64748b;
  flex-wrap: wrap;
  gap: 12px;
}

.system-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #cbd5e1;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  animation: pulse-green 2s infinite;
}

@keyframes pulse-green {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* Form Side */
.auth-form-side {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 40px 24px;
  background: var(--bg);
  min-height: 100vh;
}

.auth-theme-btn {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: all .15s ease;
}

.auth-theme-btn:hover {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--border-strong);
}

.theme-toggle-btn .icon-sun { display: none; }
.theme-toggle-btn .icon-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle-btn .icon-sun { display: block; }
  :root:not([data-theme="light"]) .theme-toggle-btn .icon-moon { display: none; }
}
html[data-theme="dark"] .theme-toggle-btn .icon-sun { display: block; }
html[data-theme="dark"] .theme-toggle-btn .icon-moon { display: none; }
html[data-theme="light"] .theme-toggle-btn .icon-sun { display: none; }
html[data-theme="light"] .theme-toggle-btn .icon-moon { display: block; }

.auth-form-container {
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
}

.mobile-brand {
  display: none;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
  justify-content: center;
}

.mobile-brand img {
  height: 34px;
  width: auto;
}

.logo-on-dark { display: none; }
.logo-on-light { display: block; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .logo-on-dark { display: block; }
  :root:not([data-theme="light"]) .logo-on-light { display: none; }
}
html[data-theme="dark"] .logo-on-dark { display: block; }
html[data-theme="dark"] .logo-on-light { display: none; }

.auth-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 36px 32px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05), 0 1px 3px rgba(0, 0, 0, 0.04);
  transition: box-shadow .2s ease;
}

.auth-box-header {
  margin-bottom: 24px;
  text-align: left;
}

.auth-lock-badge {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--brand-soft);
  color: var(--brand);
  display: grid;
  place-items: center;
  margin-bottom: 16px;
}

.auth-box-title {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0 0 6px;
  color: var(--text);
}

.auth-box-subtitle {
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--muted);
  margin: 0;
}

/* Enhanced Form Controls */
.auth-field {
  margin-bottom: 18px;
}

.auth-field-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 7px;
}

.auth-field-header label {
  margin-bottom: 0;
}

.forgot-link {
  font-size: 12.5px;
  font-weight: 550;
  color: var(--brand);
  text-decoration: none;
}

.forgot-link:hover {
  text-decoration: underline;
}

.auth-actions-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 20px;
  gap: 12px;
}

.auth-back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 550;
  color: var(--muted);
  text-decoration: none;
  transition: color .15s ease;
}

.auth-back-link:hover {
  color: var(--brand);
  text-decoration: none;
}

.code-input {
  letter-spacing: .25em;
  font-weight: 700;
  font-size: 18px !important;
  font-family: var(--mono);
}

.auth-field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 7px;
}

.input-with-icon {
  position: relative;
  display: flex;
  align-items: center;
}

.input-with-icon .field-icon {
  position: absolute;
  left: 14px;
  color: var(--faint);
  pointer-events: none;
  display: grid;
  place-items: center;
  transition: color .15s ease;
}

.input-with-icon input {
  width: 100%;
  height: 44px;
  padding: 10px 14px 10px 42px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  transition: border-color .15s ease, box-shadow .15s ease;
}

.input-with-icon input:hover {
  border-color: color-mix(in srgb, var(--brand) 40%, var(--border-strong));
}

.input-with-icon input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent);
}

.input-with-icon input:focus + .field-icon,
.input-with-icon input:focus ~ .field-icon {
  color: var(--brand);
}

.password-toggle-btn {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: 0;
  padding: 6px;
  border-radius: 6px;
  color: var(--muted);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: color .15s ease;
}

.password-toggle-btn:hover {
  color: var(--text);
  background: var(--surface-2);
}

.password-toggle-btn .icon-eye-off { display: none; }
.password-toggle-btn.is-visible .icon-eye { display: none; }
.password-toggle-btn.is-visible .icon-eye-off { display: block; }

.caps-warning {
  display: none;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  color: #b45309;
  background: #fef3c7;
  border: 1px solid #fde68a;
  padding: 6px 10px;
  border-radius: 6px;
  margin-top: 6px;
}

.caps-warning.is-active {
  display: inline-flex;
}

@media (prefers-color-scheme: dark) {
  .caps-warning {
    color: #fde68a;
    background: #362208;
    border-color: #573a0c;
  }
}

.auth-check {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
  margin: 12px 0 20px;
  user-select: none;
}

.auth-check input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--brand);
  cursor: pointer;
}

.btn-auth-submit {
  width: 100%;
  height: 44px;
  border-radius: 10px;
  background: var(--brand);
  color: var(--brand-ink);
  border: 1px solid var(--brand);
  font: inherit;
  font-size: 14.5px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: filter .15s ease, box-shadow .15s ease, transform .1s ease;
  box-shadow: 0 1px 3px rgba(31, 94, 255, 0.25);
}

.btn-auth-submit:hover {
  filter: brightness(1.08);
  box-shadow: 0 4px 12px rgba(31, 94, 255, 0.35);
}

.btn-auth-submit:active {
  transform: scale(0.99);
}

.btn-auth-submit.is-loading .btn-text {
  opacity: .8;
}

.btn-auth-submit.is-loading .btn-spinner {
  display: block !important;
}

.btn-spinner {
  animation: spin .8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.auth-notice-card {
  margin-top: 24px;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--muted);
}

.auth-notice-card .notice-icon {
  flex-shrink: 0;
  color: var(--brand);
  margin-top: 1px;
}

/* One-page sign-in / forgot / reset flow */
[data-auth-flow] [hidden] { display: none !important; }
[data-auth-flow] form { animation: auth-step-in .18s ease; }
@keyframes auth-step-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.auth-actions-center { justify-content: center; }
.forgot-link[aria-disabled="true"] { color: var(--muted); pointer-events: none; text-decoration: none; }
.auth-help { margin: 16px 0 0; text-align: center; font-size: 12.5px; color: var(--muted); }

.auth-external-links {
  text-align: center;
  margin-top: 20px;
  font-size: 12.5px;
  color: var(--faint);
}

.auth-external-links a {
  color: var(--muted);
  font-weight: 500;
}

.auth-external-links a:hover {
  color: var(--brand);
}

/* Mobile & Tablet Responsive */
@media (max-width: 980px) {
  .auth-split {
    grid-template-columns: 1fr;
  }
  .auth-brand-side {
    display: none;
  }
  .mobile-brand {
    display: flex;
  }
  .auth-form-side {
    padding: 32px 18px;
    min-height: 100vh;
  }
  .auth-box {
    padding: 28px 20px;
  }
}

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; z-index: 20; left: 0; top: 0; width: 260px; transform: translateX(-100%); transition: transform .2s; box-shadow: 0 0 40px rgba(0,0,0,.2); }
  body.nav-open .side { transform: none; }
  .menu-btn { display: inline-flex; }
  .main { padding: 16px; }
  .g2, .g3, .g-side { grid-template-columns: 1fr; }
  dl.kv { grid-template-columns: 1fr; gap: 2px 0; } dl.kv dd { margin-bottom: 8px; }
  .filters input[type=search] { min-width: 0; width: 100%; }
}

/* Modal dialog (native <dialog>) */
dialog.modal { border: 1px solid var(--border); border-radius: 14px; padding: 22px; width: min(460px, calc(100vw - 32px)); background: var(--surface); color: var(--text); box-shadow: 0 20px 60px rgba(0,0,0,.25); }
dialog.modal::backdrop { background: rgba(15,17,21,.55); }
dialog.modal h2 { font-size: 17px; margin-bottom: 10px; }
.btn:disabled, .btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn.danger:disabled:hover { background: var(--surface); }
