/* Host++ dashboard. Dark-first; light is opt-in via the toggle (app-feature-standards.md). */
:root,
[data-theme="dark"] {
  --bg: #0b0b0d;
  --panel: #141417;
  --card: #18181b;
  --card-hi: #1f1f23;
  --edge: #2a2a30;
  --text: #f2f2f4;
  --muted: #a1a1aa;
  --faint: #6b6b74;
  --accent: #ffc93c;
  --accent-ink: #ffd666;
  --sky: #4b93f2;
  --ok: #34d399;
  --warn: #fbbf24;
  --hot: #f87171;
  --off: #52525b;
  --track: #26262b;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}
[data-theme="light"] {
  --bg: #f4f4f6;
  --panel: #ffffff;
  --card: #ffffff;
  --card-hi: #f7f7f9;
  --edge: #e2e2e8;
  --text: #18181b;
  --muted: #52525b;
  --faint: #8a8a94;
  --accent: #b7791f;
  --accent-ink: #8a5a0f;
  --sky: #1d64c8;
  --ok: #15803d;
  --warn: #b45309;
  --hot: #c62828;
  --off: #a1a1aa;
  --track: #e9e9ee;
  --shadow: 0 10px 30px rgba(20, 20, 30, 0.08);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI Variable", "Segoe UI", Roboto, Inter, sans-serif;
  -webkit-font-smoothing: antialiased;
}
.mono, .num { font-family: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-variant-numeric: tabular-nums; }
.pp { color: var(--accent); }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--edge); background: var(--card-hi); color: var(--text); padding: 9px 16px; border-radius: 10px; font-weight: 600; text-decoration: none; cursor: pointer; }
.btn:hover { border-color: var(--faint); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #1a1405; }
[data-theme="light"] .btn.primary { color: #ffffff; }
.btn.danger { background: transparent; border-color: color-mix(in srgb, var(--hot) 55%, var(--edge)); color: var(--hot); }
.btn.ghost { background: transparent; }
.btn.small { padding: 5px 10px; font-size: 12.5px; border-radius: 8px; }
.icon-btn { width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--edge); background: transparent; cursor: pointer; display: inline-grid; place-items: center; }
.icon-btn svg { width: 17px; height: 17px; fill: none; stroke: var(--muted); stroke-width: 1.8; }

/* gate (signed out) */
.gate-body { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.gate { max-width: 440px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.gate-icon { border-radius: 22.5%; box-shadow: var(--shadow); }
.gate h1 { font-size: 34px; letter-spacing: -0.02em; margin: 6px 0 0; }
.gate .lede { color: var(--muted); margin: 0 0 6px; font-size: 15px; text-wrap: balance; }
.inline { display: inline; }

/* header */
.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 16px; padding: 12px 20px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(12px); border-bottom: 1px solid var(--edge); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 17px; letter-spacing: -0.01em; }
.brand img { border-radius: 22.5%; }
.summary { color: var(--muted); font-size: 13px; }
.actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.account { display: flex; align-items: center; gap: 8px; }
.who { color: var(--muted); font-size: 13px; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conn { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.conn i { width: 8px; height: 8px; border-radius: 50%; background: var(--off); }
.conn.ok i { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 25%, transparent); }
.conn.bad i { background: var(--warn); }

/* fleet grid */
.fleet-main { padding: 20px; max-width: 1480px; margin: 0 auto; }
.fleet { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.card { background: var(--card); border: 1px solid var(--edge); border-radius: 16px; padding: 14px 16px 14px; display: flex; flex-direction: column; gap: 10px; cursor: pointer; text-align: left; transition: border-color .12s, transform .12s; min-width: 0; }
.card:hover { border-color: var(--faint); }
.card:focus-visible { outline: 2px solid var(--sky); outline-offset: 2px; }
.card.offline { opacity: 0.62; }
.card-head { display: flex; align-items: center; gap: 10px; min-width: 0; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--off); flex: 0 0 9px; }
.dot.on { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 22%, transparent); }
.dot.live { animation: pulse 1.8s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--ok) 8%, transparent); } }
.name { font-weight: 700; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip { margin-left: auto; font-size: 11.5px; color: var(--muted); border: 1px solid var(--edge); border-radius: 999px; padding: 1px 8px; white-space: nowrap; }
.sub { color: var(--faint); font-size: 12px; margin-top: -6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meters { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; }
.meter { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.meter .lbl { display: flex; justify-content: space-between; gap: 6px; font-size: 12px; color: var(--muted); }
.meter .lbl b { color: var(--text); font-weight: 650; }
.bar { height: 6px; border-radius: 99px; background: var(--track); overflow: hidden; }
.bar > i { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--sky); transition: width .5s ease; }
.bar > i.warm { background: var(--warn); }
.bar > i.hot { background: var(--hot); }
.foot { display: flex; flex-wrap: wrap; gap: 4px 14px; color: var(--muted); font-size: 12px; }
.foot span { white-space: nowrap; }
.spark { width: 100%; height: 34px; display: block; }
.spark path.line { fill: none; stroke: var(--sky); stroke-width: 1.6; }
.spark path.area { fill: color-mix(in srgb, var(--sky) 16%, transparent); stroke: none; }

.empty { text-align: center; color: var(--muted); padding: 80px 16px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.empty img { border-radius: 22.5%; opacity: .9; }
.empty h2 { color: var(--text); margin: 8px 0 0; }
.empty p { max-width: 420px; margin: 0; text-wrap: balance; }

/* detail drawer */
.detail { position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100%); background: var(--panel); border-left: 1px solid var(--edge); box-shadow: var(--shadow); z-index: 10; overflow-y: auto; padding: 18px 20px 40px; }
.detail-head { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.detail-head h2 { margin: 0; font-size: 20px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.detail-head .close { margin-left: auto; }
.detail .row-actions { display: flex; gap: 8px; margin: 10px 0 16px; }
.detail h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--faint); margin: 22px 0 8px; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; font-size: 13px; }
.facts dt { color: var(--faint); }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.cores { display: grid; grid-template-columns: repeat(auto-fill, minmax(18px, 1fr)); gap: 3px; }
.cores i { height: 36px; border-radius: 4px; background: var(--track); position: relative; overflow: hidden; }
.cores i b { position: absolute; left: 0; right: 0; bottom: 0; background: var(--sky); }
.list { display: flex; flex-direction: column; gap: 10px; }
.list .item { display: flex; flex-direction: column; gap: 4px; }
.list .item .lbl { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; }
.list .item .lbl span:last-child { color: var(--muted); }
table.procs { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.procs th { text-align: left; color: var(--faint); font-weight: 600; padding: 4px 0; border-bottom: 1px solid var(--edge); }
table.procs td { padding: 5px 0; border-bottom: 1px solid color-mix(in srgb, var(--edge) 60%, transparent); }
table.procs td.num, table.procs th.num { text-align: right; }
.tabs { display: inline-flex; border: 1px solid var(--edge); border-radius: 9px; overflow: hidden; }
.tabs button { background: transparent; border: 0; padding: 5px 11px; font-size: 12.5px; cursor: pointer; color: var(--muted); }
.tabs button[aria-pressed="true"] { background: var(--card-hi); color: var(--text); font-weight: 650; }
.chart { width: 100%; height: 150px; display: block; margin-top: 8px; }
.chart .grid { stroke: var(--edge); stroke-width: 1; }
.chart .l-cpu { stroke: var(--sky); fill: none; stroke-width: 1.8; }
.chart .l-mem { stroke: #a78bfa; fill: none; stroke-width: 1.8; }
.chart .l-gpu { stroke: var(--ok); fill: none; stroke-width: 1.8; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); margin-top: 6px; }
.legend i { display: inline-block; width: 10px; height: 3px; border-radius: 2px; margin-right: 5px; vertical-align: middle; }
.note { color: var(--faint); font-size: 12.5px; }
.detail .foot { margin-top: 14px; }

/* modal */
.modal { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.45); display: grid; place-items: center; z-index: 20; padding: 16px; }
.modal-box { background: var(--panel); border: 1px solid var(--edge); border-radius: 16px; padding: 20px; width: min(420px, 100%); box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 12px; }
.modal-box h2 { margin: 0; font-size: 18px; }
.modal-box p { margin: 0; color: var(--muted); }
.modal-box input { font: inherit; color: var(--text); background: var(--card-hi); border: 1px solid var(--edge); border-radius: 10px; padding: 9px 12px; }
.modal-box .row { display: flex; justify-content: flex-end; gap: 8px; }

@media (max-width: 720px) {
  .top { padding: 10px 16px; flex-wrap: wrap; gap: 8px 12px; }
  .summary { order: 3; width: 100%; }
  .who { display: none; }
  .fleet-main { padding: 14px 16px; }
  .fleet { grid-template-columns: 1fr; }
  .detail { padding: 16px 16px 40px; }
}
