:root {
  --bg: #0d1120; --surface: #151a2c; --surface2: #1b2136; --sunk: #0f1424;
  --line: #283050; --line2: #323b60;
  --text: #e9ecf7; --muted: #9ba5c4; --faint: #7d87a8;
  --accent: #8e9cff; --accent2: #39c6e0;
  --ok: #3fcf8e; --warn: #f2b33d; --bad: #ff6b81; --info: #7fb2ff;
  --radius: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font: 15px/1.55 Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased;
}
.glow {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(900px 420px at 0% -10%, rgba(142, 156, 255, .16), transparent 60%),
    radial-gradient(700px 420px at 100% 0%, rgba(57, 198, 224, .10), transparent 60%);
}
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small-text { font-size: 14px; font-weight: 500; }
h1, h2, h3, h4 { margin: 0 0 .35em; letter-spacing: -.01em; }
h2 { font-size: 22px; font-weight: 700; } h3 { font-size: 16px; font-weight: 650; }
p { margin: 0 0 .5em; }

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; box-shadow: 0 1px 0 rgba(255, 255, 255, .03) inset, 0 8px 24px rgba(0, 0, 0, .25);
}
.card.flush { padding: 0; overflow: hidden; }
input, textarea, select {
  width: 100%; margin: 6px 0 10px; padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--sunk); color: var(--text); font: inherit;
}
input:focus, textarea:focus, select:focus, .btn:focus-visible, .find:focus-visible,
.tab:focus-visible, .chip:focus-visible, .run-row:focus-visible, .pill:focus-visible {
  outline: 2px solid var(--accent2); outline-offset: 2px;
}
select { width: auto; margin: 0 0 0 8px; padding: 7px 10px; }
label { display: block; color: var(--muted); font-size: 13px; }
label.inline { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
label.inline input { width: auto; margin: 0; }
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; margin: 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 15px; border-radius: 10px; border: 1px solid var(--line2);
  background: var(--surface2); color: var(--text); font: inherit; font-weight: 600;
  cursor: pointer; text-decoration: none; transition: background .15s, transform .08s;
}
.btn:hover { background: #242b45; }
.btn:active { transform: scale(.98); }
.btn.small { padding: 7px 12px; font-size: 14px; }
.btn.primary { background: linear-gradient(135deg, #7f8fff, #5f6ff0); border-color: transparent; color: #fff; }
.btn.danger { background: rgba(255, 107, 129, .14); border-color: rgba(255, 107, 129, .5); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--text); background: var(--surface2); }
.btn.wide { width: 100%; padding: 12px; margin-top: 6px; }
.btn[disabled] { opacity: .55; cursor: progress; }

/* Sign-in */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card { width: min(400px, 100%); }
.logo {
  width: 50px; height: 50px; border-radius: 14px; display: grid; place-items: center; font-size: 24px;
  background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #0d1120; margin-bottom: 14px;
}
.err { color: #ffb3c1; min-height: 1.5em; margin: 10px 0 0; }

/* Top bar and tabs */
.top {
  position: sticky; top: 0; z-index: 1000; background: rgba(13, 17, 32, .88);
  backdrop-filter: blur(12px); border-bottom: 1px solid var(--line);
}
.top-in {
  max-width: 1180px; margin: 0 auto; padding: 0 20px; height: 60px;
  display: flex; align-items: center; gap: 24px;
}
.brand { font-size: 17px; font-weight: 750; display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.mark { color: var(--accent); }
.tabs { display: flex; gap: 2px; height: 100%; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  background: none; border: 0; color: var(--muted); font: inherit; font-weight: 600; cursor: pointer;
  padding: 0 14px; height: 100%; border-bottom: 2px solid transparent; white-space: nowrap;
}
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.pill {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px;
  border: 1px solid var(--line2); background: var(--surface2); color: var(--text);
  font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap;
}
a.pill { text-decoration: none; }
a.pill:hover { border-color: var(--accent); }
.pill .dot { background: var(--faint); }
.pill.ok .dot { background: var(--ok); } .pill.warn .dot { background: var(--warn); } .pill.bad .dot { background: var(--bad); }
.pill.warn { border-color: rgba(242, 179, 61, .5); } .pill.bad { border-color: rgba(255, 107, 129, .6); }
.badge { padding: 4px 10px; border-radius: 999px; font-size: 13px; font-weight: 600;
  color: #fde68a; background: rgba(250, 204, 21, .12); border: 1px solid rgba(250, 204, 21, .35); }

main { max-width: 1180px; margin: 0 auto; padding: 26px 20px 40px; }
.panel { display: grid; gap: 18px; animation: fade .18s ease-out; }
.panel > * { min-width: 0; }
@keyframes fade { from { opacity: 0; translate: 0 4px; } to { opacity: 1; translate: 0 0; } }
.panel-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.panel-head p { margin: 0; }
.stack { display: grid; gap: 14px; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--faint); flex: none; }
.dot.on, .dot.ok { background: var(--ok); }
.dot.off, .dot.bad { background: var(--bad); }
.dot.warn { background: var(--warn); }
.dot.info { background: var(--info); }

/* Digest */
.headline {
  font-size: 20px; font-weight: 650; line-height: 1.4;
  border-left: 4px solid var(--accent); background: linear-gradient(90deg, rgba(142, 156, 255, .10), transparent 70%), var(--surface);
}
.section h3 { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.section .count { font-size: 12px; font-weight: 700; color: var(--muted); background: var(--surface2);
  border: 1px solid var(--line); border-radius: 999px; padding: 1px 8px; }
.section.needs { border-color: rgba(242, 179, 61, .45); }
.section.needs h3 { color: #f8d58a; }
.items { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.items li { display: grid; grid-template-columns: 130px 1fr; gap: 14px; align-items: baseline;
  padding-top: 10px; border-top: 1px solid var(--line); }
.items li:first-child { border-top: 0; padding-top: 0; }
.who { font-size: 13px; font-weight: 650; color: var(--b, var(--accent)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 2px; background: var(--b, var(--accent)); margin-right: 7px; }
.stale { color: #f8d58a; }

/* Agents */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.stat .k { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .07em; }
.stat .v { font-size: 24px; font-weight: 750; margin-top: 2px; }
.stat .s { font-size: 13px; color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 1px solid var(--line2); background: transparent; color: var(--muted); border-radius: 999px;
  padding: 5px 13px; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
.chip:hover { color: var(--text); }
.chip[aria-pressed="true"] { background: rgba(142, 156, 255, .16); border-color: var(--accent); color: var(--text); }
.runs .day { padding: 10px 18px; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase;
  letter-spacing: .07em; background: var(--sunk); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.runs .day:first-child { border-top: 0; }
.run-row { display: grid; grid-template-columns: 64px minmax(120px, 1.1fr) minmax(120px, 2fr) 74px 104px 70px;
  gap: 12px; align-items: center; padding: 11px 18px; border-bottom: 1px solid var(--line); cursor: pointer;
  width: 100%; background: none; border-left: 0; border-right: 0; border-top: 0; color: inherit; font: inherit; text-align: left; }
.run-row:hover { background: rgba(142, 156, 255, .06); }
.run-row[aria-expanded="true"] { background: rgba(142, 156, 255, .09); }
.run-row .t { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 14px; }
.run-row .a { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.run-row .w { color: var(--muted); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.run-row .d, .run-row .c { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 14px; text-align: right; }
.state { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 650; }
.state.ok { color: var(--ok); } .state.bad { color: var(--bad); } .state.warn { color: var(--warn); } .state.info { color: var(--info); }
.run-detail { padding: 14px 18px 18px 94px; border-bottom: 1px solid var(--line); background: var(--sunk); }
.kv { display: grid; grid-template-columns: 120px 1fr; gap: 6px 14px; font-size: 14px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; word-break: break-word; }
.result { white-space: pre-wrap; word-break: break-word; max-height: 360px; overflow: auto; margin: 12px 0 0;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px; font-size: 13.5px; line-height: 1.5; }
.empty { padding: 28px; text-align: center; color: var(--muted); }

/* Host */
.summary { display: flex; align-items: center; gap: 16px; }
.summary .big { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; font-size: 22px; font-weight: 800; flex: none; }
.summary.ok .big { background: rgba(63, 207, 142, .15); color: var(--ok); }
.summary.warn .big { background: rgba(242, 179, 61, .15); color: var(--warn); }
.summary.bad .big { background: rgba(255, 107, 129, .15); color: var(--bad); }
.summary h3 { margin: 0; font-size: 18px; }
.summary ul { margin: 6px 0 0; padding-left: 18px; color: var(--muted); font-size: 14px; }
.groups { columns: 3 320px; column-gap: 16px; }
.groups > .group { break-inside: avoid; margin-bottom: 16px; }
.group h3 { font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .07em; margin-bottom: 8px; }
.check { display: grid; grid-template-columns: 14px 1fr auto; gap: 4px 10px; align-items: baseline; padding: 9px 0; border-top: 1px solid var(--line); }
.check:first-of-type { border-top: 0; }
.check .dot { translate: 0 -1px; }
.check .n { font-weight: 600; }
.check .v { font-variant-numeric: tabular-nums; font-weight: 600; text-align: right; }
.check .v.bad { color: var(--bad); } .check .v.warn { color: var(--warn); }
.check .x { grid-column: 2 / 4; color: var(--muted); font-size: 13px; }

/* Git */
.repo-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.repo-head code, .mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 13.5px; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; }
.fact { background: var(--sunk); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.fact .k { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .07em; }
.fact .v { font-size: 19px; font-weight: 700; margin: 3px 0 2px; }
.fact .s { font-size: 13px; color: var(--muted); word-break: break-word; }
.flags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.flag { font-size: 13px; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--line2); color: var(--muted); }
.flag.ok { color: var(--ok); border-color: rgba(63, 207, 142, .4); }
.flag.warn { color: var(--warn); border-color: rgba(242, 179, 61, .5); }
.flag.bad { color: var(--bad); border-color: rgba(255, 107, 129, .55); }

/* Phone */
.hero { display: flex; gap: 24px; align-items: center; justify-content: space-between; flex-wrap: wrap;
  background: linear-gradient(135deg, rgba(142, 156, 255, .14), rgba(57, 198, 224, .05)), var(--surface); }
.hero-left { flex: 1 1 380px; }
.hero-right { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.find {
  width: 140px; height: 140px; border-radius: 50%; border: 0; cursor: pointer; color: #fff;
  font: 800 21px/1 system-ui, sans-serif; letter-spacing: .12em;
  background: radial-gradient(circle at 30% 30%, #ff8aa0, var(--bad) 55%, #c0264a);
  box-shadow: 0 0 0 0 rgba(255, 107, 129, .6), 0 12px 34px rgba(255, 107, 129, .4);
  animation: pulse 2.2s infinite; transition: transform .1s;
}
.find:active { transform: scale(.95); }
.find.ringing { animation: pulse .7s infinite, shake .35s infinite; }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(255, 107, 129, .55), 0 12px 34px rgba(255, 107, 129, .4); }
  70% { box-shadow: 0 0 0 26px rgba(255, 107, 129, 0), 0 12px 34px rgba(255, 107, 129, .4); }
  100% { box-shadow: 0 0 0 0 rgba(255, 107, 129, 0), 0 12px 34px rgba(255, 107, 129, .4); }
}
@keyframes shake { 0%, 100% { rotate: 0deg; } 25% { rotate: -4deg; } 75% { rotate: 4deg; } }
.grid { display: grid; gap: 16px; }
.tiles { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.actions { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.tile .k { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .07em; }
.tile .v { font-size: 28px; font-weight: 750; margin: 4px 0; }
.tile .s { color: var(--muted); font-size: 13px; }
.bar { height: 6px; border-radius: 6px; background: rgba(255, 255, 255, .08); overflow: hidden; margin: 6px 0; }
.bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--ok), var(--accent2)); transition: width .6s; }
.cardhead { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.cardhead input { width: 260px; margin: 0; }
#map { height: 420px; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); background: #0d1428; }
.leaflet-container { font: inherit; }
.pin { width: 22px; height: 22px; border-radius: 50%; background: var(--accent2); border: 3px solid #fff;
  box-shadow: 0 0 0 8px rgba(57, 198, 224, .25), 0 0 24px rgba(57, 198, 224, .9); }
.shot { display: block; max-width: 100%; max-height: 420px; margin-top: 12px; border-radius: 12px; border: 1px solid var(--line); }
.pieces { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
.piece { border: 1px solid var(--line); border-radius: 12px; padding: 14px; background: var(--sunk); }
.piece summary { cursor: pointer; font-weight: 700; }
.piece summary .muted { font-weight: 400; display: block; font-size: 13px; }
.piece pre { white-space: pre-wrap; word-break: break-word; max-height: 260px; overflow: auto;
  background: rgba(0, 0, 0, .35); padding: 10px; border-radius: 10px; font-size: 12.5px; }
.piece label { margin-top: 8px; }
/* OSM's light tiles, turned dark to sit in the page. */
.dark-tiles { filter: invert(1) hue-rotate(180deg) brightness(0.95) contrast(0.9); }
.hint { font-size: 13px; margin: -4px 0 14px; }

footer { text-align: center; font-size: 13px; padding: 0 20px 30px; }
.toast {
  position: fixed; left: 50%; bottom: 24px; translate: -50% 20px; opacity: 0; pointer-events: none; z-index: 2000;
  padding: 12px 18px; border-radius: 12px; background: #1f2742; border: 1px solid var(--line2);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .4); transition: opacity .25s, translate .25s; max-width: 90vw;
}
.toast.show { opacity: 1; translate: -50% 0; }
.toast.bad { border-color: rgba(255, 107, 129, .6); }

@media (max-width: 760px) {
  .top-in { height: auto; flex-wrap: wrap; gap: 0 12px; padding: 10px 16px 0; }
  .tabs { order: 3; width: 100%; height: 44px; }
  .top-right .btn.ghost { padding: 6px 8px; }
  #statusText { display: none; }
  .spacetext { display: none; }
  main { padding: 20px 14px 32px; }
  .items li { grid-template-columns: 1fr; gap: 2px; }
  .run-row { grid-template-columns: 52px 1fr auto; }
  .run-row .w, .run-row .d, .run-row .c { display: none; }
  .run-detail { padding-left: 18px; }
  .kv { grid-template-columns: 96px 1fr; }
  .find { width: 120px; height: 120px; } #map { height: 320px; }
}

.btn.gbtn { background: #fff; color: #1f1f1f; border-color: #dadce0; gap: 12px; margin-top: 14px; }
.btn.gbtn:hover { background: #f1f3f4; }
.linkbtn { display: block; margin: 18px auto 0; background: none; border: 0; padding: 4px 8px;
  color: var(--muted); font: inherit; font-size: 13px; cursor: pointer; text-decoration: underline; }
.linkbtn:hover { color: var(--text); }
.whoami { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; color: var(--text); }
.whoami img { border-radius: 50%; object-fit: cover; }

.account { position: relative; }
.whoami { background: none; border: 0; padding: 4px 8px; border-radius: 10px; cursor: pointer; font-family: inherit; }
.whoami:hover, .whoami[aria-expanded="true"] { background: var(--surface2); }
.whoami:focus-visible { outline: 2px solid var(--accent, #7b8cff); outline-offset: 2px; }
.caret { color: var(--muted); font-size: 11px; }
.menu { position: absolute; right: 0; top: calc(100% + 6px); min-width: 200px; z-index: 20; padding: 6px;
  background: var(--surface); border: 1px solid var(--line2); border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,.45); }
.menu-note { margin: 6px 10px 8px; font-size: 13px; }
.menu-item { display: block; width: 100%; text-align: left; padding: 9px 10px; border: 0; border-radius: 8px;
  background: none; color: var(--text); font: inherit; font-weight: 600; cursor: pointer; }
.menu-item:hover, .menu-item:focus-visible { background: var(--surface2); outline: none; }
