:root {
  color-scheme: dark;
  --bg: #080909;
  --side: #0b0c0c;
  --panel: #101212;
  --line: #232727;
  --line-soft: #1b1e1e;
  --text: #f1f3f2;
  --muted: #a0abaa;
  --dim: #82908d;
  --accent: #62e6b8;
  --accent-dark: #102b23;
  --warning: #edbb77;
  --error: #f29c9c;
  --sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: ui-monospace, "Cascadia Code", "SFMono-Regular", Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--text); font: 14px/1.5 var(--sans); }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .55; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 3px;
}
img { display: block; }
i[data-icon], .icon { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.icon svg, i[data-icon] svg { width: 18px; height: 18px; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.eyebrow, .nav-label { color: var(--dim); font-size: 10px; font-weight: 750; letter-spacing: .15em; text-transform: uppercase; }
.error { color: var(--error); }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(26px, 3.3vw, 37px); font-weight: 680; letter-spacing: -.045em; line-height: 1.15; }
h2 { font-size: 16px; font-weight: 680; letter-spacing: -.015em; }
h3 { font-size: 13px; font-weight: 660; }
.shell { min-height: 100vh; display: grid; grid-template-columns: 224px minmax(0, 1fr); }
.sidebar { background: var(--side); border-right: 1px solid var(--line); position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 27px 16px 18px; }
.brand { display: flex; align-items: center; gap: 11px; padding: 0 9px; }
.brand strong { display: block; font-size: 18px; line-height: 1.12; letter-spacing: .06em; }
.brand span { display: block; color: var(--dim); font-size: 11px; margin-top: 4px; }
.nav-label { margin: 42px 12px 10px; }
nav { display: grid; gap: 4px; }
nav button, .logout { display: flex; align-items: center; gap: 11px; width: 100%; border: 1px solid transparent; background: transparent; color: var(--muted); padding: 10px 11px; border-radius: 8px; text-align: left; font-size: 13px; font-weight: 560; }
nav button:hover, .logout:hover { background: #171b1a; color: var(--text); }
nav button[aria-current] { color: var(--accent); background: #11231e; border-color: #1c3c32; }
.sidebar-bottom { margin-top: auto; display: grid; gap: 12px; }
.system-tag { display: flex; gap: 8px; align-items: center; color: var(--dim); font-size: 11px; margin: 0 10px; }
.tag-dot, .dot { width: 7px; height: 7px; background: currentColor; border-radius: 50%; flex-shrink: 0; }
.tag-dot { color: var(--accent); }
.main { min-width: 0; }
.topbar { min-height: 69px; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 0 34px; border-bottom: 1px solid var(--line-soft); }
.crumb, .top-actions, .page-actions { display: flex; gap: 10px; align-items: center; }
.crumb { color: var(--dim); font-size: 12px; }
.crumb strong { color: var(--text); font-weight: 600; }
.crumb-slash { color: #54625f; }
.workspace { max-width: 1440px; margin: 0 auto; padding: 31px 34px 48px; }
.page-head { display: flex; justify-content: space-between; align-items: end; gap: 18px; margin-bottom: 24px; }
.page-head .eyebrow { margin-bottom: 8px; }
.page-head .muted { margin-top: 8px; }
.button { border: 1px solid transparent; display: inline-flex; align-items: center; justify-content: center; gap: 7px; border-radius: 8px; min-height: 38px; padding: 7px 13px; font-weight: 650; font-size: 12px; white-space: nowrap; text-decoration: none; }
.button svg { width: 15px !important; height: 15px !important; }
.button.primary { background: var(--accent); color: #092119; }
.button.primary:hover { background: #8cf2cc; }
.button.secondary { color: var(--text); background: #141717; border-color: var(--line); }
.button.secondary:hover { background: #202524; }
.button.small { min-height: 32px; padding: 5px 10px; }
.button.ghost { background: transparent; color: var(--muted); }
.button.ghost:hover { background: #202524; color: var(--text); }
.button.danger { background: #f19a9a; color: #2a1010; }
.badge { display: inline-flex; align-items: center; gap: 6px; min-height: 23px; padding: 3px 8px; border-radius: 6px; color: var(--muted); background: #1a1f1e; font-size: 10px; font-weight: 680; white-space: nowrap; }
.badge.ok { color: var(--accent); background: var(--accent-dark); }
.badge.warn, .demo-badge { color: var(--warning); background: #282015; }
.badge.bad { color: var(--error); background: #301d20; }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.metric { border: 1px solid var(--line); background: var(--panel); border-radius: 10px; padding: 16px 17px; }
.metric-top { display: flex; gap: 8px; justify-content: space-between; align-items: center; color: var(--muted); font-size: 12px; font-weight: 620; }
.metric-top .icon { color: #76a79a; }
.metric-top svg { width: 16px; height: 16px; }
.metric-value { font-size: 29px; line-height: 1.2; font-weight: 660; letter-spacing: -.045em; margin-top: 12px; }
.metric-note { color: var(--dim); font-size: 11px; margin-top: 5px; }
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; min-width: 0; }
.panel + .panel.full, .panel.full + .panel { margin-top: 16px; }
.panel-head { padding: 15px 17px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.panel-head h2 + p { color: var(--dim); font-size: 11px; margin-top: 2px; }
.panel-head .icon { color: var(--accent); }
.service-row, .peer-row { display: flex; align-items: center; justify-content: space-between; gap: 9px; min-height: 57px; padding: 10px 17px; border-top: 1px solid var(--line-soft); }
.service-row:first-child, .peer-row:first-child { border-top: 0; }
.row-title { font-size: 13px; font-weight: 630; overflow-wrap: anywhere; }
.row-detail { font: 10px/1.65 var(--mono); color: var(--dim); overflow-wrap: anywhere; }
.row-actions { display: flex; gap: 3px; margin-left: 2px; }
.row-actions .button { padding-inline: 6px; }
.service-end { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.empty { padding: 22px 17px; color: var(--muted); }
.soft-notice { border: 1px solid #3d3121; background: #1b1711; color: var(--warning); padding: 11px 13px; border-radius: 8px; margin-bottom: 15px; font-size: 12px; }
.status-footer { display: flex; justify-content: space-between; gap: 12px; margin-top: 16px; color: var(--dim); font-size: 11px; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th, td { text-align: left; padding: 10px 17px; border-bottom: 1px solid var(--line-soft); }
th { color: var(--dim); font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
.site-directory .row-actions { gap: 7px; margin-left: 0; }
.site-directory .row-actions .button { padding-inline: 9px; white-space: nowrap; }
.assignment { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 7px; color: var(--muted); font: 11px/1.5 var(--mono); }
.assignment strong { color: var(--accent); }
.form-panel { padding: 20px; }
.form-section { display: grid; gap: 14px; padding-bottom: 17px; margin-bottom: 17px; border-bottom: 1px solid var(--line); }
.form-section:last-of-type { border-bottom: 0; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }
label { display: block; font-size: 12px; font-weight: 650; }
input, select { border: 1px solid var(--line); border-radius: 7px; color: var(--text); background: #0c0e0e; width: 100%; min-height: 39px; padding: 7px 10px; }
label input, label select { display: block; margin-top: 5px; }
input::placeholder { color: #74807c; }
details summary { cursor: pointer; color: var(--muted); font-size: 12px; font-weight: 620; }
details .form-grid { margin-top: 12px; }
.form-end { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.form-end p, .hint { color: var(--dim); font-size: 11px; }
.activity-panel { margin-top: 16px; }
.log-controls { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.log-controls select { width: auto; }
.log-controls input { min-width: 130px; max-width: 220px; }
.log-view { margin: 0; padding: 16px 17px; max-height: 530px; min-height: 128px; overflow: auto; color: #bac6c2; font: 12px/1.7 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; }
.toast { position: fixed; z-index: 3; right: 22px; bottom: 20px; max-width: min(420px, calc(100vw - 44px)); border: 1px solid #386453; border-radius: 9px; background: #11231e; color: var(--text); padding: 11px 15px; box-shadow: 0 12px 35px #0008; }
.toast.fail { border-color: #75454a; background: #2c1b20; }
dialog { width: min(415px, calc(100vw - 32px)); border: 1px solid #38433f; border-radius: 12px; padding: 21px; background: var(--panel); color: var(--text); }
dialog::backdrop { background: #000a; }
dialog p { margin-top: 9px; }
dialog label { margin-top: 14px; }
.dialog-actions { display: flex; justify-content: end; gap: 8px; margin-top: 20px; }
.login, .loading { min-height: 100vh; display: grid; place-content: center; padding: 25px; }
.loading { gap: 14px; color: var(--muted); justify-items: center; }
.login-card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; width: min(420px, calc(100vw - 50px)); padding: 28px; }
.login-card .eyebrow { margin: 21px 0 7px; }
.login-card .muted { margin: 8px 0 20px; }
.login-card form { display: grid; gap: 8px; }
.login-card form .button { margin-top: 7px; }

@media (max-width: 1100px) {
  .shell { grid-template-columns: 192px minmax(0, 1fr); }
  .topbar { padding-inline: 24px; }
  .workspace { padding-inline: 24px; }
  .grid { grid-template-columns: 1fr; }
}
@media (max-width: 670px) {
  .shell { display: block; }
  .sidebar { height: auto; position: static; padding: 14px 13px 7px; border-right: 0; border-bottom: 1px solid var(--line); }
  .brand { padding-left: 4px; }
  .nav-label, .system-tag { display: none; }
  nav { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; margin-top: 13px; }
  nav button { justify-content: center; gap: 4px; padding: 7px 3px; font-size: 10px; text-align: center; }
  nav button svg { width: 13px !important; height: 13px !important; }
  .sidebar-bottom { position: absolute; top: 15px; right: 12px; }
  .logout { font-size: 11px; }
  .topbar { min-height: 52px; padding-inline: 14px; }
  .workspace { padding: 22px 13px 32px; }
  .page-head { align-items: flex-start; flex-direction: column; gap: 12px; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric { padding: 13px; }
  .metric-value { font-size: 24px; }
  .form-end { align-items: flex-start; flex-direction: column; }
}
