/* Sprinkler Control — "night garden" theme.
   Dark glass over a deep night sky; water is the only thing that glows. */
:root {
  color-scheme: dark;
  --night: #050a0f;
  --ground: #071019;
  --surface: rgba(140, 185, 230, .055);
  --surface-2: rgba(140, 185, 230, .085);
  --surface-solid: #0d1823;
  --ink: #e6f0f7;
  --muted: #8399ad;
  --line: rgba(150, 195, 240, .12);
  --line-strong: rgba(150, 195, 240, .22);
  --water: #3ab8ff;
  --water-2: #2ee6c5;
  --water-soft: rgba(58, 184, 255, .16);
  --water-glow: 0 0 18px rgba(58, 184, 255, .55);
  --turf: #5fd68f;
  --turf-soft: rgba(95, 214, 143, .13);
  --warn: #ffb547;
  --danger: #ff5f5f;
  --ok: #5fd68f;
  --heat: #ff9a3d;
  --plan-grid: rgba(130, 190, 240, .07);
  --radius-s: 10px;
  --radius-m: 18px;
  --radius-l: 26px;
  --blur: blur(18px) saturate(140%);
  --font: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-num: "Sora", "Manrope", system-ui, sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--night);
  font: 400 15px/1.5 var(--font);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(900px 600px at 12% -10%, rgba(40, 140, 220, .22), transparent 60%),
    radial-gradient(800px 700px at 105% 110%, rgba(30, 200, 170, .14), transparent 60%),
    radial-gradient(600px 400px at 60% 40%, rgba(60, 90, 160, .08), transparent 70%),
    linear-gradient(180deg, #071220 0%, var(--night) 70%);
}
a { color: var(--water); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; font-family: var(--font-num); font-weight: 600; letter-spacing: -.015em; }
h1 { font-size: 1.9rem; line-height: 1.1; }
h2 { font-size: 1.05rem; }
h3 { font-size: .98rem; }
p { margin: 0; }
code { font-family: ui-monospace, Menlo, monospace; font-size: .85em; color: var(--water-2); }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--water); outline-offset: 2px; border-radius: 6px; }
.num { font-family: var(--font-num); font-weight: 600; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }

/* ---------- shell ---------- */
.shell {
  display: grid;
  grid-template-columns: 236px 1fr;
  grid-template-rows: auto 1fr;
  grid-template-areas: "nav top" "nav view";
  min-height: 100vh;
}
.topbar {
  grid-area: top; position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 16px;
  padding: calc(14px + var(--safe-top)) 28px 14px;
  background: linear-gradient(180deg, rgba(5, 10, 15, .85), rgba(5, 10, 15, .4));
  backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
}
.brand { display: flex; align-items: center; gap: 12px; color: var(--ink); font-family: var(--font-num); font-weight: 600; font-size: 1.05rem; text-decoration: none !important; }
.brand svg { width: 30px; height: 30px; color: var(--water); filter: drop-shadow(0 0 8px rgba(58, 184, 255, .6)); }
.topbar .brand { display: none; }
.link-status { margin-left: auto; display: flex; align-items: center; gap: 9px; font-size: .86rem; color: var(--muted); padding: 7px 14px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); }
.link-status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.link-status.ok::before { background: var(--ok); box-shadow: 0 0 10px var(--ok); }
.link-status.bad::before { background: var(--danger); box-shadow: 0 0 10px var(--danger); }
.link-status.warn::before { background: var(--warn); box-shadow: 0 0 10px var(--warn); }

.nav {
  grid-area: nav; position: sticky; top: 0; align-self: start; height: 100vh;
  padding: calc(22px + var(--safe-top)) 14px 22px; display: flex; flex-direction: column; gap: 4px;
  border-right: 1px solid var(--line);
  background: rgba(8, 16, 26, .55);
  backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
}
.nav .brand { padding: 0 10px 22px; }
.nav a {
  display: flex; align-items: center; gap: 13px; padding: 11px 14px; border-radius: 12px;
  color: var(--muted); font-weight: 600; font-size: .95rem; text-decoration: none !important;
  transition: background .15s, color .15s;
}
.nav a svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.nav a:hover { color: var(--ink); background: var(--surface); }
.nav a.active { color: var(--ink); background: linear-gradient(90deg, rgba(58, 184, 255, .18), rgba(58, 184, 255, .04)); box-shadow: inset 2px 0 0 var(--water); }
.nav a.active svg { stroke: var(--water); filter: drop-shadow(0 0 6px rgba(58, 184, 255, .7)); }

.view { grid-area: view; padding: 8px 28px 64px; min-width: 0; outline: none; }
.page-head { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin: 6px 0 22px; }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.sub { color: var(--muted); margin-top: 6px; }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; grid-template-areas: "top" "view"; }
  .topbar .brand { display: flex; }
  .topbar .brand span { display: none; }
  .nav {
    position: fixed; top: auto; bottom: 10px; left: 10px; right: 10px; height: auto; z-index: 30;
    flex-direction: row; justify-content: space-around; gap: 0; padding: 6px;
    border: 1px solid var(--line-strong); border-radius: 22px; margin-bottom: var(--safe-bottom);
    background: rgba(10, 20, 32, .78);
    box-shadow: 0 18px 40px -12px rgba(0, 0, 0, .7);
  }
  .nav .brand { display: none; }
  .nav a { flex-direction: column; gap: 3px; font-size: .66rem; padding: 7px 2px; flex: 1; text-align: center; border-radius: 14px; }
  .nav a.active { box-shadow: none; background: rgba(58, 184, 255, .14); }
  .view { padding: 4px 14px calc(110px + var(--safe-bottom)); }
  .topbar { padding-left: 14px; padding-right: 14px; }
  h1 { font-size: 1.6rem; }
}

/* ---------- glass ---------- */
.panel {
  position: relative;
  background: linear-gradient(160deg, rgba(150, 195, 240, .075), rgba(150, 195, 240, .03));
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  padding: 18px;
  backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .05), 0 20px 50px -30px rgba(0, 0, 0, .8);
}
.panel > h2, .panel > header { margin-bottom: 14px; }
.panel > header { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.panel > header h2 { margin: 0; }
.panel > header .spacer { flex: 1; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(320px, 1fr); gap: 18px; align-items: start; }
@media (max-width: 1150px) { .grid-2 { grid-template-columns: 1fr; } }
.empty { padding: 26px; text-align: center; color: var(--muted); border: 1px dashed var(--line-strong); border-radius: var(--radius-m); }
.empty p + .btn { margin-top: 12px; }

/* ---------- hero tiles ---------- */
.hero { display: grid; grid-template-columns: 1.25fr 1fr 1fr 1.35fr; gap: 18px; margin-bottom: 18px; }
@media (max-width: 1250px) { .hero { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) {
  .hero { grid-template-columns: 1fr 1fr; gap: 12px; }
  .hero .tile.flow, .hero .tile:last-child { grid-column: span 2; }
  .tile { min-height: 0; padding: 14px; }
  .tile .big { font-size: 1.8rem; }
  .yard-hint { display: none; }
}
.tile { display: flex; flex-direction: column; gap: 6px; min-height: 150px; }
.tile .label { color: var(--muted); font-size: .84rem; font-weight: 600; }
.tile .big { font-family: var(--font-num); font-weight: 600; font-size: 2.4rem; line-height: 1; letter-spacing: -.03em; }
.tile .big small { font-size: .9rem; color: var(--muted); font-weight: 500; margin-left: 5px; letter-spacing: 0; }
.tile .foot { margin-top: auto; color: var(--muted); font-size: .85rem; }
.tile.flow { flex-direction: row; align-items: center; gap: 18px; }
.tile.flow .gauge { flex: none; }
.tile.live { border-color: rgba(58, 184, 255, .35); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06), 0 0 40px -10px rgba(58, 184, 255, .45); }
.wx { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 4px; }
.wx > div { padding: 10px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); }
.wx b { display: block; font-family: var(--font-num); font-size: 1.2rem; font-weight: 600; }
.wx span { font-size: .76rem; color: var(--muted); }

/* ---------- gauges ---------- */
.gauge { position: relative; display: inline-grid; place-items: center; }
.gauge svg { display: block; overflow: visible; }
.gauge .track { stroke: rgba(150, 195, 240, .1); }
.gauge .arc { transition: stroke-dashoffset .7s cubic-bezier(.2, .8, .2, 1); }
.gauge .arc.on { filter: drop-shadow(0 0 6px rgba(58, 184, 255, .8)); }
.gauge .val { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding-top: 6px; }
.gauge .val b { font-family: var(--font-num); font-weight: 600; font-size: 1.55rem; line-height: 1; letter-spacing: -.02em; }
.gauge .val small { font-size: .72rem; color: var(--muted); margin-top: 3px; }
.gauge.lg .val b { font-size: 2.1rem; }
.gauge .cap { position: absolute; bottom: 2px; left: 0; right: 0; text-align: center; font-size: .78rem; color: var(--muted); font-weight: 600; }
.gauges { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; justify-items: center; }
.gauges .gauge { width: 100% !important; max-width: 116px; height: auto !important; aspect-ratio: 1; }
.gauges .gauge svg { width: 100%; height: 100%; }

/* ---------- buttons + fields ---------- */
.btn {
  appearance: none; border: 1px solid var(--line-strong); background: var(--surface);
  color: var(--ink); font: 600 .92rem/1 var(--font);
  padding: 10px 16px; border-radius: 12px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 40px; text-decoration: none !important; white-space: nowrap;
  transition: background .15s, border-color .15s, box-shadow .2s, transform .08s;
}
.btn:hover { background: var(--surface-2); border-color: rgba(150, 195, 240, .32); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn.primary { background: linear-gradient(135deg, #3ab8ff, #2a8cf0); border-color: transparent; color: #04121f; box-shadow: 0 8px 24px -10px rgba(58, 184, 255, .8); }
.btn.primary:hover { box-shadow: 0 10px 30px -8px rgba(58, 184, 255, .95); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--ink); background: var(--surface); }
.btn.danger { color: var(--danger); }
.btn.small { min-height: 32px; padding: 6px 12px; font-size: .84rem; border-radius: 10px; }
.btn.wide { width: 100%; }
.btn.stop { background: linear-gradient(135deg, #ff6b6b, #e5484d); border-color: transparent; color: #fff; padding: 9px 18px; border-radius: 999px; box-shadow: 0 6px 22px -8px rgba(255, 95, 95, .8); }
.btn.stop:hover { box-shadow: 0 8px 28px -6px rgba(255, 95, 95, 1); }
.btn.on { background: linear-gradient(135deg, #3ab8ff, #2ee6c5); color: #04121f; border-color: transparent; box-shadow: 0 0 30px -4px rgba(58, 184, 255, .8); }

.field { display: flex; flex-direction: column; gap: 6px; font-size: .86rem; color: var(--muted); }
.field > span { font-weight: 600; }
.field input, .field select, .field textarea, input.inline, select.inline {
  font: 500 .95rem var(--font); color: var(--ink);
  background: rgba(0, 0, 0, .25); border: 1px solid var(--line-strong); border-radius: 10px;
  padding: 9px 12px; min-height: 40px; width: 100%;
}
.field input:focus, .field select:focus, .field textarea:focus, input.inline:focus { outline: none; border-color: var(--water); box-shadow: 0 0 0 3px rgba(58, 184, 255, .2); }
.field select option { background: var(--surface-solid); }
.field textarea { min-height: 96px; font-family: ui-monospace, Menlo, monospace; font-size: .85rem; }
.field small { color: var(--muted); font-size: .78rem; font-weight: 400; }
.fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; }
.check { display: flex; align-items: center; gap: 10px; font-size: .93rem; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--water); }
.form-error { color: var(--danger); font-size: .88rem; min-height: 1.2em; }
input[type=color] { padding: 4px; }

.seg { display: inline-flex; padding: 4px; gap: 3px; border-radius: 13px; background: rgba(0, 0, 0, .28); border: 1px solid var(--line); }
.seg button { appearance: none; border: 0; background: transparent; color: var(--muted); font: 600 .85rem var(--font); padding: 7px 13px; border-radius: 10px; cursor: pointer; }
.seg button:hover { color: var(--ink); }
.seg button.active { background: rgba(58, 184, 255, .18); color: var(--ink); box-shadow: inset 0 0 0 1px rgba(58, 184, 255, .35); }

.chips { display: flex; gap: 7px; flex-wrap: wrap; }
.chip { appearance: none; border: 1px solid var(--line-strong); background: var(--surface); color: var(--muted); border-radius: 999px; padding: 6px 13px; font: 600 .84rem var(--font); cursor: pointer; }
.chip.active { background: rgba(58, 184, 255, .2); border-color: rgba(58, 184, 255, .55); color: var(--ink); }

input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 28px; background: transparent; }
input[type=range]::-webkit-slider-runnable-track { height: 6px; border-radius: 3px; background: linear-gradient(90deg, var(--water), var(--water-2)); opacity: .9; }
input[type=range]::-moz-range-track { height: 6px; border-radius: 3px; background: linear-gradient(90deg, var(--water), var(--water-2)); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 22px; height: 22px; margin-top: -8px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 4px rgba(58, 184, 255, .35), 0 0 16px rgba(58, 184, 255, .8); }
input[type=range]::-moz-range-thumb { width: 22px; height: 22px; border: 0; border-radius: 50%; background: #fff; box-shadow: 0 0 0 4px rgba(58, 184, 255, .35), 0 0 16px rgba(58, 184, 255, .8); }

/* ---------- status bits ---------- */
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--muted); flex: none; }
.dot.ok { background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.dot.water { background: var(--water); box-shadow: 0 0 0 4px rgba(58, 184, 255, .2), 0 0 12px var(--water); animation: pulse 1.6s ease-in-out infinite; }
.dot.bad { background: var(--danger); box-shadow: 0 0 8px var(--danger); }
.dot.warn { background: var(--warn); box-shadow: 0 0 8px var(--warn); }
@keyframes pulse { 50% { box-shadow: 0 0 0 7px rgba(58, 184, 255, 0), 0 0 16px var(--water); } }
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: .76rem; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: var(--surface); color: var(--muted); border: 1px solid var(--line); white-space: nowrap; }
.badge.water { color: var(--water); border-color: rgba(58, 184, 255, .4); background: rgba(58, 184, 255, .1); }
.badge.warn { color: var(--warn); border-color: rgba(255, 181, 71, .35); background: rgba(255, 181, 71, .08); }
.badge.bad { color: var(--danger); border-color: rgba(255, 95, 95, .4); background: rgba(255, 95, 95, .08); }
.badge.ok { color: var(--ok); border-color: rgba(95, 214, 143, .35); background: rgba(95, 214, 143, .08); }
.swatch { width: 12px; height: 12px; border-radius: 4px; flex: none; box-shadow: 0 0 10px currentColor; }

/* ---------- yard plan ---------- */
.yard-wrap { position: relative; border-radius: 16px; overflow: hidden; border: 1px solid var(--line); background: rgba(3, 8, 13, .65); }
.yard-wrap canvas { display: block; width: 100%; touch-action: pan-y pinch-zoom; cursor: crosshair; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.yard-hint { position: absolute; left: 12px; bottom: 10px; right: 140px; font-size: .82rem; color: var(--muted); pointer-events: none; }
.yard-scale { position: absolute; right: 12px; bottom: 10px; font-size: .76rem; color: var(--muted); }
.yard-bar { position: absolute; top: 12px; left: 12px; right: 12px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; z-index: 2; pointer-events: none; }
.yard-bar > * { pointer-events: auto; }
.toggle { display: inline-flex; align-items: center; gap: 8px; font-size: .85rem; font-weight: 600; color: var(--muted); cursor: pointer; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: rgba(0, 0, 0, .3); }
.toggle input { accent-color: var(--heat); }

/* ---------- head tiles ---------- */
.head-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.head-row {
  display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; align-items: center;
  padding: 14px; border-radius: 16px; color: var(--ink); text-decoration: none !important;
  background: rgba(0, 0, 0, .2); border: 1px solid var(--line);
  transition: border-color .15s, background .15s;
}
.head-row:hover { border-color: var(--line-strong); background: var(--surface); }
.head-row.watering { border-color: rgba(58, 184, 255, .45); box-shadow: 0 0 30px -12px rgba(58, 184, 255, .8); }
.head-row .gauge { grid-row: span 2; }
.head-row .name { font-family: var(--font-num); font-weight: 600; display: flex; align-items: center; gap: 8px; }
.head-row .meta { display: flex; gap: 12px; flex-wrap: wrap; font-size: .8rem; color: var(--muted); }
.head-row .meta b { color: var(--ink); font-family: var(--font-num); font-weight: 600; font-size: .92rem; }
.head-row .state { grid-column: 1 / 3; font-size: .8rem; color: var(--muted); display: flex; align-items: center; gap: 7px; }

.jobs .job { padding: 12px 0; border-top: 1px solid var(--line); }
.jobs .job:first-child { border-top: 0; padding-top: 0; }
.progress { height: 6px; border-radius: 3px; background: rgba(0, 0, 0, .35); overflow: hidden; margin-top: 8px; }
.progress > i { display: block; height: 100%; background: linear-gradient(90deg, var(--water), var(--water-2)); box-shadow: 0 0 12px var(--water); transition: width .6s ease; }

/* ---------- head control ---------- */
.control { display: grid; grid-template-columns: minmax(220px, 290px) minmax(0, 1fr); gap: 22px; align-items: start; }
.control > .stack { min-width: 0; }
@media (max-width: 1320px) and (min-width: 1151px), (max-width: 680px) { .control { grid-template-columns: 1fr; justify-items: center; } .control > .stack { width: 100%; } }
.dial-wrap { position: relative; }
.dial { width: 100%; max-width: 300px; height: auto; aspect-ratio: 1; margin: 0 auto; touch-action: none; user-select: none; cursor: grab; display: block; }
.dial:active { cursor: grabbing; }
.dial-aim { text-align: center; margin-top: 4px; }
.dial-aim b { font-family: var(--font-num); font-size: 2.2rem; font-weight: 600; letter-spacing: -.03em; }
.dial-aim span { color: var(--muted); font-size: .85rem; display: block; }
.nudges { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; }
.nudges .btn { padding-left: 2px; padding-right: 2px; min-width: 0; }
.water-btn { min-height: 56px; font-size: 1.05rem; border-radius: 16px; }
.slider-label { display: flex; justify-content: space-between; font-size: .86rem; color: var(--muted); }
.slider-label b { color: var(--ink); font-family: var(--font-num); font-size: 1.1rem; }

.tabs { display: flex; gap: 4px; padding: 4px; margin-bottom: 16px; border-radius: 14px; background: rgba(0, 0, 0, .28); border: 1px solid var(--line); overflow-x: auto; }
.tabs button { appearance: none; border: 0; background: transparent; color: var(--muted); font: 600 .9rem var(--font); padding: 9px 14px; cursor: pointer; border-radius: 10px; white-space: nowrap; flex: 1; }
.tabs button.active { color: var(--ink); background: rgba(58, 184, 255, .16); box-shadow: inset 0 0 0 1px rgba(58, 184, 255, .3); }

.points { width: 100%; border-collapse: collapse; font-size: .9rem; }
.points td, .points th { padding: 7px 6px; border-top: 1px solid var(--line); text-align: left; }
.points th { color: var(--muted); font-weight: 600; border-top: 0; font-size: .8rem; }
.points input { width: 90px; }

.trace-cta { border: 1px solid rgba(58, 184, 255, .3); background: linear-gradient(160deg, rgba(58, 184, 255, .12), rgba(46, 230, 197, .04)); border-radius: 16px; padding: 16px; }
.trace-cta ol { margin: 10px 0 0; padding-left: 20px; color: var(--muted); font-size: .9rem; }
.trace-cta ol li + li { margin-top: 4px; }

/* ---------- run panel ---------- */
.run-panel { transition: border-color .3s, box-shadow .3s; }
.run-panel.active { border-color: rgba(58, 184, 255, .4); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06), 0 0 40px -14px rgba(58, 184, 255, .6); }
.run-top { display: flex; align-items: center; gap: 18px; margin-bottom: 14px; }
.run-clock b { display: block; font-family: var(--font-num); font-weight: 600; font-size: 2.6rem; line-height: 1; letter-spacing: -.03em; }
.run-panel.active .run-clock b { color: #bfeaff; text-shadow: 0 0 22px rgba(58, 184, 255, .55); }
.run-clock span { font-size: .8rem; color: var(--muted); }
.run-what { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.run-what b { font-family: var(--font-num); font-weight: 600; }
.planbar { display: block; border-radius: 6px; overflow: hidden; }
.planbar .pb-now { animation: pbpulse 1.4s ease-in-out infinite; }
@keyframes pbpulse { 50% { opacity: .55; } }
.run-legend { display: flex; gap: 14px; margin-top: 8px; flex-wrap: wrap; }
.run-legend span { display: inline-flex; align-items: center; gap: 6px; }
.lg { width: 12px; height: 8px; border-radius: 2px; display: inline-block; }
.lg.done { background: rgba(58, 184, 255, .7); } .lg.now { background: #9ef0ff; box-shadow: 0 0 8px #9ef0ff; } .lg.next { background: rgba(150, 195, 240, .2); }
.run-next { margin-top: 14px; display: flex; flex-direction: column; gap: 6px; }
.run-next:empty { display: none; }
.run-next h3 { font-size: .85rem; color: var(--muted); margin-bottom: 2px; }
.run-next .row { gap: 12px; flex-wrap: nowrap; }
.run-next .num { min-width: 120px; }
.run-mini { font-size: .95rem; color: #bfeaff; }

/* ---------- inside (3D) ---------- */
.twin-stage { position: relative; height: min(70vh, 720px); min-height: 380px; border-radius: 16px; overflow: hidden; border: 1px solid var(--line);
  background: radial-gradient(120% 90% at 50% 20%, #0d2236 0%, #060c13 70%); }
.twin-stage canvas { display: block; touch-action: none; cursor: grab; }
.twin-stage canvas:active { cursor: grabbing; }
.twin-loading { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); }
.twin-status { position: absolute; left: 12px; top: 12px; right: 12px; display: flex; align-items: center; gap: 9px; width: fit-content; max-width: calc(100% - 24px);
  padding: 8px 14px; border-radius: 999px; font-size: .86rem; font-weight: 600; background: rgba(5, 10, 15, .7); border: 1px solid var(--line); backdrop-filter: blur(8px); pointer-events: none; }
.twin-status.fault { border-color: rgba(255, 95, 95, .55); color: #ffd0d0; box-shadow: 0 0 30px -8px rgba(255, 95, 95, .7); }
.twin-status.warn { border-color: rgba(255, 181, 71, .5); color: #ffe2b0; }
.twin-tags { position: absolute; inset: 0; pointer-events: none; z-index: 2; }
.twin-tag { position: absolute; transform: translate(-50%, calc(-100% - 18px)); display: flex; flex-direction: column; align-items: center; }
.twin-tag span { padding: 5px 11px; border-radius: 999px; font-size: .78rem; font-weight: 700; white-space: nowrap; color: #fff; background: rgba(229, 72, 77, .92); box-shadow: 0 0 20px rgba(255, 80, 80, .7); }
.twin-tag i { order: 2; width: 2px; height: 16px; background: rgba(255, 95, 95, .9); }
.twin-tag.warn span { background: rgba(214, 140, 30, .92); box-shadow: 0 0 20px rgba(255, 181, 71, .6); }
.twin-tag.warn i { background: rgba(255, 181, 71, .9); }
.health { display: flex; flex-direction: column; gap: 6px; }
.health-row { appearance: none; text-align: left; display: grid; grid-template-columns: 12px 1fr; gap: 12px; align-items: start; padding: 11px 12px; border-radius: 12px;
  background: rgba(0, 0, 0, .2); border: 1px solid var(--line); color: var(--ink); font: inherit; cursor: pointer; }
.health-row .dot { margin-top: 6px; }
.health-row b { display: block; font-size: .92rem; }
.health-row .small { display: block; margin-top: 1px; }
.health-row:hover { border-color: var(--line-strong); }
.health-row.fault { border-color: rgba(255, 95, 95, .5); background: rgba(255, 95, 95, .07); }
.health-row.warn { border-color: rgba(255, 181, 71, .4); background: rgba(255, 181, 71, .05); }
.issue { margin-top: 14px; padding: 12px 14px; border-radius: 12px; border: 1px solid rgba(255, 95, 95, .45); background: rgba(255, 95, 95, .06); }
.issue.warn { border-color: rgba(255, 181, 71, .4); background: rgba(255, 181, 71, .05); }
.issue b { margin-right: 8px; }
.issue ol { margin: 10px 0 0; padding-left: 20px; color: var(--muted); font-size: .88rem; }
.issue ol li + li { margin-top: 4px; }

/* ---------- tables + lists ---------- */
.table-wrap { overflow-x: auto; }
table.list { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.list th { text-align: left; color: var(--muted); font-weight: 600; font-size: .8rem; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.list td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.list tr:last-child td { border-bottom: 0; }
table.list tbody tr:hover td { background: rgba(150, 195, 240, .03); }

.stat-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.stat-strip > div { padding: 14px 16px; border-radius: 14px; background: rgba(0, 0, 0, .22); border: 1px solid var(--line); }
.stat-strip .value { font-family: var(--font-num); font-weight: 600; font-size: 1.5rem; letter-spacing: -.02em; }
.stat-strip .label { color: var(--muted); font-size: .8rem; font-weight: 600; }

.chart { width: 100%; height: 240px; display: block; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: .85rem; color: var(--muted); margin-top: 10px; }
.legend span { display: inline-flex; gap: 7px; align-items: center; }

.events { list-style: none; margin: 0; padding: 0; font-size: .9rem; }
.events li { display: grid; grid-template-columns: 74px 1fr; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line); }
.events li:first-child { border-top: 0; padding-top: 0; }
.events time { color: var(--muted); font-size: .8rem; padding-top: 2px; }
.events .warn { color: var(--warn); }
.events .error { color: var(--danger); }

.hot { display: grid; grid-template-columns: 34px 1fr auto; gap: 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.hot:first-child { border-top: 0; padding-top: 0; }
.hot .n { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-family: var(--font-num); font-weight: 600; font-size: .9rem; color: #1b0e02; background: radial-gradient(circle at 35% 35%, #ffc27a, var(--heat)); box-shadow: 0 0 16px rgba(255, 154, 61, .6); }

.code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .8rem; background: rgba(0, 0, 0, .35); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; overflow-x: auto; white-space: pre; color: #bfe6ff; }
.callout { padding: 12px 14px; border-radius: 12px; font-size: .88rem; color: var(--muted); background: rgba(0, 0, 0, .22); border: 1px solid var(--line); }

/* ---------- login + toast + dialogs ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card { width: min(380px, 100%); display: flex; flex-direction: column; gap: 16px; padding: 32px; border-radius: var(--radius-l); background: linear-gradient(160deg, rgba(150, 195, 240, .09), rgba(150, 195, 240, .03)); border: 1px solid var(--line-strong); backdrop-filter: var(--blur); box-shadow: 0 30px 80px -30px rgba(0, 0, 0, .9), 0 0 60px -20px rgba(58, 184, 255, .35); }
.login-mark { width: 52px; height: 52px; color: var(--water); filter: drop-shadow(0 0 12px rgba(58, 184, 255, .8)); }
.toast {
  position: fixed; left: 50%; bottom: calc(26px + var(--safe-bottom)); transform: translate(-50%, 20px);
  background: rgba(16, 30, 44, .92); color: var(--ink); padding: 12px 18px; border-radius: 14px; border: 1px solid var(--line-strong);
  backdrop-filter: var(--blur); box-shadow: 0 16px 40px -12px rgba(0, 0, 0, .8);
  font-size: .92rem; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 50; max-width: min(540px, 92vw);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { border-color: rgba(255, 95, 95, .55); box-shadow: 0 16px 40px -12px rgba(0, 0, 0, .8), 0 0 30px -8px rgba(255, 95, 95, .6); }
@media (max-width: 900px) { .toast { bottom: calc(96px + var(--safe-bottom)); } }

dialog { border: 1px solid var(--line-strong); border-radius: 22px; background: rgba(12, 24, 36, .96); color: var(--ink); padding: 24px; width: min(580px, 94vw); box-shadow: 0 30px 90px -20px rgba(0, 0, 0, .9), 0 0 50px -25px rgba(58, 184, 255, .5); }
dialog::backdrop { background: rgba(2, 6, 10, .6); backdrop-filter: blur(4px); }
dialog h2 { margin-bottom: 16px; font-size: 1.25rem; }
dialog footer { display: flex; justify-content: flex-end; gap: 8px; margin-top: 22px; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
