:root {
  color-scheme: dark;
  --bg: #080b0e;
  --sidebar: #07090c;
  --surface: #0d1217;
  --surface-2: #11181e;
  --line: #202932;
  --line-soft: #172028;
  --text: #f2f5f7;
  --muted: #84909f;
  --muted-2: #596573;
  --lime: #a8ff3e;
  --green: #61e6a2;
  --amber: #ffbd55;
  --red: #ff6d78;
  --blue: #6aa9ff;
  --sidebar-width: 252px;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { min-width: 1180px; background: var(--bg); }
body { margin: 0; background: var(--bg); color: var(--text); }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--lime); outline-offset: 3px; }
.desktop-gate { display: none; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: var(--sidebar-width) minmax(0, 1fr); }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-width); padding: 22px 18px 18px;
  border-right: 1px solid var(--line); background: var(--sidebar); display: flex; flex-direction: column; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 0 8px 22px; color: inherit; text-decoration: none; border-bottom: 1px solid var(--line-soft); }
.brand-mark { width: 38px; height: 38px; display: grid; place-items: center; border: 1px solid #4b702a; border-radius: 11px; color: var(--lime); background: #10180d; font-weight: 800; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 14px; letter-spacing: -.01em; }
.brand small { margin-top: 3px; color: var(--muted); font-size: 9px; letter-spacing: .16em; text-transform: uppercase; }
.sidebar nav { padding-top: 22px; }
.nav-label { display: block; margin: 0 10px 8px; color: #4e5a67; font-size: 9px; letter-spacing: .16em; font-weight: 700; }
.nav-label:not(:first-child) { margin-top: 24px; }
.nav-item { min-height: 42px; padding: 0 11px; border: 1px solid transparent; border-radius: 9px; display: flex; gap: 11px; align-items: center; color: #8592a2; text-decoration: none; font-size: 13px; transition: 160ms ease; }
.nav-item > span { width: 19px; color: #46515e; font: 700 9px/1 ui-monospace, SFMono-Regular, Consolas, monospace; }
.nav-item:hover { color: var(--text); background: #0d1217; }
.nav-item.active { color: var(--text); border-color: #2a343e; background: #12171c; }
.nav-item.active > span { color: var(--lime); }
.nav-item em { margin-left: auto; color: #596675; font-size: 9px; font-style: normal; text-transform: uppercase; }
.nav-item.disabled { cursor: default; opacity: .58; }
.guardrail { margin-top: auto; padding: 13px; border: 1px solid #263126; border-radius: 11px; background: #0d130d; display: flex; gap: 10px; align-items: center; }
.guardrail-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--lime); box-shadow: 0 0 14px rgba(168,255,62,.55); }
.guardrail strong, .guardrail small { display: block; }
.guardrail strong { color: #d9edc2; font-size: 11px; }
.guardrail small { margin-top: 3px; color: #6f8065; font-size: 9px; }
.actor-card { min-width: 0; display: flex; align-items: center; gap: 10px; padding: 16px 6px 0; }
.avatar { flex: 0 0 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: #17202a; color: #cbd4dd; font-size: 12px; font-weight: 800; }
.actor-card div { min-width: 0; }
.actor-card strong, .actor-card small { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.actor-card strong { font-size: 11px; }
.actor-card small { margin-top: 3px; color: var(--muted); font-size: 9px; }

.workspace { grid-column: 2; min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 15; min-height: 62px; padding: 0 34px; border-bottom: 1px solid var(--line); background: rgba(8,11,14,.92); backdrop-filter: blur(18px); display: flex; justify-content: space-between; align-items: center; }
.environment { display: flex; align-items: center; gap: 8px; }
.environment > span { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 12px rgba(97,230,162,.5); }
.environment strong { color: #bac5cf; font-size: 10px; letter-spacing: .12em; }
.environment small { color: var(--muted-2); font-size: 10px; }
.top-actions { display: flex; gap: 12px; align-items: center; }
.clock { min-width: 126px; color: var(--muted); font: 10px/1 ui-monospace, SFMono-Regular, Consolas, monospace; text-align: right; }
.icon-button { width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); color: #abb6c0; cursor: pointer; font-size: 18px; transition: 160ms ease; }
.icon-button:hover { border-color: #3c4a56; color: var(--lime); transform: rotate(18deg); }

main { padding: 48px 34px 70px; max-width: 1600px; margin: 0 auto; }
.view[hidden], .locked-state[hidden] { display: none; }
.page-head { display: flex; justify-content: space-between; align-items: end; gap: 40px; margin-bottom: 30px; }
.page-head.compact { margin-bottom: 28px; }
.eyebrow, .panel-kicker { margin: 0 0 10px; color: var(--lime); font: 800 9px/1 ui-monospace, SFMono-Regular, Consolas, monospace; letter-spacing: .16em; }
.page-head h1 { max-width: 850px; margin: 0; font-size: clamp(34px, 4vw, 61px); line-height: .98; letter-spacing: -.055em; }
.page-head.compact h1 { font-size: 46px; }
.page-head p:not(.eyebrow) { max-width: 750px; margin: 16px 0 0; color: #9aa7b4; font-size: 14px; line-height: 1.65; }
.period-control { display: grid; gap: 7px; color: var(--muted); font-size: 9px; letter-spacing: .1em; text-transform: uppercase; }
.period-control input { width: 172px; height: 40px; border: 1px solid var(--line); border-radius: 9px; padding: 0 12px; background: var(--surface); color: #cad3dc; }

.metrics-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 12px; }
.metric { min-height: 152px; padding: 20px; border: 1px solid var(--line); border-radius: 14px; background: linear-gradient(145deg, #10161b, #0b1014); position: relative; overflow: hidden; }
.metric::after { content: ""; position: absolute; width: 120px; height: 120px; border: 1px solid rgba(168,255,62,.08); border-radius: 50%; right: -52px; top: -58px; }
.metric small { color: var(--muted); font-size: 10px; }
.metric strong { display: block; margin: 28px 0 8px; font-size: 34px; letter-spacing: -.04em; }
.metric p { margin: 0; color: #687583; font-size: 10px; }
.metric.accent strong { color: var(--lime); }
.skeleton { background: linear-gradient(100deg, #0d1318 25%, #172028 42%, #0d1318 63%); background-size: 400% 100%; animation: shimmer 1.4s infinite; }
@keyframes shimmer { to { background-position: -130% 0; } }

.overview-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(300px, .75fr); gap: 12px; margin-bottom: 12px; }
.panel { border: 1px solid var(--line); border-radius: 14px; background: var(--surface); overflow: hidden; }
.panel > header { min-height: 70px; padding: 17px 20px; border-bottom: 1px solid var(--line-soft); display: flex; justify-content: space-between; align-items: center; }
.panel h2 { margin: 0; font-size: 17px; letter-spacing: -.02em; }
.panel-kicker { display: block; margin-bottom: 7px; color: #65717e; }
.live-pill { padding: 6px 8px; border: 1px solid #244a39; border-radius: 999px; color: #79dbaa; font: 800 8px/1 ui-monospace, monospace; letter-spacing: .12em; }
.live-pill i { display: inline-block; width: 5px; height: 5px; margin-right: 5px; border-radius: 50%; background: var(--green); }
.status-chart { min-height: 250px; padding: 26px 22px; display: grid; gap: 15px; align-content: center; }
.status-row { display: grid; grid-template-columns: 92px minmax(0, 1fr) 38px; gap: 12px; align-items: center; }
.status-row span, .status-row strong { font-size: 10px; }
.status-row span { color: #8793a0; text-transform: capitalize; }
.status-row strong { text-align: right; font-family: ui-monospace, monospace; }
.status-track { height: 7px; border-radius: 999px; background: #171f26; overflow: hidden; }
.status-track i { display: block; height: 100%; min-width: 3px; border-radius: inherit; background: var(--blue); }
.status-row[data-status="completed"] i { background: var(--green); }
.status-row[data-status="failed"] i, .status-row[data-status="uncertain"] i { background: var(--red); }
.status-row[data-status="queued"] i, .status-row[data-status="claimed"] i { background: var(--amber); }
.coverage-panel { padding-bottom: 22px; }
.coverage-score { padding: 24px 20px 0; }
.coverage-score strong { display: block; color: var(--lime); font-size: 42px; letter-spacing: -.05em; }
.coverage-score span { color: var(--muted); font-size: 10px; }
.coverage-panel > p { padding: 0 20px; color: #a3afba; font-size: 11px; line-height: 1.55; }
.coverage-panel .muted { color: #65717c; }
.rule { height: 1px; margin: 18px 20px; background: var(--line-soft); }
.recent-panel { margin-top: 0; }
.text-button { border: 0; background: transparent; color: var(--lime); cursor: pointer; font-size: 10px; }

.table-panel .table-toolbar { min-height: 52px; padding: 0 18px; border-bottom: 1px solid var(--line-soft); display: flex; justify-content: space-between; align-items: center; color: #b0bbc5; font-size: 10px; }
.privacy-note { color: #65717d; }
.table-wrap { width: 100%; overflow: hidden; }
table { width: 100%; border-collapse: collapse; table-layout: fixed; }
th { height: 39px; padding: 0 16px; border-bottom: 1px solid var(--line-soft); color: #55616d; font-size: 8px; letter-spacing: .12em; text-align: left; text-transform: uppercase; }
td { height: 60px; padding: 9px 16px; border-bottom: 1px solid #151c22; color: #b9c3cc; font-size: 10px; vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #10171c; }
.mono { color: #c8d1da; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.subline { display: block; margin-top: 5px; color: #5d6976; font-size: 8px; }
.status-badge { display: inline-flex; align-items: center; gap: 6px; padding: 6px 8px; border: 1px solid #2b3640; border-radius: 999px; color: #aab5bf; font-size: 8px; text-transform: uppercase; }
.status-badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--blue); }
.status-badge.completed::before { background: var(--green); }
.status-badge.failed::before, .status-badge.uncertain::before { background: var(--red); }
.status-badge.queued::before, .status-badge.claimed::before, .status-badge.dispatching::before { background: var(--amber); }
.empty-row td { height: 180px; color: #5e6b77; text-align: center; }
.load-more { width: calc(100% - 32px); height: 40px; margin: 10px 16px 16px; border: 1px solid #2b3741; border-radius: 9px; background: #11181e; color: #aeb9c4; cursor: pointer; }
.load-more:hover { border-color: #4a5b68; color: var(--lime); }

.promo-grid { display: grid; grid-template-columns: minmax(360px, .72fr) minmax(0, 1.5fr); gap: 12px; align-items: start; }
.promo-form-panel form { padding: 20px; display: grid; gap: 14px; }
.promo-form-panel label { display: grid; gap: 7px; color: #778491; font-size: 9px; letter-spacing: .08em; text-transform: uppercase; }
.promo-form-panel input, .promo-form-panel select {
  width: 100%; height: 40px; padding: 0 11px; border: 1px solid #27323c; border-radius: 8px;
  background: #0a0f13; color: #d6dde3; color-scheme: dark;
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form-note { margin: 0; color: #64717d; font-size: 10px; line-height: 1.5; }
.primary-button { height: 42px; border: 1px solid #52792f; border-radius: 9px; background: #14200f; color: var(--lime); cursor: pointer; font-weight: 700; }
.primary-button:disabled { opacity: .45; cursor: wait; }
.code-export { margin: 0 20px 20px; padding: 16px; border: 1px solid #5f5229; border-radius: 10px; background: #18150c; }
.code-export strong { color: var(--amber); font-size: 12px; }
.code-export p { color: #8f845f; font-size: 10px; }
.code-export pre { max-height: 220px; overflow: auto; padding: 12px; border: 1px solid #332d1d; border-radius: 7px; background: #0b0a07; color: #f3deb0; font: 11px/1.7 ui-monospace, monospace; user-select: all; }
.code-export button, .danger-button { height: 34px; padding: 0 11px; border: 1px solid #4c5660; border-radius: 7px; background: #11171c; color: #c4ccd3; cursor: pointer; font-size: 9px; }
.danger-button { border-color: #63333a; color: #ff9aa3; background: #180d10; }

.locked-state { max-width: 720px; min-height: 65vh; margin: 0 auto; display: grid; place-content: center; text-align: center; }
.lock-mark { width: 64px; height: 64px; margin: 0 auto 25px; display: grid; place-items: center; border: 1px solid #65353b; border-radius: 18px; background: #1a0e11; color: var(--red); font-size: 31px; }
.locked-state h1 { margin: 0; font-size: 48px; letter-spacing: -.05em; }
.locked-state > p:not(.eyebrow) { color: var(--muted); }
.locked-state button { height: 42px; margin: 18px auto 0; padding: 0 18px; border: 1px solid #4b702a; border-radius: 9px; background: #10180d; color: var(--lime); cursor: pointer; }
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 50; max-width: 420px; padding: 13px 16px; border: 1px solid #36434e; border-radius: 10px; background: #12191f; box-shadow: 0 18px 60px rgba(0,0,0,.38); color: #d9e0e6; font-size: 11px; }

@media (max-width: 1100px) {
  html { min-width: 0; }
  .app-shell { display: none; }
  .desktop-gate { min-height: 100vh; padding: 32px; display: grid; place-content: center; gap: 9px; text-align: center; }
  .desktop-gate strong { color: var(--lime); font-size: 18px; }
  .desktop-gate span { color: var(--muted); font-size: 12px; }
}
