:root {
  --bg-0: #06090f;
  --bg-1: #0c121d;
  --bg-2: #121b2b;
  --bg-3: #1a263c;
  --border: #1e2d47;
  --border-hi: #2e446b;
  --txt-1: #ecf2ff;
  --txt-2: #9ab0d1;
  --txt-3: #63799c;
  --cyan: #22d3ee;
  --blue: #3b82f6;
  --emerald: #10b981;
  --amber: #f59e0b;
  --red: #ef4444;
  --purple: #a855f7;
  --radius: 10px;
  --mono: "JetBrains Mono", "Fira Code", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sans: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  background: radial-gradient(circle at 15% 0%, #0f1b31 0%, var(--bg-0) 55%);
  color: var(--txt-1);
  font-family: var(--sans);
  font-size: 13.5px;
  line-height: 1.45;
  min-height: 100vh;
}

.hidden { display: none !important; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.flex-1 { flex: 1; }

/* ================= LOGIN ================= */
.login-backdrop {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  background: radial-gradient(circle at 50% 25%, #13223d 0%, #05080d 70%);
  z-index: 100;
}
.login-card {
  width: 100%; max-width: 420px;
  background: rgba(12, 18, 29, 0.92);
  border: 1px solid var(--border-hi);
  border-radius: 14px;
  padding: 28px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.65);
}
.brand-hero { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; }
.brand-hero .trophy { font-size: 34px; }
.brand-hero h1 { font-size: 20px; letter-spacing: 1.5px; font-weight: 800; }
.brand-hero p { font-size: 11px; color: var(--cyan); letter-spacing: 0.7px; margin-top: 2px; }
#login-form label { display: block; color: var(--txt-2); font-size: 12px; margin-bottom: 6px; }
#login-form input {
  width: 100%; padding: 10px 12px; border-radius: 8px;
  border: 1px solid var(--border-hi); background: var(--bg-0); color: var(--txt-1);
  font-size: 14px; margin-bottom: 14px; outline: none;
}
#login-form input:focus { border-color: var(--cyan); }
.form-err { color: #fca5a5; background: rgba(239,68,68,0.14); border: 1px solid rgba(239,68,68,0.4); padding: 8px 10px; border-radius: 6px; margin-bottom: 12px; font-size: 12px; }
.login-foot { margin-top: 16px; text-align: center; font-size: 11px; color: var(--txt-3); }

/* ================= BANNERS ================= */
.alert-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 18px; font-size: 13px; border-bottom: 1px solid transparent;
}
.alert-danger { background: linear-gradient(90deg, #7f1d1d, #450a0a); border-color: #ef4444; color: #fecaca; }
.alert-warn { background: linear-gradient(90deg, #78350f, #451a03); border-color: #f59e0b; color: #fde68a; }

/* ================= SHELL & TOPBAR ================= */
.app-shell { max-width: 1620px; margin: 0 auto; padding-bottom: 36px; }

.topbar {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px;
  padding: 12px 20px;
  background: rgba(12, 18, 29, 0.88);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 40;
}
.topbar-left { display: flex; align-items: center; gap: 12px; }
.logo-badge {
  width: 38px; height: 38px; border-radius: 9px;
  background: linear-gradient(135deg, #1e3a8a, #0e7490);
  border: 1px solid rgba(34, 211, 238, 0.4);
  display: flex; align-items: center; justify-content: center; font-size: 20px;
}
.brand-title { font-weight: 800; font-size: 15px; letter-spacing: 0.8px; }
.brand-sub { color: var(--cyan); font-weight: 600; font-size: 12.5px; }
.brand-meta { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--txt-2); margin-top: 2px; font-family: var(--mono); }
.dot { color: var(--txt-3); }

.topbar-right { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }

/* ================= PILLS & BUTTONS ================= */
.pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; font-family: var(--mono);
  border: 1px solid transparent;
}
.pill-neutral { background: var(--bg-2); color: var(--txt-2); border-color: var(--border); }
.pill-ok { background: rgba(16, 185, 129, 0.14); color: #34d399; border-color: rgba(16, 185, 129, 0.35); }
.pill-warn { background: rgba(245, 158, 11, 0.15); color: #fbbf24; border-color: rgba(245, 158, 11, 0.4); }
.pill-err { background: rgba(239, 68, 68, 0.16); color: #f87171; border-color: rgba(239, 68, 68, 0.4); }
.pill-info { background: rgba(34, 211, 238, 0.13); color: var(--cyan); border-color: rgba(34, 211, 238, 0.35); }
.pill-purple { background: rgba(168, 85, 247, 0.16); color: #d8b4fe; border-color: rgba(168, 85, 247, 0.4); }

.status-pill {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 5px 11px; border-radius: 999px; font-size: 11.5px; font-weight: 700; font-family: var(--mono);
}
.pulse-dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.state-running { background: rgba(34,211,238,0.15); color: var(--cyan); border: 1px solid rgba(34,211,238,0.45); }
.state-running .pulse-dot { animation: pulse 1.2s infinite; }
.state-armed { background: rgba(16,185,129,0.14); color: #34d399; border: 1px solid rgba(16,185,129,0.4); }
.state-paused { background: rgba(245,158,11,0.14); color: #fbbf24; border: 1px solid rgba(245,158,11,0.4); }
.state-stopped { background: rgba(239,68,68,0.18); color: #f87171; border: 1px solid rgba(239,68,68,0.5); }

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.35; transform: scale(1.3); }
}

.btn {
  cursor: pointer; border: 1px solid var(--border); border-radius: 7px;
  padding: 7px 12px; font-size: 12.5px; font-weight: 600; color: var(--txt-1);
  background: var(--bg-2); transition: all 0.15s ease;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.btn:hover:not(:disabled) { border-color: var(--border-hi); background: var(--bg-3); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-block { width: 100%; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-icon { padding: 6px 9px; }
.btn-primary { background: linear-gradient(135deg, #0284c7, #2563eb); border-color: #38bdf8; color: #fff; }
.btn-primary:hover:not(:disabled) { filter: brightness(1.1); }
.btn-secondary { background: #17253b; border-color: #2c466e; color: #dbeafe; }
.btn-danger { background: rgba(220, 38, 38, 0.85); border-color: #f87171; color: #fff; }
.btn-danger-outline { background: rgba(239, 68, 68, 0.1); border-color: rgba(239, 68, 68, 0.45); color: #fca5a5; }
.btn-danger-outline:hover:not(:disabled) { background: rgba(239, 68, 68, 0.25); }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--txt-2); }
.btn-light { background: #fff; color: #7f1d1d; border: none; font-weight: 700; }
.btn-chip.active { background: rgba(34, 211, 238, 0.18); border-color: var(--cyan); color: #fff; }
.btn-link { background: none; border: none; color: var(--cyan); cursor: pointer; font-size: 12px; }
.btn-link:hover { text-decoration: underline; }

/* ================= CARDS & KPI GRID ================= */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding: 14px 20px 0;
}
@media (min-width: 1700px) { .kpi-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
@media (max-width: 900px) { .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.card {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.kpi-card { display: flex; flex-direction: column; justify-content: space-between; min-height: 142px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-bottom: 8px; }
.card-label { font-size: 12px; color: var(--txt-2); font-weight: 600; }

.kpi-big-row { display: flex; align-items: baseline; gap: 10px; margin: 4px 0 8px; }
.kpi-big { font-size: 27px; font-weight: 800; font-family: var(--mono); letter-spacing: -0.5px; }
.kpi-sub { font-size: 12px; color: var(--txt-3); font-family: var(--mono); }
.kpi-foot { font-size: 11px; color: var(--txt-3); margin-top: 6px; }

/* Slot Matrix */
.slot-matrix { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 4px 0 8px; }
.slot-box {
  background: var(--bg-0); border: 1px solid var(--border); border-radius: 7px;
  padding: 6px 4px; text-align: center; font-family: var(--mono);
}
.slot-box.done { background: rgba(16, 185, 129, 0.14); border-color: rgba(16, 185, 129, 0.5); }
.slot-box.slot-sa.done { background: rgba(168, 85, 247, 0.18); border-color: rgba(168, 85, 247, 0.55); }
.slot-box .s-tag { display: block; font-size: 10px; color: var(--txt-3); }
.slot-box .s-val { display: block; font-size: 11.5px; font-weight: 700; color: var(--txt-1); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; }

.mini-list { font-size: 11px; color: var(--txt-2); font-family: var(--mono); max-height: 76px; overflow-y: auto; }

/* Progress Bar */
.progress-track {
  position: relative; height: 9px; background: var(--bg-0);
  border-radius: 999px; border: 1px solid var(--border); overflow: hidden;
}
.progress-fill { height: 100%; background: linear-gradient(90deg, #0ea5e9, #10b981); transition: width 0.4s ease; }
.progress-fill.warn { background: linear-gradient(90deg, #d97706, #f59e0b); }
.progress-fill.err { background: linear-gradient(90deg, #b91c1c, #ef4444); }
.progress-mark { position: absolute; top: 0; bottom: 0; width: 2px; background: rgba(245, 158, 11, 0.7); z-index: 2; }
.progress-mark.mark-target { background: #22d3ee; }

/* Sparkline */
.sparkline-wrap { height: 42px; display: flex; align-items: flex-end; margin-top: 4px; }
.sparkline-wrap svg { width: 100%; height: 42px; display: block; }

/* Theme & AQP */
.theme-callout { font-size: 11.5px; color: var(--txt-2); display: grid; gap: 3px; margin: 2px 0 6px; }
.chip-row { display: flex; flex-wrap: wrap; gap: 5px; }
.alpha-chip {
  font-family: var(--mono); font-size: 11px; padding: 2px 7px; border-radius: 5px;
  background: var(--bg-0); border: 1px solid var(--border-hi); color: var(--cyan);
}

/* System Meters */
.sys-meters { display: grid; gap: 5px; margin: 4px 0; }
.meter-row { display: grid; grid-template-columns: 38px 1fr 74px; align-items: center; gap: 7px; font-size: 11px; color: var(--txt-2); }
.meter-bar { height: 6px; background: var(--bg-0); border-radius: 999px; overflow: hidden; border: 1px solid var(--border); }
.meter-fill { height: 100%; background: var(--cyan); width: 0%; transition: width 0.3s; }
.meter-swap { background: var(--purple); }
.meter-disk { background: var(--emerald); }

/* ================= MAIN 2-COL GRID ================= */
.main-grid {
  display: grid;
  grid-template-columns: 430px minmax(0, 1fr);
  gap: 14px;
  padding: 14px 20px 0;
}
@media (max-width: 1100px) { .main-grid { grid-template-columns: minmax(0, 1fr); } }

.section-title-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.section-title-row h2, .console-title h2 { font-size: 14.5px; font-weight: 700; }

.control-group { display: grid; gap: 9px; }
.group-label { font-size: 11.5px; font-weight: 700; color: var(--txt-2); text-transform: uppercase; letter-spacing: 0.4px; }
.label-with-action { display: flex; justify-content: space-between; align-items: center; }
.btn-grid-2 { display: grid; grid-template-columns: 1.3fr 1fr; gap: 8px; }
.slot-launch-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; }

.input-sm, textarea {
  background: var(--bg-0); border: 1px solid var(--border); color: var(--txt-1);
  border-radius: 7px; padding: 6px 9px; font-size: 12.5px; font-family: inherit; outline: none;
}
.input-sm:focus, textarea:focus { border-color: var(--cyan); }
textarea { width: 100%; resize: vertical; margin: 7px 0; font-family: var(--mono); font-size: 12px; }

.custom-prompt-box summary {
  cursor: pointer; font-size: 12px; color: var(--cyan); user-select: none; padding: 3px 0;
}

.sep { border: none; border-top: 1px solid var(--border); margin: 12px 0; }

.field-row { display: flex; align-items: center; gap: 10px; }
.field-lbl { width: 64px; font-size: 12px; color: var(--txt-2); flex-shrink: 0; }
.acct-btn-group { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; flex: 1; }
.tiny-note { font-size: 11px; color: var(--txt-3); }

.chk-row { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--txt-2); cursor: pointer; }
.chk-inline { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--txt-2); cursor: pointer; }

.sched-grid { display: grid; gap: 8px; }
.sched-inputs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.sched-inputs > div { display: grid; gap: 4px; font-size: 11px; color: var(--txt-3); }
.sched-inputs input { width: 100%; }

/* ================= LIVE CONSOLE ================= */
.console-panel { display: flex; flex-direction: column; min-height: 470px; max-height: 580px; }
.console-head {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px;
  padding-bottom: 10px; border-bottom: 1px solid var(--border);
}
.console-title { display: flex; align-items: center; gap: 8px; }
.console-controls { display: flex; align-items: center; gap: 10px; }

.console-body {
  flex: 1; margin-top: 10px; padding: 10px 12px;
  background: #05070c; border: 1px solid #152033; border-radius: 8px;
  font-family: var(--mono); font-size: 12px; line-height: 1.55;
  overflow-y: auto; display: flex; flex-direction: column; gap: 5px;
}
.console-empty { color: var(--txt-3); margin: auto; text-align: center; }
.log-line { word-break: break-word; white-space: pre-wrap; padding: 3px 6px; border-radius: 4px; }
.log-sys { color: #7c93b6; font-size: 11.5px; }
.log-tool { color: #38bdf8; background: rgba(14, 116, 144, 0.12); border-left: 2px solid var(--cyan); }
.log-say { color: #e2e8f0; }
.log-end { color: #34d399; background: rgba(16, 185, 129, 0.12); border-left: 2px solid var(--emerald); font-weight: 600; }
.log-err { color: #fca5a5; background: rgba(239, 68, 68, 0.15); border-left: 2px solid var(--red); font-weight: 600; }

/* ================= TABS & TABLES ================= */
.tabs-section { margin: 14px 20px 0; }
.tabs-bar { display: flex; flex-wrap: wrap; gap: 6px; border-bottom: 1px solid var(--border); padding-bottom: 10px; margin-bottom: 14px; }
.tab-btn {
  background: transparent; border: 1px solid transparent; color: var(--txt-2);
  padding: 6px 12px; border-radius: 7px; cursor: pointer; font-weight: 600; font-size: 12.5px;
}
.tab-btn:hover { color: var(--txt-1); background: var(--bg-2); }
.tab-btn.active { background: var(--bg-2); border-color: var(--border-hi); color: var(--cyan); }
.tab-cnt {
  background: rgba(245, 158, 11, 0.2); color: #fbbf24; padding: 1px 6px;
  border-radius: 999px; font-size: 11px; margin-left: 4px; font-family: var(--mono);
}

.sub-block + .sub-block { margin-top: 18px; }
.sub-block h3, .three-col-logs h3 { font-size: 13px; color: var(--txt-2); margin-bottom: 8px; }
.sub-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.empty-hint { padding: 12px; border-radius: 8px; background: var(--bg-0); border: 1px dashed var(--border); color: var(--txt-3); font-size: 12.5px; }

.pending-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 10px; }
.pending-card {
  background: var(--bg-0); border: 1px solid rgba(245, 158, 11, 0.45);
  border-radius: 8px; padding: 12px; display: grid; gap: 7px;
}
.pending-top { display: flex; justify-content: space-between; align-items: center; }
.pending-expr { font-family: var(--mono); font-size: 11.5px; color: var(--txt-2); background: var(--bg-1); padding: 6px 8px; border-radius: 5px; max-height: 64px; overflow-y: auto; }
.pending-actions { display: flex; gap: 8px; justify-content: flex-end; }

.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.data-table th, .data-table td {
  padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--border);
  font-variant-numeric: tabular-nums;
}
.data-table th { color: var(--txt-3); font-weight: 600; font-size: 11.5px; text-transform: uppercase; background: var(--bg-0); }
.data-table tbody tr:hover { background: rgba(30, 45, 71, 0.3); }
.empty-cell { text-align: center !important; color: var(--txt-3); padding: 20px !important; }

/* Docs & Logs */
.docs-toolbar { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.doc-switch-group { display: flex; gap: 6px; }
.doc-pre {
  background: #05070c; border: 1px solid var(--border); border-radius: 8px;
  padding: 14px; font-family: var(--mono); font-size: 12px; line-height: 1.55;
  color: #dbeafe; max-height: 520px; overflow: auto; white-space: pre-wrap; word-break: break-word;
}

.three-col-logs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 1024px) { .three-col-logs { grid-template-columns: 1fr; } }
.log-feed {
  background: var(--bg-0); border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 10px; max-height: 360px; overflow-y: auto; display: grid; gap: 6px;
}
.feed-item { font-size: 12px; border-bottom: 1px solid rgba(30,45,71,0.55); padding-bottom: 6px; }
.feed-item:last-child { border-bottom: none; padding-bottom: 0; }
.feed-ts { font-family: var(--mono); font-size: 10.5px; color: var(--txt-3); margin-right: 6px; }

/* Toasts */
.toast-root { position: fixed; right: 18px; bottom: 18px; display: grid; gap: 8px; z-index: 200; }
.toast {
  background: var(--bg-2); border: 1px solid var(--border-hi); color: var(--txt-1);
  padding: 10px 14px; border-radius: 8px; font-size: 12.5px; box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}
.toast-ok { border-left: 3px solid var(--emerald); }
.toast-err { border-left: 3px solid var(--red); }

/* ================= 30d card sync line & account usage ================= */
.sync-line { color: var(--txt-3); }
.sync-warn { color: #fbbf24; }
.sync-err { color: #f87171; }
.kpi-foot.mono { font-size: 10.5px; }

.acct-usage-list { display: grid; gap: 8px; }
.acct-row {
  background: var(--bg-0); border: 1px solid var(--border); border-radius: 8px;
  padding: 7px 9px; display: grid; gap: 4px;
}
.acct-row.is-active { border-color: rgba(34, 211, 238, 0.55); }
.acct-row-top { display: flex; justify-content: space-between; align-items: center; gap: 6px; font-size: 12.5px; }
.acct-row-top strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.occ-row { grid-template-columns: 22px 1fr 84px; }
.meter-fill.warn { background: var(--amber); }
.meter-fill.err { background: var(--red); }

/* ================= MOBILE / TOUCH ================= */
.app-shell { padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); }
.tabs-bar, .doc-switch-group { -webkit-overflow-scrolling: touch; }

.main-grid > *, .kpi-grid > * { min-width: 0; }
select, .input-sm { max-width: 100%; text-overflow: ellipsis; }

@media (max-width: 900px) {
  .main-grid { grid-template-columns: minmax(0, 1fr); }
  .console-panel { min-height: 320px; max-height: 70vh; }
  .three-col-logs { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  html, body { font-size: 14px; -webkit-text-size-adjust: 100%; }

  /* Topbar: brand on one line, controls become a swipeable button strip */
  .topbar { padding: 8px 12px; gap: 8px; position: static; }
  .topbar-left { width: 100%; }
  .logo-badge { width: 32px; height: 32px; font-size: 17px; }
  .brand-sub { display: none; }
  .brand-meta { flex-wrap: wrap; gap: 4px 8px; font-size: 11px; }
  .topbar-right {
    width: 100%; flex-wrap: nowrap; overflow-x: auto; gap: 6px;
    padding-bottom: 4px; scrollbar-width: none;
  }
  .topbar-right::-webkit-scrollbar { display: none; }
  .topbar-right > * { flex: 0 0 auto; }
  .alert-banner { flex-direction: column; align-items: stretch; padding: 10px 12px; font-size: 12.5px; }

  /* Comfortable touch targets; 16px inputs stop iOS zooming the page on focus */
  .btn { min-height: 40px; padding: 8px 12px; }
  .btn-sm { min-height: 36px; }
  .input-sm, textarea, #login-form input, select { font-size: 16px; min-height: 40px; }
  .chk-row input, .chk-inline input { width: 20px; height: 20px; }
  .chk-row { align-items: flex-start; line-height: 1.4; }

  /* KPI cards: single column, tighter */
  .kpi-grid { grid-template-columns: minmax(0, 1fr); padding: 10px 12px 0; gap: 10px; }
  .kpi-card { min-height: 0; }
  .kpi-big { font-size: 24px; }
  .slot-matrix { grid-template-columns: repeat(2, 1fr); }
  .mini-list { max-height: 80px; }

  /* Workspace */
  .main-grid { padding: 10px 12px 0; gap: 10px; }
  .card { padding: 12px; }
  .btn-grid-2 { grid-template-columns: 1fr; }
  .slot-launch-row { grid-template-columns: 1fr; }
  .field-row { flex-wrap: wrap; gap: 6px; }
  .field-lbl { width: 100%; }
  .acct-btn-group { width: 100%; }
  .sched-inputs { grid-template-columns: 1fr 1fr; }
  .sched-inputs > div:last-child { grid-column: 1 / -1; }

  /* Console */
  .console-panel { min-height: 300px; max-height: 65vh; }
  .console-head { flex-direction: column; align-items: stretch; }
  .console-controls { flex-wrap: wrap; }
  .console-controls select { flex: 1; min-width: 0; }
  .console-body { font-size: 11.5px; padding: 8px; }

  /* Tabs: one swipeable row instead of a 4-line wrap */
  .tabs-section { margin: 10px 12px 0; }
  .tabs-bar { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .tabs-bar::-webkit-scrollbar { display: none; }
  .tab-btn { flex: 0 0 auto; white-space: nowrap; min-height: 38px; }

  /* Tables scroll sideways inside their wrapper instead of squashing columns */
  .data-table { min-width: 560px; font-size: 12px; }
  .data-table th, .data-table td { padding: 7px 8px; white-space: nowrap; }
  .pending-grid { grid-template-columns: 1fr; }
  .pending-actions { flex-wrap: wrap; }
  .pending-actions .btn { flex: 1; }
  .docs-toolbar { flex-direction: column; align-items: stretch; }
  .doc-switch-group { overflow-x: auto; }
  .doc-switch-group .btn { flex: 0 0 auto; }
  .doc-pre { max-height: 60vh; font-size: 11.5px; padding: 10px; }
  .log-feed { max-height: 280px; }

  /* Toasts become a bottom sheet */
  .toast-root { left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); }
  .login-card { padding: 20px; }
}

/* Long unbreakable strings (emails, keyring lines, alpha expressions) must wrap, never widen the page */
.control-group, .sched-grid, .acct-usage-list, .acct-row { grid-template-columns: minmax(0, 1fr); }
.tiny-note, .kpi-foot, .acct-row-top { overflow-wrap: anywhere; }
.field-row > *, .label-with-action > * { min-width: 0; }
