:root {
  --bg: #090b10;                  /* True OLED near-black canvas */
  --surface: #111520;             /* Primary card surface */
  --surface-2: #171d2c;           /* Elevated pill / active surface */
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);

  --text-1: #f8fafc;              /* Primary high-contrast text & hero numerals */
  --text-2: #94a3b8;              /* Secondary labels */
  --text-3: #64748b;              /* Muted metadata / timestamps */

  --emerald: #10b981;             /* Live pulse, fast tok/s, healthy */
  --emerald-soft: rgba(16, 185, 129, 0.14);
  --cyan: #06b6d4;                /* Active agent accent, chart stroke, Antigravity */
  --cyan-soft: rgba(6, 182, 212, 0.14);
  --amber: #f59e0b;               /* Idle dot, TTFT, ≥ lower-bound Codex badge */
  --amber-soft: rgba(245, 158, 11, 0.14);
  --rose: #f43f5e;                /* Offline dot, errors, slow warning */
  --rose-soft: rgba(244, 63, 94, 0.14);
  --violet: #a78bfa;              /* Claude / secondary agent accent */
  --violet-soft: rgba(167, 139, 250, 0.16);

  --radius-card: 16px;
  --radius-pill: 999px;

  --font-sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "JetBrains Mono", "Cascadia Mono", Consolas, monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  background-color: var(--bg);
  color: var(--text-1);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-text-size-adjust: 100%;
  color-scheme: dark;
}

body {
  margin: 0;
  min-height: 100dvh;
  background-color: var(--bg);
  color: var(--text-1);
  overflow-x: clip;
  -webkit-tap-highlight-color: transparent;
}

body.is-locked {
  overflow: hidden;
}

[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

button,
input {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
}

button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}

/* ==========================================================================
   App Shell & Sticky Top Status Bar
   ========================================================================== */

.app-shell {
  width: 100%;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.top-bar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(9, 11, 16, 0.85);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding-top: env(safe-area-inset-top, 0px);
  padding-left: env(safe-area-inset-left, 0px);
  padding-right: env(safe-area-inset-right, 0px);
}

.top-bar-inner {
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  padding: 10px 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex-shrink: 0;
}

.brand-icon {
  display: block;
  flex-shrink: 0;
}

.brand-name {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-1);
  white-space: nowrap;
}

.top-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  max-width: 185px;
  height: 30px;
  padding: 0 10px;
  border-radius: var(--radius-pill);
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-2);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--text-3);
}

.status-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-pill.is-live {
  background: var(--emerald-soft);
  border-color: rgba(16, 185, 129, 0.34);
  color: #a7f3d0;
}

.status-pill.is-live .status-dot {
  background: var(--emerald);
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  animation: hud-pulse 1.8s ease-out infinite;
}

.status-pill.is-idle {
  background: var(--amber-soft);
  border-color: rgba(245, 158, 11, 0.28);
  color: #fde68a;
}

.status-pill.is-idle .status-dot {
  background: var(--amber);
}

.status-pill.is-offline {
  background: var(--rose-soft);
  border-color: rgba(244, 63, 94, 0.3);
  color: #fecdd3;
}

.status-pill.is-offline .status-dot {
  background: var(--rose);
}

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.12s ease;
}

.icon-btn:hover {
  color: var(--text-1);
  border-color: var(--border-strong);
}

.icon-btn:active {
  transform: scale(0.95);
  background: var(--surface-2);
}

.icon-btn.is-spinning .refresh-icon {
  color: var(--cyan);
  animation: hud-spin 0.8s linear infinite;
}

/* Period Segmented Control */
.period-switch {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  padding: 3px;
  border-radius: 13px;
  background: var(--surface);
  border: 1px solid var(--border);
}

.period-btn {
  min-height: 40px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.period-btn:hover {
  color: var(--text-1);
}

.period-btn.is-active {
  background: var(--surface-2);
  color: var(--text-1);
  box-shadow: inset 0 0 0 1px var(--border-strong);
}

/* ==========================================================================
   Main Content Stack
   ========================================================================== */

.hud-main {
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  padding: 12px 14px calc(24px + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.notice-banner {
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 12.5px;
  line-height: 1.4;
  border: 1px solid var(--border);
}

.notice-banner.is-info {
  background: var(--cyan-soft);
  border-color: rgba(6, 182, 212, 0.28);
  color: #a5f3fc;
}

.notice-banner.is-warn {
  background: var(--amber-soft);
  border-color: rgba(245, 158, 11, 0.3);
  color: #fde68a;
}

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 15px 15px;
  min-width: 0;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
  min-width: 0;
}

.card-title {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  letter-spacing: 0.01em;
}

.card-meta {
  font-size: 12px;
  color: var(--text-3);
  white-space: nowrap;
  flex-shrink: 0;
}

/* ==========================================================================
   2. Live Active Agents Banner
   ========================================================================== */

.active-card {
  position: relative;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(6, 182, 212, 0.11) 0%, rgba(17, 21, 32, 0.98) 65%);
  border-color: rgba(6, 182, 212, 0.35);
  box-shadow: inset 0 1px 0 rgba(34, 211, 238, 0.32), 0 8px 24px rgba(0, 0, 0, 0.28);
  padding: 13px 14px;
}

.active-head {
  margin-bottom: 8px;
}

.active-title-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.active-title-wrap .card-title {
  color: #e0f2fe;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--cyan);
  flex-shrink: 0;
  box-shadow: 0 0 0 0 rgba(6, 182, 212, 0.7);
  animation: hud-pulse-cyan 1.6s ease-out infinite;
}

.active-live-tag {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #67e8f9;
  background: rgba(6, 182, 212, 0.18);
  border: 1px solid rgba(6, 182, 212, 0.35);
  border-radius: var(--radius-pill);
  padding: 2px 7px;
  flex-shrink: 0;
}

.active-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.active-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 10px;
  border-radius: 11px;
  background: rgba(9, 11, 16, 0.56);
  border: 1px solid rgba(255, 255, 255, 0.07);
  min-width: 0;
}

.active-row-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}

.agent-pill {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.03em;
  padding: 2px 6px;
  border-radius: 6px;
  flex-shrink: 0;
}

.agent-pill.tone-cyan {
  color: #67e8f9;
  background: var(--cyan-soft);
  border: 1px solid rgba(6, 182, 212, 0.3);
}

.agent-pill.tone-amber {
  color: #fcd34d;
  background: var(--amber-soft);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.agent-pill.tone-violet {
  color: #ddd6fe;
  background: var(--violet-soft);
  border: 1px solid rgba(167, 139, 250, 0.32);
}

.agent-pill.tone-emerald {
  color: #6ee7b7;
  background: var(--emerald-soft);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.active-model {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-1);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.active-state-tag {
  font-size: 10.5px;
  color: var(--text-2);
  background: var(--surface-2);
  border-radius: 5px;
  padding: 1px 5px;
  flex-shrink: 0;
}

.active-row-right {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

.active-timer {
  font-size: 13.5px;
  font-weight: 600;
  color: #67e8f9;
}

.active-chevron {
  font-size: 11px;
  color: rgba(103, 232, 249, 0.65);
}

/* ==========================================================================
   3. Hero Speed Card
   ========================================================================== */

.hero-card {
  padding: 16px 16px 14px;
}

.hero-head {
  margin-bottom: 6px;
}

.pill {
  display: inline-flex;
  align-items: center;
  font-size: 11.5px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  white-space: nowrap;
  flex-shrink: 0;
}

.pill-emerald {
  color: #6ee7b7;
  background: var(--emerald-soft);
  border: 1px solid rgba(16, 185, 129, 0.28);
}

.pill-amber {
  color: #fcd34d;
  background: var(--amber-soft);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.pill-muted {
  color: var(--text-3);
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.hero-metric {
  display: flex;
  align-items: baseline;
  gap: 7px;
  margin-top: 2px;
  min-width: 0;
}

.hero-number {
  font-size: 44px;
  font-weight: 700;
  line-height: 1.06;
  letter-spacing: -0.03em;
  color: var(--text-1);
}

.hero-number.is-amber {
  color: var(--amber);
}

.hero-number.is-muted {
  color: var(--text-3);
}

.hero-unit {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-2);
}

.floor-pill {
  margin-top: 10px;
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 5px 10px;
  border-radius: 10px;
  background: var(--amber-soft);
  border: 1px solid rgba(245, 158, 11, 0.26);
  color: #fcd34d;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.35;
}

.kpi-strip {
  margin-top: 14px;
  padding-top: 13px;
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.kpi-cell {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  padding: 0 8px;
}

.kpi-cell:first-child {
  padding-left: 0;
}

.kpi-cell:last-child {
  padding-right: 0;
}

.kpi-cell + .kpi-cell {
  border-left: 1px solid var(--border);
}

.kpi-label {
  font-size: 11.5px;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kpi-value-row {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
  min-width: 0;
}

.kpi-value {
  font-size: 15.5px;
  font-weight: 700;
  color: var(--text-1);
  line-height: 1.25;
  white-space: nowrap;
}

.kpi-sub {
  font-size: 11px;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kpi-error-badge {
  font-size: 10.5px;
  font-weight: 600;
  color: #fda4af;
  background: var(--rose-soft);
  border: 1px solid rgba(244, 63, 94, 0.32);
  border-radius: 5px;
  padding: 1px 5px;
  line-height: 1.3;
}

/* ==========================================================================
   4. Pure SVG Speed & Activity Mini-Chart
   ========================================================================== */

.chart-card {
  padding: 14px 15px 13px;
}

.chart-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.chart-head-left {
  min-width: 0;
}

.mini-switch {
  display: inline-flex;
  padding: 2px;
  border-radius: 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.mini-switch-btn {
  min-height: 36px;
  padding: 0 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  white-space: nowrap;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.mini-switch-btn.is-active {
  background: var(--surface-2);
  color: var(--text-1);
  box-shadow: inset 0 0 0 1px var(--border-strong);
}

.chart-readout-row {
  margin-top: 8px;
  margin-bottom: 6px;
  min-width: 0;
}

.chart-readout {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  min-height: 26px;
  padding: 3px 9px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  font-size: 11.5px;
  color: var(--text-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.chart-readout.is-active {
  background: var(--cyan-soft);
  border-color: rgba(6, 182, 212, 0.34);
  color: #e0f2fe;
  cursor: pointer;
}

.chart-canvas-wrap {
  position: relative;
  width: 100%;
  height: 132px;
  border-radius: 10px;
  background: rgba(9, 11, 16, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.04);
  overflow: hidden;
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
  cursor: crosshair;
}

.chart-svg {
  display: block;
  width: 100%;
  height: 100%;
}

.chart-y-labels {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.chart-y-label {
  position: absolute;
  right: 6px;
  transform: translateY(-100%);
  font-size: 10px;
  line-height: 1;
  padding: 1px 4px;
  border-radius: 4px;
  background: rgba(9, 11, 16, 0.72);
  color: var(--text-3);
}

.chart-y-label.is-med {
  color: rgba(110, 231, 183, 0.85);
}

.chart-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12.5px;
  color: var(--text-3);
  pointer-events: none;
}

.chart-x-axis {
  margin-top: 7px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  padding: 0 2px;
  min-height: 16px;
}

.chart-x-tick {
  font-size: 11px;
  color: var(--text-3);
  white-space: nowrap;
}

.chart-x-tick.is-selected {
  color: #67e8f9;
  font-weight: 600;
}

/* ==========================================================================
   5. Model Speed Leaderboard
   ========================================================================== */

.leaderboard-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 13px;
}

.model-row {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

.model-row-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.model-name-wrap {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  flex: 1;
}

.agent-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.agent-dot.tone-cyan { background: var(--cyan); }
.agent-dot.tone-amber { background: var(--amber); }
.agent-dot.tone-violet { background: var(--violet); }
.agent-dot.tone-emerald { background: var(--emerald); }

.model-name {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-1);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.model-speed {
  font-size: 13.5px;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
}

.model-speed.is-exact { color: var(--emerald); }
.model-speed.is-amber { color: var(--amber); }
.model-speed.is-muted { color: var(--text-3); }

.speed-bar-track {
  width: 100%;
  height: 4px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.07);
  overflow: hidden;
}

.speed-bar-fill {
  height: 100%;
  border-radius: var(--radius-pill);
  transition: width 0.25s ease;
}

.speed-bar-fill.is-exact {
  background: linear-gradient(90deg, var(--cyan), var(--emerald));
}

.speed-bar-fill.is-amber {
  background: linear-gradient(90deg, rgba(245, 158, 11, 0.72), var(--amber));
}

.model-row-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  font-size: 12px;
  color: var(--text-2);
  line-height: 1.3;
}

.meta-amber {
  color: rgba(252, 211, 77, 0.85);
}

.meta-sep {
  color: var(--text-3);
}

/* ==========================================================================
   6. Recent Requests Feed
   ========================================================================== */

.recent-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}

.recent-row {
  padding: 10px 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.recent-row:first-child {
  padding-top: 2px;
}

.recent-row:last-child {
  padding-bottom: 2px;
}

.recent-row + .recent-row {
  border-top: 1px solid var(--border);
}

.recent-row-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.recent-model {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-1);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.speed-pill {
  font-size: 12px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  white-space: nowrap;
  flex-shrink: 0;
}

.speed-pill.is-exact {
  color: #6ee7b7;
  background: var(--emerald-soft);
}

.speed-pill.is-amber {
  color: #fcd34d;
  background: var(--amber-soft);
}

.speed-pill.is-error {
  color: #fda4af;
  background: var(--rose-soft);
}

.speed-pill.is-muted {
  color: var(--text-3);
  background: var(--surface-2);
}

.recent-row-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  font-size: 12px;
  color: var(--text-3);
  line-height: 1.3;
  padding-left: 14px;
}

.recent-time {
  color: var(--text-2);
}

.empty-placeholder {
  padding: 22px 12px;
  text-align: center;
  font-size: 13px;
  color: var(--text-3);
}

/* ==========================================================================
   7. Footer
   ========================================================================== */

.hud-footer {
  margin-top: 2px;
  padding: 8px 4px 4px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--text-3);
}

.footer-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}

.footer-host {
  color: var(--text-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 165px;
}

.footer-sep {
  color: var(--text-3);
}

.footer-sources {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.src-badge {
  font-size: 11.5px;
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
}

.src-badge.is-ok {
  color: #6ee7b7;
  border-color: rgba(16, 185, 129, 0.28);
}

.src-badge.is-err {
  color: #fda4af;
  border-color: rgba(244, 63, 94, 0.28);
}

.src-badge.is-muted {
  color: var(--text-3);
}

.logout-btn {
  min-height: 40px;
  padding: 0 10px;
  margin-right: -10px;
  border-radius: 10px;
  font-size: 12.5px;
  color: var(--text-2);
  transition: color 0.15s ease, background-color 0.15s ease;
}

.logout-btn:hover {
  color: var(--rose);
  background: var(--rose-soft);
}

/* ==========================================================================
   Auth Gate Overlay
   ========================================================================== */

.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: radial-gradient(circle at 50% 24%, rgba(6, 182, 212, 0.12), transparent 55%), var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(20px + env(safe-area-inset-top, 0px)) 20px calc(20px + env(safe-area-inset-bottom, 0px));
}

.auth-card {
  width: 100%;
  max-width: 360px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 20px;
  padding: 28px 22px 24px;
  text-align: center;
  box-shadow: 0 20px 56px rgba(0, 0, 0, 0.65);
}

.auth-logo {
  display: inline-flex;
  margin-bottom: 14px;
}

.auth-title {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-1);
}

.auth-subtitle {
  margin: 6px 0 20px;
  font-size: 13.5px;
  color: var(--text-2);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.auth-input {
  width: 100%;
  min-height: 46px;
  padding: 0 14px;
  border-radius: 12px;
  background: var(--bg);
  border: 1px solid var(--border-strong);
  color: var(--text-1);
  font-size: 15px;
  text-align: center;
  letter-spacing: 0.04em;
}

.auth-input::placeholder {
  color: var(--text-3);
  letter-spacing: normal;
  font-family: var(--font-sans);
  font-size: 13.5px;
}

.auth-error {
  margin: 0;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--rose-soft);
  border: 1px solid rgba(244, 63, 94, 0.3);
  color: #fecdd3;
  font-size: 12.5px;
  line-height: 1.35;
}

.auth-submit {
  width: 100%;
  min-height: 46px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--emerald), var(--cyan));
  color: #041318;
  font-size: 15px;
  font-weight: 700;
  transition: opacity 0.15s ease, transform 0.12s ease;
}

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

.auth-submit:disabled {
  opacity: 0.65;
  cursor: wait;
}

/* ==========================================================================
   Compact 360px Tuning & Animations
   ========================================================================== */

@media (max-width: 374px) {
  .top-bar-inner {
    padding: 8px 12px;
  }
  .hud-main {
    padding: 10px 12px calc(22px + env(safe-area-inset-bottom, 0px));
  }
  .brand-name {
    font-size: 15px;
  }
  .status-pill {
    max-width: 148px;
    padding: 0 8px;
    font-size: 11.5px;
  }
  .hero-number {
    font-size: 38px;
  }
  .kpi-value {
    font-size: 14px;
  }
  .mini-switch-btn {
    padding: 0 8px;
    font-size: 11.5px;
  }
}

@keyframes hud-pulse {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.72); }
  70% { box-shadow: 0 0 0 7px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

@keyframes hud-pulse-cyan {
  0% { box-shadow: 0 0 0 0 rgba(6, 182, 212, 0.72); }
  70% { box-shadow: 0 0 0 7px rgba(6, 182, 212, 0); }
  100% { box-shadow: 0 0 0 0 rgba(6, 182, 212, 0); }
}

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

@media (prefers-reduced-motion: reduce) {
  .status-pill.is-live .status-dot,
  .pulse-dot,
  .icon-btn.is-spinning .refresh-icon {
    animation: none;
  }
  .speed-bar-fill,
  .icon-btn,
  .period-btn,
  .mini-switch-btn,
  .auth-submit {
    transition: none;
  }
}
