/* CamSolLuna web UI. docs/web-interface.md: mobile first; bottom bar < 600 px, rail to 1100 px,
   sidebar above; components size to their container; 44 px targets on coarse pointers. */

:root {
  color-scheme: dark;
  --bg: #0b0f17;
  --surface: #121826;
  --surface-2: #1a2233;
  --line: #263047;
  --text: #e7ebf3;
  --muted: #93a0b8;
  --accent: #7cc4ff;
  --accent-ink: #0b0f17;
  --ok: #5fd39a;
  --warn: #f2c14e;
  --bad: #ff7a7a;
  --radius: 12px;
  --gap: clamp(10px, 1.6vw, 18px);
  --tap: 36px;
  --nav-h: 64px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f6fa;
  --surface: #ffffff;
  --surface-2: #eef1f6;
  --line: #d6dce7;
  --text: #121826;
  --muted: #58647a;
  --accent: #0b63b6;
  --accent-ink: #ffffff;
  --ok: #0f7446;
  --warn: #805800;
  --bad: #b42f2f;
}
/* Red night mode: the whole page through a red filter, images included, so the screen does not
   spoil dark adaptation at the camera. Pure red (green and blue at zero), luminance kept. */
:root[data-night] { color-scheme: dark; --bg: #000; --surface: #0a0000; --surface-2: #140000; --line: #2a0505; }
:root[data-night] body { filter: url(#csl-red) brightness(.85); }   /* brightness into the red channel only */

@media (pointer: coarse) { :root { --tap: 44px; } }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-block-size: 100dvh; background: var(--bg); color: var(--text);
  font: 400 clamp(15px, 1.1vw + 11px, 16px)/1.45 var(--font);
  display: grid; grid-template-columns: 1fr; grid-template-rows: 1fr auto;
}
img, svg, video, canvas { display: block; max-inline-size: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; }
h1 { font-size: clamp(20px, 2vw + 12px, 26px); }
h2 { font-size: clamp(17px, 1vw + 12px, 20px); }
.muted { color: var(--muted); }
.pad { padding: var(--gap); }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.skip { position: absolute; inset-inline-start: -999px; }
.skip:focus { inset-inline-start: 8px; inset-block-start: 8px; z-index: 10; background: var(--surface); padding: 8px; }
:where(a, button, input, select, textarea, [tabindex]):focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }

/* -- navigation: bottom bar (phone) ---------------------------------------------------------- */
.appnav {
  grid-row: 2; position: sticky; inset-block-end: 0; z-index: 5;
  display: flex; align-items: stretch; background: color-mix(in srgb, var(--surface) 92%, transparent);
  border-block-start: 1px solid var(--line); padding-block-end: env(safe-area-inset-bottom);
  backdrop-filter: blur(10px);
}
.brand { display: none; }
.navlist { display: flex; flex: 1; margin: 0; padding: 0; list-style: none; }
.navlist li { flex: 1; display: flex; }
.navtools { display: flex; }
.navtools .iconbtn:last-child { display: none; }
.navlink, .iconbtn {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-block-size: var(--nav-h); min-inline-size: 56px; padding: 6px 4px; border: 0; background: none;
  color: var(--muted); text-decoration: none; font-size: 11.5px; cursor: pointer; border-radius: 10px;
}
.navlink svg, .iconbtn svg { inline-size: 24px; block-size: 24px; flex: none; }
.navlabel { white-space: nowrap; }
.navlink[aria-current="page"] { color: var(--accent); }
.navlink[aria-current="page"] svg { filter: drop-shadow(0 0 6px color-mix(in srgb, var(--accent) 45%, transparent)); }
.iconbtn[aria-pressed="true"] { color: var(--bad); }
@media (hover: hover) { .navlink:hover, .iconbtn:hover { color: var(--text); background: var(--surface-2); } }
main { grid-row: 1; min-inline-size: 0; outline: none; }
@media (max-width: 599px) { .navlist li.more { display: none; } }
@media (min-width: 600px) { .navlist li.morebtn { display: none; } }
.navmore { position: fixed; inset: auto 8px calc(var(--nav-h) + env(safe-area-inset-bottom) + 8px) auto; margin: 0;
  padding: 6px; min-inline-size: 210px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--text);
  box-shadow: 0 10px 30px #0008; display: grid; gap: 2px; }
.navmore:not(:popover-open):not([hidden]) { display: none; }
@supports not selector(:popover-open) { .navmore:not([hidden]) { display: grid; } }
.navmore .navlink { flex-direction: row; justify-content: flex-start; gap: 12px; min-block-size: 48px; padding: 0 12px; font-size: 15px; color: var(--text); }

/* -- the bell (bell.js): top right on a phone, top of the rail on a tablet, by the name on a desktop -- */
.bell { position: fixed; inset-block-start: calc(env(safe-area-inset-top) + 8px); inset-inline-end: 8px; z-index: 6;
  display: grid; place-items: center; inline-size: 40px; block-size: 40px; padding: 0; border: 1px solid var(--line);
  border-radius: 50%; background: color-mix(in srgb, var(--surface) 88%, transparent); color: var(--muted); cursor: pointer;
  backdrop-filter: blur(10px); }
.bell svg { inline-size: 22px; block-size: 22px; }
@media (hover: hover) { .bell:hover { color: var(--text); } }
.bell-badge { position: absolute; inset-block-start: -3px; inset-inline-end: -3px; min-inline-size: 18px; block-size: 18px;
  padding: 0 5px; border-radius: 9px; background: var(--accent); color: var(--bg, #000); font-size: 11px; font-weight: 700;
  line-height: 18px; text-align: center; }
.bellpanel { position: fixed; inset: calc(env(safe-area-inset-top) + 56px) 8px auto auto; margin: 0; padding: 8px;
  inline-size: min(380px, calc(100vw - 16px)); max-block-size: 70dvh; overflow: auto; border: 1px solid var(--line);
  border-radius: 14px; background: var(--surface); color: var(--text); box-shadow: 0 10px 30px #0008; }
.bellpanel:not(:popover-open):not([hidden]) { display: none; }
@supports not selector(:popover-open) { .bellpanel:not([hidden]) { display: block; } }
.bell-head { display: flex; justify-content: space-between; align-items: baseline; padding: 2px 4px 8px; }
.bell-item { display: grid; grid-template-columns: 52px 1fr; gap: 8px; align-items: start; padding: 8px 6px; border-radius: 10px;
  color: var(--text); text-decoration: none; }
.bell-item + .bell-item { border-block-start: 1px solid var(--line); }
.bell-item.unread { background: color-mix(in srgb, var(--accent) 12%, transparent); }
@media (hover: hover) { .bell-item:hover { background: var(--surface-2); } }
.bell-kind { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding-block-start: 2px; }
.bell-item.now .bell-kind { color: var(--accent); font-weight: 700; }
.bell-text { display: grid; gap: 2px; }
.page-head { padding-inline-end: 48px; }

/* -- rail (tablet) ------------------------------------------------------------------------------ */
@media (min-width: 600px) {
  body { grid-template-columns: auto 1fr; grid-template-rows: 1fr; }
  .appnav {
    grid-row: 1; grid-column: 1; position: sticky; inset-block-start: 0; block-size: 100dvh;
    flex-direction: column; border-block-start: 0; border-inline-end: 1px solid var(--line);
    padding: 8px 6px env(safe-area-inset-bottom);
  }
  main { grid-column: 2; }
  .brand { display: grid; place-items: center; min-block-size: 56px; color: var(--accent); text-decoration: none; }
  .brand svg { inline-size: 30px; block-size: 30px; }
  .brand-name { display: none; }
  .navlist { flex-direction: column; flex: 0; gap: 4px; }
  .navlink, .iconbtn { flex: 0; min-block-size: 60px; inline-size: 72px; }
  .navtools { flex-direction: column; margin-block-start: auto; gap: 4px; }
  .navtools .iconbtn:last-child { display: flex; }
  .bell { inset-block-start: 68px; inset-inline: 22px auto; }          /* under the logo, at the top of the rail */
  body:has(.bell:not([hidden])) .navlist { margin-block-start: 52px; }
  .bellpanel { inset: 8px auto auto 96px; }
  .page-head { padding-inline-end: 0; }
}
/* -- sidebar (desktop) ------------------------------------------------------------------------ */
@media (min-width: 1100px) {
  .appnav { inline-size: 212px; padding-inline: 12px; }
  .brand { display: flex; justify-content: flex-start; gap: 10px; padding-inline: 10px; color: var(--text); font-weight: 650; text-decoration: none; }
  .brand svg { color: var(--accent); }
  .brand-name { display: inline; }
  .navlink, .iconbtn { flex-direction: row; justify-content: flex-start; gap: 12px; inline-size: auto;
    min-block-size: 44px; padding-inline: 12px; font-size: 14.5px; }
  .navlink svg, .iconbtn svg { inline-size: 20px; block-size: 20px; }
  .bell { inset-block-start: 18px; inset-inline-start: 166px; inline-size: 36px; block-size: 36px; }   /* beside the name */
  body:has(.bell:not([hidden])) .navlist { margin-block-start: 0; }
  .brand { padding-inline-end: 48px; }
  .bellpanel { inset: 8px auto auto 228px; }
}

/* -- common pieces ---------------------------------------------------------------------------- */
.page { padding: var(--gap); max-inline-size: 1600px; margin-inline: auto; }
.page-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin-block-end: var(--gap); }
.page-head h1 { margin: 0; }
.page-head .spacer { flex: 1; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--gap); }
.grid-cards { display: grid; gap: var(--gap); grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-block-size: var(--tap);
  padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface-2);
  color: var(--text); text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; font-weight: 600; }
.btn.danger { color: var(--bad); }
.btn:disabled { opacity: .5; cursor: default; }
@media (hover: hover) { .btn:not(:disabled):hover { filter: brightness(1.12); } }
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { min-block-size: calc(var(--tap) - 6px); padding: 0 12px; border-radius: 999px; border: 0; background: none; color: var(--muted); cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px #0004; }
.chips { display: flex; gap: 8px; overflow-x: auto; scroll-snap-type: x proximity; padding-block-end: 4px; scrollbar-width: thin; }
.chip { scroll-snap-align: start; flex: none; min-block-size: var(--tap); padding: 0 14px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.chip[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); }
.chip small { color: var(--muted); }
.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; background: var(--surface-2); color: var(--muted); }
.badge.ok { color: var(--ok); } .badge.warn { color: var(--warn); } .badge.bad { color: var(--bad); }
.facts { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 0; }
.facts div { display: flex; gap: 6px; align-items: baseline; }
.facts dt { color: var(--muted); font-size: 13px; }
.facts dd { margin: 0; font-variant-numeric: tabular-nums; }
.empty { padding: 40px 16px; text-align: center; color: var(--muted); }
table { border-collapse: collapse; inline-size: 100%; }
th, td { text-align: start; padding: 8px 10px; border-block-end: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 500; font-size: 13px; }
td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.table-wrap { overflow-x: auto; }
.toasts { position: fixed; inset-inline: 0; inset-block-end: calc(var(--nav-h) + 12px); display: grid; justify-items: center; gap: 8px; pointer-events: none; z-index: 20; }
@media (min-width: 600px) { .toasts { inset-block-end: 16px; } }
.toast { pointer-events: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 10px 16px; box-shadow: 0 6px 20px #0006; }
.toast.bad { border-color: var(--bad); }
.toast.warn { border-color: var(--warn); }

/* -- live view --------------------------------------------------------------------------------- */
.live { display: grid; gap: var(--gap); padding: var(--gap); container-type: inline-size; }
.live > div:first-child { min-inline-size: 0; }
@media (min-width: 1100px) { .live { grid-template-columns: minmax(0, 1fr) 320px; align-items: start; } }
/* the picture is as wide as the column allows but never taller than the screen, so the whole sky stays in view */
.live { --stage-max: calc(100dvh - var(--nav-h) - 2 * var(--gap) - 48px); }   /* 48px: the chips row under the picture, and its margin */
@media (min-width: 600px) { .live { --stage-max: calc(100dvh - 2 * var(--gap) - 48px); } }   /* the nav is a side rail here: no height of its own */
.live-stage { position: relative; display: grid; place-items: center; background: #000; border-radius: var(--radius);
  overflow: clip; aspect-ratio: 1; inline-size: min(100%, var(--stage-max, 100%)); margin-inline: auto; }
/* absolute, like .ed-stage: a percentage height against the ratio-derived box is indefinite, so the image used to
   keep its own square and spill past the bottom of the stage, where overflow: clip cut it off unreachably */
.live-stage img { position: absolute; inset: 0; inline-size: 100%; block-size: 100%; object-fit: contain; cursor: zoom-in; }
.live-when { display: flex; flex-direction: column; gap: 2px; }
.live-when .live-stamp { font-size: 1.05rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.live-stage .pulse { position: absolute; inset-inline-end: 12px; inset-block-start: 12px; inline-size: 10px; block-size: 10px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 0 var(--ok); }
.live-stage .pulse.stale { background: var(--warn); }
@media (prefers-reduced-motion: no-preference) { .live-stage .pulse:not(.stale) { animation: pulse 2.4s infinite; } }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 70%, transparent); } 70% { box-shadow: 0 0 0 10px transparent; } }
.live-side { display: grid; gap: var(--gap); }

/* -- gallery ---------------------------------------------------------------------------------- */
.thumbs { display: grid; gap: 6px; grid-template-columns: repeat(auto-fill, minmax(clamp(96px, 22cqi, 180px), 1fr)); container-type: inline-size; }
.gallery-body { container-type: inline-size; }
.thumb { position: relative; padding: 0; border: 0; background: #000; border-radius: 8px; overflow: clip; cursor: pointer; aspect-ratio: 1; content-visibility: auto; contain-intrinsic-size: auto 160px; }
.thumb img { inline-size: 100%; block-size: 100%; object-fit: cover; }
.thumb span { position: absolute; inset-inline-start: 4px; inset-block-end: 4px; font-size: 11px; padding: 1px 6px; border-radius: 999px; background: #000a; color: #fff; }
.hour { grid-column: 1 / -1; color: var(--muted); font-size: 13px; padding-block: 8px 2px; border-block-end: 1px solid var(--line); }

/* -- full-screen viewer (dialog) ------------------------------------------------------------ */
dialog.viewer { inline-size: 100vw; block-size: 100dvh; max-inline-size: none; max-block-size: none; margin: 0; padding: 0; border: 0; background: #000; color: #fff; }
dialog.viewer::backdrop { background: #000; }
.viewer-bar { position: absolute; inset-inline: 0; inset-block-start: 0; display: flex; align-items: center; gap: 8px; padding: 8px max(8px, env(safe-area-inset-right)) 8px max(8px, env(safe-area-inset-left));
  background: linear-gradient(#000c, #0000); z-index: 2; }
.viewer-bar .title { flex: 1; font-variant-numeric: tabular-nums; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewer-bar .iconbtn, .viewer-nav .iconbtn { color: #fff; flex: none; min-inline-size: var(--tap); min-block-size: var(--tap); inline-size: auto; }
.viewer-nav { position: absolute; inset-inline: 0; inset-block-end: 0; display: flex; justify-content: center; gap: 12px; padding: 10px 10px max(10px, env(safe-area-inset-bottom)); background: linear-gradient(#0000, #000c); z-index: 2; }
csl-zoom { display: block; position: absolute; inset: 0; overflow: hidden; touch-action: none; user-select: none; cursor: grab; }
csl-zoom img { position: absolute; inset-inline-start: 0; inset-block-start: 0; transform-origin: 0 0; max-inline-size: none; will-change: transform; -webkit-user-drag: none; }

/* -- editor ----------------------------------------------------------------------------------- */
.editor { display: grid; gap: var(--gap); padding: var(--gap); grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto 1fr; }
@media (min-width: 900px) {
  .editor { grid-template-columns: minmax(0, 1fr) minmax(300px, 380px); grid-template-rows: auto 1fr; align-items: start; }
  /* the controls are their own scrolling column, so the picture stays put while a slider is worked */
  .editor .ed-controls { grid-row: 1 / span 2; grid-column: 2; position: sticky; inset-block-start: var(--gap);
    max-block-size: calc(100dvh - 2 * var(--gap)); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; padding-inline-end: 4px; }
  /* the picture, the detection row and the frame strips stay together: one sticky block that scrolls
     inside itself when it is taller than the window, while the controls scroll on their own */
  .editor .ed-view { position: sticky; inset-block-start: var(--gap); max-block-size: calc(100dvh - 2 * var(--gap));
    overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
  .editor .ed-view .ed-stage { inline-size: min(100%, calc(100dvh - 330px)); }
}
.ed-stage { position: relative; background: #000; border-radius: var(--radius); overflow: clip; aspect-ratio: 1; inline-size: min(100%, calc(100dvh - 190px)); margin-inline: auto; }
.ed-stage img { position: absolute; inset: 0; inline-size: 100%; block-size: 100%; object-fit: contain; user-select: none; -webkit-user-drag: none; }
.ed-stage img { -webkit-touch-callout: none; }   /* a long press shows the live look, not the save-image sheet */
.ed-stage .tag.held { background: var(--accent); color: var(--accent-ink); }
.ed-stage .after { clip-path: inset(0 0 0 var(--split, 50%)); }
.ed-stage .divider { position: absolute; inset-block: 0; inset-inline-start: var(--split, 50%); inline-size: 44px; translate: -50% 0; cursor: ew-resize; touch-action: none; display: grid; place-items: center; }
.ed-stage .divider::before { content: ""; position: absolute; inset-block: 0; inline-size: 2px; background: #fff; box-shadow: 0 0 6px #000; }
.ed-stage .divider span { position: relative; inline-size: 34px; block-size: 34px; border-radius: 50%; background: #fff; color: #000; display: grid; place-items: center; font-size: 13px; box-shadow: 0 1px 6px #0008; }
.ed-stage .tag { position: absolute; inset-block-start: 8px; padding: 2px 8px; border-radius: 999px; background: #000a; color: #fff; font-size: 12px; }
.ed-stage .tag.l { inset-inline-start: 8px; } .ed-stage .tag.r { inset-inline-end: 8px; }
.ed-stage .busy { position: absolute; inset-inline-end: 10px; inset-block-end: 10px; font-size: 12px; background: #000a; color: #fff; padding: 2px 8px; border-radius: 999px; }
.filmstrip { display: flex; gap: 6px; overflow-x: auto; padding-block-end: 4px; scrollbar-width: thin; }
.filmstrip button { flex: none; inline-size: 72px; aspect-ratio: 1; padding: 0; border: 2px solid transparent; border-radius: 8px; overflow: clip; background: #000; cursor: pointer; position: relative; }
.filmstrip button[aria-pressed="true"] { border-color: var(--accent); }
.filmstrip img { inline-size: 100%; block-size: 100%; object-fit: cover; }
.filmstrip span { position: absolute; inset-inline: 0; inset-block-end: 0; font-size: 10px; background: #000a; color: #fff; }
.ed-controls { display: grid; gap: 10px; align-content: start; }
.ed-actions { display: grid; gap: 4px; position: sticky; inset-block-start: 0; background: var(--bg); padding-block: 6px; z-index: 1; }
details.stage { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
details.stage > summary { list-style: none; display: flex; align-items: center; gap: 10px; min-block-size: 48px; padding: 0 14px; cursor: pointer; font-weight: 600; }
details.stage > summary::-webkit-details-marker { display: none; }
details.stage > summary::after { content: "›"; margin-inline-start: auto; color: var(--muted); transition: rotate .15s; }
details.stage[open] > summary::after { rotate: 90deg; }
details.stage .body { padding: 4px 14px 14px; display: grid; gap: 14px; }
.stage-facts { font-size: 12.5px; color: var(--muted); font-family: var(--mono); }
.field { display: grid; gap: 4px; }
.field-head { display: flex; align-items: center; gap: 8px; }
.field-head label { flex: 1; font-size: 14px; }
.field-head .reset { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 12px; min-block-size: 28px; }
.field-help { font-size: 12.5px; color: var(--muted); }
.field.changed .field-head label::after { content: " •"; color: var(--accent); }
.slider { display: grid; grid-template-columns: 1fr 5.5em; gap: 10px; align-items: center; }
.slider.solo { grid-template-columns: minmax(0, 9em); }
.slider input[type=number] { inline-size: 100%; min-block-size: var(--tap); padding: 0 8px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface-2); text-align: end; font-variant-numeric: tabular-nums; }
input[type=range] { inline-size: 100%; min-block-size: var(--tap); accent-color: var(--accent); cursor: pointer; }
.switch { display: inline-flex; align-items: center; gap: 10px; min-block-size: var(--tap); cursor: pointer; }
.switch input { inline-size: 42px; block-size: 24px; accent-color: var(--accent); }
.phased { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; }
select { min-block-size: var(--tap); border-radius: 8px; border: 1px solid var(--line); background: var(--surface-2); padding: 0 10px; }

/* -- login -------------------------------------------------------------------------------------- */
.login { min-block-size: 80dvh; display: grid; place-items: center; padding: var(--gap); }
.login form { inline-size: min(100%, 360px); display: grid; gap: 12px; }
.login input { min-block-size: 48px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); }
.login .err { color: var(--bad); min-block-size: 1.4em; margin: 0; }

/* -- status ----------------------------------------------------------------------------------- */
.status .sect { margin-block: calc(var(--gap) * 1.6) var(--gap); }
.status h2.sect, .status .sect h2 { margin-block-end: 0; }
.tiles { display: grid; gap: var(--gap); grid-template-columns: repeat(auto-fill, minmax(min(100%, 160px), 1fr)); }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; display: grid; gap: 2px; align-content: start; }
.tile-label { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.tile-value { font-size: clamp(17px, 1.2vw + 10px, 20px); font-weight: 600; font-variant-numeric: tabular-nums; }
.tile-sub { font-size: 12.5px; }
.tile.bad { border-color: color-mix(in srgb, var(--bad) 60%, var(--line)); }
.tile.warn { border-color: color-mix(in srgb, var(--warn) 50%, var(--line)); }
.dot { inline-size: 10px; block-size: 10px; border-radius: 50%; background: var(--muted); flex: none; display: inline-block; }
.dot.ok { background: var(--ok); } .dot.warn { background: var(--warn); } .dot.bad { background: var(--bad); }
.t-warn { color: var(--warn); } .t-bad { color: var(--bad); } .t-ok { color: var(--ok); }
.node-card .note.now { font-weight: 600; font-size: 13.5px; }
.meter { display: block; block-size: 6px; border-radius: 3px; background: var(--surface-2); overflow: clip; margin-block: 6px 4px; }
.meter > span { display: block; block-size: 100%; background: var(--accent); }
.node-card { color: inherit; text-decoration: none; display: grid; gap: 8px; align-content: start; }
.node-card:hover { border-color: var(--accent); }
.node-card h3 { display: flex; align-items: center; gap: 8px; margin: 0; flex-wrap: wrap; }
.node-card .host { font-weight: 400; font-size: 13px; }
/* pinned to the card's top right, stacked (button over the hours / the countdown), out of the
   flow entirely so rendering or switching state never reflows the card */
.node-card { position: relative; }
.node-card .pausebox { position: absolute; inset-block-start: 10px; inset-inline-end: 12px; z-index: 2;
  display: flex; flex-direction: column; align-items: flex-end; gap: 4px; font-weight: 400; }
.pausebox .btn, .pausebox .sel { min-block-size: 28px; padding: 2px 10px; font-size: 12.5px; }
.pausebox .t-warn { text-align: end; }
.node-card h3 { padding-inline-end: 96px; }
.node-card .thumbline { display: flex; gap: 12px; align-items: flex-start; }
.node-card .thumbline img, .node-card .noimg { inline-size: 104px; aspect-ratio: 1; object-fit: cover; border-radius: 8px; background: #000; flex: none; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px 12px; margin: 0; }
.stats dt { font-size: 12px; color: var(--muted); }
.stats dd { margin: 0; font-variant-numeric: tabular-nums; }
.stats.lead { grid-template-columns: 1fr; align-content: start; }
.stats.lead dd { font-size: 17px; font-weight: 600; }
.node-card .note { margin: 0; font-size: 12.5px; }
.chart-grid { display: grid; gap: var(--gap); grid-template-columns: repeat(auto-fill, minmax(min(100%, 460px), 1fr)); }
.chart-card { padding: 12px 10px 6px; min-inline-size: 0; }
.chart-card h3 { font-size: 15px; margin: 0 4px 6px; }
.chart { inline-size: 100%; min-block-size: 220px; }
.chart .u-legend { font-size: 12px; text-align: start; }
.chart .u-legend .u-series { padding: 2px 6px; }
tr.total td { font-weight: 600; }
.event-list { list-style: none; margin: 0; padding: 0; display: grid; }
.event-list li { display: grid; grid-template-columns: auto auto 1fr auto; gap: 4px 10px; align-items: baseline; padding: 8px 2px; border-block-end: 1px solid var(--line); font-size: 14px; }
.event-list .ev-node { font-family: var(--mono); font-size: 12.5px; color: var(--muted); }
.event-list time { font-size: 12.5px; white-space: nowrap; }
.events .more { margin-block-start: 10px; }
.event-list .ev-msg { overflow-wrap: anywhere; }
@media (max-width: 560px) { .event-list li { grid-template-columns: auto auto 1fr; } .event-list .ev-msg { grid-column: 1 / -1; order: 5; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
/* editor on a phone: the picture stays in view while the controls scroll under it */
@media (max-width: 899px) {
  .editor .ed-view { position: sticky; inset-block-start: 0; z-index: 2; background: var(--bg); padding-block-end: 6px; }
  .editor .ed-stage { inline-size: min(100%, 44dvh); }
  .editor .page-head h1 { font-size: 1.3rem; }
}
dialog:not(.viewer) { padding: 18px; }
dialog:not(.viewer)::backdrop { background: #0009; }

/* -- settings ----------------------------------------------------------------------------------- */
.settings-bar { position: sticky; inset-block-start: 0; z-index: 3; display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  background: var(--bg); padding-block: 8px; margin-block-end: 8px; }
.settings-bar { max-inline-size: 820px; }
.settings-bar .actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.settings-bar .actions[hidden] { display: none; }
.settings-bar .search { flex: 1 1 260px; min-block-size: var(--tap); padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface-2); }
.settings-list { display: grid; gap: 10px; max-inline-size: 820px; }
details.stage.sub { background: var(--surface-2); }
details.stage.sub > summary { min-block-size: 44px; font-weight: 500; }
details.stage > summary .count { font-weight: 400; font-size: 13px; }
.field input.text, .field textarea.json { inline-size: 100%; min-block-size: var(--tap); padding: 6px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface-2); }
.field textarea.json { font-family: var(--mono); font-size: 13px; resize: vertical; }
.field [aria-invalid="true"] { border-color: var(--bad); }
.field-head .badge { margin-inline-start: auto; }
dialog.sheet { max-inline-size: min(680px, 94vw); border: 1px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--text); }

/* -- system ------------------------------------------------------------------------------------- */
.sys-grid { display: grid; gap: var(--gap); grid-template-columns: repeat(auto-fit, minmax(min(100%, 440px), 1fr)); align-items: start; }
.sys-col { display: grid; gap: var(--gap); min-inline-size: 0; }
.card.sys { min-inline-size: 0; }
.card.sys h2 { font-size: 17px; }
.nowrap { white-space: nowrap; }
.card.sys h3 { font-size: 15px; margin-block: 14px 8px; }
.small { font-size: 13px; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-block-start: 12px; }
.row.end { justify-content: flex-end; }
.links { margin: 0; padding-inline-start: 18px; display: grid; gap: 8px; }
.disk { display: flex; gap: 14px; align-items: center; margin-block-end: 10px; }
.disk-num { font-size: 28px; font-weight: 650; font-variant-numeric: tabular-nums; }
.disk-bar { flex: 1; display: grid; gap: 4px; }
.meter.tall { block-size: 10px; position: relative; overflow: visible; }
.meter.tall > span { border-radius: 5px; }
.meter .mark { position: absolute; inset-block: -3px; inline-size: 2px; background: var(--warn); }
.meter .mark.crit { background: var(--bad); }
table.compact td { padding-block: 5px; }
details.log summary { cursor: pointer; color: var(--muted); font-size: 12.5px; }
details.log pre { white-space: pre-wrap; font-size: 11.5px; max-block-size: 240px; overflow: auto; background: var(--surface-2); padding: 8px; border-radius: 8px; }
.form { display: grid; gap: 12px; }
.form label { display: grid; gap: 4px; font-size: 14px; }
.form select, .form input.text { min-block-size: var(--tap); }
.form input.text { padding: 0 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface-2); }
.boxes { display: flex; flex-wrap: wrap; gap: 4px 18px; }

/* -- sky report --------------------------------------------------------------------------------- */
.sky .chips { margin-block-end: var(--gap); }
.sky-grid { display: grid; gap: var(--gap); grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); align-items: start; }
.sky-grid .wide { grid-column: 1 / -1; }
.verdict { display: grid; gap: 10px; }
.verdict-word { font-size: clamp(28px, 4vw + 12px, 40px); font-weight: 700; line-height: 1.1; }
.verdict.ok .verdict-word { color: var(--ok); } .verdict.warn .verdict-word { color: var(--warn); } .verdict.bad .verdict-word { color: var(--muted); }
.verdict .stats dd { font-size: 17px; font-weight: 600; }
.verdict .stats.sun dd { font-size: 15px; font-weight: 500; }
.strip-wrap { display: grid; gap: 2px; }
.strip { display: flex; block-size: 26px; border-radius: 6px; overflow: clip; }
.strip i, .legend i { flex: 1; display: block; }
.strip-ticks { position: relative; block-size: 16px; font-size: 11px; color: var(--muted); }
.strip-ticks span { position: absolute; translate: -50% 0; white-space: nowrap; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12px; color: var(--muted); margin-block-start: 4px; }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend i { inline-size: 12px; block-size: 12px; border-radius: 3px; flex: none; }
.c-day { background: #6f8fb8; } .c-twilight { background: #34466b; } .c-dark { background: #1c2436; }
.c-clear { background: #1f7a55; } .c-partly { background: #8a7a2e; } .c-cloudy { background: #545b66; }
.c-none { background: repeating-linear-gradient(45deg, transparent 0 3px, var(--line) 3px 5px); }
.best { display: grid; gap: 6px; padding: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: clip; cursor: zoom-in; color: var(--muted); font-size: 13px; text-align: start; }
.best img { inline-size: 100%; aspect-ratio: 1; object-fit: cover; background: #000; }
.best span { padding: 0 12px 10px; }

/* -- reports ------------------------------------------------------------------------------------ */
.reports .sect { margin-block: calc(var(--gap) * 1.6) var(--gap); }
.report-table table { font-size: 14px; }
.report-table th, .report-table td { white-space: nowrap; }
.report-table tbody th { position: sticky; inset-inline-start: 0; background: var(--bg); font-weight: 500; color: var(--text); font-size: 14px; }
.report-table thead th:first-child { position: sticky; inset-inline-start: 0; background: var(--bg); }
.links-card { display: grid; gap: 10px; }
.navlink { position: relative; }
.navbadge { position: absolute; inset-block-start: 6px; inset-inline-start: calc(50% + 6px); min-inline-size: 18px; block-size: 18px; padding: 0 5px;
  border-radius: 9px; background: var(--bad); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; line-height: 1; }
@media (min-width: 1100px) { .navbadge { position: static; margin-inline-start: auto; } }

/* -- timelapses --------------------------------------------------------------------------------- */
.timelapse .sect { margin-block: calc(var(--gap) * 1.4) var(--gap); }
.tl-grid { display: grid; gap: var(--gap); grid-template-columns: minmax(0, 1fr); }
@media (min-width: 1000px) { .tl-grid { grid-template-columns: minmax(0, 1fr) 340px; } .tl-keo { grid-column: 1 / -1; } }
.tl-video { inline-size: 100%; max-block-size: calc(100dvh - 200px); aspect-ratio: 1; background: #000; border-radius: var(--radius); }
.tl-side { display: grid; gap: 8px; align-content: start; }
.tl-side h2 { margin: 0; }
.tl-trails { padding: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: clip; cursor: zoom-in; display: grid; color: var(--muted); font-size: 13px; text-align: start; }
.tl-trails img { inline-size: 100%; aspect-ratio: 1; object-fit: cover; background: #000; }
.tl-trails span { padding: 6px 10px; }
.tl-keo { margin: 0; display: grid; gap: 4px; }
.tl-keo img { inline-size: 100%; block-size: 140px; object-fit: fill; border-radius: 8px; background: #000; }
.keo-wrap { position: relative; }
.keo-wrap.pick { cursor: crosshair; }
.keo-band { position: absolute; inset-block: 0; background: color-mix(in srgb, var(--accent, #4a8) 22%, transparent); border-inline: 1px solid var(--accent, #4a8); pointer-events: none; border-radius: 2px; }
.keo-mark { position: absolute; inset-block: 0; inline-size: 0; border-inline-start: 2px solid #ffd54a; pointer-events: none; }
.keo-mark.dark { border-color: #9cc3ff; }
.keo-mark.picked { border-color: #ff7ad9; border-style: dashed; }
.keo-mark b { position: absolute; inset-block-start: 4px; inset-inline-start: 4px; white-space: nowrap; font: 600 11px/1.3 system-ui, sans-serif; color: #fff; background: rgba(0, 0, 0, .6); padding: 1px 5px; border-radius: 4px; }
.keo-mark.dark b { inset-block-start: auto; inset-block-end: 4px; }
.keo-mark.picked b { inset-block-start: 40%; }
.tl-derot { grid-column: 1 / -1; display: grid; gap: var(--gap); }
.tl-derot .sect { margin: 8px 0 0; }
.tl-derot-grid { display: grid; gap: var(--gap); grid-template-columns: minmax(0, 1fr); }
@media (min-width: 1000px) { .tl-derot-grid { grid-template-columns: minmax(0, 1fr) 340px; } }
.tl-derot-list .btn[aria-pressed="true"] { border-color: var(--accent, #4a8); }
.tl-earth { display: grid; gap: 8px; }
.tl-earth .tl-video { aspect-ratio: auto; max-inline-size: 1280px; }
.tl-ring-box { display: grid; gap: 6px; }
.tl-ring { display: block; inline-size: 100%; aspect-ratio: 16 / 9; max-block-size: calc(100dvh - 200px); background: #000; border-radius: var(--radius); touch-action: pan-y; cursor: grab; }
@media (max-width: 600px) { .tl-ring { aspect-ratio: 1; } }      /* a phone shows about 130°, not a 200 px sliver */
.tl-ring:active { cursor: grabbing; }
.tl-ring:focus-visible { outline: 2px solid var(--accent, #6af); outline-offset: 2px; }
.tl-ring-src { position: absolute; inline-size: 1px; block-size: 1px; opacity: 0; pointer-events: none; }
.tl-ring-box input[type="range"] { flex: 1 1 160px; }
.tl-list { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); }
.tl-night { display: grid; gap: 6px; padding: 8px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--text); cursor: pointer; text-align: start; }
.tl-night[aria-pressed="true"] { border-color: var(--accent); }
.tl-night img, .tl-night .noimg { inline-size: 100%; block-size: 56px; object-fit: fill; border-radius: 6px; background: #000; display: block; }
.tl-label { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; }
.tl-build .row { margin-block-start: 0; }
.tl-admin { margin-block-start: var(--gap); }
.chip.keo { display: grid; gap: 4px; padding: 6px 10px; border-radius: 12px; min-inline-size: 140px; text-align: start; }
.chip.keo img { inline-size: 100%; block-size: 28px; object-fit: fill; border-radius: 4px; background: #000; }
.sr-only { position: absolute; inline-size: 1px; block-size: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
h2.h3 { font-size: 15px; margin: 0 4px 6px; }
.field.planned { opacity: .7; }
/* Process: histogram of the picture being judged. Sized to the stage so the two line up. */
.hist { margin-block-start: 8px; padding: 8px 10px; }
.hist .hist-canvas { inline-size: 100%; block-size: 96px; display: block; border-radius: 4px;
  background: color-mix(in srgb, var(--fg) 6%, transparent); }
@media (max-width: 900px) { .hist .hist-canvas { block-size: 72px; } }

.ed-quad { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; inline-size: min(100%, calc(100dvh - 190px)); margin-inline: auto; }
.ed-quad figure { margin: 0; position: relative; aspect-ratio: 1; background: #000; border-radius: 10px; overflow: clip; }
.ed-quad img { inline-size: 100%; block-size: 100%; object-fit: contain; }
.ed-quad figcaption { position: absolute; inset-block-start: 6px; inset-inline-start: 6px; padding: 1px 8px; border-radius: 999px; background: #000a; color: #fff; font-size: 12px; }
.ed-quad.draft figcaption::after { content: " · draft"; color: var(--accent); }
.filmstrip button.sample span { background: color-mix(in srgb, var(--accent) 45%, #000); font-weight: 600; }
@media (max-width: 899px) { .editor .ed-quad { inline-size: min(100%, 44dvh); } }
.btn:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
kbd { font-family: var(--mono); font-size: .85em; padding: 1px 5px; border: 1px solid var(--line); border-block-end-width: 2px; border-radius: 4px; background: var(--surface-2); }
.keys-hint { margin: 0; }
@media (pointer: coarse) { .keys-hint { display: none; } }
.lat-grid { display: grid; gap: 0 calc(var(--gap) * 2); grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); }
.stage-bars { display: grid; gap: 6px; font-size: 14px; }
.stage-bar { display: grid; grid-template-columns: 8.5em 1fr 5em; gap: 10px; align-items: center; }
.stage-bar .bar { block-size: 10px; background: var(--surface-2); border-radius: 5px; overflow: clip; }
.stage-bar .bar i { display: block; block-size: 100%; background: var(--accent); }
.stage-bar .num { text-align: end; font-variant-numeric: tabular-nums; }
.stage-bar.total { font-weight: 600; border-block-start: 1px solid var(--line); padding-block-start: 6px; }
.skymap-wrap { display: flex; gap: 12px; align-items: center; margin-block-start: 10px; }
.skymap-wrap:has(.skymap[hidden]) { display: none; }
/* the admin's gear under the details, and the overlay field editor it opens (views/live.js) */
.live-tools { display: flex; justify-content: flex-end; margin-block-start: 6px; }
.live-tools .iconbtn { color: var(--muted); }
.live-tools .iconbtn[aria-pressed="true"] { color: var(--accent); background: var(--surface-2); }
.live-editor { min-inline-size: 0; }
.live-editor-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.live-editor-head code { font-size: 12px; }
.live-editor .ov-field { min-inline-size: 0; }
.live-editor .row { flex-wrap: wrap; align-items: center; }
.skymap { display: grid; grid-template-columns: repeat(var(--n, 6), 1fr); gap: 2px; inline-size: 96px; aspect-ratio: 1; border-radius: 50%; overflow: clip; background: var(--surface-2); flex: none; }
.skymap i { display: block; }
.skymap i.clear { background: var(--accent); }
.skymap i.cloud { background: var(--muted); }
.skymap i.none { background: transparent; }

/* -- overlays editor (views/overlays.js) ---------------------------------------------------- */
.ov-stage { touch-action: none; }
.ov-shadowed { border-color: var(--warn); color: var(--warn); }
.ov-handles { position: absolute; inset: 0; }
.ov-handle { position: absolute; border: 1.5px dashed #fff9; border-radius: 4px; cursor: move; box-shadow: 0 0 0 1px #0008; touch-action: none; }
.ov-handle:hover, .ov-handle:focus-visible { border-color: var(--accent); border-style: solid; outline: none; }
.ov-handle.sel { border-color: var(--accent); border-style: solid; box-shadow: 0 0 0 1px #0008, 0 0 0 3px color-mix(in srgb, var(--accent) 35%, transparent); }
.ov-handle.drag { opacity: .85; }
.ov-fields { display: grid; gap: 6px; margin-block-start: 10px; }
.ov-field, .ov-blade { border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); }
.ov-blade { margin-block-start: 8px; }
.ov-field > summary, .ov-blade > summary { display: flex; align-items: center; gap: 8px; min-block-size: var(--tap); padding: 0 10px; cursor: pointer; list-style: none; }
.ov-field > summary::-webkit-details-marker, .ov-blade > summary::-webkit-details-marker { display: none; }
.ov-field > summary code { font-size: 12px; }
.ov-field .ov-tpl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-inline-size: 0; }
.ov-field[open] > summary .ov-tpl, .ov-blade[open] > summary .ov-tpl { display: none; }
.ov-field .body, .ov-blade > .body { padding: 4px 10px 10px; }
.ov-field .body { display: grid; gap: 8px; }
.ov-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; align-items: end; }
.ov-num { display: grid; gap: 3px; min-inline-size: 0; }
.ov-num.wide { grid-column: 1 / -1; }
.ov-num input[type=number], .ov-num input[type=text], .ov-num select { inline-size: 100%; min-block-size: var(--tap); padding: 0 8px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); }
.ov-num input[type=color] { inline-size: 100%; min-block-size: var(--tap); padding: 2px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); }
.ov-chks { display: flex; gap: 12px; align-items: center; min-block-size: var(--tap); }
.ov-chk { display: inline-flex; gap: 6px; align-items: center; }
.ov-out { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; align-items: center; margin-block-start: 8px; }
.ov-vars .chips.wrap { flex-wrap: wrap; overflow: visible; }
.ov-vars .chip.small { min-block-size: 30px; padding: 0 10px; font-size: 12px; font-family: ui-monospace, monospace; }
.ov-vars summary { cursor: pointer; min-block-size: var(--tap); display: flex; align-items: center; }
.overlays .ed-controls, .overlays .card, .ov-field { min-inline-size: 0; }
.overlays .row { flex-wrap: wrap; }
.ov-out select { min-inline-size: 0; inline-size: 100%; }

/* -- node health chips and the report sheet (views/nodehealth.js) -------------------------- */
.node-card h3 a.plain { color: inherit; text-decoration: none; }
.node-card h3 a.plain:hover { text-decoration: underline; }
.node-card .thumbline > a { flex: none; display: block; }
.health-chips { flex-wrap: wrap; overflow: visible; gap: 6px; }
.chip.health { min-block-size: 30px; padding: 0 10px 0 8px; font-size: 12.5px; display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.chip.health .dot { inline-size: 8px; block-size: 8px; }
.chip.health .dot.none { background: var(--line); }
.chip.health.ok { border-color: color-mix(in srgb, var(--ok) 45%, var(--line)); }
.chip.health.warn { border-color: var(--warn); color: var(--warn); }
.chip.health.bad { border-color: var(--bad); color: var(--bad); }
.chip.health.stale { opacity: .6; }
dialog.health-sheet { max-inline-size: min(760px, 94vw); }
.health-grid { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .health-grid { grid-template-columns: 270px 1fr; } }
.health-sheet h3 { margin: 10px 0 6px; font-size: 14px; color: var(--muted); }
.stats.two { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.skyplot { inline-size: 100%; max-inline-size: 270px; display: block; margin-inline: auto; }
.skyplot .ring { fill: none; stroke: var(--line); stroke-width: 1; }
.skyplot .compass { fill: var(--muted); font-size: 11px; }
.skyplot .sat circle { fill: none; stroke: var(--muted); stroke-width: 1.5; }
.skyplot .sat.used circle { fill: var(--accent); stroke: var(--accent); fill-opacity: .85; }
.skyplot .sat.silent circle { stroke-dasharray: 2 2; opacity: .5; }
.skyplot .sat text { fill: var(--text); font-size: 9px; }
.chips .spacer { flex: 1; min-inline-size: 8px; }
.chips > select { flex: none; }

/* -- star map over a picture (views/starmap.js) --------------------------------------------- */
.live-stage .starmap, .ed-stage .starmap { position: absolute; inset: 0; inline-size: 100%; block-size: 100%; pointer-events: none; }
.starmap .sm-grid polyline { fill: none; stroke: #8fd3ff; stroke-opacity: .35; stroke-width: 1; vector-effect: non-scaling-stroke; stroke-dasharray: 3 4; }
.starmap .sm-cardinals text { fill: #8fd3ff; font-size: .022px; font-weight: 700; paint-order: stroke; stroke: #000a; stroke-width: .004px; }
.starmap .sm-star circle { fill: none; stroke: #ffe9a8; stroke-width: 1.2; vector-effect: non-scaling-stroke; }
.starmap .sm-star text, .starmap .sm-planet text, .starmap .sm-moon text, .starmap .sm-sun text { fill: #ffe9a8; font-size: .013px; paint-order: stroke; stroke: #000c; stroke-width: .003px; }
.starmap .sm-planet text { fill: #ffd28a; }
.starmap .sm-planet circle { stroke: #000a; stroke-width: 1; vector-effect: non-scaling-stroke; }
.starmap .sm-moon circle { fill: none; stroke: #fff; stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.starmap .sm-sun circle { fill: none; stroke: #ffd400; stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.starmap .sm-star, .starmap .sm-planet { pointer-events: auto; }
.starmap .sm-sat path { fill: #7fe3ff; stroke: #000a; stroke-width: 1; vector-effect: non-scaling-stroke; }
.starmap .sm-sat.shadow path { fill: none; stroke: #7fe3ff; }
.starmap .sm-sat text { fill: #7fe3ff; font-size: .013px; paint-order: stroke; stroke: #000c; stroke-width: .003px; }
.starmap .sm-sat { pointer-events: auto; }
.sm-adjust { margin-block-start: 8px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); padding: 0 12px; }
.sm-adjust > summary { min-block-size: var(--tap); display: flex; align-items: center; cursor: pointer; font-weight: 600; }
.sm-adjust .sm-form { display: grid; gap: 8px; padding-block: 4px 12px; }
.sm-adjust .sm-prov { margin: 0; }
.sm-adjust output { font-variant-numeric: tabular-nums; color: var(--text); }
.field .own-tag { display: inline-flex; align-items: center; gap: 4px; margin-inline-start: auto; }
.field.own .field-head label { color: var(--accent); }
.scope-row { margin-block-start: 0; align-items: center; }
.scope-row .seg button { padding-inline: 10px; font-size: 13px; }
.btn.small { min-block-size: 32px; padding-inline: 12px; font-size: 13px; font-family: var(--font, inherit); }

/* -- overlay text field: colour by state, completion list --------------------------------- */
.tpl-wrap { position: relative; }
.ov-num input.tpl.good { border-color: var(--ok); }
.ov-num input.tpl.warn { border-color: var(--warn); }
.ov-num input.tpl.bad { border-color: var(--bad); box-shadow: 0 0 0 2px color-mix(in srgb, var(--bad) 25%, transparent); }
.tpl-msg { display: block; min-block-size: 16px; margin-block-start: 2px; }
.tpl-list { position: absolute; inset-inline: 0; inset-block-start: calc(100% - 18px); z-index: 5; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 6px 20px #0004; max-block-size: 240px; overflow-y: auto; }
.tpl-list [role=option] { display: flex; gap: 8px; align-items: baseline; padding: 6px 10px; cursor: pointer; min-block-size: 32px; }
.tpl-list [role=option].active, .tpl-list [role=option]:hover { background: var(--surface-2); }
.tpl-list code { font-size: 12.5px; flex: none; }

/* the on/off switch in a stage blade's header (Process): readable while the blade is closed */
details.stage > summary .hd-switch { display: inline-flex; inline-size: 22px; block-size: 22px; align-items: center; justify-content: center; flex: none; cursor: pointer; }
details.stage > summary .hd-switch input { inline-size: 20px; block-size: 20px; margin: 0; accent-color: var(--ok); cursor: pointer; }
details.stage > summary .hd-switch.changed input { accent-color: var(--warn); outline: 2px solid var(--warn); outline-offset: 1px; border-radius: 3px; }
details.stage > summary .hd-switch.none { visibility: hidden; }
.changes-note { block-size: 20px; line-height: 20px; overflow: hidden; padding-inline: 2px; }
.strips { display: grid; gap: 6px; margin-block-start: 6px; }
.strip-row { display: grid; gap: 3px; }
.strip-label b { font-weight: 600; color: var(--fg); }

.chips.hours { margin-block-start: 8px; }
.chips.hours .chip small { color: var(--muted); margin-inline-start: 2px; }

.sm-opacity { inline-size: 110px; accent-color: var(--accent); }

.sm-layers { margin-block-start: 6px; gap: 6px 12px; align-items: center; }
.sm-layer { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; color: var(--muted); cursor: pointer; }
.sm-layer input[type=checkbox] { accent-color: var(--accent); inline-size: 16px; block-size: 16px; margin: 0; }
.sm-layer input[type=number] { inline-size: 58px; padding: 2px 4px; font-size: 13px; }
.starmap .sm-dso ellipse { fill: none; stroke: #b8f0c8; stroke-width: 1.2; stroke-dasharray: 2 2; vector-effect: non-scaling-stroke; }
.starmap .sm-dso text { fill: #b8f0c8; font-size: .012px; paint-order: stroke; stroke: #000c; stroke-width: .003px; }
.starmap .sm-dso.galaxy ellipse { stroke: #f2c4ff; } .starmap .sm-dso.galaxy text { fill: #f2c4ff; }
.starmap .sm-dso.nebula ellipse { stroke: #ffb3b3; } .starmap .sm-dso.nebula text { fill: #ffb3b3; }
.live-stage.sm-pointing, .ed-stage.sm-pointing { cursor: crosshair; outline: 2px dashed var(--accent); outline-offset: -2px; }

/* overlays: the compass card */
.ov-compass .ov-row { margin-block-start: 6px; }
.ov-compass input.text { inline-size: 7em; }
.ov-handle.compass { border-radius: 999px; border-color: #ffd166aa; }
.ov-off { display: block; margin-block-start: 2px; min-block-size: 1em; }
.ov-off .link { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; font: inherit; text-decoration: underline; }
.ov-ring { position: absolute; border: 1px dashed #ffd16688; border-radius: 50%; pointer-events: none; }
.ov-centre { position: absolute; inline-size: 28px; block-size: 28px; border-radius: 50%; border: 2px solid #ffd166; box-shadow: 0 0 0 1px #0008, inset 0 0 0 1px #0008; cursor: move; touch-action: none; background: radial-gradient(circle, #ffd166 2px, transparent 3px); }
.ov-centre:hover, .ov-centre:focus-visible { border-color: var(--accent); outline: none; }

/* live: detected stars */
.live-stars .st-star { fill: none; stroke: #7CFC9A; stroke-width: 1.2; vector-effect: non-scaling-stroke; }
.live-stars .st-hot { fill: none; stroke: #ff5a5a; stroke-width: 1; vector-effect: non-scaling-stroke; }
/* Process: the processing region boundary. The mask faint, the region inside it picked out --
   the gap between them is what the measurements and the look are ignoring. */
.live-stage .region-ring, .ed-stage .region-ring { position: absolute; inset: 0; inline-size: 100%;
  block-size: 100%; pointer-events: none; }
.region-ring .rr-mask { fill: none; stroke: #ffffff40; stroke-width: 1; vector-effect: non-scaling-stroke; }
.region-ring .rr-region { fill: none; stroke: #ffb44c; stroke-width: 1.5; stroke-dasharray: 6 5;
  vector-effect: non-scaling-stroke; }

.live-stars .st-edge { fill: none; stroke: #7CFC9A66; stroke-width: 1; stroke-dasharray: 4 4; vector-effect: non-scaling-stroke; }
.live-stars .st-noise { fill: none; stroke: #ffffff66; stroke-width: 1; vector-effect: non-scaling-stroke; }
.live-stars .st-bad { fill: none; stroke: #ff2db0; stroke-width: 1.4; vector-effect: non-scaling-stroke; }
.live-stars .st-shape { fill: none; stroke: #ffd400; stroke-width: 1; vector-effect: non-scaling-stroke; }
.live-picks { pointer-events: none; }
.live-picks .st-pick circle { fill: none; stroke: #ff7ad9; stroke-width: 2; vector-effect: non-scaling-stroke; }
.live-picks .st-pick text { fill: #ff7ad9; font-size: .014px; font-weight: 700; paint-order: stroke; stroke: #000c; stroke-width: .003px; }
.live-stage.st-picking img, .ed-stage.st-picking img { cursor: crosshair; }
.ed-stage.st-picking .divider { display: none; }
.detect-tools { margin-block-start: 8px; }
.st-profile { margin-block-start: 8px; }
.st-table { border-collapse: collapse; font-size: .85em; margin: 6px 0; }
.st-table th, .st-table td { padding: 2px 8px; text-align: right; }
.st-table th:first-child, .st-table td:first-child { text-align: left; }
.st-head { align-items: center; margin-block-start: 0; flex-wrap: wrap; }
.st-head strong { margin-inline-end: 8px; }
.st-profile .warn { color: var(--warn, #c77700); margin: 2px 0; }

/* Which phase anchor the frame on screen actually resolves. The anchors blend by weight, so a
   daytime frame leaves the night and moon values genuinely inert -- without this the slider
   looks broken. The lead anchor is ringed; any anchor with weight gets the dot. */
.phased .seg button.phase-live { color: var(--text); }
.phased .seg button.phase-live::after {
  content: ""; display: inline-block; inline-size: 5px; block-size: 5px; border-radius: 50%;
  background: var(--accent, currentColor); margin-inline-start: 4px; vertical-align: 2px;
}
.phased .seg button.phase-lead { box-shadow: inset 0 0 0 1px var(--accent, currentColor); }
.phase-now { margin-inline-start: 8px; white-space: nowrap; }

/* the nightly review on Reports */
.review .props { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 10px; }
.review .prop { padding: 8px 10px; border-inline-start: 3px solid var(--muted); }
.review .prop.setting { border-color: var(--accent, var(--warn)); }
.review .prop.action { border-color: var(--warn); }
.review .prop p { margin: 4px 0 6px; }
.review .prop pre { font-size: 11px; max-height: 12em; overflow: auto; margin: 4px 0 0; }
.chip.bright { display: inline-flex; align-items: center; gap: 6px; margin-inline-start: auto; }
.chip.bright input[type="range"] { inline-size: 110px; flex: none; }
.chip.bright .bright-out { display: inline-block; min-inline-size: 4.5ch; text-align: end; font-variant-numeric: tabular-nums; }
.chip.bright .bright-sun { cursor: pointer; user-select: none; }
.review .regimes { font-size: 0.85em; margin: 8px 0; border-collapse: collapse; }
.review .regimes th, .review .regimes td { padding: 2px 10px 2px 0; text-align: left; }
.review .regimes td.num { text-align: right; font-variant-numeric: tabular-nums; }

/* the 360° panorama under the Live picture: full width on a desk, scroll sideways on a phone */
.pano-strip { margin-block-start: 8px; overflow-x: auto; overscroll-behavior-x: contain; background: #000; border-radius: var(--radius); scrollbar-width: thin; }
.pano-strip img { display: block; inline-size: max(100%, 900px); max-inline-size: none; block-size: auto; aspect-ratio: 2400 / 633; cursor: zoom-in; }
.pano-strip:focus-visible { outline: 2px solid var(--accent, #6af); outline-offset: 2px; }

/* the panoramic timelapse under the keogram: as wide as the page, scroll sideways when narrow */
.tl-pano { margin: 12px 0 0; overflow-x: auto; }
.tl-pano video { display: block; inline-size: max(100%, 760px); block-size: auto; background: #000; border-radius: var(--radius); }

/* the 360° dome viewer: the canvas fills the viewer dialog under its bars */
dialog.dome .dome-canvas { position: absolute; inset: 0; inline-size: 100%; block-size: 100%; display: block; touch-action: none; cursor: grab; outline: none; }
dialog.dome .dome-canvas:active { cursor: grabbing; }
dialog.dome .viewer-bar { z-index: 2; }
dialog.dome .dome-map { position: absolute; inset: 0; inline-size: 100%; block-size: 100%; pointer-events: none; }
dialog.dome .dome-dir { color: #ccd; font-variant-numeric: tabular-nums; white-space: nowrap; }
.dome-nogl { padding: 80px 20px; text-align: center; }

/* -- gallery: the picture big like Live, the management and the roll down the right side ------- */
.gal { display: grid; gap: var(--gap); padding: var(--gap); container-type: inline-size; }
.gal-main { min-inline-size: 0; display: grid; gap: 10px; justify-items: stretch; align-content: start; }
.gal-head { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; }
.gal-head .spacer { flex: 1; min-inline-size: 8px; }
.gal-views { display: grid; gap: 8px; min-inline-size: 0; }
.gal-split { margin-block-start: 0; }
.gal-stage .dome-canvas { position: absolute; inset: 0; inline-size: 100%; block-size: 100%; touch-action: none; cursor: grab; outline: none; }
.gal-stage .dome-canvas:active { cursor: grabbing; }
.gal-stage .dome-map { position: absolute; inset: 0; inline-size: 100%; block-size: 100%; pointer-events: none; }
.pano-wrap { position: relative; inline-size: max(100%, 900px); }
.pano-wrap img { inline-size: 100%; }
.pano-wrap .starmap { position: absolute; inset: 0; inline-size: 100%; block-size: 100%; pointer-events: none; }
/* the sky map projects onto the round frame and the strip; the dome draws its own sky */
.gal-stage:has(.dome-canvas) .starmap { display: none; }
.gal-stage:has(.dome-canvas) img { visibility: hidden; }
.gal-list .day { grid-column: 1 / -1; font-weight: 600; font-size: 14px; padding-block: 10px 2px; border-block-end: 1px solid var(--line); }
/* split view: the round picture gives up room so the strip fits under it */
.gal.is-split { --stage-max: calc(100dvh - var(--nav-h) - 2 * var(--gap) - 340px); }
@media (min-width: 600px) { .gal.is-split { --stage-max: calc(100dvh - 2 * var(--gap) - 340px); } }
.gal { --stage-max: calc(100dvh - var(--nav-h) - 2 * var(--gap) - 150px); }   /* the head row above, the meta row below */
@media (min-width: 600px) { .gal { --stage-max: calc(100dvh - 2 * var(--gap) - 150px); } }
.gal-stage:focus-visible { outline: 2px solid var(--accent, #6af); outline-offset: 2px; }
.gal-stage.is-pano { aspect-ratio: 2400 / 633; inline-size: 100%; }           /* the 360° strip: wide, not square */
.gal-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; inline-size: 100%; }
.gal-meta .stamp { font-size: 1.05rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.gal-meta .spacer { flex: 1; }
.gal-side { display: grid; gap: var(--gap); align-content: start; min-inline-size: 0; }
.gal-tools { display: grid; gap: 8px; }
.gal-tools .chips.wrap { flex-wrap: wrap; overflow: visible; }
.gal-list { align-content: start; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); }
.gal-list .thumb[aria-current="true"] { outline: 2px solid var(--accent, #58a6ff); outline-offset: 1px; }
@media (min-width: 1100px) {
  /* the page fills the screen and stays put: only the roll of thumbnails scrolls */
  .gal { grid-template-columns: minmax(0, 1fr) 360px; align-items: stretch; block-size: calc(100dvh - 0px); }
  .gal-side { display: flex; flex-direction: column; min-block-size: 0; }
  .gal-list { flex: 1; min-block-size: 0; overflow-y: auto; scrollbar-width: thin; padding: 2px; }
}

/* Hardware page (views/hardware.js): the node picker beside the title; the page itself is <csl-hardware> */
.hw-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-block-end: 12px; }
.hw-head h1 { margin: 0; font-size: 22px; }
.hw-head select { min-block-size: var(--tap); padding: 4px 8px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font: inherit; }
.chip.hw-link { display: inline-flex; align-items: center; text-decoration: none; color: var(--accent); border-color: var(--accent); }
.node-links { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 6px; }

/* Camera settings page (docs/camera-settings.md) */
.cam-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; position: sticky; inset-block-start: 0; z-index: 2; margin-block-end: 12px; }
.cam-bar .cam-err { flex-basis: 100%; margin: 0; }
.cam-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(250px, 320px); gap: 12px; align-items: start; }
.cam-form { display: grid; gap: 12px; min-inline-size: 0; }
.cam-sec h2 { margin-block-start: 0; }
.cam-sec > p { margin-block: 0 8px; }
.cam-field { display: grid; grid-template-columns: minmax(130px, 210px) minmax(0, 1fr); gap: 2px 12px; align-items: center; padding: 6px 0; border-block-start: 1px solid var(--line); }
.cam-field.dirty > label { color: var(--accent); font-weight: 600; }
.cam-field .cam-help { grid-column: 2; }
.cam-days { gap: 4px 12px; }
.cam-disk { color: var(--muted); }
.cam-disk strong { color: var(--text); }
.cam-quiet { display: grid; gap: 6px; justify-items: start; }
.cam-inline { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.cam-field input.num { inline-size: 9em; }
.cam-cost { position: sticky; inset-block-start: 64px; }
.cam-cost h2 { margin-block-start: 0; }
.cam-dl { margin: 0; }
.cam-row { padding: 6px 0; border-block-start: 1px solid var(--line); }
.cam-row dt { font-size: 13px; color: var(--muted); }
.cam-row dd { margin: 0; font-weight: 600; }
.cam-row dd .muted { font-weight: 400; }
@media (max-width: 1000px) {
  .cam-layout { grid-template-columns: minmax(0, 1fr); }
  .cam-cost { position: static; }
}
@media (max-width: 520px) {
  .cam-field { grid-template-columns: minmax(0, 1fr); }
  .cam-field .cam-help { grid-column: 1; }
}

/* Timelapse → Latest: the rolling loop of the last hours (views/timelapse.js) */
/* Loop: the rolling loop of the last hours (views/loop.js) */
.loop .page-head { flex-wrap: wrap; gap: 8px 12px; }
.loop-stage { display: grid; margin-block: 4px 8px; }
.loop-stage .tl-video { inline-size: 100%; max-block-size: calc(100dvh - 220px); background: #000; border-radius: 10px; }

/* -- satellites (views/satellites.js) ------------------------------------------------------------ */
.satellites .sat-obj + .sat-obj { margin-block-start: var(--gap); }
.satellites .sat-obj > h3 { margin: 0 0 8px; }
.satellites .sat-cam { display: grid; gap: 6px; align-content: start; }
.satellites .sat-cam h3 { margin: 0; }
.satellites .sat-cam p { margin: 0; }
.satellites .sat-cam-view { display: grid; gap: 2px; justify-items: center; }
.satellites .sat-key { font-size: 11px; color: var(--muted); }
.satellites .sat-key .k-next { color: #ffd200; }
.satellites .sat-key .k-then { color: #4fc3f7; }
.satellites .sat-key .k-past { color: #d0444d; }
.satellites .sat-now { color: var(--accent); }
.satellites .sat-table td { text-align: left; }
.satellites .sat-table tr.approx td { color: var(--muted); }
.satellites .sat-table .badge { margin-inline-start: 6px; }
.satellites .sat-detail { display: grid; gap: 8px; margin-block-end: var(--gap); }
.satellites .sat-detail p { margin: 0; }
.satellites .sat-imgs { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; }
.satellites .sat-img { display: grid; gap: 4px; padding: 0; border: 0; background: none; color: inherit; cursor: zoom-in; text-align: start; }
.satellites .sat-img img { inline-size: 100%; border-radius: 10px; }
.live-pass { margin: 4px 0 0; }
.satellites .sat-views { display: flex; flex-wrap: wrap; gap: 8px; }
.satellites .sat-view-cam { display: grid; gap: 2px; justify-items: center; }
.sat-view { position: relative; display: block; margin: 0; padding: 0; border: 0; background: #000; inline-size: 132px;
  border-radius: 8px; overflow: hidden; cursor: pointer; }
.sat-view.big { inline-size: min(100%, 720px); cursor: zoom-out; }   /* a click closes the pass */
.sat-view.none { display: grid; place-items: center; block-size: 80px; color: var(--muted); font-size: 12px; background: var(--surface-2); }
.sat-view img { display: block; inline-size: 100%; block-size: auto; }
.sat-view svg { position: absolute; inset: 0; inline-size: 100%; block-size: 100%; pointer-events: none; }
.sat-view polyline { fill: none; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.sat-view .next polyline.vis { stroke: #ffd200; stroke-width: 2.5; }
.sat-view .next polyline.dark { stroke: #b8c4d6; stroke-width: 1.5; stroke-dasharray: 4 4; }
.sat-view.big .next polyline.vis { stroke-width: 3.5; }
.sat-view .next circle.tick { fill: #fff; stroke: #000a; stroke-width: 1; vector-effect: non-scaling-stroke; }
.sat-view .next polygon.head { fill: #ffd200; stroke: #000a; stroke-width: 1; vector-effect: non-scaling-stroke; }
/* the pass after the next: light blue, under the next one */
.sat-view .then polyline.vis { stroke: #4fc3f7; stroke-width: 2.5; }
.sat-view .then polyline.dark { stroke: #4fc3f7; stroke-width: 1.5; stroke-dasharray: 4 4; opacity: .7; }
.sat-view .then circle.tick { fill: #4fc3f7; stroke: #000a; stroke-width: 1; vector-effect: non-scaling-stroke; }
.sat-view .then polygon.head { fill: #4fc3f7; stroke: #000a; stroke-width: 1; vector-effect: non-scaling-stroke; }
/* the camera's last pass, already over: dark red, under the next one */
.sat-view .past polyline.vis { stroke: #b3202a; stroke-width: 2.5; }
.sat-view .past polyline.dark { stroke: #7a1b22; stroke-width: 1.5; stroke-dasharray: 4 4; }
.sat-view .past circle.tick { fill: #b3202a; stroke: #000a; stroke-width: 1; vector-effect: non-scaling-stroke; }
.sat-view .past polygon.head { fill: #b3202a; stroke: #000a; stroke-width: 1; vector-effect: non-scaling-stroke; }
.sat-view text { fill: #fff; font-size: .028px; paint-order: stroke; stroke: #000c; stroke-width: .006px; }
.satellites .sat-big { display: grid; gap: 4px; }
.satellites .sat-cam-view .sat-view { inline-size: 100%; }
