/* The portal's stylesheet. Hand-written, no build step. The heat ramp comes
   from common/static/heat.css, as on every other page in this system; --line
   is defined here because that file paints a gap with it. No inline styles
   anywhere: the CSP is style-src 'self'. */

:root {
  --bg: #f6f7f9; --panel: #fff; --ink: #1b1f24; --muted: #6a737d;
  --line: #dfe3e8; --ok: #1a7f37; --ok-bg: #e8f5ec; --bad: #b42318;
  --bad-bg: #fdeceb; --warn: #8a5a00; --warn-bg: #fdf3e0; --accent: #2457c5;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14171a; --panel: #1c2024; --ink: #e6e8ea; --muted: #99a1a9;
    --line: #2c3238; --ok: #4ac776; --ok-bg: #14301f; --bad: #ff6b5e;
    --bad-bg: #351a18; --warn: #e0b055; --warn-bg: #2e2515; --accent: #7aa2ff;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent); }
header {
  padding: .8rem 1.2rem; background: var(--panel); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: .8rem;
}
.brand { font-weight: 700; letter-spacing: -.02em; color: var(--ink); text-decoration: none; }
.langs { margin-left: auto; display: flex; gap: .1rem; align-items: center; }
.lang {
  font-size: .72rem; font-weight: 600; letter-spacing: .04em; padding: .15rem .4rem;
  border-radius: 4px; text-decoration: none; color: var(--muted);
}
.lang:hover { background: var(--bg); color: var(--ink); }
.lang.current { color: var(--ink); background: var(--bg); }
.signout { margin: 0; }
main { max-width: 64rem; margin: 0 auto; padding: 1.2rem; }
footer { max-width: 64rem; margin: 0 auto; padding: 0 1.2rem 2rem; color: var(--muted); font-size: .8rem; }
h1 { font-size: 1.4rem; margin: .4rem 0 1rem; }
.hint, .customer { color: var(--muted); }
.notice { background: var(--warn-bg); color: var(--warn); padding: .6rem .8rem; border-radius: 6px; }
.error { background: var(--bad-bg); color: var(--bad); padding: .6rem .8rem; border-radius: 6px; }

button {
  font: inherit; padding: .45rem 1rem; border-radius: 6px; cursor: pointer;
  border: 1px solid var(--line); background: var(--panel); color: var(--ink);
}

.card {
  background: var(--panel); padding: 1.2rem 1.5rem; margin-bottom: 1rem;
  border: 1px solid var(--line); border-radius: 10px;
}
.card.narrow { max-width: 24rem; margin: 3rem auto; }
.card h2 { font-size: 1.05rem; margin: 0 0 .6rem; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; width: 100%; }
.below { margin: 1rem 0 0; font-size: .9rem; }
.nav { color: var(--ink); text-decoration: none; font-size: .9rem; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: .3rem 1rem; margin: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }
.secret code { font-size: 1.05rem; letter-spacing: .08em; word-break: break-all; }
.card label { display: block; margin: 0 0 .9rem; font-size: .9rem; color: var(--muted); max-width: 24rem; }
.card input {
  display: block; width: 100%; margin-top: .25rem; font: inherit; padding: .5rem .6rem;
  border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--ink);
}


/* ---- sites (C3). The strip and equipment rows are the report page's
   drawing; the colours are common/static/heat.css. ---- */
h2 { font-size: .85rem; text-transform: uppercase; letter-spacing: .05em;
     color: var(--muted); margin: 0 0 .6rem; }
.crumbs { margin: 0 0 .4rem; font-size: .9rem; }
.site-head { text-transform: none; letter-spacing: 0; font-size: 1.05rem; margin: 0 0 .3rem; }
.site-head a { color: var(--ink); text-decoration: none; }
.site-head a:hover { text-decoration: underline; }
.site-state { margin: 0 0 .6rem; display: flex; flex-wrap: wrap; gap: .5rem; align-items: baseline; }
.since, .stale-age { color: var(--muted); font-size: .85rem; }
.status {
  font-weight: 600; text-transform: uppercase; font-size: .7rem;
  padding: .12rem .45rem; border-radius: 4px;
}
.status.up { color: var(--ok); background: var(--ok-bg); }
.status.down { color: var(--bad); background: var(--bad-bg); }
.status.unknown { color: var(--muted); background: var(--line); }
.strip-head { display: flex; gap: .5rem; align-items: baseline; }
.uptime { font-variant-numeric: tabular-nums; font-weight: 600; }
.uptime.bad { color: var(--bad); }
.over { color: var(--muted); font-size: .78rem; }
.strip { margin: .5rem 0 .2rem; }
.bar { display: flex; gap: 1px; height: 18px; }
.bar i { flex: 1 1 0; border-radius: 1px; min-width: 0; }
svg.axis { display: block; overflow: visible; }
svg.axis text { font-size: 11px; fill: var(--muted); text-anchor: middle;
                font-variant-numeric: tabular-nums; }
.stale {
  color: var(--warn); background: var(--warn-bg); font-size: .85rem;
  padding: .45rem .7rem; border-radius: 6px; margin: .6rem 0 0;
}

.stills { list-style: none; padding: 0; margin: 0; display: grid; gap: .6rem;
          grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr)); }
.still { margin: 0; }
.still img, .still-off { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9;
                         object-fit: cover; border-radius: 6px; background: var(--line); }
.still-off { display: flex; align-items: center; justify-content: center;
             color: var(--muted); font-size: .85rem; }
.still-name { display: block; font-size: .85rem; margin-top: .2rem; }

.equip { margin: .4rem 0 0; }
.equip > .equip-row { padding-left: 1.1rem; }
.group > summary { cursor: pointer; display: flex; align-items: center; list-style: none; }
.group > summary::-webkit-details-marker { display: none; }
.group > summary::before { content: "\25B8"; color: var(--muted); font-size: .8rem;
                           flex: 0 0 1.1rem; transition: transform .1s; }
.group[open] > summary::before { transform: rotate(90deg); }
.group > summary .equip-row { flex: 1 1 auto; }
.group > summary .equip-name { font-weight: 600; }
.tally { display: flex; align-items: center; gap: .3rem; flex-wrap: wrap; }
.devices { color: var(--muted); font-size: .78rem; }
.pill { font-size: .7rem; font-weight: 600; padding: .12rem .4rem; border-radius: 4px;
        color: var(--muted); background: var(--line); white-space: nowrap; }
.pill.ok { color: var(--ok); background: var(--ok-bg); }
.pill.bad { color: var(--bad); background: var(--bad-bg); }
.equip-row { display: flex; align-items: center; gap: .7rem; margin: .35rem 0; }
.equip-name { flex: 0 0 10rem; font-size: .88rem; overflow-wrap: anywhere; }
.equip-row .bar { flex: 1 1 auto; height: 12px; }
.equip-uptime { flex: 0 0 4.5rem; text-align: right; font-size: .8rem;
                font-variant-numeric: tabular-nums; color: var(--muted); }
.equip-uptime.bad { color: var(--bad); font-weight: 600; }

table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: left; padding: .4rem .6rem .4rem 0;
         border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .72rem; text-transform: uppercase; letter-spacing: .04em;
     color: var(--muted); font-weight: 600; }
tr:last-child td { border-bottom: 0; }
td.when, td.how-long { white-space: nowrap; font-variant-numeric: tabular-nums; }
tr.ongoing td { color: var(--bad); font-weight: 600; }

@media (max-width: 560px) {
  .equip-row { flex-wrap: wrap; }
  .equip-name { flex: 1 1 100%; }
  .equip-row .bar { flex: 1 1 60%; }
}

/* ---- live view (C4) ---- */
.streams { display: flex; gap: .4rem; margin: 0 0 .6rem; }
.streams a.pill { text-decoration: none; }
.player { position: relative; background: #000; border-radius: 8px; overflow: hidden;
          aspect-ratio: 16 / 9; margin-bottom: 1rem; }
.player video { display: block; width: 100%; height: 100%; object-fit: contain; }
.overlay { position: absolute; inset: 0; display: flex; flex-direction: column;
           align-items: center; justify-content: center; gap: .8rem; padding: 1rem;
           background: rgba(0, 0, 0, .72); color: #fff; text-align: center; }
.overlay[hidden] { display: none; }
.lens-list { margin: 0; padding-left: 1.1rem; }
.still-link { display: block; }
