:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #07100e;
  color: #eef7f3;
  --bg: #07100e;
  --sidebar: #0a1512;
  --surface: #0e1b17;
  --surface-2: #12231d;
  --line: #21372f;
  --line-soft: #182b25;
  --muted: #8da69b;
  --accent: #56e39f;
  --accent-strong: #27c985;
  --accent-soft: #173f31;
  --danger: #ff6b74;
  --danger-soft: #431e24;
  --warning: #f2bf62;
  --radius: 18px;
  --shadow: 0 22px 60px rgb(0 0 0 / 24%);
}
* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body { margin: 0; min-height: 100vh; background: radial-gradient(circle at 78% -10%, rgb(40 119 87 / 20%), transparent 35%), var(--bg); }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: var(--accent); text-decoration: none; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 4px; font-size: clamp(1.65rem, 2.5vw, 2.3rem); letter-spacing: -.045em; }
h2 { margin-bottom: 0; font-size: 1.08rem; letter-spacing: -.02em; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.eyebrow { margin-bottom: 6px; color: var(--accent); font-size: .68rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }

/* Public scoreboard */
body:not(.admin-body) > header, body:not(.admin-body) > main { width: min(1180px, calc(100% - 32px)); margin: auto; }
body:not(.admin-body) > header { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 32px 0 18px; }
.panel, .surface { border: 1px solid var(--line); border-radius: var(--radius); background: linear-gradient(145deg, rgb(17 34 28 / 96%), rgb(11 24 20 / 96%)); box-shadow: var(--shadow); }
.panel { margin-bottom: 18px; padding: 20px; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
.stat strong { display: block; color: var(--accent); font-size: 2rem; }

/* Authentication */
.admin-body { overflow-x: hidden; }
.auth-shell { display: grid; min-height: 100vh; place-items: center; padding: 24px; background: linear-gradient(120deg, rgb(7 16 14 / 40%), rgb(7 16 14 / 96%)), radial-gradient(circle at 30% 30%, #194c39, transparent 42%); }
.auth-card { width: min(440px, 100%); padding: 38px; border: 1px solid rgb(86 227 159 / 20%); border-radius: 26px; background: rgb(10 21 18 / 88%); box-shadow: 0 30px 100px #0008; backdrop-filter: blur(20px); animation: rise-in .55s ease both; }
.brand-mark { display: grid; width: 54px; height: 54px; margin-bottom: 24px; place-items: center; border-radius: 16px; background: linear-gradient(135deg, var(--accent), #2c9cff); color: #06120e; font-size: 1.5rem; font-weight: 900; box-shadow: 0 12px 32px rgb(86 227 159 / 22%); }
.brand-mark.small { width: 38px; height: 38px; margin: 0; border-radius: 11px; font-size: 1rem; }
.stack { display: grid; gap: 16px; margin-top: 28px; }
.form-message { min-height: 1.3rem; margin: 16px 0 0; color: var(--danger); }

/* App shell */
.app-shell { display: grid; min-height: 100vh; grid-template-columns: 242px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; display: flex; height: 100vh; flex-direction: column; padding: 24px 15px; border-right: 1px solid var(--line-soft); background: rgb(8 19 16 / 94%); backdrop-filter: blur(18px); }
.sidebar-brand { display: flex; align-items: center; gap: 12px; padding: 0 10px 28px; }
.sidebar-brand strong, .sidebar-brand small { display: block; }
.sidebar-brand small { margin-top: 2px; color: var(--muted); font-size: .7rem; }
.side-nav { display: grid; gap: 5px; }
.nav-item { display: flex; width: 100%; align-items: center; gap: 12px; padding: 11px 13px; border: 0; border-radius: 11px; background: transparent; color: var(--muted); font-weight: 650; text-align: left; cursor: pointer; transition: color .18s ease, background .18s ease, transform .18s ease; }
.nav-item span { display: inline-grid; width: 22px; place-items: center; color: #6c897d; font-size: 1.05rem; }
.nav-item:hover { background: var(--surface-2); color: #fff; transform: translateX(2px); }
.nav-item.active { background: linear-gradient(90deg, var(--accent-soft), rgb(23 63 49 / 35%)); color: var(--accent); box-shadow: inset 2px 0 var(--accent); }
.nav-item.active span { color: var(--accent); }
.sidebar-footer { display: grid; gap: 5px; margin-top: auto; padding-top: 18px; border-top: 1px solid var(--line-soft); }
.workspace { min-width: 0; padding: 0 38px 50px; }
.topbar { display: flex; min-height: 112px; align-items: center; justify-content: space-between; gap: 24px; }
.top-actions { display: flex; align-items: center; gap: 12px; }
.status-message { min-height: 20px; color: var(--muted); font-size: .82rem; }
.status-message[data-kind="success"] { color: var(--accent); }
.status-message[data-kind="error"] { color: var(--danger); }
.icon-button { display: grid; width: 38px; height: 38px; place-items: center; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); color: var(--muted); cursor: pointer; transition: .2s ease; }
.icon-button:hover { color: var(--accent); transform: rotate(30deg); }
.page { display: none; }
.page.active { display: grid; gap: 18px; animation: page-in .28s ease both; }

/* Components */
.surface { min-width: 0; padding: 22px; }
.section-heading { display: flex; min-height: 42px; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 18px; }
.section-heading .eyebrow { margin-bottom: 3px; }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(160px, 1fr)); gap: 14px; }
.metric-card { position: relative; overflow: hidden; min-height: 145px; padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: linear-gradient(145deg, var(--surface-2), var(--surface)); box-shadow: 0 14px 38px #0003; transition: transform .2s ease, border-color .2s ease; }
.metric-card:hover { transform: translateY(-3px); border-color: #315344; }
.metric-card.accent { background: linear-gradient(135deg, #184d39, #102c23); border-color: #2a7255; }
.metric-card span, .metric-card small { display: block; color: var(--muted); }
.metric-card strong { display: block; margin: 16px 0 5px; color: #fff; font-size: 2.3rem; line-height: 1; letter-spacing: -.05em; }
.metric-card.accent strong { color: var(--accent); }
.metric-card small { font-size: .72rem; }
.live-pill { display: inline-flex; align-items: center; gap: 7px; padding: 6px 10px; border: 1px solid #295a47; border-radius: 99px; color: var(--accent); font-size: .72rem; font-weight: 700; }
.live-pill i { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 5px rgb(86 227 159 / 10%); animation: pulse 2s ease infinite; }
.notice { padding: 18px 20px; border: 1px solid #295a47; border-radius: 14px; background: rgb(23 63 49 / 38%); color: var(--accent); }
.notice p { margin: 5px 0 0; color: var(--muted); }

.button { width: auto; padding: 9px 14px; border: 1px solid transparent; border-radius: 10px; color: #effaf5; font-weight: 750; cursor: pointer; transition: filter .18s ease, transform .18s ease, border-color .18s ease; }
.button:hover { filter: brightness(1.12); transform: translateY(-1px); }
.button.primary { background: linear-gradient(135deg, var(--accent-strong), #199b69); color: #03140d; }
.button.secondary { border-color: var(--line); background: var(--surface-2); color: #dcebe5; }
.button.danger { border-color: #73313a; background: var(--danger-soft); color: #ffabb1; }
.button.compact { padding: 6px 9px; border-radius: 8px; font-size: .72rem; white-space: nowrap; }
.button.wide { width: 100%; padding: 12px; }

label { display: grid; gap: 7px; color: var(--muted); font-size: .76rem; font-weight: 650; }
input, select, textarea { width: 100%; min-width: 0; padding: 10px 11px; border: 1px solid #2a443a; border-radius: 9px; outline: none; background: #091410; color: #edf7f2; transition: border-color .18s ease, box-shadow .18s ease; }
input:focus, select:focus, textarea:focus { border-color: var(--accent-strong); box-shadow: 0 0 0 3px rgb(86 227 159 / 10%); }
textarea { resize: vertical; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent-strong); }
.form-grid { display: grid; grid-template-columns: repeat(3, minmax(160px, 1fr)); gap: 16px; align-items: end; }
.span-2 { grid-column: span 2; }
.form-action { display: flex; align-items: end; }
.statistic-form { grid-template-columns: repeat(4, minmax(140px, 1fr)) auto; }
.spaced-table { margin-top: 22px; }
.inline-form { display: grid; max-width: 570px; grid-template-columns: 1fr auto; align-items: end; gap: 12px; margin-top: 22px; }
.inline-form.user-form { max-width: 820px; grid-template-columns: 1fr 1fr auto; }
.inline-controls { display: flex; align-items: center; gap: 8px; }
.inline-controls select { min-width: 250px; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line-soft); border-radius: 12px; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 13px; border-bottom: 1px solid var(--line-soft); text-align: left; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
tbody tr { transition: background .15s ease; }
tbody tr:hover { background: rgb(255 255 255 / 1.8%); }
th { background: rgb(7 16 14 / 55%); color: #718d81; font-size: .64rem; letter-spacing: .1em; text-transform: uppercase; }
td { color: #cbdcd5; font-size: .79rem; }
.status { font-weight: 800; }
.status.healthy, .status.ready, .status.transferred { color: var(--accent); }
.status.starting, .status.waiting, .status.assigned, .status.transferring { color: var(--warning); }
.status.unhealthy, .status.missing, .status.exited, .status.version-mismatch { color: var(--danger); }
.row-actions { display: flex; gap: 6px; }
.policy-row input { min-width: 72px; }
.policy-row input[type="text"] { min-width: 115px; }
.policy-row textarea { min-width: 220px; }
.wide-table { min-width: 1420px; }

.console-surface { padding: 0; overflow: hidden; }
.console-surface > .section-heading { padding: 22px 22px 0; }
.console-frame { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); background: #030806; }
.console-bar { display: flex; align-items: center; gap: 6px; padding: 10px 14px; border-bottom: 1px solid #15241e; color: #658074; font: .68rem ui-monospace, monospace; }
.console-bar i { width: 8px; height: 8px; border-radius: 50%; background: #385047; }
.console-bar i:first-child { background: #db676d; }.console-bar i:nth-child(2) { background: #d8b35d; }.console-bar i:nth-child(3) { background: #52bd83; }.console-bar span { margin-left: 6px; }
.console-output { min-height: 440px; max-height: 620px; margin: 0; overflow: auto; padding: 18px; color: #a7e8c1; font: .76rem/1.6 ui-monospace, SFMono-Regular, Consolas, monospace; white-space: pre-wrap; word-break: break-word; }
.console-command { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 9px; padding: 16px 22px; }
.console-command span { color: var(--accent); font: 700 1rem ui-monospace, monospace; }
.fine-print { margin: 0; padding: 0 22px 20px; font-size: .72rem; }
.workshop-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(320px, .65fr); gap: 18px; }
.page[data-view="maps-page"].active { margin-bottom: 18px; }
.build-launch-surface { order: -1; }
.source-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.source-card { display: grid; align-content: start; gap: 14px; padding: 20px; border: 1px solid var(--line); border-radius: 15px; background: rgb(6 15 12 / 38%); }
.source-card h3, .source-card p { margin-bottom: 0; }
.source-card.accent-card { border-color: #2a7255; background: linear-gradient(145deg, rgb(23 63 49 / 55%), rgb(9 20 16 / 60%)); }
.source-icon { display: grid; width: 42px; height: 42px; place-items: center; border-radius: 12px; background: var(--accent-soft); color: var(--accent); font-size: 1.25rem; }
.source-divider { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: .7rem; text-transform: uppercase; }
.source-divider::before, .source-divider::after { height: 1px; flex: 1; background: var(--line); content: ""; }
.workflow-list { display: grid; gap: 9px; margin: 0; padding-left: 22px; color: #cbdcd5; font-size: .82rem; }
.world-progress { width: 100%; height: 8px; accent-color: var(--accent-strong); }
.fine-status { min-height: 1.25rem; margin: 0; font-size: .74rem; }
.fine-status[data-kind="success"] { color: var(--accent); }
.fine-status[data-kind="error"] { color: var(--danger); }
.file-toolbar { display: flex; align-items: center; gap: 10px; margin: 16px 0 12px; }
.file-toolbar code { min-width: 0; flex: 1; overflow: hidden; color: var(--accent); text-overflow: ellipsis; white-space: nowrap; }
.file-toolbar input[type="file"] { max-width: 270px; padding: 7px; font-size: .72rem; }
.file-table { max-height: 420px; overflow: auto; }
.editor-panel { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); }
.editor-panel textarea { min-height: 320px; line-height: 1.55; tab-size: 2; }
.dual-action { gap: 8px; }
.build-output { max-height: 300px; margin: 18px 0 0; overflow: auto; padding: 14px; border: 1px solid var(--line); border-radius: 10px; background: #030806; color: #a7e8c1; font: .72rem/1.5 ui-monospace, monospace; white-space: pre-wrap; }
.check-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 0; padding: 14px; border: 1px solid var(--line); border-radius: 10px; }
.check-grid legend { padding: 0 7px; color: var(--muted); font-size: .72rem; }
.check-grid label, .check-line { display: flex; align-items: center; gap: 8px; }

@keyframes page-in { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: translateY(0); } }
@keyframes rise-in { from { opacity: 0; transform: translateY(15px) scale(.99); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes pulse { 50% { opacity: .45; box-shadow: 0 0 0 8px rgb(86 227 159 / 4%); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; } }
@media (max-width: 1050px) { .metric-grid { grid-template-columns: repeat(2, 1fr); } .form-grid { grid-template-columns: repeat(2, 1fr); } .workshop-grid, .source-grid { grid-template-columns: 1fr; } }
@media (max-width: 760px) {
  .app-shell { display: block; }
  .sidebar { position: sticky; z-index: 20; top: 0; display: block; width: 100%; height: auto; padding: 10px 12px; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .sidebar-brand { display: none; }.side-nav { display: flex; width: max-content; }.sidebar-footer { display: none; }
  .nav-item { width: auto; white-space: nowrap; }.workspace { padding: 0 16px 32px; }.topbar { min-height: 88px; }
  .status-message { display: none; }.metric-grid { grid-template-columns: 1fr 1fr; }.surface { padding: 17px; }.form-grid { grid-template-columns: 1fr; }.span-2 { grid-column: auto; }.file-toolbar { align-items: stretch; flex-direction: column; }.file-toolbar input[type="file"] { max-width: none; }
}
@media (max-width: 700px) { .inline-form.user-form { grid-template-columns: 1fr; } }
@media (max-width: 480px) { .metric-grid { grid-template-columns: 1fr; }.inline-form { grid-template-columns: 1fr; }.section-heading { align-items: flex-start; flex-direction: column; }.auth-card { padding: 28px 22px; } body:not(.admin-body) > header { align-items: flex-start; flex-direction: column; } }
