/* Machine Pulse — UI styles (light theme). Colors are roles from a validated
   palette, stepped for the light surface. */
:root {
  color-scheme: light;
  --page: #f9f9f7;
  --surface: #fcfcfb;
  --surface-2: #f3f2ee;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --muted: #898781;
  --grid: #e1e0d9;
  --axis: #c3c2b7;
  --border: rgba(11, 11, 11, 0.10);
  --accent: #2a78d6;
  --accent-ink: #1c5cab;
  --accent-wash: rgba(42, 120, 214, 0.10);
  --good: #0ca30c;
  --good-ink: #006300;
  --warning: #fab219;
  --serious: #ec835a;
  --critical: #d03b3b;
  --critical-ink: #b42f2f;
  --st-run: #0ca30c;
  --st-stop: #b7b5ac;
  --st-none: #ecebe6;
  --planned: rgba(42, 120, 214, 0.07);
  --hatch: repeating-linear-gradient(135deg, var(--axis) 0 1.5px, var(--surface) 1.5px 6px);      /* no data */
  --hatch-sm: repeating-linear-gradient(135deg, var(--axis) 0 1.5px, var(--surface) 1.5px 4.5px);
  --seq-0: #cde2fb; --seq-1: #9ec5f4; --seq-2: #6da7ec; --seq-3: #3987e5;
  --seq-4: #256abf; --seq-5: #184f95; --seq-6: #0d366b;
  --shadow: 0 1px 2px rgba(11, 11, 11, 0.04), 0 2px 8px rgba(11, 11, 11, 0.04);
  --radius: 10px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}


* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  font: 14px/1.45 var(--font);
  color: var(--ink);
  background: var(--page);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; font-weight: 650; margin: 0; letter-spacing: -0.01em; }
h2 { font-size: 15px; font-weight: 650; margin: 0; }
h3 { font-size: 13px; font-weight: 650; margin: 0 0 8px; color: var(--ink-2); }
p { margin: 0 0 8px; }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.ink2 { color: var(--ink-2); }
.small { font-size: 12px; }
.hidden { display: none !important; }

/* --- top bar ------------------------------------------------------------ */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 24px;
  padding: 0 24px; height: 56px;
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none !important; }
.brand-bg { fill: var(--ink); }

.brand-name { font-weight: 700; font-size: 15px; letter-spacing: -0.01em; }
.brand-site { color: var(--muted); font-size: 13px; border-left: 1px solid var(--grid); padding-left: 10px; }
#nav { display: flex; gap: 4px; flex: 1; overflow-x: auto; }
#nav a {
  color: var(--ink-2); padding: 7px 12px; border-radius: 8px; font-weight: 550; white-space: nowrap;
  text-decoration: none;
}
#nav a:hover { background: var(--surface-2); }
#nav a.active { color: var(--ink); background: var(--surface-2); }
.topbar-right { display: flex; align-items: center; gap: 12px; white-space: nowrap; }
.updated { color: var(--muted); font-size: 12px; }
.demo-badge {
  font-size: 11px; font-weight: 650; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--accent-ink); background: var(--accent-wash); padding: 3px 8px; border-radius: 999px;
}

main { --gutter: 24px; max-width: 1440px; margin: 0 auto; padding: 20px var(--gutter) 64px; }
main.loading { opacity: 0.55; transition: opacity 0.15s; }
main:has(> .dr) { max-width: none; }   /* the day report: every pixel more is more of the day */

/* --- page header & filter row -------------------------------------------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.page-head .sub { color: var(--ink-2); margin-top: 4px; }
.filters { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.filters .grow { flex: 1; }
.seg { display: inline-flex; background: var(--surface-2); border-radius: 8px; padding: 2px; }
.seg button { border: 0; background: transparent; color: var(--ink-2); font: inherit; font-weight: 550; padding: 5px 10px; border-radius: 6px; cursor: pointer; }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }

/* --- controls ------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px; font: inherit; font-weight: 600;
  border: 1px solid var(--border); background: var(--surface); color: var(--ink);
  padding: 7px 12px; border-radius: 8px; cursor: pointer; white-space: nowrap; text-decoration: none !important;
}
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.07); }
.btn.danger { color: var(--critical-ink); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.small { padding: 4px 8px; font-size: 12px; }
.btn:disabled { opacity: 0.5; cursor: default; }
input[type=text], input[type=search], input[type=number], input[type=date], input[type=password], input[type=time],
input[type=email], input[type=tel], select, textarea {
  font: inherit; color: var(--ink); background: var(--surface);
  border: 1px solid var(--border); border-radius: 8px; padding: 6px 9px; min-width: 0;
}
input:focus, select:focus, textarea:focus, .btn:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 1px;
}
input[type=number] { width: 100px; }
label.field { display: grid; gap: 4px; font-weight: 550; color: var(--ink-2); font-size: 12.5px; }
label.check { display: inline-flex; gap: 8px; align-items: center; cursor: pointer; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px 18px; }
.form-grid .hint { font-weight: 400; color: var(--muted); font-size: 12px; }
.unit { display: flex; align-items: center; gap: 6px; }
.unit span { color: var(--muted); font-weight: 400; }
.err { color: var(--critical-ink); font-size: 12px; }

/* --- cards & layout ------------------------------------------------------------ */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px 18px;
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.card-head .sub { color: var(--muted); font-size: 12.5px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.stack { display: grid; gap: 16px; align-content: start; }
@media (max-width: 960px) { .grid2 { grid-template-columns: 1fr; } }

/* --- stat tiles ------------------------------------------------------------------ */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 18px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 16px; box-shadow: var(--shadow); }
.kpi .label { color: var(--ink-2); font-size: 12.5px; font-weight: 550; display: flex; align-items: center; gap: 6px; }
.kpi .value { font-size: 28px; font-weight: 650; letter-spacing: -0.02em; margin-top: 2px; }
.kpi .value small { font-size: 15px; font-weight: 550; color: var(--muted); margin-left: 3px; }
.kpi .foot { color: var(--muted); font-size: 12px; }

/* --- state pills (icon + label, never color alone) --------------------------------- */
.pill { display: inline-flex; align-items: center; gap: 6px; font-weight: 650; font-size: 12.5px; padding: 2px 9px 2px 7px; border-radius: 999px; white-space: nowrap; }
.pill .ico { width: 9px; height: 9px; flex: none; }
.pill.running { color: var(--good-ink); background: rgba(12, 163, 12, 0.10); }
.pill.running .ico { background: var(--st-run); border-radius: 50%; }
.pill.stopped { color: var(--ink-2); background: var(--surface-2); }
.pill.stopped .ico { background: var(--muted); border-radius: 2px; }
.pill.offline { color: var(--critical-ink); background: rgba(208, 59, 59, 0.10); }
.pill.offline .ico { width: 0; height: 0; border-left: 5px solid transparent; border-right: 5px solid transparent; border-bottom: 9px solid var(--critical); }
.pill.unknown { color: var(--muted); background: var(--surface-2); }
.pill.unknown .ico { border: 2px solid var(--muted); border-radius: 50%; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; }

/* --- machine cards ------------------------------------------------------------------- */
.mgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 12px; }
.mcard {
  display: grid; gap: 8px; color: var(--ink); text-decoration: none !important;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 14px 16px 12px; transition: border-color 0.12s;
}
.mcard:hover { border-color: var(--axis); }
.mcard-top { display: flex; align-items: center; gap: 8px; }
.mcard-top .since { color: var(--ink-2); font-size: 12.5px; }
.mcard-top .icons { margin-left: auto; display: flex; gap: 10px; color: var(--muted); font-size: 12px; align-items: center; }
.mcard-name { font-weight: 650; font-size: 15.5px; line-height: 1.25; overflow-wrap: anywhere; }
.mcard-sub { color: var(--muted); font-size: 12.5px; margin-top: -6px; min-height: 18px; }
.mcard-util { display: flex; align-items: baseline; gap: 8px; }
.mcard-util .big { font-size: 22px; font-weight: 650; letter-spacing: -0.02em; }
.mcard-util .lbl { color: var(--muted); font-size: 12.5px; }
.meter { height: 6px; border-radius: 999px; background: var(--seq-0); overflow: hidden; }
.meter > i { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.strip { display: block; width: 100%; border-radius: 4px; background: var(--hatch); }
.strip-axis { display: flex; justify-content: space-between; color: var(--muted); font-size: 11px; margin-top: -4px; }
.flag { color: var(--serious); font-size: 12px; font-weight: 600; }
.flag.warn { color: #b77a00; }


/* --- legend ----------------------------------------------------------------------------- */
.legend { display: flex; gap: 14px; flex-wrap: wrap; color: var(--ink-2); font-size: 12.5px; align-items: center; }
.legend .sw { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -2px; }
.legend .ln { display: inline-block; width: 16px; height: 0; border-top: 2px solid; margin-right: 6px; vertical-align: 3px; }

/* --- gantt ---------------------------------------------------------------------------------- */
.gantt { display: grid; grid-template-columns: minmax(150px, 220px) 1fr 64px; align-items: center; row-gap: 6px; column-gap: 12px; }
.gantt .gname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 550; }
.gantt .gname small { display: block; color: var(--muted); font-weight: 400; font-size: 11.5px; }
.gantt .gutil { text-align: right; font-weight: 650; }
.gantt .gaxis { position: relative; height: 18px; color: var(--muted); font-size: 11px; }
.gantt .gaxis span { position: absolute; transform: translateX(-50%); white-space: nowrap; }
.gantt .ghead { color: var(--muted); font-size: 12px; font-weight: 550; }

/* --- tables ------------------------------------------------------------------------------------ */
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th { text-align: left; color: var(--ink-2); font-weight: 600; font-size: 12px; padding: 8px 10px; border-bottom: 1px solid var(--grid); white-space: nowrap; }
td { padding: 8px 10px; border-bottom: 1px solid var(--grid); vertical-align: middle; }
td.r, th.r { text-align: right; font-variant-numeric: tabular-nums; }
tr.total td { font-weight: 650; border-bottom: 0; border-top: 1px solid var(--axis); }
tbody tr:hover { background: var(--surface-2); }
th.sort { cursor: pointer; }
th.sort:hover { color: var(--ink); }

/* --- charts --------------------------------------------------------------------------------------- */
.chart { position: relative; width: 100%; }
.chart svg { display: block; overflow: visible; }
.chart text { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.chart .tick line, .chart .gridline { stroke: var(--grid); stroke-width: 1; shape-rendering: crispEdges; }
.chart .baseline { stroke: var(--axis); stroke-width: 1; shape-rendering: crispEdges; }
.chart .crosshair { stroke: var(--ink-2); stroke-width: 1; shape-rendering: crispEdges; pointer-events: none; }
.chart .thr { stroke: var(--ink-2); stroke-width: 1; shape-rendering: crispEdges; }
.chart .thr-label { fill: var(--ink-2); font-weight: 600; }
.chart .sugg { stroke: var(--accent); stroke-width: 1.5; stroke-dasharray: 4 3; }
.chart .sugg-label { fill: var(--accent-ink); font-weight: 650; }
.chart-empty { color: var(--muted); padding: 32px 0; text-align: center; }

/* --- what the puck feels: mounting check + small multiples --------------------------------------- */
.mcheck { background: var(--surface-2); border-radius: 8px; padding: 10px 14px 12px; display: grid; gap: 7px; }
.mcheck-head { font-weight: 650; font-size: 13px; color: var(--ink-2); }
.mitem { display: grid; grid-template-columns: 20px 1fr; gap: 8px; align-items: start; font-size: 13px; line-height: 1.45; }
.mitem b { color: var(--ink); font-weight: 650; }
.mitem span:last-child { color: var(--ink-2); }
.micon { width: 18px; height: 18px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 800; color: #fff; margin-top: 1px; }
.mitem.good .micon { background: var(--good); }
.mitem.warn .micon { background: var(--warning); color: var(--ink); }
.mitem.info .micon { background: var(--accent); }
.sig { display: grid; }
.sig-row { display: grid; grid-template-columns: 176px minmax(0, 1fr) 196px; gap: 14px; align-items: center;
  padding: 5px 0; border-top: 1px solid var(--grid); }
.sig-row.sig-axis { border-top: 0; padding: 0; }
.sig-label b { display: block; font-size: 13px; }
.sig-label span { display: block; font-size: 11.5px; color: var(--muted); line-height: 1.35; }
.sig-sum { display: flex; flex-direction: column; gap: 2px; font-size: 12px; color: var(--muted); }
.sig-verdict { color: var(--ink); font-weight: 600; font-size: 12.5px; }
.sig-chart { position: relative; width: 100%; }
.sig-chart svg { display: block; overflow: visible; }
.sig-chart text { fill: var(--muted); font-size: 10.5px; font-family: var(--font); font-variant-numeric: tabular-nums; }
.sig-chart .gridline { stroke: var(--grid); stroke-width: 1; shape-rendering: crispEdges; }
.sig-chart .crosshair { stroke: var(--ink-2); stroke-width: 1; shape-rendering: crispEdges; pointer-events: none; }
.sig-chart .thr { stroke: var(--ink-2); stroke-width: 1; shape-rendering: crispEdges; }
.sig-chart .thr-label { fill: var(--ink-2); font-weight: 600; }
.sig-run { fill: var(--st-run); opacity: 0.12; }
.sig-band { fill: var(--accent); opacity: 0.12; }
.sig-line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.sig-dot { fill: var(--accent); }
.sig-hdot { fill: var(--accent); stroke: var(--surface); stroke-width: 2; pointer-events: none; }
.sig-off { fill: var(--surface-2); }
.sig-chart .sig-off-text { fill: var(--muted); font-size: 11.5px; }
@media (max-width: 760px) {
  .sig-row { grid-template-columns: 1fr; gap: 4px; }
  .sig-row.sig-axis > div:first-child, .sig-row.sig-axis > div:last-child { display: none; }
}
.tableview { margin-top: 8px; max-height: 320px; overflow: auto; }

/* --- tooltip --------------------------------------------------------------------------------------- */
#tooltip {
  position: fixed; z-index: 50; pointer-events: none; min-width: 120px; max-width: 280px;
  background: var(--surface); color: var(--ink); border: 1px solid var(--border);
  border-radius: 8px; padding: 8px 10px; font-size: 12.5px;
  box-shadow: 0 4px 16px rgba(11, 11, 11, 0.12);
}
#tooltip .tt-title { color: var(--ink-2); font-size: 11.5px; margin-bottom: 4px; }
#tooltip .tt-row { display: flex; align-items: center; gap: 8px; }
#tooltip .tt-row b { font-weight: 650; font-variant-numeric: tabular-nums; }
#tooltip .tt-row span { color: var(--ink-2); }
#tooltip .key { width: 12px; height: 0; border-top: 2px solid; flex: none; }
#tooltip .keybox { width: 10px; height: 10px; border-radius: 2px; flex: none; }

#toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 60;
  background: var(--ink); color: var(--page); padding: 9px 16px; border-radius: 8px; font-weight: 550;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.2);
}

/* --- detail page ------------------------------------------------------------------------------- */
.detail-head { display: flex; gap: 16px; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; margin-bottom: 16px; }
.detail-head .title { display: grid; gap: 6px; }
.detail-head .meta { display: flex; gap: 4px 10px; align-items: center; flex-wrap: wrap; color: var(--ink-2); }
.detail-head .name-row { display: flex; gap: 12px; align-items: center; }
.head-dev { text-align: right; }
.only-sm { display: none; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 550; overflow-wrap: anywhere; }
.events { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.events li { display: grid; grid-template-columns: 120px 1fr; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--grid); font-size: 13px; }
.events li:last-child { border-bottom: 0; }
.events time { color: var(--muted); font-variant-numeric: tabular-nums; }
.banner { border-radius: 8px; padding: 9px 12px; font-size: 13px; display: flex; gap: 8px; align-items: flex-start; }
.banner.info { background: var(--accent-wash); color: var(--ink); }
.banner.warn { background: rgba(250, 178, 25, 0.14); color: var(--ink); }
.banner.ok { background: rgba(12, 163, 12, 0.09); color: var(--ink); }
.callout { background: var(--surface-2); border-radius: 8px; padding: 12px 14px; }
.calib-suggest { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-top: 10px; }
.danger-zone { border-color: rgba(208, 59, 59, 0.35); }
pre.snippet { background: var(--surface-2); border-radius: 8px; padding: 12px 14px; overflow-x: auto; margin: 6px 0 10px; }
.copyrow { display: flex; gap: 8px; align-items: center; }
.sched { display: grid; grid-template-columns: 110px auto auto 1fr; gap: 8px 12px; align-items: center; }
.login { max-width: 360px; margin: 12vh auto; }

/* --- sensitivity ------------------------------------------------------------------------------- */
.sens-row { display: grid; grid-template-columns: auto 1fr auto auto; gap: 6px 14px; align-items: start; }
.sens-end { font-weight: 650; font-size: 13px; display: grid; line-height: 1.25; padding-top: 2px; }
.sens-end small { font-weight: 400; color: var(--muted); font-size: 11.5px; }
.sens-end.r { text-align: right; }
.sens-track { position: relative; padding-bottom: 18px; }
.sens-slider { width: 100%; margin: 4px 0 0; accent-color: var(--accent); height: 22px; cursor: pointer; }
.sens-auto { position: absolute; top: 28px; transform: translateX(-50%); font-size: 10.5px; font-weight: 650;
  color: var(--accent-ink); text-transform: uppercase; letter-spacing: 0.04em; pointer-events: none; }
.sens-auto::before { content: ""; position: absolute; left: 50%; top: -6px; width: 1px; height: 5px; background: var(--accent-ink); }
.sens-val { display: grid; justify-items: end; min-width: 150px; }
.sens-val b { font-size: 24px; font-weight: 650; line-height: 1.1; }
.sens-mode { color: var(--muted); font-size: 12px; text-align: right; }
.sens-stats { display: flex; gap: 6px 18px; flex-wrap: wrap; font-size: 13px; color: var(--ink-2); align-items: baseline; }
.sens-stats b { color: var(--ink); font-size: 15px; }
.delta { font-weight: 650; }
.delta.up { color: var(--good-ink); }
.delta.down { color: var(--critical-ink); }
.sens-levels { display: flex; gap: 6px 8px; flex-wrap: wrap; align-items: center; }
.lvl { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 2px 8px;
  border-radius: 999px; background: var(--surface-2); color: var(--ink-2); font-variant-numeric: tabular-nums; }
.lvl .dot { width: 8px; height: 8px; }
.lvl.on .dot { background: var(--st-run); }
.lvl.off .dot { background: var(--st-stop); }

@media (max-width: 720px) {
  .sens-row { grid-template-columns: 1fr 1fr; }
  .sens-track { grid-column: 1 / -1; grid-row: 2; }
  .sens-end.r { grid-column: 2; grid-row: 1; }
  .sens-val { grid-column: 1 / -1; justify-items: start; }
  .topbar { padding: 8px 12px 6px; gap: 6px 12px; height: auto; flex-wrap: wrap; }
  #nav { order: 3; flex-basis: 100%; }
  #nav a { padding: 6px 7px; font-size: 13.5px; }
  .topbar-right { margin-left: auto; }
  .brand-site, .updated { display: none; }
  main { --gutter: 12px; padding: 14px var(--gutter) 48px; }
  .gantt { grid-template-columns: 110px 1fr 48px; column-gap: 8px; }
  .events li { grid-template-columns: 1fr; gap: 2px; }
}
tbody tr.sel { background: var(--accent-wash); }

/* --- phones --------------------------------------------------------------------------------------- */
/* Grid children may shrink below their content, so a wide table scrolls inside its card
   instead of widening the page (which makes a phone zoom everything out). */
.stack > *, .grid2 > *, .kpis > *, .mgrid > * { min-width: 0; }
.table-wrap { -webkit-overflow-scrolling: touch; }
.seg { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.seg button { white-space: nowrap; }
.chart .halo { paint-order: stroke; stroke: var(--surface); stroke-width: 3px; stroke-linejoin: round; }

@media (max-width: 600px) {
  h1 { font-size: 20px; }
  .page-head { margin-bottom: 10px; }
  .page-head .sub { font-size: 13px; }
  .filters { gap: 6px; margin-bottom: 12px; }
  .stack { gap: 12px; }
  .grid2 { gap: 12px; }
  .card { padding: 12px 12px 14px; }
  .card-head { margin-bottom: 8px; gap: 6px 8px; }
  .card-head h2 { font-size: 15px; }
  /* tiles: two per row, an odd last one across the whole row */
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: 12px; }
  .kpis > :last-child:nth-child(odd) { grid-column: 1 / -1; }
  .kpi { padding: 9px 12px; }
  .kpi .value { font-size: 22px; }
  .kpi .foot { font-size: 11.5px; }
  /* machine cards: one per row, compact; the 24 h strip says what the meter and axis said */
  .mgrid { grid-template-columns: 1fr; gap: 8px; }
  .mcard { padding: 10px 12px; gap: 5px; }
  .mcard-name { font-size: 15px; }
  .mcard-sub { margin-top: -4px; min-height: 0; }
  .mcard-util .big { font-size: 17px; }
  .mcard .meter, .mcard .strip-axis { display: none; }
  /* timeline: the name and utilization on one line, the day's bar full width below */
  .gantt { grid-template-columns: minmax(0, 1fr) auto; grid-auto-flow: row dense; row-gap: 3px; column-gap: 8px; }
  .gantt > .strip, .gantt > .gaxis { grid-column: 1 / -1; }
  .gantt > .strip { margin-bottom: 6px; }
  .gantt .gname { white-space: normal; display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
  .gantt .gname small { display: inline; }
  /* tables: fewer columns, tighter cells */
  .hide-sm { display: none; }
  table { font-size: 12.5px; }
  th, td { padding: 7px 8px; }
  .kv { gap: 4px 12px; font-size: 12.5px; }
  .banner { font-size: 12.5px; }
  .legend { gap: 6px 12px; font-size: 12px; }
}
/* first and last labels of a time axis stay inside the card */
.gantt .gaxis span:first-child { transform: none; }
.gantt .gaxis span:last-child { transform: translateX(-100%); }
@media (max-width: 600px) {
  /* tables with class rows-sm: each row a two-line entry (name, then the facts) */
  table.rows-sm thead { display: none; }
  table.rows-sm tr { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; padding: 9px 2px; border-bottom: 1px solid var(--grid); }
  table.rows-sm td { display: inline-flex; align-items: center; gap: 4px; padding: 0; border: 0; }
  table.rows-sm td:first-child { flex-basis: 100%; font-weight: 600; font-size: 14px; }
  table.rows-sm td[data-label]::before { content: attr(data-label); color: var(--muted); }
  table.rows-sm .dash { display: none; }
  table.rows-sm tbody tr:hover { background: none; }
}
@media (max-width: 600px) {
  table.rows-sm td.hide-sm { display: none; }
  .sched { grid-template-columns: 92px minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
  .sched > span:empty { display: none; }
  .sched input[type=time] { width: 100%; min-width: 0; }
}
@media (max-width: 600px) {
  table.rows-sm tr { gap: 3px 9px; }
  table.rows-sm td:not(:first-child) { font-size: 12.5px; }
}

/* --- phones: no boxes. Sections are a heading and a hairline on one white surface. --- */
@media (max-width: 600px) {
  body { background: var(--surface); }
  .card { background: none; border: 0; border-radius: 0; box-shadow: none; padding: 14px 0 2px; border-top: 1px solid var(--grid); }
  .card-head h2 { font-size: 16px; }
  .stack { gap: 6px; }
  .grid2 { gap: 6px; }
  /* key figures: a plain two-column grid divided by hairlines */
  .kpis { gap: 0; margin-bottom: 4px; border-top: 1px solid var(--grid); }
  .kpi { background: none; border: 0; border-radius: 0; box-shadow: none; padding: 10px 0; }
  .kpis > .kpi:nth-child(odd) { padding-right: 12px; }
  .kpis > .kpi:nth-child(even) { padding-left: 12px; border-left: 1px solid var(--grid); }
  .kpis > .kpi:nth-child(n+3) { border-top: 1px solid var(--grid); }
  .kpis > .kpi:last-child:nth-child(odd) { padding-right: 0; }
  /* machines: list rows instead of cards */
  .mgrid { gap: 0; }
  .mcard { background: none; border: 0; border-radius: 0; box-shadow: none; padding: 12px 0; border-top: 1px solid var(--grid); }
  .mcheck { background: none; padding: 4px 0; }
}

/* --- phones: each device / machine of a list in its own light gray box --- */
@media (max-width: 600px) {
  table.rows-sm, table.rows-sm tbody { display: block; }
  table.rows-sm tr { background: var(--surface-2); border-radius: 10px; border-bottom: 0; padding: 10px 12px; margin-bottom: 8px; }
  .mgrid { gap: 8px; }
  .mcard { background: var(--surface-2); border-radius: 10px; border-top: 0; padding: 10px 12px; }
}
@media (max-width: 600px) {
  .mcard .pill.stopped, .mcard .pill.unknown, table.rows-sm .pill.stopped, table.rows-sm .pill.unknown { background: var(--surface); }
}

/* --- machine page: running and stopped, day by day --- */
.days { display: grid; grid-template-columns: 84px minmax(0, 1fr) 48px; align-items: center; gap: 8px 12px; padding-top: 14px; }
.days-label { font-size: 13px; font-weight: 600; color: var(--ink-2); white-space: nowrap; }
.days-pct { text-align: right; font-weight: 650; }
.days .strip-axis { margin-top: -2px; }
.strip-axis.abs { display: block; position: relative; height: 1.4em; }
.strip-axis.abs span { position: absolute; top: 0; transform: translateX(-50%); white-space: nowrap; }
.strip-axis.abs span:first-child { transform: none; }
.strip-axis.abs span:last-child { transform: translateX(-100%); }
.days-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px 12px; flex-wrap: wrap; }
.daybar { position: relative; }
.daybar-now { position: absolute; top: -4px; bottom: -4px; width: 2px; margin-left: -1px; background: var(--ink); border-radius: 1px; }
.daybar-now span { position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); font-size: 10.5px; font-weight: 650; color: var(--ink); line-height: 1.3; }
.legend .sw.hatch { background: var(--hatch-sm); box-shadow: inset 0 0 0 1px var(--grid); }
@media (max-width: 600px) {
  .days { grid-template-columns: 64px minmax(0, 1fr) 38px; gap: 8px; }
  .days-label { font-size: 12px; }
}

/* --- machine page: key figures inside the Utilization section --- */
.util-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-top: 1px solid var(--grid); margin-top: 4px; }
.util-stats > div { padding: 12px 16px 0; min-width: 0; }
.util-stats > div:first-child { padding-left: 0; }
.util-stats > div + div { border-left: 1px solid var(--grid); }
.util-stats .label { color: var(--ink-2); font-size: 12.5px; font-weight: 550; }
.util-stats .value { font-size: 26px; font-weight: 650; letter-spacing: -0.02em; margin-top: 2px; font-variant-numeric: tabular-nums; }
.util-stats .foot { color: var(--muted); font-size: 12px; }

/* --- phones: a compact machine header, wider day bars, a nav that always fits --- */
@media (max-width: 600px) {
  .only-sm { display: inline; }
  .detail-head { display: block; margin-bottom: 8px; }
  .detail-head .title { gap: 3px; }
  .detail-head .name-row { justify-content: space-between; gap: 10px; }
  /* one flowing line; a separator stays at the end of a line, never starts one */
  .detail-head .meta { display: block; font-size: 12.5px; line-height: 1.45; color: var(--muted); }
  .detail-head .meta > span:not(:last-child)::after { content: '\00A0\00B7\20'; }
  .head-dev { display: none; }
  .days { grid-template-columns: auto minmax(0, 1fr) auto; gap: 8px; }
  .days-label { font-size: 12px; }
  .days-pct { font-size: 12.5px; }
  .util-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .util-stats > div { padding: 10px 0 8px; }
  .util-stats > div:nth-child(odd) { padding-right: 12px; border-left: 0; }
  .util-stats > div:nth-child(even) { padding-left: 12px; }
  .util-stats > div:nth-child(n+3) { border-top: 1px solid var(--grid); }
  .util-stats .value { font-size: 22px; }
  .util-stats .foot { font-size: 11.5px; }
}
@media (max-width: 720px) {
  .topbar { padding: 6px 12px 5px; row-gap: 4px; }
  #nav { gap: 2px; overflow: visible; }
  #nav a { flex: 1 1 0; min-width: 0; padding: 6px 2px; text-align: center; font-size: 13px; overflow: hidden; text-overflow: ellipsis; }
}
@media (max-width: 350px) {
  #nav a { font-size: 12px; }
}

/* --- the activity graph moves through time: a pad over it takes touches and drags (it is
       never redrawn, so a gesture keeps going while the chart under it is) --- */
.trace-wrap { position: relative; }
.trace-pad { position: absolute; inset: 0; touch-action: pan-y; cursor: grab; user-select: none; -webkit-user-select: none;
  -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; }
.trace-pad.grabbing { cursor: grabbing; }

/* --- the customer view (/view) and the logins for it --- */
.viewmode #nav { display: none; }
.cust-form { display: grid; gap: 10px; border-top: 1px solid var(--grid); padding-top: 12px; }
.cust-form h3 { margin: 0; }
.check-list { display: grid; gap: 4px; margin: 4px 0 2px; }
.cust-form details summary { cursor: pointer; color: var(--ink-2); margin: 4px 0; }
.row-actions { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.viewmode .topbar-right { margin-left: auto; }
.viewmode .topbar { background: #fff; border-bottom-color: var(--grid); }   /* white, a line under it */
@media (min-width: 721px) { .viewmode .topbar { height: 45px; } }          /* desktop: a slim bar */
.cust-form .field.sees { display: grid; gap: 4px; justify-items: start; }
.cust-form .field.sees > span:first-child { font-weight: 550; color: var(--ink-2); font-size: 12.5px; }

/* --- renaming a machine; the customers' Add machine dialog; orders --- */
.name-edit { display: inline-flex; align-items: center; gap: 4px; min-width: 0; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 30px; height: 30px;
  border: 0; border-radius: 8px; background: none; color: var(--muted); cursor: pointer; font-size: 20px; line-height: 1; }
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.rename { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; width: 100%; }
.rename-input { font-size: 18px !important; font-weight: 650; flex: 1 1 200px; max-width: 420px; }
.dlg { border: 0; border-radius: 14px; padding: 16px 20px 20px; width: min(540px, calc(100vw - 24px));
  max-height: calc(100vh - 32px); color: var(--ink); background: var(--surface); box-shadow: 0 12px 40px rgba(11, 11, 11, 0.2); }
.dlg::backdrop { background: rgba(11, 11, 11, 0.3); }
.dlg-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.dlg-head h2 { margin: 0; font-size: 18px; }
.dlg .seg { margin-bottom: 14px; }
.dlg textarea { resize: vertical; }
.code-input { text-transform: uppercase; letter-spacing: 0.08em; }
.orders { display: grid; gap: 10px; }
.order { border: 1px solid var(--grid); border-radius: 10px; padding: 10px 12px; display: grid; gap: 4px; font-size: 13.5px; }
.order.done { opacity: 0.6; }
.order-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.order .pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.order .row-actions { margin-top: 4px; }
.tag { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 650; }
.tag.new { background: var(--accent-wash); color: var(--accent-ink); }
.tag.done { background: var(--surface-2); color: var(--muted); }
.orders-note { display: block; margin-bottom: 12px; text-decoration: none; }
/* phones: 16 px in fields, or an iPhone zooms the page in when one is tapped */
@media (max-width: 600px) {
  input[type=text], input[type=search], input[type=number], input[type=password], input[type=email], input[type=tel],
  input[type=date], input[type=time], select, textarea { font-size: 16px; }
  .detail-head .name-row h1 { overflow-wrap: anywhere; }
}
.code-input::placeholder { text-transform: none; letter-spacing: normal; }

/* --- the customer's day report: the units on the left stay put; the days to the right,
   each one view wide, scroll and snap a day at a time --- */
.dr-head { display: flex; align-items: center; justify-content: space-between; gap: 12px 24px; flex-wrap: wrap; margin: 6px 0 16px; }
.dr-title { display: flex; align-items: center; gap: 8px 18px; flex-wrap: wrap; }
.dr-title h1 { margin: 0; font-size: 18px; }
.dr-navbtns { display: flex; align-items: center; gap: 8px; }
.dr-foot { display: flex; justify-content: flex-end; margin-top: 12px; }
.dr { --unitw: 380px; --row: 60px; --axish: 30px; display: grid; grid-template-columns: calc(var(--unitw) + var(--gutter)) minmax(0, 1fr);
  margin: 0 calc(-1 * var(--gutter)); border-bottom: 1px solid var(--grid); }
  /* a table on the page itself: lines, no box; its lines run to the window's edges, its content keeps the page's margin */
.dr-units { min-width: 0; }
.dr-corner { height: var(--axish); border-bottom: 1px solid var(--grid); }
.dr-unit { height: var(--row); box-sizing: border-box; padding: 7px 14px 7px calc(var(--gutter) + 2px); border-bottom: 1px solid var(--grid); min-width: 0;
  border-right: 1px solid var(--grid);   /* the column line: beside the units, not in the header row */
  display: grid; grid-template-columns: minmax(0, max-content) max-content minmax(max-content, 1fr);
  grid-template-areas: "name pill rt" "meta meta meta"; align-content: center; align-items: center; gap: 4px 8px; }
.dr-unit:last-child, .dr-row:last-child { border-bottom: 0; }
.dr-unit.dr-add { display: flex; justify-content: center; }
.dr-add .btn { color: var(--accent-ink); }
.dr-addrow { cursor: pointer; opacity: 0.55; }
.dr-addrow:hover { opacity: 0.9; }
.dr-name { grid-area: name; font-weight: 650; color: var(--ink); text-decoration: none; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; min-width: 0; }
.dr-name:hover { color: var(--accent-ink); text-decoration: underline; }
.dr-unit > .pill { grid-area: pill; justify-self: start; font-size: 11.5px; padding: 1px 8px; }
.dr-unit > .rt, .dr-unit > .rt-none { grid-area: rt; justify-self: end; }
.dr-l2 { grid-area: meta; display: flex; align-items: center; gap: 4px 10px; color: var(--muted); font-size: 12px;
  white-space: nowrap; overflow: hidden; min-width: 0; }
.dr-l2 .fact { display: inline-flex; align-items: center; gap: 4px; flex: none; }
.dr-l2 .low { color: var(--serious); }
.dr-loc { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.dr-when { flex: none; }
.rt { flex: none; display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px 1px 6px;
  border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--accent-ink);
  font: inherit; font-size: 11.5px; font-weight: 600; line-height: 1.5; cursor: pointer; white-space: nowrap; }
button.rt:hover, button.rt:focus-visible { background: var(--accent-wash); border-color: var(--accent); }
.rt.on { color: var(--good-ink); border-color: transparent; background: rgba(12, 163, 12, 0.10); cursor: default; }
.rt.asked { color: var(--muted); border-style: dashed; cursor: default; }
.dr-scroll { overflow-x: auto; overflow-y: hidden; scroll-snap-type: x mandatory; overscroll-behavior-x: contain;
  scrollbar-width: none; outline: none; }
.dr-scroll::-webkit-scrollbar { display: none; }
.dr-scroll:focus-visible { box-shadow: inset 0 0 0 2px var(--accent); }
.dr-track { display: flex; }
.dr-day { --padx: 16px; flex: 0 0 100%; min-width: 0; box-sizing: border-box; padding: 0 var(--gutter) 0 var(--padx);
  scroll-snap-align: start; scroll-snap-stop: always; }
.dr-inner { position: relative; }
.dr-axis { position: relative; height: var(--axish); border-bottom: 1px solid var(--grid); font-size: 11px; color: var(--muted); }
.dr-axis b { position: absolute; left: 0; top: 8px; color: var(--ink-2); font-size: 11.5px; font-weight: 650; white-space: nowrap; }
.dr-axis span { position: absolute; top: 9px; transform: translateX(-50%); white-space: nowrap; }
.dr-row { position: relative; height: var(--row); box-sizing: border-box; display: flex; align-items: center;
  border-bottom: 1px solid var(--grid); }
/* the lines run on to the column of units, through the day's left margin */
.dr-axis::after, .dr-row:not(:last-child)::after { content: ''; position: absolute; left: calc(-1 * var(--padx)); width: var(--padx);
  bottom: -1px; border-bottom: 1px solid var(--grid); }   /* -1px: on the row's own border line */
.dr-axis::before, .dr-row:not(:last-child)::before { content: ''; position: absolute; right: calc(-1 * var(--gutter)); width: var(--gutter);
  bottom: -1px; border-bottom: 1px solid var(--grid); }   /* and on to the right edge */
.dr-now { position: absolute; z-index: 2; top: calc(var(--axish) - 5px); bottom: 0; width: 2px; margin-left: -1px; background: var(--ink);
  border-radius: 1px; pointer-events: none; }
.dr-now span { position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); font-size: 10.5px; font-weight: 650;
  color: var(--ink); line-height: 1.2; background: var(--page); padding: 0 2px; }
.dr-cursor { position: absolute; z-index: 3; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: var(--accent); pointer-events: none; }
.dr.has-add .dr-cursor, .dr.has-add .dr-now { bottom: var(--row); }    /* not through the "add" row */
.dr-row .strip { border-radius: 5px; }
@media (max-width: 1100px) {
  .dr { --unitw: 300px; }
  .rt .rt-text { display: none; }   /* the bolt alone; the title says it */
}
@media (max-width: 860px) {
  .dr { --unitw: 230px; }
  .dr-loc { display: none; }
}
@media (max-width: 600px) {
  .dr { --unitw: 142px; --row: 58px; --axish: 28px; }
  .dr-unit { padding: 6px 8px 6px calc(var(--gutter) + 2px); grid-template-columns: max-content minmax(0, 1fr) max-content;
    grid-template-areas: "name name name" "pill meta rt"; gap: 3px 6px; }
  .dr-name { font-size: 13.5px; }
  .dr-unit > .pill { font-size: 0; padding: 4px; gap: 0; }   /* the coloured dot only */
  .rt { padding: 1px 5px; }
  .rt.on, .rt.asked { font-size: 0; gap: 0; }
  .dr-when { display: none; }
  .dr-day { --padx: 10px; }
  .dr-axis .h6, .dr-axis .h18 { display: none; }

}

/* --- the customer's top bar on a phone: the brand, Add machine and a menu; the day and its
   arrows right under it, both staying at the top --- */
.vm-phone { display: none; }
.dr-title h1 .short { display: none; }
.vmenu { position: relative; }
.vmenu-btn { width: 34px; height: 34px; color: var(--ink-2); }
.vmenu-panel { position: absolute; right: 0; top: calc(100% + 8px); z-index: 30; min-width: 220px; padding: 6px;
  background: #fff; border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 10px 30px rgba(11, 11, 11, 0.12); }
.vmenu-who { padding: 8px 10px 10px; font-weight: 650; border-bottom: 1px solid var(--grid); margin-bottom: 4px; white-space: nowrap; }
.vmenu-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 6px 10px; color: var(--ink-2); }
.vmenu-item { display: block; width: 100%; padding: 9px 10px; border: 0; border-radius: 6px; background: none; font: inherit;
  text-align: left; color: var(--ink); cursor: pointer; }
.vmenu-item:hover, .vmenu-item:focus-visible { background: var(--surface-2); }
@media (max-width: 600px) {
  .viewmode .topbar { height: 54px; padding: 0 14px; flex-wrap: nowrap; gap: 10px; }
  .signed-in .updated, .signed-in .topbar-right > .seg.lang, .signed-in #logout { display: none; }
  .signed-in .vm-phone { display: inline-flex; }
  .vm-add { width: 34px; height: 34px; padding: 0; justify-content: center; }
  .vm-add svg { margin-right: 0 !important; }
  body:has(.dr-head) .topbar { border-bottom-color: transparent; }
  .dr-head { position: sticky; top: 54px; z-index: 19; margin: -14px calc(-1 * var(--gutter)) 12px; padding: 0 var(--gutter) 10px;
    background: #fff; border-bottom: 1px solid var(--grid); }
  .dr-head > .btn.primary { display: none; }       /* the top bar's + does it */
  .dr-title { width: 100%; justify-content: space-between; flex-wrap: nowrap; }
  .dr-title h1 { font-size: 16px; }
  .dr-title h1 .long { display: none; }
  .dr-title h1 .short { display: inline; }
  .dr-navbtns .btn { height: 32px; min-width: 32px; padding: 0 10px; }
}

/* --- the day report on a phone: a card per unit, the day's total over its bar --- */
.drc-list { display: none; }
@media (max-width: 600px) {
  .dr { display: none; }
  .drc-list { display: flex; flex-direction: column; gap: 10px; }
}
.drc { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 12px 12px 8px; box-shadow: var(--shadow); cursor: pointer; }
.drc:active { border-color: var(--accent); }
.drc-l1 { display: flex; align-items: center; gap: 8px; min-width: 0; }
.drc-name { font-weight: 650; font-size: 15px; color: var(--ink); text-decoration: none; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; min-width: 0; }
.drc-l1 .pill { flex: none; font-size: 11.5px; padding: 1px 8px; }
.drc-facts { margin-left: auto; display: inline-flex; align-items: center; gap: 8px; flex: none; color: var(--muted); font-size: 12px; }
.drc-facts .fact { display: inline-flex; align-items: center; gap: 4px; }
.drc-facts .low { color: var(--serious); }
.drc-l1 .rt { padding: 2px 6px; }
.drc-l1 .rt .rt-text { display: none; }
.drc-sum { margin: 5px 0 9px; font-size: 12.5px; color: var(--ink-2); }
.drc-sum b { color: var(--ink); }
.drc .strip { border-radius: 4px; }
.drc-ax { position: relative; height: 15px; margin-top: 3px; font-size: 10px; color: var(--muted); }
.drc-ax span { position: absolute; top: 0; transform: translateX(-50%); }
.drc-ax span:first-child { transform: none; }
.drc-ax span:last-child { transform: translateX(-100%); }
.drc-add { display: flex; align-items: center; justify-content: center; gap: 2px; width: 100%; padding: 14px; border: 1.5px dashed var(--axis);
  border-radius: 12px; background: none; color: var(--accent-ink); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
.drc-list.slide-l { animation: drc-in-l 0.22s ease-out; }
.drc-list.slide-r { animation: drc-in-r 0.22s ease-out; }
@keyframes drc-in-l { from { transform: translateX(28px); opacity: 0.35; } to { transform: none; opacity: 1; } }
@keyframes drc-in-r { from { transform: translateX(-28px); opacity: 0.35; } to { transform: none; opacity: 1; } }

/* --- customer view: Help beside a section title; the language switch --- */
.help-link { display: inline-flex; align-items: center; gap: 4px; margin-left: 8px; padding: 2px 7px 2px 5px; border: 0;
  border-radius: 999px; background: none; color: var(--muted); font: inherit; font-size: 13px; font-weight: 500;
  line-height: 1.4; cursor: pointer; vertical-align: 1px; }
.help-link:hover, .help-link:focus-visible { color: var(--accent-ink); background: var(--accent-wash); }
.help p { margin: 0 0 12px; line-height: 1.55; color: var(--ink-2); }
.seg.lang button { padding: 3px 8px; font-size: 12px; font-weight: 600; }
@media (max-width: 600px) {
  .viewmode .brand-name { font-size: 14px; }
  .viewmode .topbar-right { gap: 8px; }
}

/* --- the device's power reports (admin machine page) --- */
.power-hist { margin-top: 8px; }
.power-hist summary { cursor: pointer; color: var(--ink-2); font-size: 13px; }

/* Live mode and recordings */
.live-status, .live-rec { display: grid; gap: 10px; }
.live-line { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.live-badge { display: inline-flex; align-items: center; gap: 7px; font-weight: 650; font-size: 14px; padding: 4px 11px;
  border-radius: 999px; background: var(--surface-2); color: var(--ink-2); }
.live-badge.on { background: rgba(12, 163, 12, 0.10); color: var(--good-ink); }
.live-badge.wait { background: rgba(250, 178, 25, 0.16); color: #7a5200; }
.live-badge.rec { background: rgba(208, 59, 59, 0.10); color: var(--critical-ink); }
.rec-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--critical); flex: none; }
.live-badge.on .rec-dot { background: var(--good); animation: live-pulse 1.6s ease-in-out infinite; }
.live-badge.rec .rec-dot { animation: live-pulse 1.6s ease-in-out infinite; }
.btn .rec-dot { margin-right: 6px; vertical-align: 0; background: #fff; }
@keyframes live-pulse { 50% { opacity: 0.25; } }
@media (prefers-reduced-motion: reduce) { .live-badge .rec-dot { animation: none; } }
.rec-on { display: inline-flex; align-items: center; gap: 6px; color: var(--critical-ink); font-weight: 600; }
.rec-clock { font-variant-numeric: tabular-nums; font-weight: 650; font-size: 18px; }
.live-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.live-start { display: inline-flex; gap: 8px; align-items: center; }
.live-health { font-size: 12.5px; }
.live-recform { display: flex; gap: 8px; flex-wrap: wrap; }
.live-recform input { flex: 1 1 220px; min-width: 0; }
.kpi .value.live-pill { font-size: 16px; padding: 6px 0 2px; }
.small { font-size: 12.5px; margin: 0; }
@media (max-width: 720px) {
  .live-actions .btn, .live-recform .btn { padding: 9px 14px; }   /* thumbs on a factory floor */
  .live-start select { padding: 8px; }
}

/* Settings in sections: measuring, uploads, LED */
.form-secs { display: grid; gap: 16px; }
.form-sec { display: grid; gap: 8px; }
.form-sec + .form-sec { border-top: 1px solid var(--grid); padding-top: 14px; }
.form-sec h3 { font-size: 14px; margin: 0; color: var(--ink); }
.form-sec > p { margin: 0; }
.field.info { display: grid; gap: 4px; font-weight: 550; color: var(--ink-2); font-size: 12.5px; align-content: start; }
.field.info .info-val { font-weight: 650; color: var(--ink); font-size: 14px; padding: 7px 0 3px; }
.estimate > div { display: grid; gap: 2px; }
.estimate b { color: var(--ink); }

/* real-time units: how old the last upload is, instead of a "Real-time" badge */
.rt.age { color: var(--ink-2); border-color: transparent; background: var(--surface-2); cursor: default; font-variant-numeric: tabular-nums; }
.rt.age.old { color: var(--critical-ink); background: rgba(208, 59, 59, 0.10); }
.rt.age .age-short { display: none; }
@media (max-width: 1100px) { .rt.age .age-long { display: none; } .rt.age .age-short { display: inline; } }
.drc-l1 .rt.age .age-long { display: none; }
.drc-l1 .rt.age .age-short { display: inline; }

/* Spot check */
.spot { display: grid; gap: 10px; }
.spot-wait { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 10px 12px; border-radius: 8px; background: var(--surface-2); font-variant-numeric: tabular-nums; }
.spot-result { display: grid; gap: 8px; padding: 12px; border: 1px solid var(--grid); border-radius: 8px; background: var(--surface); }
.spot-result p { margin: 0; }
.spot-list-title { margin: 4px 0 2px; font-weight: 600; }
.chart .ref-line { stroke: var(--ink-2); stroke-width: 1; stroke-dasharray: 4 3; }
.chart .ref-label { fill: var(--ink-2); font-size: 10.5px; }
.chart .mark-dot { fill: var(--critical); }
.chart .mark-label { fill: var(--ink); font-size: 11px; font-weight: 650; }
.vbadge { justify-self: start; display: inline-flex; align-items: center; font-weight: 700; font-size: 14px; padding: 3px 12px;
  border-radius: 999px; }
.vbadge.ok { color: var(--good-ink); background: rgba(12, 163, 12, 0.13); }
.vbadge.warn { color: #7a5200; background: rgba(250, 178, 25, 0.22); }
.vbadge.bad { color: var(--critical-ink); background: rgba(208, 59, 59, 0.12); }
.spot td .vbadge { font-size: 12px; padding: 1px 9px; }
