:root {
  color-scheme: dark;
  --bg: #101411;
  --sidebar: #151b17;
  --surface: #1b231d;
  --surface-2: #222c25;
  --line: #334238;
  --text: #eef4e9;
  --muted: #a9b9a9;
  --dim: #799079;
  --accent: #c7ec9f;
  --accent-ink: #172311;
  --danger: #ff8d7c;
  --danger-bg: #412621;
  --warning: #e9c47c;
  --radius: 14px;
  --space: 8px;
  font-family: "Segoe UI", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.48;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--text); }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .5; }
a { color: var(--accent); }
strong { font-weight: 650; }
small { font-size: .79rem; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.skip-link { position: absolute; z-index: 100; top: -60px; left: 12px; padding: 10px 16px; background: var(--accent); color: var(--accent-ink); }
.skip-link:focus { top: 12px; }
.eyebrow { margin: 0; color: var(--accent); font-size: .7rem; font-weight: 750; letter-spacing: .15em; }
.muted, .panel-head p, .page-heading p:last-child, .control-strip p { color: var(--muted); }
.boot-screen { display: grid; min-height: 100dvh; place-items: center; color: var(--muted); }

.login-shell { min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(360px, 440px); align-items: center; gap: clamp(32px, 8vw, 132px); max-width: 1400px; padding: clamp(28px, 6vw, 88px); margin: auto; }
.login-intro h1 { max-width: 790px; margin: 20px 0 24px; font-size: clamp(3rem, 6vw, 6.8rem); line-height: 1.01; letter-spacing: -.075em; font-weight: 700; }
.login-intro h1 span { color: var(--accent); }
.login-intro > p:not(.eyebrow) { max-width: 480px; color: var(--muted); font-size: 1.07rem; }
.login-line { display: flex; gap: 8px; margin-top: 62px; }
.login-line span { width: 48px; height: 3px; background: var(--line); }
.login-line span:first-child { background: var(--accent); width: 90px; }
.login-card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: clamp(24px, 3vw, 38px); box-shadow: 0 24px 70px #0003; }
.login-card-head { display: flex; align-items: center; gap: 15px; }
.login-card h2 { margin: 2px 0 0; font-size: 1.8rem; letter-spacing: -.045em; }
.login-card > p { margin: 25px 0 26px; }
.brand-mark { width: 40px; height: 40px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 10px; color: var(--accent-ink); background: var(--accent); font-weight: 900; font-size: 1.35rem; letter-spacing: -.12em; padding-right: 3px; }

.app-shell { min-height: 100dvh; display: grid; grid-template-columns: 244px minmax(0, 1fr); }
.sidebar { background: var(--sidebar); border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 26px 17px 18px; position: sticky; top: 0; height: 100dvh; }
.brand { display: flex; align-items: center; gap: 12px; padding: 3px 9px 31px; }
.brand strong, .brand small { display: block; line-height: 1.18; letter-spacing: .055em; }
.brand strong { font-size: 1.06rem; }
.brand small { color: var(--dim); font-size: .64rem; margin-top: 3px; letter-spacing: .16em; }
.navigation { display: grid; gap: 4px; }
.navigation button { width: 100%; padding: 12px 13px; text-align: left; border: 1px solid transparent; border-radius: 9px; background: transparent; color: var(--muted); font-weight: 570; }
.navigation button:hover { background: var(--surface-2); color: var(--text); }
.navigation button[aria-current="page"] { background: var(--surface-2); border-color: var(--line); color: var(--accent); }
.nav-index { display: inline-block; width: 30px; font-family: Consolas, monospace; font-size: .74rem; color: var(--dim); }
.sidebar-foot { margin-top: auto; padding: 18px 10px 2px; border-top: 1px solid var(--line); color: var(--muted); font-size: .76rem; display: flex; gap: 10px; align-items: center; }
.side-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); flex: 0 0 auto; }
.content-shell { min-width: 0; display: flex; flex-direction: column; }
.topbar { min-height: 92px; border-bottom: 1px solid var(--line); padding: 18px clamp(22px, 4vw, 52px); display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.topbar h1 { margin: 2px 0 0; font-size: 1.34rem; letter-spacing: -.035em; }
.topbar-actions, .button-row { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.account-chip { color: var(--muted); border-right: 1px solid var(--line); padding-right: 18px; margin-right: 8px; font-size: .86rem; }
main#main { width: 100%; max-width: 1600px; margin: 0 auto; padding: clamp(24px, 4vw, 50px); flex: 1; }
.page-heading { display: flex; justify-content: space-between; align-items: end; gap: 16px; margin-bottom: 28px; }
.page-heading h2 { margin: 7px 0 5px; font-size: clamp(1.9rem, 3vw, 2.8rem); line-height: 1.12; letter-spacing: -.055em; }
.page-heading p:last-child { margin: 0; }
.updated { color: var(--dim); font-size: .77rem; white-space: nowrap; }
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 15px; margin: 34px 0 14px; }
.section-head h3, .section-head h4 { margin: 2px 0 0; font-size: 1.12rem; letter-spacing: -.025em; }
.section-head .eyebrow { color: var(--dim); }
.system-banner { padding: 17px 19px; border: 1px solid var(--line); background: var(--surface); border-left: 4px solid var(--accent); border-radius: 0 var(--radius) var(--radius) 0; display: flex; gap: 12px; align-items: center; }
.system-banner.warning { border-left-color: var(--warning); }
.system-banner.danger { border-left-color: var(--danger); }
.system-banner strong { font-size: .99rem; }
.system-banner span { color: var(--muted); font-size: .83rem; }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 17px 0; }
.metric { min-height: 116px; border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius); padding: 17px 18px; }
.metric span { display: block; color: var(--muted); font-size: .79rem; }
.metric strong { display: block; margin-top: 9px; font-size: 2rem; line-height: 1; letter-spacing: -.06em; font-variant-numeric: tabular-nums; }
.control-strip { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 19px 20px; background: #1d2320; border: 1px solid var(--line); border-radius: var(--radius); }
.control-strip p { margin: 3px 0 0; font-size: .82rem; }
.panel { padding: 21px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); min-width: 0; }
.stop-reports { margin-top: 14px; }
.stop-reports .section-head { margin: 0 0 12px; }
.stop-report { border-top: 1px solid var(--line); padding: 14px 0; }
.stop-report:first-child { border-top: 0; }
.stop-report-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px 16px; }
.stop-report p { margin: 7px 0 0; font-size: .83rem; color: var(--muted); }
.stop-report-errors { margin: 9px 0 0; padding-left: 20px; color: var(--danger); font-size: .84rem; overflow-wrap: anywhere; }
.stop-report-errors li + li { margin-top: 5px; }
.panel.compact { padding: 20px; }
.panel h3 { margin: 0; font-size: 1.13rem; }
.panel-head p { margin: 5px 0 20px; font-size: .84rem; }
.two-column { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.button { border: 1px solid var(--line); min-height: 40px; padding: 9px 15px; border-radius: 8px; background: var(--surface-2); color: var(--text); font-weight: 650; white-space: nowrap; }
.button:hover:not(:disabled) { filter: brightness(1.12); }
.button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.button.secondary { background: transparent; border-color: var(--accent); color: var(--accent); }
.button.quiet { background: transparent; color: var(--muted); }
.button.danger { color: #fff1ee; background: var(--danger-bg); border-color: #945348; }
.button.full { width: 100%; margin-top: 10px; }
label { display: block; color: var(--text); font-size: .83rem; font-weight: 600; margin-bottom: 6px; }
input, select { width: 100%; min-height: 43px; border: 1px solid var(--line); border-radius: 8px; background: #111813; color: var(--text); padding: 9px 11px; outline: 0; }
input::placeholder { color: var(--dim); }
input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 2px #c7ec9f22; }
.form-stack { display: grid; gap: 7px; }
.form-stack input { margin-bottom: 12px; }
.form-grid { display: grid; grid-template-columns: minmax(150px, 1.1fr) minmax(150px, 1fr) auto; gap: 14px; align-items: end; }
.form-grid label { margin-bottom: 6px; }
.artifact-form { grid-template-columns: minmax(150px, .8fr) minmax(220px, 2fr) minmax(140px, .8fr) auto; }
.inline-form .input-row { display: flex; gap: 8px; }
.input-row input { flex: 1; min-width: 0; }
.pairing-result { margin-top: 18px; border: 1px solid #547d41; border-radius: 9px; padding: 14px; background: #253622; }
.pairing-result code { display: block; margin: 8px 0; font-size: 1.8rem; color: var(--accent); letter-spacing: .08em; overflow-wrap: anywhere; }
.pairing-result small { color: var(--muted); }
.table-wrap { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 610px; text-align: left; }
th, td { padding: 13px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--dim); font-size: .71rem; font-weight: 750; text-transform: uppercase; letter-spacing: .1em; white-space: nowrap; }
td { font-size: .85rem; }
tr:last-child td { border-bottom: 0; }
td.actions { text-align: right; white-space: nowrap; }
td.actions .button { min-height: 32px; padding: 5px 10px; font-size: .78rem; }
.mono { font-family: Consolas, "SFMono-Regular", monospace; font-size: .8rem; overflow-wrap: anywhere; }
.path { max-width: 390px; overflow-wrap: anywhere; }
.empty { padding: 25px 18px; color: var(--muted); font-size: .88rem; }
.badge { display: inline-block; border: 1px solid var(--line); color: var(--muted); border-radius: 999px; padding: 3px 9px; font-size: .74rem; white-space: nowrap; }
.badge.good { border-color: #527d4d; color: var(--accent); background: #263928; }
.badge.warn { border-color: #786643; color: var(--warning); background: #302b20; }
.badge.bad { border-color: #8b4d42; color: var(--danger); background: var(--danger-bg); }
.pending-row { border-top: 1px solid var(--line); padding: 12px 0; }
.pending-row:first-child { border-top: 0; }
.pending-row .mono { display: block; margin: 5px 0 11px; color: var(--muted); }
.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 20px; margin: 18px 0; }
.fact { min-width: 0; }
.fact span { display: block; color: var(--dim); font-size: .75rem; }
.fact strong { display: block; overflow-wrap: anywhere; font-size: .87rem; margin-top: 3px; }
.job-detail { margin-top: 16px; }
.job-detail .section-head { margin: 0 0 12px; }
.job-detail h4 { margin: 24px 0 10px; }
.job-detail .log-heading { margin-top: 22px; }
.step-list { margin: 0; padding: 0 0 0 20px; list-style: none; border-left: 1px solid var(--line); }
.step-list li { position: relative; margin: 0 0 13px; padding-left: 12px; }
.step-list li::before { position: absolute; left: -25px; top: 7px; content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--dim); }
.step-list li.done::before { background: var(--accent); }
.step-list li.failed::before { background: var(--danger); }
.step-list small { display: block; color: var(--muted); }
.session-detail { margin-top: 16px; }
.session-detail .section-head { margin: 0 0 12px; }
.session-detail h4 { margin: 25px 0 10px; }
.progress-tree, .progress-tree ul { list-style: none; margin: 0; padding: 0; }
.progress-tree ul { border-left: 1px solid var(--line); margin-left: 12px; padding-left: 18px; }
.progress-tree li { position: relative; padding: 9px 0 9px 0; }
.progress-tree li::before { content: ""; position: absolute; left: -18px; top: 20px; width: 12px; border-top: 1px solid var(--line); }
.progress-tree > li::before { display: none; }
.progress-node { display: flex; flex-wrap: wrap; align-items: center; gap: 7px 11px; }
.progress-node .kind { color: var(--dim); font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; }
.progress-node strong { overflow-wrap: anywhere; }
.session-action { border-left: 3px solid var(--line); padding: 10px 14px; margin: 0 0 9px; background: var(--surface-2); }
.session-action.warn { border-left-color: var(--warning); }
.session-action.bad { border-left-color: var(--danger); }
.session-action.good { border-left-color: var(--accent); }
.session-action .head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.session-action small { display: block; margin-top: 6px; color: var(--muted); overflow-wrap: anywhere; }
.session-action .error { color: var(--danger); }
#session-more-button { margin-top: 8px; }
.log-view { background: #0b100d; border: 1px solid var(--line); border-radius: 9px; padding: 14px; min-height: 140px; max-height: 410px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; color: #c9d8c4; font: .79rem/1.55 Consolas, "SFMono-Regular", monospace; }
.form-error { color: var(--danger); font-size: .82rem; }
.invite-panel { margin-top: 14px; }
.invite-result { margin-top: 15px; padding: 13px; border: 1px solid var(--line); border-radius: 8px; overflow-wrap: anywhere; }
.footer { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; border-top: 1px solid var(--line); padding: 17px clamp(22px, 4vw, 52px); color: var(--dim); font-size: .68rem; letter-spacing: .06em; }
.notice { position: fixed; z-index: 50; right: 20px; bottom: 20px; max-width: min(440px, calc(100vw - 40px)); padding: 13px 17px; border: 1px solid #5b7c4e; border-radius: 10px; color: var(--text); background: #253524; box-shadow: 0 12px 32px #0008; }
.notice.error { background: var(--danger-bg); border-color: #975345; }

@media (max-width: 1050px) {
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid, .artifact-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid .button { align-self: end; }
}
@media (max-width: 780px) {
  .app-shell { display: block; }
  .sidebar { position: static; height: auto; padding: 13px 15px 0; }
  .brand { padding: 0 2px 12px; }
  .brand-mark { width: 34px; height: 34px; }
  .navigation { display: flex; gap: 5px; overflow-x: auto; padding-bottom: 10px; }
  .navigation button { width: auto; flex: 0 0 auto; padding: 8px 11px; white-space: nowrap; }
  .nav-index, .sidebar-foot { display: none; }
  .topbar { min-height: 72px; }
  .topbar .eyebrow { display: none; }
  .two-column { grid-template-columns: 1fr; }
  .login-shell { grid-template-columns: 1fr; gap: 20px; padding: 28px; }
  .login-intro h1 { font-size: clamp(2.7rem, 11vw, 4.5rem); }
  .login-line { margin-top: 22px; }
}
@media (max-width: 560px) {
  main#main { padding: 25px 16px; }
  .topbar { align-items: start; padding: 15px 16px; }
  .topbar-actions { justify-content: flex-end; }
  .account-chip { display: none; }
  .topbar .button { padding: 7px 10px; min-height: 34px; font-size: .78rem; }
  .page-heading { display: block; }
  .updated { display: block; margin-top: 8px; }
  .metric-grid { gap: 8px; }
  .metric { min-height: 100px; padding: 12px; }
  .metric strong { font-size: 1.65rem; }
  .control-strip { display: block; }
  .control-strip .button-row { margin-top: 14px; }
  .form-grid, .artifact-form { grid-template-columns: 1fr; }
  .facts { grid-template-columns: 1fr; }
  .input-row { flex-wrap: wrap; }
  .inline-form .input-row .button { width: 100%; }
  .footer { padding: 16px; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
