/* Gemini App2API — Operations Console Design System
 * Clean obsidian & alabaster surfaces, single cobalt/blue accent, tabular numerals,
 * strict zero-overflow responsive geometry, and full keyboard/reduced-motion support. */

:root {
  color-scheme: dark;
  --canvas: #090c12;
  --canvas-glow: rgb(59 130 246 / 9%);
  --surface: #10151f;
  --surface-elevated: #141b28;
  --inset: #171f2e;
  --code-bg: #0b0f17;
  --hover: #1e283b;
  --text: #f3f6fc;
  --muted: #98a4bd;
  --subtle: #78859e;
  --border: #222b3d;
  --border-strong: #32405a;
  --input: #475673;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-text: #ffffff;
  --violet: #60a5fa;
  --violet-bg: rgb(59 130 246 / 14%);
  --teal: #34d399;
  --teal-bg: rgb(16 185 129 / 14%);
  --amber: #fbbf24;
  --amber-bg: rgb(245 158 11 / 14%);
  --rose: #fb7185;
  --rose-bg: rgb(244 63 94 / 14%);
  --shadow: 0 22px 54px -12px rgb(0 0 0 / 62%), 0 0 0 1px rgb(255 255 255 / 4%) inset;
  --panel-shadow: 0 4px 20px -4px rgb(0 0 0 / 38%), 0 1px 0 inset rgb(255 255 255 / 4%);
  --panel-shadow-hover: 0 10px 28px -6px rgb(0 0 0 / 52%), 0 1px 0 inset rgb(255 255 255 / 7%);
  --focus: #60a5fa;
}

:root[data-theme=light] {
  color-scheme: light;
  --canvas: #f5f7fb;
  --canvas-glow: rgb(37 99 235 / 6%);
  --surface: #ffffff;
  --surface-elevated: #ffffff;
  --inset: #eef2f8;
  --code-bg: #f8fafd;
  --hover: #e4eaf4;
  --text: #0f172a;
  --muted: #475569;
  --subtle: #64748b;
  --border: #dce3ef;
  --border-strong: #c1ccdf;
  --input: #8b9bb4;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-text: #ffffff;
  --violet: #1d4ed8;
  --violet-bg: #eff6ff;
  --teal: #047857;
  --teal-bg: #ecfdf5;
  --amber: #b45309;
  --amber-bg: #fffbeb;
  --rose: #be123c;
  --rose-bg: #fff1f2;
  --shadow: 0 20px 48px -12px rgb(15 23 42 / 16%), 0 1px 3px rgb(15 23 42 / 6%);
  --panel-shadow: 0 2px 10px -2px rgb(15 23 42 / 6%), 0 1px 2px rgb(15 23 42 / 4%);
  --panel-shadow-hover: 0 10px 24px -6px rgb(15 23 42 / 11%), 0 2px 6px rgb(15 23 42 / 5%);
  --focus: #2563eb;
}

* { box-sizing: border-box; }

html { background: var(--canvas); }

body {
  margin: 0;
  min-height: 100dvh;
  background-color: var(--canvas);
  background-image: radial-gradient(1080px 380px at 50% -140px, var(--canvas-glow), transparent 72%);
  background-repeat: no-repeat;
  color: var(--text);
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Inter, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button, input, select, textarea { font: inherit; color: inherit; }
button, a, input, select, textarea, summary { touch-action: manipulation; }

/* Interactive Controls */
button, .button {
  display: inline-flex;
  gap: 7px;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-elevated);
  padding: 6px 13px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
  white-space: nowrap;
  text-decoration: none;
  color: var(--text);
  cursor: pointer;
  box-shadow: 0 1px 2px rgb(0 0 0 / 10%), 0 1px 0 inset rgb(255 255 255 / 4%);
  transition: background-color 120ms ease-out, border-color 120ms ease-out, color 120ms ease-out, box-shadow 120ms ease-out, transform 80ms ease-out;
}
button:hover, .button:hover {
  background: var(--hover);
  border-color: var(--border-strong);
}
button:active, .button:active { transform: translateY(1px); }
button:disabled, .button[aria-disabled=true] {
  cursor: not-allowed;
  color: var(--subtle);
  background: var(--inset);
  background-image: none;
  border-color: var(--border);
  box-shadow: none;
  transform: none;
}

button.primary, .button.primary {
  background-color: var(--primary);
  background-image: linear-gradient(180deg, var(--primary) 0%, var(--primary-hover) 100%);
  color: var(--primary-text);
  border-color: color-mix(in srgb, var(--primary) 78%, #000000);
  box-shadow: 0 2px 10px color-mix(in srgb, var(--primary) 34%, transparent), 0 1px 0 inset rgb(255 255 255 / 22%);
}
button.primary:hover, .button.primary:hover {
  background-color: var(--primary-hover);
  background-image: linear-gradient(180deg, var(--primary-hover) 0%, color-mix(in srgb, #000000 12%, var(--primary-hover)) 100%);
}
button.primary:disabled, .button.primary[aria-disabled=true] {
  background-color: var(--inset);
  background-image: none;
  color: var(--subtle);
  border-color: var(--border);
  filter: none;
  box-shadow: none;
}

.danger { color: var(--rose); }
button.danger:hover, .button.danger:hover {
  background: var(--rose-bg);
  border-color: color-mix(in srgb, var(--rose) 55%, var(--border));
}
.quiet {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}
.quiet:hover {
  background: var(--hover);
  border-color: transparent;
}
.compact {
  padding: 4px 10px;
  min-height: 29px;
  font-size: 12px;
  border-radius: 7px;
}
.icon-button {
  width: 36px;
  padding: 0;
  flex-shrink: 0;
}

a {
  color: var(--violet);
  text-underline-offset: 3px;
}
a:hover { text-decoration-thickness: 2px; }

:focus-visible,
summary:focus {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}
summary:not(:focus-visible):focus {
  outline: 2px solid var(--focus);
}
main[tabindex="-1"]:focus,
h1[tabindex="-1"]:focus {
  outline: none;
}

/* Form Elements & Custom Switches */
input, select, textarea {
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--inset);
  padding: 7px 11px;
  min-width: 0;
  max-width: 100%;
  font-size: 13.5px;
  color: var(--text);
  transition: border-color 120ms ease-out, background-color 120ms ease-out, box-shadow 120ms ease-out;
}
input:hover, select:hover, textarea:hover { border-color: var(--input); }
input:focus, select:focus, textarea:focus {
  background: var(--surface);
  border-color: var(--focus);
}
input::placeholder, textarea::placeholder { color: var(--subtle); opacity: 1; }
textarea { resize: vertical; width: 100%; line-height: 1.55; }

input[type=checkbox] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
  cursor: pointer;
}
input[type=checkbox][role=switch] {
  appearance: none;
  position: relative;
  width: 34px;
  min-width: 34px;
  height: 20px;
  padding: 0;
  margin: 0;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--input);
  font-size: 16px;
  flex-shrink: 0;
  cursor: pointer;
  transition: background-color 140ms ease-out, border-color 140ms ease-out;
}
input[type=checkbox][role=switch]::before {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 1px 3px rgb(0 0 0 / 32%);
  transition: transform 140ms cubic-bezier(.2, .9, .3, 1.15);
}
input[type=checkbox][role=switch]:checked {
  background: var(--primary);
  border-color: color-mix(in srgb, #ffffff 20%, var(--primary));
}
input[type=checkbox][role=switch]:checked::before {
  transform: translateX(14px);
}
input[type=checkbox][role=switch]:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

label {
  display: grid;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}
label input:not([type=checkbox]), label select, label textarea {
  width: 100%;
  color: var(--text);
  font-weight: 450;
}
.check-label {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}

/* Typography */
h1, h2, h3, h4, p { margin: 0; }
h1 { font-size: 26px; line-height: 1.22; letter-spacing: -0.65px; font-weight: 680; }
h2 { font-size: 15px; line-height: 1.38; font-weight: 630; letter-spacing: -0.2px; }
h3 { font-size: 13px; line-height: 1.4; font-weight: 620; }
h4 { font-size: 12px; line-height: 1.4; font-weight: 550; }
small, .small, .help, .subline { font-size: 12px; line-height: 1.48; }
.muted { color: var(--muted); }
.subtle { color: var(--subtle); }
.mono, code, pre {
  font-family: "SF Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
}
code { color: var(--violet); }
.number { font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
p, dd { overflow-wrap: anywhere; }
.mono, code { overflow-wrap: break-word; }

pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.62;
  margin: 0;
  padding: 15px 16px;
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  max-height: 420px;
  overflow: auto;
}

svg { width: 16px; height: 16px; flex-shrink: 0; }
svg.chart { width: 100%; height: 164px; display: block; }
svg.spark { width: 76px; height: 24px; display: block; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}
[hidden] { display: none !important; }

.skip {
  position: fixed;
  z-index: 100;
  left: 16px;
  top: -999px;
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  color: var(--text);
  font-weight: 600;
}
.skip:focus { top: 8px; }

/* Boot & Brand */
.boot {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
}
.brand-mark {
  background-color: var(--primary);
  background-image: linear-gradient(135deg, color-mix(in srgb, #ffffff 22%, var(--primary)), var(--primary));
  color: #ffffff;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  flex-shrink: 0;
  box-shadow: 0 3px 12px color-mix(in srgb, var(--primary) 40%, transparent), 0 1px 0 inset rgb(255 255 255 / 24%);
}
.brand {
  display: flex;
  gap: 10px;
  align-items: center;
  min-width: 0;
}
.brand strong {
  font-size: 14px;
  font-weight: 660;
  letter-spacing: -0.3px;
  white-space: nowrap;
}
.brand small {
  display: block;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1.3px;
  color: var(--muted);
  margin-top: 1px;
}

/* Topbar & Unified Workspace Shell */
.shell { display: block; min-height: 100dvh; }
.workspace { min-width: 0; display: flex; flex-direction: column; min-height: 100dvh; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px max(24px, calc((100vw - 1220px) / 2));
  gap: 24px;
  background-color: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(16px) saturate(140%);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 4px 20px -8px rgb(0 0 0 / 18%);
}
.topbar > .brand { flex-shrink: 0; }
.topbar .brand small { display: none; }

.daily-nav {
  display: flex;
  gap: 3px;
  align-self: center;
  margin-right: auto;
  padding: 3px;
  background: var(--inset);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.daily-nav a {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 13px;
  text-decoration: none;
  color: var(--muted);
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
  border-radius: 7px;
  transition: background-color 120ms ease-out, color 120ms ease-out, box-shadow 120ms ease-out;
}
.daily-nav a:hover {
  background: var(--hover);
  color: var(--text);
}
.daily-nav a[aria-current=page] {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 3px rgb(0 0 0 / 18%), 0 0 0 1px var(--border);
}
.daily-nav a[aria-current=page] svg { color: var(--violet); }

.toolbar, .actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.toolbar { justify-content: flex-end; }
.draft-indicator {
  color: var(--amber);
  background: var(--amber-bg);
  border: 1px solid color-mix(in srgb, var(--amber) 30%, transparent);
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.demo-banner {
  padding: 7px max(24px, calc((100vw - 1220px) / 2));
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: var(--amber);
  background: var(--amber-bg);
  border-bottom: 1px solid color-mix(in srgb, var(--amber) 24%, transparent);
  flex-wrap: wrap;
}
.demo-banner a { color: inherit; margin-left: auto; font-weight: 600; white-space: nowrap; }
.demo-scenario {
  color: inherit;
  font-size: 12px;
  gap: 8px;
  display: inline-flex;
  align-items: center;
}
.demo-scenario select {
  width: auto;
  padding: 3px 8px;
  min-height: 28px;
  font-size: 12px;
  background: var(--surface);
}

/* Main Content Area */
.main {
  width: 100%;
  max-width: 1220px;
  margin: 0 auto;
  padding: 26px 24px 44px;
  min-width: 0;
}

.page-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px 24px;
  margin: 0 0 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.page-heading > div:first-child { min-width: 0; }
.page-heading h1 { font-size: 26px; letter-spacing: -0.7px; }
.page-heading p { font-size: 13px; color: var(--muted); margin-top: 4px; max-width: 680px; }
.page-heading .actions:empty { display: none; }

.eyebrow {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--violet);
  text-transform: uppercase;
  letter-spacing: 1.4px;
  margin-bottom: 6px;
}

/* Sign-in & Explicit ToS Controls */
.sign-in-controls {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  padding: 3px 4px 3px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 1px 2px rgb(0 0 0 / 8%);
}
.sign-in-controls #add-account {
  min-height: 30px;
  padding: 5px 11px;
  border-radius: 7px;
}
.terms-consent {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 550;
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
}
.terms-tooltip { position: relative; display: inline-flex; }
button.terms-help {
  min-height: 24px;
  width: 24px;
  padding: 0;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  background: var(--inset);
  box-shadow: none;
}
.terms-tooltip [role=tooltip] {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 50;
  width: min(272px, calc(100vw - 32px));
  padding: 12px 14px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  color: var(--text);
  background: var(--surface-elevated);
  box-shadow: var(--shadow);
  font-size: 12px;
  font-weight: 450;
  line-height: 1.55;
  white-space: normal;
  text-align: left;
}
.terms-tooltip:not([data-dismissed=true]):hover [role=tooltip],
.terms-tooltip:not([data-dismissed=true]):focus-within [role=tooltip] {
  display: block;
}

/* Badges & Notices */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 9px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, currentColor 22%, transparent);
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.45;
  color: var(--muted);
  background: var(--inset);
  white-space: nowrap;
  max-width: 100%;
}
.badge.teal { background: var(--teal-bg); color: var(--teal); }
.badge.violet { background: var(--violet-bg); color: var(--violet); }
.badge.amber { background: var(--amber-bg); color: var(--amber); }
.badge.rose { background: var(--rose-bg); color: var(--rose); }
.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 7px currentColor;
  flex-shrink: 0;
}

.notice {
  font-size: 13px;
  line-height: 1.55;
  padding: 12px 16px;
  border-radius: 10px;
  background: var(--surface);
  color: var(--muted);
  border: 1px solid var(--border);
  overflow-wrap: anywhere;
}
.notice.amber { background: var(--amber-bg); color: var(--amber); border-color: color-mix(in srgb, var(--amber) 28%, transparent); }
.notice.rose { background: var(--rose-bg); color: var(--rose); border-color: color-mix(in srgb, var(--rose) 28%, transparent); }
.notice.teal { background: var(--teal-bg); color: var(--teal); border-color: color-mix(in srgb, var(--teal) 28%, transparent); }
.page-error {
  margin-bottom: 16px;
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}

/* Panels & Common Grids */
.stack { display: grid; gap: 14px; min-width: 0; }
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--panel-shadow);
  min-width: 0;
}
.panel-head {
  padding: 16px 20px 12px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.panel-head > div { min-width: 0; }
.panel-head p { font-size: 12px; color: var(--muted); margin-top: 3px; }
.panel-body { padding: 0 20px 18px; }

.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.form-stack { display: grid; gap: 14px; min-width: 0; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 14px; }
.form-grid label { min-width: 0; }
.help { display: block; color: var(--muted); font-weight: 400; margin-top: 0; }

/* Accounts Page — Refresh Strip, Filters & Compact Daily Cards */
.refresh-strip {
  display: flex;
  align-items: center;
  gap: 12px 20px;
  flex-wrap: wrap;
  padding: 10px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--panel-shadow);
}
.refresh-strip .auto-refresh { flex-shrink: 0; font-size: 12.5px; }
#bulk-status {
  flex: 1 1 260px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}
#bulk-status[data-state=running] { color: var(--violet); }
#bulk-status[data-state=error] { color: var(--rose); }

.daily-filters {
  display: grid;
  grid-template-columns: minmax(0,1fr) 176px minmax(176px, 240px);
  gap: 12px;
  align-items: end;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--panel-shadow);
}
.daily-filters input, .daily-filters select {
  height: 36px;
  padding: 6px 10px;
}

[data-page=accounts] .account-list { display: grid; gap: 12px; }
[data-page=accounts] .account-category-bar {
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--panel-shadow);
}
[data-page=accounts] .account-category-bar .badge { white-space: normal; }
[data-page=accounts] .account-count {
  padding: 0 2px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

/* Account Card — Strict Compact Geometry (card <= main + terms + summary + 2) */
[data-page=accounts] .account-card { animation: none; }
.content-enter .account-card {
  animation: enter 200ms var(--account-stagger, 0ms) cubic-bezier(.16, 1, .3, 1) both;
}

[data-page=accounts] .daily-account {
  padding: 0;
  border-radius: 12px;
  border: 1px solid var(--border);
  background-color: var(--surface);
  background-image: linear-gradient(180deg, color-mix(in srgb, var(--hover) 24%, var(--surface)) 0%, var(--surface) 100%);
  box-shadow: var(--panel-shadow);
  transition: border-color 140ms ease-out, box-shadow 140ms ease-out;
}
[data-page=accounts] .daily-account:hover {
  border-color: var(--border-strong);
  box-shadow: var(--panel-shadow-hover);
}

.daily-account-main {
  display: grid;
  grid-template-columns: minmax(168px, 1.25fr) auto minmax(0, 2.1fr) auto;
  align-items: center;
  gap: 20px;
  padding: 10px 20px 8px;
  min-height: 86px;
}
.daily-identity {
  display: grid;
  gap: 2px;
  min-width: 0;
}
[data-page=accounts] .daily-identity h2 {
  font-size: 14px;
  line-height: 1.3;
  font-weight: 650;
  overflow-wrap: anywhere;
}
.daily-identity small {
  font-size: 11.5px;
  line-height: 1.3;
  color: var(--muted);
  font-weight: 500;
}

.enabled-switch {
  position: relative;
  padding: 0;
  min-height: 24px;
  height: 24px;
  width: 42px;
  border-radius: 999px;
  font-size: 0;
  background: var(--input);
  border: 1px solid color-mix(in srgb, var(--border-strong) 80%, transparent);
  box-shadow: inset 0 1px 2px rgb(0 0 0 / 28%);
}
.enabled-switch::after {
  content: "";
  position: absolute;
  left: 3px;
  top: 50%;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 1px 3px rgb(0 0 0 / 35%);
  transform: translateY(-50%);
  transition: transform 150ms cubic-bezier(.2, .9, .3, 1.2);
}
.enabled-switch[aria-checked=true] {
  background: var(--primary);
  border-color: color-mix(in srgb, #ffffff 22%, var(--primary));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 16%, transparent);
}
.enabled-switch[aria-checked=true]::after {
  transform: translate(18px, -50%);
}
.enabled-switch:hover {
  background: var(--input);
  border-color: var(--text);
}
.enabled-switch[aria-checked=true]:hover {
  background: var(--primary);
  filter: brightness(1.08);
}

.daily-quota {
  display: grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: 2px 22px;
  min-width: 0;
}
.daily-slot { min-width: 0; }
.daily-slot h3 {
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.25;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.45px;
}
.daily-value {
  display: block;
  font-size: 19px;
  line-height: 1.28;
  letter-spacing: -0.4px;
  font-weight: 680;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.daily-value small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0;
  margin-left: 2px;
}
.daily-bar {
  height: 5px;
  background: var(--inset);
  border-radius: 999px;
  margin: 3px 0;
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgb(0 0 0 / 22%);
}
.daily-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background-color: var(--primary);
  background-image: linear-gradient(90deg, var(--primary), var(--violet));
}
.daily-window {
  display: block;
  font-size: 10.5px;
  line-height: 1.25;
  color: var(--muted);
  overflow-wrap: anywhere;
}
.daily-data-time {
  grid-column: 1 / -1;
  font-size: 10.5px;
  line-height: 1.25;
  color: var(--subtle);
}

.daily-test {
  display: grid;
  justify-items: center;
  gap: 3px;
  min-width: 68px;
}
.daily-test small {
  font-size: 10.5px;
  line-height: 1.2;
  color: var(--muted);
  font-weight: 600;
  white-space: nowrap;
}

.account-terms {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 12px;
  padding: 5px 20px;
  border-top: 1px solid color-mix(in srgb, var(--border) 68%, transparent);
  font-size: 12px;
  line-height: 1.35;
  color: var(--muted);
}
.account-terms-status {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  font-weight: 500;
}
.account-terms .compact {
  min-height: 26px;
  padding: 2px 9px;
  font-size: 11.5px;
}
.terms-app-link { font-size: 12px; white-space: nowrap; }
.terms-error { flex-basis: 100%; color: var(--rose); }

[data-page=accounts] .daily-account > .account-disclosure {
  border: 0;
  font-size: 12px;
  min-width: 0;
}
[data-page=accounts] .daily-account > .account-disclosure > summary {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 20px;
  border-top: 1px solid color-mix(in srgb, var(--border) 68%, transparent);
  font-size: 11.5px;
  line-height: 1.35;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  list-style: none;
  border-radius: 0 0 11px 11px;
  transition: color 120ms ease-out, background-color 120ms ease-out;
}
[data-page=accounts] .daily-account > .account-disclosure > summary::-webkit-details-marker { display: none; }
[data-page=accounts] .daily-account > .account-disclosure > summary::marker { content: ""; }
[data-page=accounts] .daily-account > .account-disclosure > summary::before {
  content: "▸";
  font-size: 11px;
  line-height: 1;
  color: var(--subtle);
  transition: transform 140ms ease-out;
}
[data-page=accounts] .daily-account > .account-disclosure[open] > summary {
  color: var(--violet);
  border-radius: 0;
}
[data-page=accounts] .daily-account > .account-disclosure[open] > summary::before {
  transform: rotate(90deg);
  color: var(--violet);
}
[data-page=accounts] .daily-account > .account-disclosure > summary:hover {
  color: var(--text);
  background: color-mix(in srgb, var(--hover) 45%, transparent);
}

/* Expanded Account Details */
[data-page=accounts] .daily-details {
  padding: 16px 20px 18px;
  border-top: 1px solid var(--border);
  background: color-mix(in srgb, var(--canvas) 45%, var(--surface));
  border-radius: 0 0 11px 11px;
}
.daily-details .definition {
  max-width: 760px;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.account-subscription,
.account-quota,
[data-page=accounts] .daily-details .account-models {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  padding: 13px 16px;
  min-width: 0;
}
.account-subscription {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  flex-wrap: wrap;
}
.subscription-summary, .subscription-meta {
  display: flex;
  align-items: center;
  gap: 6px 10px;
  flex-wrap: wrap;
  min-width: 0;
}
.subscription-meta { font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.subscription-meta time { font-variant-numeric: tabular-nums; }

.account-section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.quota-value-note {
  font-size: 11.5px;
  line-height: 1.45;
  color: var(--muted);
  margin: 0 0 10px;
}
.quota-tiles {
  display: grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: 10px;
}
.quota-tile {
  padding: 11px 13px;
  background: var(--inset);
  border: 1px solid var(--border);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  overflow-wrap: anywhere;
}
.quota-tile h4 { font-size: 12px; font-weight: 600; color: var(--text); }
.quota-value {
  display: block;
  font-size: 20px;
  line-height: 1.2;
  font-weight: 660;
  letter-spacing: -0.45px;
}
.quota-bar {
  height: 5px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  margin: 2px 0;
  overflow: hidden;
}
.quota-bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--violet));
  border-radius: inherit;
}
.quota-time {
  display: block;
  font-size: 12px;
  line-height: 1.42;
  color: var(--muted);
  overflow-wrap: anywhere;
}
.quota-time time { color: var(--text); }
.quota-budget { font-size: 12px; }
.quota-unavailable {
  grid-column: 1 / -1;
  padding: 12px;
  border: 1px dashed var(--border-strong);
  border-radius: 8px;
  display: grid;
  gap: 4px;
}
.quota-unavailable strong { font-size: 13px; font-weight: 600; }
.quota-unavailable p { font-size: 12px; color: var(--muted); }
.quota-feedback {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 12px;
  margin-top: 10px;
  padding-left: 10px;
  border-left: 2px solid var(--border-strong);
  font-size: 12px;
  line-height: 1.45;
  color: var(--muted);
  overflow-wrap: anywhere;
}
.quota-feedback[data-state=error] { border-color: var(--rose); }
.quota-feedback[data-state=error] > p { color: var(--rose); }
.quota-feedback[data-state=pending] { border-color: var(--violet); }
.quota-controls {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin: 10px 0 6px;
}
.account-quota > .account-disclosure { margin-top: 6px; }
.account-quota > .account-disclosure > summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 12px;
  padding: 4px 0;
}
.disclosure-body {
  display: grid;
  gap: 8px;
  padding: 8px 0 2px;
  color: var(--muted);
  font-size: 12px;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.account-models > h3 { margin-bottom: 8px; }
[data-account-model-states] { display: grid; }
[data-provider-model] {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px 10px;
  padding: 8px 0;
  border-top: 1px solid var(--border);
}
[data-provider-model]:first-child { border-top: 0; padding-top: 2px; }
[data-provider-model] > .mono { font-size: 12px; font-weight: 600; margin-right: auto; }
.model-row-controls { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.model-test-result {
  font-weight: 650;
  font-size: 11.5px;
  min-width: 28px;
  text-align: center;
  color: var(--muted);
}
.model-test-result.ok { color: var(--teal); }
.model-test-result.fail, .model-test-error { color: var(--rose); }
.model-test-error, [data-model-checked-at] {
  flex-basis: 100%;
  font-size: 11px;
  line-height: 1.38;
}

/* Overview, Onboarding & Metrics */
.account-name { display: flex; gap: 10px; align-items: center; min-width: 0; }
.avatar {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--inset);
  color: var(--violet);
  font-size: 12px;
  font-weight: 650;
  flex-shrink: 0;
}

.overview-status {
  display: flex;
  align-items: center;
  gap: 10px 20px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--muted);
}
.overview-shortcuts { margin-top: 16px; }
.overview-shortcuts .primary { min-height: 38px; }

.setup-journey {
  border-top: 3px solid var(--primary);
}
#overview-setup > .setup-journey {
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
.journey-main {
  padding: 20px;
  display: flex;
  gap: 20px;
  align-items: center;
  justify-content: space-between;
}
.journey-main > div { min-width: 0; max-width: 720px; }
.journey-main h2 { font-size: 19px; letter-spacing: -0.35px; }
.journey-main p:not(.eyebrow) { color: var(--muted); margin-top: 6px; font-size: 13px; }
.journey-main > .button, .journey-main > button { flex-shrink: 0; }
.setup-journey > details { padding: 0 20px 14px; }
.setup-journey summary { cursor: pointer; color: var(--muted); font-size: 13px; font-weight: 550; padding: 6px 0; }
.journey-steps { list-style: none; margin: 10px 0 0; padding: 0; display: grid; }
.journey-steps li {
  display: grid;
  grid-template-columns: 24px minmax(0,1fr) auto;
  align-items: start;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--border);
}
.journey-steps li p { font-size: 12px; color: var(--muted); margin-top: 2px; }
.journey-marker { color: var(--subtle); font-weight: 700; }
.journey-steps [data-observed=true] .journey-marker { color: var(--teal); }

.section-fold > summary {
  padding: 14px 20px;
  font-size: 14px;
  font-weight: 620;
  cursor: pointer;
}
.section-fold > .stack { padding: 0 20px 18px; }
.section-fold > .panel-body { padding-top: 4px; }

.evidence-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 14px; }
.evidence-grid .panel-body { display: grid; gap: 10px; }
.attention-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 12px; }
.attention-tile {
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-align: left;
  gap: 12px;
  min-height: 62px;
  padding: 14px 18px;
  background: var(--surface);
  font-weight: 550;
  white-space: normal;
}
.attention-tile strong { font-size: 22px; color: var(--text); }
.attention-tile.rose strong { color: var(--rose); }
.attention-tile.amber strong { color: var(--amber); }

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0,1fr));
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}
.metric { padding: 16px 20px; min-width: 0; border-right: 1px solid var(--border); }
.metric:last-child { border-right: 0; }
.metric-label { font-size: 12px; color: var(--muted); display: flex; gap: 8px; align-items: center; justify-content: space-between; }
.metric-value {
  font-size: 27px;
  font-weight: 660;
  letter-spacing: -0.8px;
  font-variant-numeric: tabular-nums;
  margin: 10px 0 6px;
  line-height: 1.1;
}
.metric-value .unit { font-size: 13px; letter-spacing: 0; color: var(--muted); margin-left: 4px; font-weight: 500; }
.metric-note { font-size: 12px; color: var(--muted); }
.metric:first-child .metric-value { color: var(--violet); }
.metric:nth-child(2) .metric-value { color: var(--teal); }

.chart-wrap { padding: 4px 20px 18px; }
.chart-axis {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  font-size: 11px;
  color: var(--subtle);
  font-family: "SF Mono", ui-monospace, monospace;
  margin-top: 8px;
  flex-wrap: wrap;
}
.chart-note { font-size: 12px; color: var(--muted); padding-top: 10px; }

.audit-item {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
}
.audit-item:last-child { border-bottom: 0; }
.audit-item p { color: var(--muted); font-size: 12px; margin: 0; }
.audit-item time { margin-left: auto; color: var(--muted); font-size: 12px; white-space: nowrap; }

.overview-quota { display: grid; gap: 6px; }
.overview-quota-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.overview-quota-head > strong { font-size: 13px; }
.overview-quota-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.overview-quota-row > strong { margin-left: auto; }
.mini-bar { width: 100%; height: 4px; background: var(--inset); border-radius: 999px; overflow: hidden; }
.mini-bar span { display: block; height: 100%; border-radius: inherit; background: var(--primary); }

/* Data Tables & Filter Bars */
.table-wrap { overflow-x: auto; border-radius: 0 0 12px 12px; }
table { width: 100%; border-collapse: collapse; text-align: left; font-size: 13px; min-width: 640px; }
th {
  background: color-mix(in srgb, var(--inset) 75%, var(--surface));
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.45px;
  font-weight: 650;
  color: var(--muted);
  white-space: nowrap;
}
td, th { padding: 11px 18px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: color-mix(in srgb, var(--hover) 45%, transparent); }
td { overflow-wrap: break-word; }
td:last-child { white-space: nowrap; }
td .subline { display: block; color: var(--muted); font-size: 11px; margin-top: 3px; }
.table-foot {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.table-foot label.row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.table-foot select { width: auto; min-height: 32px; padding: 4px 8px; }

.filterbar {
  padding: 14px 20px;
  display: flex;
  gap: 12px;
  align-items: flex-end;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--border);
}
.filterbar label { flex: 1 1 136px; gap: 6px; font-size: 12px; }
.filterbar label.search { flex: 2 1 220px; }
.filterbar input, .filterbar select { padding: 7px 10px; font-size: 13px; min-height: 36px; }

.filter-chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 20px; border-bottom: 1px solid var(--border); }
.filter-chips button { font-size: 12px; min-height: 30px; padding: 4px 10px; }

.empty {
  padding: 40px 20px;
  text-align: center;
  display: grid;
  justify-items: center;
  gap: 8px;
  color: var(--muted);
}
.empty svg { height: 22px; width: 22px; color: var(--subtle); }
.empty strong { font-size: 14px; color: var(--text); font-weight: 620; }
.empty p { font-size: 12.5px; max-width: 420px; }
.empty-clear, .account-clear { display: flex; margin: 0 auto 20px; }

/* Client Setup, Playground & Settings */
.connection-facts {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) auto minmax(0,1fr);
  gap: 12px;
  align-items: end;
}
.segmented {
  display: inline-flex;
  gap: 4px;
  padding: 3px;
  background: var(--inset);
  border: 1px solid var(--border);
  border-radius: 9px;
  width: fit-content;
  max-width: 100%;
  flex-wrap: wrap;
}
.segmented button {
  border-color: transparent;
  background: transparent;
  box-shadow: none;
  min-height: 28px;
  padding: 4px 11px;
  font-size: 12px;
  color: var(--muted);
  border-radius: 6px;
}
.segmented button[aria-pressed=true] {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
  box-shadow: 0 1px 2px rgb(0 0 0 / 14%);
}

.model-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 13px 20px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.model-row:last-child { border-bottom: 0; }
.model-row h3 { font-family: "SF Mono", ui-monospace, monospace; font-size: 13px; }

.test-layout {
  display: grid;
  grid-template-columns: minmax(0,1fr) minmax(0, 1.15fr);
  gap: 16px;
  align-items: start;
}
.test-layout .panel { min-width: 0; }
.test-layout textarea { min-height: 180px; font-size: 14px; }
.test-layout details > summary { padding: 6px 0; cursor: pointer; color: var(--muted); font-size: 12px; }
.test-result { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 14px; }
.test-result > details { flex-basis: 100%; }
#playground-output { max-height: 540px; font-size: 13px; line-height: 1.65; }

fieldset {
  border: 1px solid var(--border);
  border-radius: 10px;
  min-width: 0;
  padding: 14px 16px;
  margin: 0;
  background: color-mix(in srgb, var(--inset) 35%, transparent);
}
legend { padding: 0 6px; font-size: 12.5px; font-weight: 650; color: var(--text); }
.capability-fact {
  display: grid;
  gap: 5px;
  padding: 13px 16px;
  background: var(--inset);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.setting-conversion, #diagnostics-snapshot { font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }

.definition {
  display: grid;
  grid-template-columns: minmax(120px, 0.78fr) minmax(0,1fr);
  gap: 9px 14px;
  font-size: 13px;
  margin: 0;
}
.definition dt { color: var(--muted); }
.definition dd { margin: 0; overflow-wrap: anywhere; }

.request-outcome { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.recovery-guide { border-left: 3px solid var(--primary); padding-left: 14px; display: grid; gap: 10px; }
.recovery-guide p { font-size: 13px; color: var(--muted); }
.recovery-guide button { justify-self: start; }

.advanced-area { padding: 15px 20px; }
.advanced-area > summary { font-size: 14px; font-weight: 620; cursor: pointer; }
.advanced-links { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0; }
.advanced-links a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 13px;
  background: var(--inset);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  transition: background-color 120ms ease-out, border-color 120ms ease-out;
}
.advanced-links a:hover { background: var(--hover); border-color: var(--border-strong); }

.loading {
  min-height: 160px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
}

.content-enter { animation: enter 200ms cubic-bezier(.16, 1, .3, 1) both; }
@keyframes enter {
  from { opacity: 0.45; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Login Split Workspace */
.login-shell {
  min-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr);
}
.login-story {
  padding: 48px clamp(32px, 6vw, 84px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border-right: 1px solid var(--border);
  background-color: var(--surface);
  background-image: radial-gradient(640px 420px at 15% 15%, var(--canvas-glow), transparent 70%);
  gap: 48px;
}
.login-story h1 {
  font-size: clamp(32px, 3.2vw, 46px);
  line-height: 1.13;
  letter-spacing: -1.4px;
  font-weight: 680;
  max-width: 520px;
}
.login-story h1 em { font-style: normal; color: var(--violet); }
.login-story .intro {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.72;
  max-width: 430px;
  margin-top: 18px;
}
.login-principles {
  display: grid;
  border-top: 1px solid var(--border);
  margin-top: 32px;
  max-width: 440px;
}
.login-principles > div {
  padding: 13px 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  font-size: 12.5px;
}
.login-principles > div > span:last-child { color: var(--muted); text-align: right; }
.login-foot {
  font-size: 11.5px;
  color: var(--subtle);
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}
.login-area {
  padding: 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  min-width: 0;
}
.login-tools { position: absolute; right: 28px; top: 24px; }
.login-form {
  width: 100%;
  max-width: 380px;
  padding: 28px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--panel-shadow);
}
.login-form h2 { font-size: 23px; font-weight: 670; letter-spacing: -0.55px; }
.login-form > .muted { font-size: 13px; margin: 8px 0 24px; line-height: 1.6; }
.login-form form { display: grid; gap: 16px; }
.login-form .primary { width: 100%; min-height: 40px; }
.login-form .login-security {
  display: flex;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
  margin: 18px 0 0;
}
.login-demo {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.login-form .notice { margin-bottom: 16px; }

/* Modal Dialog & Toast */
dialog {
  color: var(--text);
  background: var(--surface-elevated);
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  width: 560px;
  max-width: calc(100% - 32px);
  max-height: calc(100dvh - 48px);
  padding: 24px;
  box-shadow: var(--shadow);
  overflow: auto;
}
dialog::backdrop { background: rgb(5 8 15 / 72%); backdrop-filter: blur(4px); }
dialog[open] { animation: enter 180ms cubic-bezier(.16, 1, .3, 1); }
dialog h2 { font-size: 18px; letter-spacing: -0.35px; margin-bottom: 8px; }
dialog #dialog-description { font-size: 13px; color: var(--muted); line-height: 1.62; margin-bottom: 18px; }
dialog .dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; flex-wrap: wrap; }
dialog .notice { margin-top: 14px; }
dialog pre { margin-top: 12px; user-select: all; max-height: 220px; }
dialog .dialog-context {
  padding: 11px 14px;
  background: var(--inset);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 12px;
  overflow-wrap: anywhere;
  margin-bottom: 14px;
}
dialog details > summary { cursor: pointer; min-height: 36px; display: list-item; font-size: 13px; padding: 6px 0; }

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 100;
  max-width: min(440px, calc(100% - 32px));
  padding: 12px 16px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: var(--text);
  color: var(--canvas);
  box-shadow: var(--shadow);
  font-size: 13px;
  font-weight: 550;
  animation: enter 160ms cubic-bezier(.16, 1, .3, 1);
}
.noscript { position: fixed; inset: 0; display: grid; place-items: center; background: var(--canvas); padding: 32px; }

/* Responsive Breakpoints */
@media (max-width: 1080px) {
  .connection-facts { grid-template-columns: minmax(0,1fr) auto; }
  .connection-facts > label:last-child { grid-column: 1 / -1; }
}

@media (max-width: 920px) {
  .topbar { gap: 14px; padding: 10px 20px; }
  .daily-nav a { padding: 6px 10px; }
  .daily-nav svg { display: none; }
  .test-layout { grid-template-columns: minmax(0,1fr); }
  .metrics { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .metric:nth-child(2) { border-right: 0; }
  .metric:nth-child(-n+2) { border-bottom: 1px solid var(--border); }
  .daily-account-main {
    grid-template-columns: minmax(130px, 1fr) auto minmax(0, 2fr) auto;
    gap: 14px;
  }
  .daily-quota { column-gap: 16px; }
}

@media (max-width: 740px) {
  .main { padding: 18px 16px 32px; }
  .demo-banner { padding: 8px 16px; }
  .demo-banner > span:not(.badge) { display: none; }
  .evidence-grid, .form-grid, .connection-facts, .daily-filters { grid-template-columns: minmax(0,1fr); }
  .connection-facts > label:last-child { grid-column: auto; }
  .connection-facts > button { justify-self: start; }
  .journey-main { padding: 16px; flex-wrap: wrap; }
  .attention-grid { grid-template-columns: repeat(3, minmax(0,1fr)); gap: 8px; }
  .attention-tile { padding: 12px; display: grid; gap: 4px; font-size: 12px; }

  /* Mobile >= 16px Input Rule (prevents iOS zoom & satisfies mobile audit) */
  #app input:not([type=checkbox]), #app select, #app textarea,
  dialog input:not([type=checkbox]), dialog select, dialog textarea {
    font-size: 16px;
    min-height: 40px;
  }
  #app input[type=checkbox], dialog input[type=checkbox] {
    font-size: 16px;
    min-height: 20px;
    height: 20px;
  }

  /* Sign-in Capsule & Bounds-Safe Mobile Tooltip */
  .sign-in-controls {
    position: relative;
    width: 100%;
    justify-content: space-between;
    padding: 6px 8px 6px 12px;
  }
  .terms-tooltip { position: static; }
  .terms-tooltip [role=tooltip] {
    left: 0;
    right: 0;
    width: auto;
    max-width: 100%;
    transform: none;
  }

  /* Mobile Stacked Tables (zero horizontal scroll) */
  .table-wrap { overflow: visible; max-width: 100%; }
  table { display: block; min-width: 0; width: 100%; }
  thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  tbody { display: grid; gap: 10px; padding: 12px; }
  tbody tr {
    display: block;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
    padding: 8px 12px;
  }
  td {
    display: grid;
    grid-template-columns: minmax(76px, 0.38fr) minmax(0,1fr);
    gap: 10px;
    max-width: none;
    padding: 7px 0;
    border-bottom: 1px solid var(--border);
    text-align: left;
    white-space: normal;
    overflow-wrap: anywhere;
  }
  td:last-child { white-space: normal; }
  td::before {
    content: attr(data-label);
    font-size: 11.5px;
    font-weight: 600;
    color: var(--muted);
    overflow-wrap: anywhere;
  }
  td > * { min-width: 0; max-width: 100%; justify-self: start; }
  tbody tr td:last-child { border-bottom: 0; }
  tbody tr:last-child td:not(:last-child) { border-bottom: 1px solid var(--border); }

  .login-shell { grid-template-columns: minmax(0,1fr); }
  .login-story { padding: 24px 20px; border-right: 0; border-bottom: 1px solid var(--border); gap: 20px; }
  .login-story .intro, .login-principles, .login-foot { display: none; }
  .login-area { padding: 72px 16px 32px; }
  .login-form { padding: 22px 18px; }
  dialog { max-width: calc(100% - 24px); padding: 20px; max-height: calc(100dvh - 24px); }
}

@media (max-width: 640px) {
  .topbar {
    padding: 10px 16px 8px;
    gap: 10px;
    flex-wrap: wrap;
  }
  .topbar > .brand { flex: 1; }
  .topbar .brand strong { font-size: 13.5px; }
  .daily-nav {
    order: 3;
    width: 100%;
    display: grid;
    grid-template-columns: repeat(3, minmax(0,1fr));
    gap: 4px;
    padding: 3px;
  }
  .daily-nav a {
    justify-content: center;
    min-height: 36px;
    font-size: 12.5px;
    padding: 6px 8px;
  }
  .page-heading { gap: 12px; margin-bottom: 14px; padding-bottom: 14px; }
  .page-heading h1 { font-size: 23px; }
  .page-heading .actions { width: 100%; }
  .page-heading .actions > button,
  .page-heading .actions > .button { width: 100%; }
  .sign-in-controls #add-account { margin-left: auto; }

  .refresh-strip { gap: 8px 12px; padding: 10px 12px; }
  .daily-filters { grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; padding: 12px; }
  .daily-filters .search { grid-column: 1 / -1; }

  /* Mobile Account Card Compact Stack (main <= 230px, terms <= 96px, summary <= 44px) */
  .daily-account-main {
    grid-template-columns: minmax(0,1fr) auto;
    gap: 8px 14px;
    padding: 12px 16px 8px;
    min-height: 0;
  }
  .daily-quota {
    grid-column: 1 / -1;
    gap: 2px 18px;
  }
  .daily-value { font-size: 18px; }
  .daily-test {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
  }
  .account-terms {
    padding: 6px 16px;
    gap: 6px 10px;
  }
  [data-page=accounts] .daily-account > .account-disclosure > summary {
    padding: 8px 16px;
    min-height: 36px;
    max-width: 100%;
    margin-top: 0;
  }
  [data-page=accounts] .daily-details { padding: 14px 16px; }
  .quota-tiles { grid-template-columns: minmax(0,1fr); }
  .attention-grid { grid-template-columns: minmax(0,1fr); }
}

@media (max-width: 380px) {
  .daily-filters { grid-template-columns: minmax(0,1fr); }
  .metrics { grid-template-columns: minmax(0,1fr); }
  .metric { border-right: 0; border-bottom: 1px solid var(--border); }
  .metric:last-child { border-bottom: 0; }
  .sign-in-controls { gap: 6px; }
  .definition { grid-template-columns: minmax(0,1fr); gap: 4px; }
}

@media (prefers-reduced-motion:reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
