/* ArchDash: mission-control theme. One dark surface, one accent, three reserved status
   colours. A status is never colour alone: every one carries a shape and a word. */

:root {
  --bg: #04070b;
  --panel: #0a1117;
  --panel-2: #0e1820;
  --line: #172733;
  --line-2: #22384a;
  --ink: #d7e6ef;
  --ink-2: #93a9b8;
  --ink-3: #5f7686;
  --accent: #4fd1e8;
  --accent-dim: rgba(79, 209, 232, 0.14);
  --up: #2fd07a;
  --warn: #fab219;
  --down: #f2545b;
  --idle: #5f7686;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", "Cascadia Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --gap: 10px;
}

*, *::before, *::after { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0; min-height: 100vh; color: var(--ink); background: var(--bg);
  background-image:
    linear-gradient(rgba(79, 209, 232, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(79, 209, 232, 0.035) 1px, transparent 1px);
  background-size: 44px 44px;
  font: 12.5px/1.45 var(--mono);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent); }
a:focus-visible, .app:focus-visible { outline: 1px solid var(--accent); outline-offset: 2px; }

/* ---------------------------------------------------------------- status shapes */
.glyph { display: inline-block; width: 9px; height: 9px; flex: none; background: var(--idle); border-radius: 50%; }
[data-status="up"]   > .glyph, .glyph[data-status="up"]   { background: var(--up); box-shadow: 0 0 8px rgba(47, 208, 122, 0.7); }
[data-status="warn"] > .glyph, .glyph[data-status="warn"] { background: var(--warn); border-radius: 0; clip-path: polygon(50% 0, 100% 100%, 0 100%); width: 10px; }
[data-status="down"] > .glyph, .glyph[data-status="down"] { background: var(--down); border-radius: 1px; box-shadow: 0 0 9px rgba(242, 84, 91, 0.75); }
[data-status="idle"] > .glyph, .glyph[data-status="idle"],
[data-status="wait"] > .glyph, .glyph[data-status="wait"] { background: transparent; border: 1.5px solid var(--idle); }
@keyframes blink { 50% { opacity: 0.35; } }
[data-status="down"] > .glyph, .glyph[data-status="down"] { animation: blink 1.1s steps(2, jump-none) infinite; }

.word { font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-2); white-space: nowrap; }
[data-status="warn"] > .word { color: var(--warn); }
[data-status="down"] > .word { color: var(--down); }

/* ---------------------------------------------------------------- header */
.top {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  padding: 10px 16px; background: rgba(4, 7, 11, 0.92); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line-2);
}
.brand { display: flex; align-items: center; gap: 11px; }
.mark { width: 30px; height: 30px; fill: none; stroke: var(--accent); stroke-width: 1.4; }
.mark .sat { fill: var(--up); stroke: none; }
.brand-name { font-size: 14px; font-weight: 700; letter-spacing: 0.26em; }
.brand-sub { font-size: 10.5px; color: var(--ink-3); letter-spacing: 0.08em; text-transform: uppercase; }

.verdict {
  display: flex; align-items: center; gap: 10px; margin: 0 auto; padding: 7px 16px;
  border: 1px solid var(--line-2); background: var(--panel); min-width: 300px; justify-content: center;
}
.verdict-text { font-size: 13px; font-weight: 700; letter-spacing: 0.22em; }
.verdict-sub { color: var(--ink-2); font-size: 11px; }
.verdict[data-status="up"]   { border-color: rgba(47, 208, 122, 0.55); background: rgba(47, 208, 122, 0.07); }
.verdict[data-status="warn"] { border-color: rgba(250, 178, 25, 0.6);  background: rgba(250, 178, 25, 0.07); }
.verdict[data-status="down"] { border-color: rgba(242, 84, 91, 0.7);   background: rgba(242, 84, 91, 0.09); }

.clocks { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.clock { display: flex; flex-direction: column; line-height: 1.2; }
.clock .k, .k { font-size: 9.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-3); }
.clock .v { font-size: 15px; letter-spacing: 0.04em; }
.link { display: flex; align-items: center; gap: 7px; padding: 5px 10px; border: 1px solid var(--line-2); font-size: 10.5px; letter-spacing: 0.12em; min-width: 148px; }
.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--idle); }
.link[data-status="up"] .pulse { background: var(--up); animation: ping 2s ease-out infinite; }
.link[data-status="warn"] { border-color: var(--warn); } .link[data-status="warn"] .pulse { background: var(--warn); border-radius: 0; clip-path: polygon(50% 0, 100% 100%, 0 100%); }
.link[data-status="down"] { border-color: var(--down); } .link[data-status="down"] .pulse { background: var(--down); border-radius: 1px; }
@keyframes ping { 0% { box-shadow: 0 0 0 0 rgba(47, 208, 122, 0.7); } 100% { box-shadow: 0 0 0 9px rgba(47, 208, 122, 0); } }

/* ---------------------------------------------------------------- deck */
.deck { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: var(--gap); padding: var(--gap) 16px; }
.panel {
  position: relative; min-width: 0; padding: 11px 13px 13px; background: var(--panel);
  border: 1px solid var(--line);
}
/* corner ticks */
.panel::before, .panel::after { content: ""; position: absolute; width: 9px; height: 9px; border: 1px solid var(--accent); opacity: 0.75; pointer-events: none; }
.panel::before { top: -1px; left: -1px; border-right: 0; border-bottom: 0; }
.panel::after { bottom: -1px; right: -1px; border-left: 0; border-top: 0; }
.panel h2 {
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin: 0 0 9px; padding-bottom: 7px;
  border-bottom: 1px solid var(--line); font-size: 10.5px; font-weight: 700; letter-spacing: 0.2em; text-transform: uppercase; color: var(--accent);
}
.panel h2 em { font-style: normal; font-weight: 400; letter-spacing: 0.06em; color: var(--ink-2); text-transform: none; text-align: right; }

.p-vehicle { grid-column: span 3; } .p-cpu { grid-column: span 3; } .p-mem { grid-column: span 2; }
.p-disk { grid-column: span 2; } .p-net { grid-column: span 2; }
.p-apps { grid-column: span 8; } .p-agents { grid-column: span 4; }
.p-services { grid-column: span 5; } .p-jobs { grid-column: span 4; } .p-security { grid-column: span 3; }
.p-log { grid-column: span 12; }

/* ---------------------------------------------------------------- vitals */
.vehicle { display: grid; grid-template-columns: 1fr 1fr; gap: 9px 14px; }
.kv { display: flex; flex-direction: column; min-width: 0; }
.kv:last-child { grid-column: 1 / -1; }
.kv .v { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kv .v.big { font-size: 18px; color: #fff; }
.meter { height: 4px; margin-top: 5px; background: var(--line); border-radius: 2px; overflow: hidden; }
.meter i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 2px; transition: width 0.6s; }
.meter[data-status="warn"] i { background: var(--warn); } .meter[data-status="down"] i { background: var(--down); }

.hero { display: flex; align-items: baseline; gap: 4px; }
.hero-n { font-size: 34px; font-weight: 600; line-height: 1; color: #fff; letter-spacing: -0.02em; }
.hero-u { font-size: 14px; color: var(--ink-2); }
.state { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; align-self: center; }

.spark { position: relative; height: 54px; margin: 8px 0 6px; }
.spark.small { height: 30px; margin: 3px 0 8px; }
.spark svg { display: block; width: 100%; height: 100%; overflow: visible; }
.spark .area { fill: var(--accent-dim); stroke: none; }
.spark .line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.spark .base { stroke: var(--line-2); stroke-width: 1; vector-effect: non-scaling-stroke; }
.spark .cross { stroke: var(--ink-2); stroke-width: 1; vector-effect: non-scaling-stroke; visibility: hidden; }
.spark .dot { position: absolute; width: 8px; height: 8px; margin: -4px 0 0 -4px; border-radius: 50%; background: var(--accent); border: 2px solid var(--panel); visibility: hidden; pointer-events: none; }
.spark:hover .cross, .spark:hover .dot { visibility: visible; }

.cores { display: grid; grid-template-columns: repeat(auto-fit, minmax(54px, 1fr)); gap: 6px; }
.core { font-size: 9.5px; color: var(--ink-3); letter-spacing: 0.06em; }
.core b { float: right; font-weight: 400; color: var(--ink-2); }
.sub { color: var(--ink-2); font-size: 11px; display: grid; gap: 2px; }
.sub span b { float: right; font-weight: 400; color: var(--ink); }

.disk { margin-bottom: 11px; }
.disk:last-child { margin-bottom: 0; }
.disk-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.disk-free { font-size: 20px; color: #fff; font-weight: 600; }
.disk-free small { font-size: 11px; color: var(--ink-2); font-weight: 400; }
.disk-mount { color: var(--ink-2); font-size: 11px; }
.disk-note { display: flex; justify-content: space-between; color: var(--ink-3); font-size: 10.5px; margin-top: 3px; }

.net-row { display: flex; justify-content: space-between; align-items: baseline; }
.net-row .v { font-size: 15px; color: #fff; }

/* ---------------------------------------------------------------- applications */
.apps { display: grid; grid-template-columns: repeat(auto-fill, minmax(176px, 1fr)); gap: 7px; }
.app {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; column-gap: 8px; row-gap: 2px;
  padding: 8px 10px; background: var(--panel-2); border: 1px solid var(--line); border-left: 3px solid var(--idle); min-width: 0;
}
.app[data-status="up"] { border-left-color: var(--up); }
.app[data-status="warn"] { border-left-color: var(--warn); background: rgba(250, 178, 25, 0.06); }
.app[data-status="down"] { border-left-color: var(--down); background: rgba(242, 84, 91, 0.08); }
a.app:hover { border-color: var(--accent); border-left-color: var(--accent); color: inherit; }
.app-name { font-size: 12.5px; font-weight: 700; letter-spacing: 0.04em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-port { color: var(--ink-2); font-size: 11px; }
.app-line { grid-column: 1 / -1; display: flex; justify-content: space-between; gap: 8px; color: var(--ink-3); font-size: 10.5px; min-width: 0; }
.app-line span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-line span:last-child { flex: none; white-space: nowrap; }
.app-line .word { font-size: 9.5px; }
.app[data-status="warn"] .app-line .word { color: var(--warn); } .app[data-status="down"] .app-line .word { color: var(--down); }
.chips { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 4px; margin-top: 2px; }
.chip { font-size: 9.5px; padding: 1px 5px; border: 1px solid var(--line-2); color: var(--ink-2); white-space: nowrap; letter-spacing: 0.03em; }
.chip.bad { border-color: var(--down); color: var(--down); }
.chip.open { border-color: rgba(79, 209, 232, 0.4); color: var(--accent); }

/* ---------------------------------------------------------------- agents */
.agent { padding: 10px 11px; margin-bottom: 8px; background: var(--panel-2); border: 1px solid var(--line); border-top: 2px solid var(--idle); }
.agent:last-child { margin-bottom: 0; }
.agent[data-status="up"] { border-top-color: var(--up); } .agent[data-status="warn"] { border-top-color: var(--warn); } .agent[data-status="down"] { border-top-color: var(--down); }
.agent-head { display: flex; align-items: center; gap: 8px; }
.agent-name { font-size: 15px; font-weight: 700; letter-spacing: 0.08em; color: #fff; }
.agent-role { color: var(--ink-3); font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase; }
.agent-head .word { margin-left: auto; }
.rows { display: grid; gap: 3px; margin-top: 8px; }
.row { display: grid; grid-template-columns: 12px minmax(0, 1fr) auto; align-items: center; gap: 8px; font-size: 11.5px; }
.row .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .meta { color: var(--ink-2); font-size: 10.5px; white-space: nowrap; }
.row .tag { color: var(--ink-3); font-size: 9.5px; letter-spacing: 0.08em; text-transform: uppercase; margin-left: 6px; }

/* ---------------------------------------------------------------- tables */
.scroll { overflow: auto; scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
table { width: 100%; border-collapse: collapse; font-size: 11.5px; }
th { position: sticky; top: 0; background: var(--panel); text-align: left; font-weight: 400; font-size: 9.5px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-3); padding: 0 8px 5px 0; }
td { padding: 4px 8px 4px 0; border-top: 1px solid var(--line); vertical-align: middle; white-space: nowrap; }
td.grow { width: 100%; max-width: 0; overflow: hidden; text-overflow: ellipsis; }
td.num, th.num { text-align: right; padding-right: 0; padding-left: 8px; }
td .st { display: inline-flex; align-items: center; gap: 7px; }
td.grow .st { max-width: 100%; vertical-align: middle; }
td.grow .st > span:last-child { overflow: hidden; text-overflow: ellipsis; }
td small { color: var(--ink-3); font-size: 10px; margin-left: 6px; }
tr[data-status="down"] td { background: rgba(242, 84, 91, 0.07); }
tr[data-status="warn"] td { background: rgba(250, 178, 25, 0.05); }
.dim { color: var(--ink-3); }
h3 { margin: 12px 0 5px; font-size: 9.5px; font-weight: 400; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-2); }
h3:first-child { margin-top: 0; }
.empty { color: var(--ink-3); padding: 6px 0; }

/* ---------------------------------------------------------------- security */
.checks { display: grid; gap: 4px; }
.check { display: grid; grid-template-columns: 12px minmax(0, 1fr) auto; align-items: center; gap: 8px; }
.check .val { color: var(--ink-2); font-size: 10.5px; text-align: right; }
.check[data-status="down"] .val { color: var(--down); } .check[data-status="warn"] .val { color: var(--warn); }
#security > div + div { margin-top: 12px; }
.ports { display: flex; flex-wrap: wrap; gap: 4px; }

/* ---------------------------------------------------------------- log */
.log-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; }
.issue { display: grid; grid-template-columns: 12px minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 3px 0; border-top: 1px solid var(--line); }
.issue:first-child { border-top: 0; }
.issue .val { color: var(--ink-2); font-size: 10.5px; }
.log { list-style: none; margin: 0; padding: 0; max-height: 150px; overflow: auto; scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
.log li { display: grid; grid-template-columns: 70px 12px minmax(0, 1fr); gap: 8px; align-items: center; padding: 2px 0; color: var(--ink-2); }
.log time { color: var(--ink-3); }

.foot { display: flex; flex-wrap: wrap; gap: 6px 22px; padding: 4px 16px 16px; color: var(--ink-3); font-size: 10.5px; }
#foot-errors { color: var(--warn); }

.tip { position: fixed; z-index: 20; pointer-events: none; padding: 4px 8px; background: #0f1d27; border: 1px solid var(--line-2); font-size: 11px; white-space: nowrap; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5); }
.tip b { color: #fff; font-weight: 600; } .tip span { color: var(--ink-2); margin-left: 8px; }

body.stale .deck { opacity: 0.45; filter: saturate(0.3); transition: opacity 0.4s; }

/* ---------------------------------------------------------------- narrower screens */
@media (max-width: 1500px) {
  .p-vehicle { grid-column: span 4; } .p-cpu { grid-column: span 4; } .p-mem { grid-column: span 4; }
  .p-disk { grid-column: span 6; } .p-net { grid-column: span 6; }
  .p-apps { grid-column: span 12; } .p-agents { grid-column: span 12; }
  #agents { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 8px; } .agent { margin-bottom: 0; }
  .p-services { grid-column: span 7; } .p-jobs { grid-column: span 5; } .p-security { grid-column: span 12; }
  .p-security #security { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 4px 28px; }
  #security > div + div { margin-top: 0; }
}
@media (max-width: 980px) {
  .deck > .panel { grid-column: 1 / -1; }
  .log-cols { grid-template-columns: 1fr; }
  .verdict { order: 3; width: 100%; margin: 0; }
  .top { position: static; }
}
@media (max-width: 520px) {
  .deck, .top, .foot { padding-left: 16px; padding-right: 16px; }
  .apps { grid-template-columns: 1fr 1fr; }
  .vehicle { grid-template-columns: 1fr; }
  .hide-s { display: none; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ================================================================ controls */
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 16px; top: 8px; z-index: 30; padding: 6px 10px; background: var(--panel); border: 1px solid var(--accent); }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
button:focus-visible, input:focus-visible { outline: 1px solid var(--accent); outline-offset: 2px; }
kbd { font: inherit; font-size: 10px; padding: 0 5px; border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 3px; color: var(--ink-2); }

.tools { display: flex; align-items: center; gap: 8px; }
.search { display: flex; align-items: center; gap: 7px; height: 30px; padding: 0 8px; border: 1px solid var(--line-2); background: var(--panel); transition: border-color 0.15s, width 0.2s; width: 168px; }
.search:focus-within { border-color: var(--accent); width: 230px; }
.search svg, .tool svg { width: 14px; height: 14px; flex: none; fill: none; stroke: var(--ink-2); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.search input { flex: 1; min-width: 0; background: none; border: 0; outline: 0; color: var(--ink); font: inherit; }
.search input::placeholder { color: var(--ink-3); }
.search input::-webkit-search-cancel-button { filter: grayscale(1) brightness(1.6); cursor: pointer; }
body.filtering .search { border-color: var(--accent); background: var(--accent-dim); }
.tool { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 30px; min-width: 30px; padding: 0 8px; border: 1px solid var(--line-2); background: var(--panel); color: var(--ink-2); font-size: 11px; letter-spacing: 0.06em; transition: border-color 0.15s, color 0.15s; }
.tool:hover { border-color: var(--accent); color: var(--ink); } .tool:hover svg { stroke: var(--accent); }
.tool[hidden] { display: none; }
.tool:disabled { opacity: 0.5; cursor: default; }

/* anomalies, right under the header: the first thing to read when something is wrong */
.alerts { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 8px 16px; border-bottom: 1px solid var(--line-2); background: rgba(242, 84, 91, 0.05); }
.alerts[hidden] { display: none; }
.alerts-k { font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-2); margin-right: 6px; }
.alert { display: inline-flex; align-items: center; gap: 7px; padding: 3px 9px; border: 1px solid var(--line-2); background: var(--panel); font-size: 11.5px; text-align: left; }
.alert b { font-weight: 600; } .alert span:last-child { color: var(--ink-2); }
.alert[data-status="down"] { border-color: rgba(242, 84, 91, 0.6); } .alert[data-status="warn"] { border-color: rgba(250, 178, 25, 0.55); }
.alert:not(:disabled):hover { border-color: var(--accent); }
.alert:disabled { cursor: default; }

/* segmented filters */
.bar { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 9px; }
.bar:empty { display: none; }
.seg { padding: 2px 9px; border: 1px solid var(--line); color: var(--ink-2); font-size: 10.5px; letter-spacing: 0.06em; transition: border-color 0.15s, color 0.15s, background 0.15s; }
.seg i { font-style: normal; color: var(--ink-3); margin-left: 3px; }
.seg:hover { border-color: var(--line-2); color: var(--ink); }
.seg.on { border-color: var(--accent); color: var(--ink); background: var(--accent-dim); } .seg.on i { color: var(--accent); }

/* ================================================================ ring gauges */
.vital { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 14px; align-items: center; margin-bottom: 9px; }
.ring { position: relative; width: 92px; height: 92px; }
.ring svg { width: 100%; height: 100%; display: block; }
.ring .track { fill: none; stroke: var(--line); stroke-width: 7; }
.ring .arc { fill: none; stroke: var(--accent); stroke-width: 7; stroke-linecap: round; transition: stroke-dashoffset 0.9s cubic-bezier(0.2, 0.8, 0.2, 1), stroke 0.3s; }
.ring[data-status="warn"] .arc { stroke: var(--warn); } .ring[data-status="down"] .arc { stroke: var(--down); }
.ring-n { position: absolute; inset: 0; display: flex; align-items: baseline; justify-content: center; padding-top: 30px; gap: 1px; }
.ring-n b { font-size: 26px; font-weight: 600; color: #fff; line-height: 1; letter-spacing: -0.02em; }
.ring-n span { font-size: 11px; color: var(--ink-2); }
.vital-side { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.vital-side .state { margin: 0; align-self: flex-start; }
.vital-side .spark { margin: 0; height: 58px; }

/* ================================================================ tiles of one height */
.apps { grid-auto-rows: 1fr; }
.app { align-content: start; transition: border-color 0.15s, transform 0.15s, background 0.15s; }
a.app:hover { transform: translateY(-1px); background: #111d27; }
.chips:empty { display: none; }
.app-name mark, td mark { background: var(--accent-dim); color: var(--ink); }
tbody tr { transition: background 0.15s; }
tbody tr:hover td { background: rgba(79, 209, 232, 0.05); }

.log li.quiet { color: var(--ink-3); }
.keys { margin-left: auto; }

/* before the first frame arrives */
body.booting .deck { opacity: 0.35; }
body.booting .panel > :not(h2) { visibility: hidden; }
body.booting .panel { min-height: 120px; background-image: linear-gradient(100deg, transparent 30%, rgba(79, 209, 232, 0.06) 50%, transparent 70%); background-size: 200% 100%; animation: sweep 1.4s linear infinite; }
@keyframes sweep { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* full screen: a wall display has no use for the controls */
body.wall .search, body.wall .keys { display: none; }
body.wall { font-size: 13.5px; }

@media (max-width: 1500px) { .tools { margin-left: auto; } }
@media (max-width: 980px) {
  .tools { order: 2; margin-left: auto; } .clocks { order: 4; width: 100%; justify-content: space-between; }
  .keys { display: none; }
}
@media (max-width: 520px) {
  .search, .search:focus-within { width: 100%; flex: 1; } .tools { width: 100%; }
  .search kbd { display: none; }
  .alerts { padding: 8px 16px; } .alert span:last-child { display: none; }
}

/* ================================================================ sign-in page */
body.gate { display: grid; place-items: center; min-height: 100vh; overflow: hidden; padding: 24px 16px; }
.sky { position: fixed; inset: 0; pointer-events: none; opacity: 0.9; }
.sky svg { width: 100%; height: 100%; display: block; }
.sky .orbits * { fill: none; stroke: rgba(79, 209, 232, 0.13); stroke-width: 1; }
.sky .orbits ellipse { stroke-dasharray: 3 7; }
.sky .ring { transform-origin: 400px 400px; animation: orbit 60s linear infinite; }
.sky .r2 { animation-duration: 95s; animation-direction: reverse; } .sky .r3 { animation-duration: 140s; }
.sky .sat { fill: var(--accent); filter: drop-shadow(0 0 6px rgba(79, 209, 232, 0.9)); }
.sky .r2 .sat { fill: var(--up); filter: drop-shadow(0 0 6px rgba(47, 208, 122, 0.9)); }
.sky .sweep { transform-origin: 400px 400px; animation: orbit 9s linear infinite; }
.sky .sweep path { fill: rgba(79, 209, 232, 0.045); }
@keyframes orbit { to { transform: rotate(360deg); } }

.gate-main { position: relative; width: 100%; max-width: 400px; }
.gate-card {
  position: relative; display: grid; gap: 15px; padding: 28px 28px 22px; background: rgba(8, 14, 20, 0.86);
  border: 1px solid var(--line-2); backdrop-filter: blur(10px); box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(79, 209, 232, 0.04);
  animation: arrive 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.gate-card::before, .gate-card::after { content: ""; position: absolute; width: 14px; height: 14px; border: 1px solid var(--accent); pointer-events: none; }
.gate-card::before { top: -1px; left: -1px; border-right: 0; border-bottom: 0; }
.gate-card::after { bottom: -1px; right: -1px; border-left: 0; border-top: 0; }
@keyframes arrive { from { opacity: 0; transform: translateY(10px); } }
.gate-head { display: flex; align-items: center; gap: 13px; }
.gate-head .mark { width: 40px; height: 40px; }
.gate-head h1 { margin: 0; font-size: 16px; font-weight: 700; letter-spacing: 0.28em; }
.gate-head p { margin: 2px 0 0; font-size: 10.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-3); }
.gate-status { display: flex; align-items: center; gap: 9px; padding: 7px 10px; border: 1px solid var(--line); background: var(--panel); font-size: 11px; letter-spacing: 0.06em; color: var(--ink-2); }
.gate-status[data-status="up"] { border-color: rgba(47, 208, 122, 0.55); color: var(--ink); }
.gate-status[data-status="warn"] { border-color: rgba(250, 178, 25, 0.55); }
.gate-status[data-status="down"] { border-color: rgba(242, 84, 91, 0.6); }

.field { display: grid; gap: 5px; }
.field-k { display: flex; justify-content: space-between; font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-2); }
.field-k em { font-style: normal; color: var(--warn); letter-spacing: 0.06em; }
.field input { width: 100%; height: 42px; padding: 0 12px; background: #060b10; border: 1px solid var(--line-2); border-radius: 0; color: #fff; font: 15px/1 var(--mono); letter-spacing: 0.04em; transition: border-color 0.15s, box-shadow 0.15s; }
.field input:hover { border-color: #2f4c62; }
.field input:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }
.field input:-webkit-autofill { -webkit-text-fill-color: #fff; box-shadow: 0 0 0 40px #0b141c inset; caret-color: #fff; }
.field-wrap { position: relative; display: block; }
.field-wrap input { padding-right: 62px; }
.reveal { position: absolute; right: 6px; top: 6px; height: 30px; padding: 0 9px; font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-2); }
.reveal:hover { color: var(--accent); }

.check-row { display: flex; align-items: center; gap: 10px; font-size: 11.5px; color: var(--ink-2); cursor: pointer; user-select: none; }
.check-row input { position: absolute; opacity: 0; width: 16px; height: 16px; margin: 0; }
.check-row .box { width: 16px; height: 16px; flex: none; border: 1px solid var(--line-2); background: #060b10; display: grid; place-items: center; transition: border-color 0.15s, background 0.15s; }
.check-row .box::after { content: ""; width: 8px; height: 8px; background: var(--accent); transform: scale(0); transition: transform 0.12s; }
.check-row input:checked + .box { border-color: var(--accent); } .check-row input:checked + .box::after { transform: scale(1); }
.check-row input:focus-visible + .box { outline: 1px solid var(--accent); outline-offset: 2px; }
.check-row:hover { color: var(--ink); }

.gate-error { margin: 0; padding: 8px 10px; border-left: 3px solid var(--down); background: rgba(242, 84, 91, 0.08); font-size: 11.5px; color: var(--ink); }
.gate-error[hidden] { display: none; }
.go { position: relative; height: 44px; border: 1px solid var(--accent); background: var(--accent-dim); color: #fff; font-size: 12px; font-weight: 700; letter-spacing: 0.24em; text-transform: uppercase; transition: background 0.15s, box-shadow 0.15s, border-color 0.2s; }
.go:hover:not(:disabled) { background: rgba(79, 209, 232, 0.26); box-shadow: 0 0 24px rgba(79, 209, 232, 0.22); }
.go:active:not(:disabled) { transform: translateY(1px); }
.go:disabled { cursor: default; color: var(--ink-2); border-color: var(--line-2); background: var(--panel); }
.go-spin { display: none; position: absolute; right: 14px; top: 50%; width: 14px; height: 14px; margin-top: -7px; border: 2px solid var(--line-2); border-top-color: var(--accent); border-radius: 50%; animation: orbit 0.7s linear infinite; }
.go.busy .go-spin { display: block; }
.go.granted, .go.granted:disabled { border-color: var(--up); background: rgba(47, 208, 122, 0.14); color: #fff; }
.gate-foot { margin: 0; text-align: center; font-size: 10px; letter-spacing: 0.06em; color: var(--ink-3); }
.shake { animation: shake 0.36s; }
@keyframes shake { 20% { transform: translateX(-7px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(2px); } }
body.leaving .gate-card { transition: opacity 0.4s, transform 0.4s; opacity: 0; transform: scale(1.03); }
@media (max-width: 420px) { .gate-card { padding: 22px 18px 18px; } .gate-head h1 { font-size: 14px; letter-spacing: 0.2em; } }

/* ================================================================ second pass: depth and light
   Same palette and the same rule (state = shape + word). What changes is the surface: a
   lit background, glass panels, and a picture of the whole box at the top. */
body { background-image:
    radial-gradient(1100px 520px at 12% -8%, rgba(79, 209, 232, 0.10), transparent 60%),
    radial-gradient(900px 480px at 96% 4%, rgba(47, 208, 122, 0.055), transparent 62%),
    linear-gradient(rgba(79, 209, 232, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(79, 209, 232, 0.03) 1px, transparent 1px);
  background-size: auto, auto, 44px 44px, 44px 44px; background-attachment: fixed; }
.panel { background: linear-gradient(180deg, rgba(15, 26, 35, 0.86), rgba(8, 14, 20, 0.90)); border-color: rgba(79, 209, 232, 0.13);
  border-radius: 3px; box-shadow: 0 1px 0 rgba(255, 255, 255, 0.025) inset, 0 12px 34px rgba(0, 0, 0, 0.28); transition: border-color 0.25s, box-shadow 0.25s; }
.panel:hover { border-color: rgba(79, 209, 232, 0.3); box-shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset, 0 14px 40px rgba(0, 0, 0, 0.34), 0 0 0 1px rgba(79, 209, 232, 0.04); }
.panel::before, .panel::after { opacity: 0.55; transition: opacity 0.25s, width 0.25s, height 0.25s; }
.panel:hover::before, .panel:hover::after { opacity: 1; width: 14px; height: 14px; }
.panel h2 span { display: inline-flex; align-items: center; gap: 8px; }
.panel h2 span::before { content: ""; width: 3px; height: 11px; background: var(--accent); box-shadow: 0 0 10px rgba(79, 209, 232, 0.8); }
.top { background: linear-gradient(180deg, rgba(6, 11, 16, 0.94), rgba(4, 7, 11, 0.86)); border-bottom-color: rgba(79, 209, 232, 0.2); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35); }
.brand-name { background: linear-gradient(90deg, #fff, #9be9f7); -webkit-background-clip: text; background-clip: text; color: transparent; }
.spark .line { filter: drop-shadow(0 0 4px rgba(79, 209, 232, 0.55)); }
.ring .arc { filter: drop-shadow(0 0 5px rgba(79, 209, 232, 0.5)); }
.ring[data-status="warn"] .arc { filter: drop-shadow(0 0 5px rgba(250, 178, 25, 0.5)); }
.ring[data-status="down"] .arc { filter: drop-shadow(0 0 5px rgba(242, 84, 91, 0.6)); }
.meter i { background: linear-gradient(90deg, rgba(79, 209, 232, 0.55), var(--accent)); }
.app, .agent { border-radius: 2px; }
.app { background: linear-gradient(180deg, rgba(17, 29, 39, 0.9), rgba(12, 21, 28, 0.9)); }
.mini { width: 60px; height: 14px; vertical-align: -2px; margin-right: 7px; overflow: visible; }
.mini path { fill: none; stroke: var(--accent); stroke-width: 1.2; stroke-linejoin: round; stroke-linecap: round; opacity: 0.8; }
.row .meta .mini { margin: 0 0 0 8px; }

/* ---------------------------------------------------------------- overview */
.p-hero { grid-column: 1 / -1; }
.hero-grid { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 22px; align-items: center; }
.orrery { position: relative; aspect-ratio: 1; max-width: 300px; width: 100%; margin: 0 auto; }
.orrery svg { width: 100%; height: 100%; display: block; overflow: visible; }
.orbit { fill: none; stroke: rgba(79, 209, 232, 0.16); stroke-width: 0.7; stroke-dasharray: 1.5 4; }
.orbit-k { fill: var(--ink-3); font: 5.5px var(--mono); letter-spacing: 0.22em; text-anchor: middle; }
.spin { transform-origin: 0 0; animation: orbit 240s linear infinite; }
.spin.s1 { animation-duration: 90s; } .spin.s2 { animation-duration: 180s; animation-direction: reverse; }
.orrery:hover .spin { animation-play-state: paused; }
.dot { cursor: pointer; }
.dot .hit { fill: transparent; }
.dot :not(.hit) { fill: var(--up); transition: transform 0.15s; transform-box: fill-box; transform-origin: center; }
.dot[data-status="up"] :not(.hit) { filter: drop-shadow(0 0 2.5px rgba(47, 208, 122, 0.9)); }
.dot[data-status="warn"] :not(.hit) { fill: var(--warn); filter: drop-shadow(0 0 3px rgba(250, 178, 25, 0.9)); }
.dot[data-status="down"] :not(.hit) { fill: var(--down); filter: drop-shadow(0 0 4px rgba(242, 84, 91, 1)); animation: blink 1.1s steps(2, jump-none) infinite; }
.dot:hover :not(.hit) { transform: scale(1.7); }
.planet { filter: drop-shadow(0 0 12px rgba(79, 209, 232, 0.55)); }
.planet-ring { fill: none; stroke: rgba(155, 233, 247, 0.5); stroke-width: 1; }
.halo { fill: none; stroke: var(--up); stroke-width: 1; opacity: 0.6; transform-origin: 0 0; animation: halo 3.2s ease-out infinite; }
.halo[data-status="warn"] { stroke: var(--warn); } .halo[data-status="down"] { stroke: var(--down); animation-duration: 1.3s; }
@keyframes halo { 0% { transform: scale(0.75); opacity: 0.75; } 100% { transform: scale(1.75); opacity: 0; } }

.kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.kpi { position: relative; display: grid; gap: 4px; padding: 14px 16px 13px; border: 1px solid var(--line); border-radius: 2px; overflow: hidden;
  background: linear-gradient(135deg, rgba(79, 209, 232, 0.07), rgba(79, 209, 232, 0) 55%), rgba(12, 21, 28, 0.85); transition: border-color 0.2s, transform 0.2s; }
.kpi::after { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--up); box-shadow: 0 0 14px rgba(47, 208, 122, 0.7); }
.kpi[data-status="warn"]::after { background: var(--warn); box-shadow: 0 0 14px rgba(250, 178, 25, 0.7); }
.kpi[data-status="down"]::after { background: var(--down); box-shadow: 0 0 14px rgba(242, 84, 91, 0.8); }
.kpi[data-status="warn"] { background: linear-gradient(135deg, rgba(250, 178, 25, 0.09), transparent 55%), rgba(12, 21, 28, 0.85); }
.kpi[data-status="down"] { background: linear-gradient(135deg, rgba(242, 84, 91, 0.12), transparent 55%), rgba(12, 21, 28, 0.85); }
.kpi:hover { border-color: var(--accent); transform: translateY(-2px); color: inherit; }
.kpi-k { display: flex; align-items: center; gap: 8px; font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-2); }
.kpi-v { font-size: 30px; font-weight: 600; line-height: 1.05; color: #fff; letter-spacing: -0.02em; white-space: nowrap; }
.kpi-v i { font-style: normal; font-size: 15px; font-weight: 400; color: var(--ink-3); letter-spacing: 0; }
.kpi-s { font-size: 11px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------------------------------------------------------------- toasts */
.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 25; display: grid; gap: 8px; width: min(380px, calc(100vw - 32px)); pointer-events: none; }
.toast { display: grid; grid-template-columns: 12px minmax(0, 1fr); gap: 10px; align-items: center; padding: 10px 13px; background: rgba(10, 18, 25, 0.95); border: 1px solid var(--line-2); border-left: 3px solid var(--idle);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.55); backdrop-filter: blur(8px); animation: toast-in 0.3s cubic-bezier(0.2, 0.8, 0.2, 1) both; transition: opacity 0.5s, transform 0.5s; }
.toast[data-status="up"] { border-left-color: var(--up); } .toast[data-status="warn"] { border-left-color: var(--warn); } .toast[data-status="down"] { border-left-color: var(--down); }
.toast.out { opacity: 0; transform: translateX(16px); }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px); } }

/* ---------------------------------------------------------------- command palette */
.palette { position: fixed; inset: 0; z-index: 40; display: grid; justify-items: center; align-items: start; padding: 14vh 16px 0; background: rgba(2, 5, 8, 0.66); backdrop-filter: blur(5px); animation: fade 0.15s both; }
.palette[hidden] { display: none; }
@keyframes fade { from { opacity: 0; } }
.palette-box { width: min(620px, 100%); background: rgba(10, 18, 25, 0.98); border: 1px solid rgba(79, 209, 232, 0.4); box-shadow: 0 30px 90px rgba(0, 0, 0, 0.7), 0 0 60px rgba(79, 209, 232, 0.08); animation: arrive 0.2s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
#pal-q { width: 100%; height: 52px; padding: 0 18px; background: none; border: 0; border-bottom: 1px solid var(--line-2); outline: 0; color: #fff; font: 15px/1 var(--mono); }
#pal-q::placeholder { color: var(--ink-3); }
#pal-list { list-style: none; margin: 0; padding: 6px; max-height: 50vh; overflow: auto; }
#pal-list li { display: grid; grid-template-columns: 12px 78px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 8px 12px; cursor: pointer; border-left: 2px solid transparent; }
#pal-list li.on { background: var(--accent-dim); border-left-color: var(--accent); }
#pal-list li.none { display: block; color: var(--ink-3); cursor: default; }
.pal-kind { font-size: 9.5px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-3); }
.pal-label { font-size: 13px; color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pal-hint { font-size: 11px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 240px; }
.palette-foot { display: flex; gap: 18px; padding: 8px 14px; border-top: 1px solid var(--line); color: var(--ink-3); font-size: 10.5px; }
.palette-foot kbd { margin-right: 4px; }
.tool kbd { border: 0; padding: 0; color: var(--ink-3); }
body.wall #btn-pal { display: none; }

@media (max-width: 1100px) { .hero-grid { grid-template-columns: 240px minmax(0, 1fr); gap: 16px; } .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } .kpi-v { font-size: 25px; } }
@media (max-width: 700px) { .hero-grid { grid-template-columns: 1fr; } .orrery { max-width: 250px; } #btn-pal kbd { display: none; } .pal-hint { display: none; } #pal-list li { grid-template-columns: 12px 70px minmax(0, 1fr); } }
@media (max-width: 520px) { .kpi { padding: 11px 12px; } .kpi-v { font-size: 22px; } }

/* ---------------------------------------------------------------- platform */
.p-platform { grid-column: 1 / -1; }
.platform { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 10px; align-items: start; }
.pcard { min-width: 0; padding: 11px 13px 12px; border: 1px solid var(--line); border-top: 2px solid var(--idle); border-radius: 2px; background: linear-gradient(180deg, rgba(17, 29, 39, 0.9), rgba(12, 21, 28, 0.9)); }
.pcard[data-status="up"] { border-top-color: var(--up); } .pcard[data-status="warn"] { border-top-color: var(--warn); } .pcard[data-status="down"] { border-top-color: var(--down); }
.pcard header { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; min-width: 0; }
.pcard header b { font-size: 14px; letter-spacing: 0.06em; color: #fff; white-space: nowrap; }
.pcard header span:not(.glyph):not(.word) { color: var(--ink-3); font-size: 10.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.pcard header .word { margin-left: auto; }
.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; margin-bottom: 10px; }
.fact { display: flex; flex-direction: column; min-width: 0; font-size: 12px; color: var(--ink); }
.fact.big b { font-size: 22px; font-weight: 600; color: #fff; letter-spacing: -0.02em; margin-right: 5px; }
.fact.big > span:last-of-type { color: var(--ink-2); font-size: 11px; }
.pcard table { margin-top: 2px; }
.pcard td .meter { margin-top: 4px; width: 90px; margin-left: auto; }
.pcard .spark.small { height: 34px; margin: 0; }
.chip.ver { font-size: 10.5px; padding: 3px 8px; } .chip.ver b { color: var(--ink); font-weight: 600; }
