:root {
  color-scheme: dark;
  --bg: #080b0f;
  --surface: #0f141b;
  --surface-2: #151c25;
  --line: #27313d;
  --text: #f4f7fa;
  --muted: #9aa8b7;
  --green: #39d98a;
  --amber: #f6bd5b;
  --red: #ff6678;
  --blue: #69a7ff;
  --focus: #a8c9ff;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: var(--bg); color: var(--text); }
button, input, select { font: inherit; }
button, input, select, a { outline-offset: 3px; }
:focus-visible { outline: 3px solid var(--focus); }
.skip { position: fixed; z-index: 99; left: 16px; top: -80px; padding: 12px 16px; background: var(--text); color: var(--bg); }
.skip:focus { top: 16px; }
.eyebrow { margin: 0 0 8px; color: var(--blue); font: 700 .72rem/1.2 ui-monospace, SFMono-Regular, Consolas, monospace; letter-spacing: .14em; }
.login-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(360px, .85fr); }
.login-context, .login-form { padding: clamp(32px, 7vw, 112px); display: flex; flex-direction: column; justify-content: center; }
.login-context { min-height: 100vh; background: radial-gradient(circle at 20% 10%, #183559 0, transparent 38%), linear-gradient(145deg, #0c1118, #101a26); border-right: 1px solid var(--line); }
.login-context h1 { max-width: 680px; margin: 12px 0; font-size: clamp(3rem, 7vw, 7rem); line-height: .9; letter-spacing: -.07em; }
.login-context > p:not(.eyebrow) { max-width: 620px; color: #c4cfda; font-size: clamp(1rem, 2vw, 1.3rem); line-height: 1.6; }
.brand-mark { width: 56px; height: 56px; display: grid; place-items: center; margin-bottom: 64px; border: 1px solid #517cae; color: #cfe3ff; font-weight: 900; }
.safety-list { display: grid; gap: 10px; margin: 34px 0 0; padding: 0; list-style: none; color: var(--muted); }
.safety-list li::before { content: "✓"; color: var(--green); margin-right: 10px; }
.login-form { max-width: 580px; width: 100%; margin: auto; }
.login-form h2 { margin: 0 0 32px; font-size: clamp(2rem, 4vw, 3.4rem); letter-spacing: -.045em; }
label { margin: 18px 0 8px; color: #dbe4ec; font-weight: 650; }
input { min-height: 50px; width: 100%; padding: 0 14px; border: 1px solid var(--line); border-radius: 4px; background: var(--surface); color: var(--text); }
input:hover { border-color: #4a596a; }
select { min-height: 44px; padding: 0 12px; border: 1px solid var(--line); border-radius: 4px; background: var(--surface); color: var(--text); }
.button { min-height: 44px; padding: 10px 16px; border: 1px solid transparent; border-radius: 4px; color: var(--text); background: var(--surface-2); cursor: pointer; font-weight: 750; }
.button:hover { filter: brightness(1.12); }
.button.primary { margin-top: 24px; background: var(--blue); color: #07101b; }
.button.ghost { border-color: var(--line); }
.button.danger { border-color: #81414a; background: #32171c; color: #ffc1c8; }
.status { min-height: 24px; margin: 14px 0 0; color: var(--amber); }
.app-shell { min-height: 100vh; grid-template-columns: 228px minmax(0, 1fr); }
.app-shell:not([hidden]) { display: grid; }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 24px 14px; border-right: 1px solid var(--line); background: #0a0e13; display: flex; flex-direction: column; }
.wordmark { display: flex; align-items: center; gap: 10px; padding: 0 10px 28px; }
.wordmark span { display: grid; place-items: center; width: 34px; height: 34px; border: 1px solid #5076a2; color: #cae1ff; font-weight: 900; }
.sidebar nav { display: grid; gap: 4px; }
.nav-item { min-height: 44px; width: 100%; padding: 10px 12px; border: 0; border-left: 2px solid transparent; background: transparent; color: var(--muted); cursor: pointer; text-align: left; }
.nav-item:hover, .nav-item.active { background: #131a23; color: var(--text); border-left-color: var(--blue); }
.secondary-action { margin-top: auto; }
main { min-width: 0; padding: clamp(20px, 4vw, 52px); }
.topbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 26px; }
.topbar h1 { margin: 0; font-size: clamp(2rem, 5vw, 4.6rem); letter-spacing: -.06em; line-height: 1; }
.top-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.badge { display: inline-flex; align-items: center; min-height: 30px; padding: 5px 9px; border: 1px solid var(--line); border-radius: 999px; font: 700 .72rem/1 ui-monospace, SFMono-Regular, Consolas, monospace; text-transform: uppercase; }
.badge.good { border-color: #286e4c; color: #70e9ac; background: #102b20; }
.badge.warn { border-color: #795e2f; color: #ffd788; background: #2c2414; }
.badge.bad { border-color: #82404a; color: #ff9eaa; background: #30171b; }
.badge.neutral { color: #afbdcb; }
.view { display: none; }
.view.active { display: block; }
.metric-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 1px; border: 1px solid var(--line); background: var(--line); }
.metric { min-height: 150px; padding: 20px; background: var(--surface); }
.metric span { color: var(--muted); font-size: .84rem; }
.metric strong { display: block; margin-top: 18px; font-size: clamp(2rem, 4vw, 3.4rem); letter-spacing: -.055em; }
.two-column { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(300px, .8fr); gap: 16px; margin-top: 16px; }
.three-column { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-top: 16px; }
.panel { min-width: 0; border: 1px solid var(--line); background: var(--surface); }
.panel-head { min-height: 68px; padding: 16px 18px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.panel-head h2 { margin: 0; font-size: 1rem; }
.panel-head p { margin: 4px 0 0; color: var(--muted); font-size: .84rem; }
.detail-list { margin: 0; }
.detail-list div, .setting-row, .queue-row { min-height: 52px; padding: 12px 18px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.detail-list div:last-child, .setting-row:last-child, .queue-row:last-child { border-bottom: 0; }
.detail-list dt, .setting-row span, .queue-row span { color: var(--muted); }
.detail-list dd { margin: 0; font-weight: 750; }
.empty-state { padding: 26px 18px; color: var(--muted); line-height: 1.6; }
.table-panel { margin-top: 2px; }
.view-controls { margin: 0 0 16px; padding: 16px 18px; border: 1px solid var(--line); background: var(--surface); display: flex; align-items: end; justify-content: space-between; gap: 16px; }
.view-controls[hidden] { display: none; }
.view-controls p { margin: 4px 0 0; color: var(--muted); font-size: .84rem; }
.campaign-form { width: 100%; display: grid; grid-template-columns: 1fr 1.4fr 1fr 90px auto; align-items: end; gap: 10px; }
.campaign-form label { margin: 0; font-size: .78rem; color: var(--muted); }
.campaign-form input, .campaign-form select { margin-top: 6px; }
.campaign-form .button.primary { margin-top: 0; }
.inline-actions, .row-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.row-actions .button { min-height: 34px; padding: 6px 9px; font-size: .75rem; }
.table-scroll { overflow: auto; max-height: calc(100vh - 250px); }
table { width: 100%; border-collapse: collapse; font-size: .83rem; }
th { position: sticky; top: 0; z-index: 1; background: #121922; color: #c9d4df; text-align: left; }
th, td { padding: 13px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
td { color: #dbe3eb; max-width: 320px; overflow-wrap: anywhere; }
tbody tr:hover { background: #121820; }
.app-status { margin: -12px 0 16px; }
.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; }
@media (max-width: 1080px) {
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .two-column { grid-template-columns: 1fr; }
  .three-column { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .login-shell { grid-template-columns: 1fr; }
  .login-context { min-height: auto; padding: 42px 24px; border-right: 0; border-bottom: 1px solid var(--line); }
  .login-context h1 { font-size: 3.2rem; }
  .brand-mark { margin-bottom: 32px; }
  .login-form { padding: 42px 24px; }
  .app-shell:not([hidden]) { display: block; }
  .sidebar { position: static; width: 100%; height: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .sidebar nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .view-controls, .campaign-form { display: grid; grid-template-columns: 1fr; align-items: stretch; }
  .secondary-action { margin-top: 12px; }
  .topbar { align-items: flex-start; flex-direction: column; }
  .top-actions { justify-content: flex-start; }
  main { padding: 24px 14px 40px; }
  .metric-grid { grid-template-columns: 1fr; }
  .metric { min-height: 110px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
