/* Farm monitor — 1920x1080 landscape, wall-mounted, unattended, wet gloves, daylight.
   Loaded after styles.css and inherits its tokens: the palette, the status hues and the
   spacing scale are the same ones the dashboard was validated against. Everything here
   is a kiosk-scale override.

   Three rules this file exists to enforce:
     1. Nothing scales below 15px, and no data weight below 600. A 3 m read on a cheap
        glossy panel forgives size, never thinness.
     2. Not one :hover rule. This is a touchscreen; :hover latches on tap and would
        leave a cage looking selected after the finger left.
     3. No infinite animation anywhere. The panel is on all day — an endless keyframe is
        burn-in and battery for nothing.

   Light, not dark, is deliberate: the stated scene is daylight and glare, where a light
   panel wins. The cost is burn-in risk, so there is no large field of pure white — the
   plane is --surface-2 and the tiles are --surface-1. */

:root {
  --wall-bar: 92px;
  --wall-foot: 68px;
  --wall-gap: 12px;
  --wall-pad: 20px;

  /* Kiosk type scale, rebalanced around ONE dominant number per tile.
     The old scale set the age equal to the value, which was right when a tile carried four
     metric rows and no single reading owned it. Now oxygen owns the tile, so it takes the
     size and everything else steps down — that hierarchy IS the answer to "organized but
     information-full". Nothing drops below the 15px floor for a 3 m read. */
  --t-name: 26px;
  --t-status: 15px;
  --t-big: 64px;      /* dissolved oxygen: the one number read from across the room */
  --t-uom: 20px;
  --t-value: 24px;
  --t-age: 16px;
  --t-label: 14px;
  --t-where: 15px;
  --t-strip-v: 40px;
  --t-strip-k: 13px;
  --t-zone: 19px;
}

/* Array scale. Sized so a tile carrying everything it may have to carry — four metric
   rows, a validation reason and today's feed — still fits 166px without clipping. Nothing
   is dropped to make room; the type gives way instead, and 19px stays well above the 15px
   floor for a 3 m read. */
.wall.dense {
  --t-name: 17px;
  --t-status: 12px;
  --t-big: 38px;
  --t-uom: 14px;
  --t-value: 17px;
  --t-age: 13px;
  --t-label: 10.5px;
  --t-where: 11px;
  --t-strip-v: 30px;
  --t-strip-k: 11px;
  --t-zone: 15px;
  --wall-gap: 7px;
}

body.wall {
  height: 100vh;
  overflow: hidden;                       /* a wall display never scrolls */
  /* A column, not a row template. Only #grid grows; the bar, the farm strip and the foot
     are each their own height. Nothing here counts children, so the demo band is just
     another sibling. */
  display: flex; flex-direction: column;
  background: var(--surface-2);
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;             /* no double-tap zoom under a glove */
  cursor: default;
}

/* ─────────────────────────────────────────────────────────── top bar */
#bar {
  display: flex; align-items: center; gap: var(--s6);
  padding: 0 var(--wall-pad);
  background: var(--surface-1);
  border-bottom: 2px solid var(--border-strong);
}
#bar .ident { display: flex; flex-direction: column; gap: 2px; }
#bar .farm { font-size: 25px; font-weight: 700; letter-spacing: -.02em; }
#bar .station {
  font-size: 14px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase;
  color: var(--text-secondary);
}
#bar .link { margin-left: auto; display: flex; align-items: center; gap: var(--s3); }
#bar .who { display: flex; align-items: center; gap: var(--s3); }
#bar .clock {
  font-size: 31px; font-weight: 700; font-variant-numeric: tabular-nums;
  letter-spacing: -.02em; min-width: 118px; text-align: right;
}

/* Link state. Cached is not a warning colour and not decoration — it is a fact the
   screen owes the room, at a size that reads from the door. */
.state {
  display: inline-flex; align-items: center; gap: var(--s2);
  font-size: 17px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  padding: 7px 14px; border-radius: 999px; border: 2px solid transparent;
  white-space: nowrap;
}
.state svg { width: 19px; height: 19px; }
.state.live { color: var(--good-text); border-color: color-mix(in srgb, var(--good) 55%, transparent); }
.state.cached { color: var(--critical); border-color: var(--critical); background: color-mix(in srgb, var(--critical) 8%, transparent); }
.state.signedout { color: #fff; background: var(--critical); border-color: var(--critical); }

.whobtn {
  appearance: none; font: inherit; cursor: pointer;
  display: inline-flex; align-items: center; gap: var(--s3);
  min-height: 60px; padding: 8px 20px;
  border: 2px solid var(--border-strong); border-radius: 999px;
  background: var(--surface-1); color: var(--text-primary);
}
.whobtn .nm { font-size: 21px; font-weight: 700; }
.whobtn .sub {
  font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--text-muted); white-space: nowrap;
}
.whobtn svg { width: 22px; height: 22px; flex: none; }
.whobtn.none { border-color: var(--axis); }
.whobtn.on { border-color: var(--brand-mid); background: var(--brand-pale); }
.whobtn:active { background: var(--surface-hover); }

/* ─────────────────────────────────────────────────────────── the wall */
/* The grid is now a stack of zone sections rather than one undifferentiated field. The
   frame carries the density: real headers with their own rollups, so thirty quiet tiles
   read as an organised wall instead of as noise. */
#bar { flex: none; height: var(--wall-bar); }
#strip { flex: none; }
#foot { flex: none; height: var(--wall-foot); }

#grid {
  flex: 1 1 auto;
  display: flex; flex-direction: column;
  gap: calc(var(--wall-gap) * 1.4);
  padding: var(--wall-pad);
  min-height: 0;
}
.zone { display: flex; flex-direction: column; gap: calc(var(--wall-gap) * .6); min-height: 0; }
.zone-head {
  display: flex; align-items: baseline; gap: var(--s3);
  padding-bottom: 4px; border-bottom: 2px solid var(--grid);
}
.zone-head .spacer { flex: 1 1 auto; }
.zone-name {
  margin: 0; font-size: var(--t-zone); font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: var(--text-primary);
}
.zone-sum {
  display: flex; align-items: baseline; gap: var(--s2);
  font-size: var(--t-strip-k); font-weight: 650; color: var(--text-secondary);
  white-space: nowrap;
}
.zone-sum .muted { color: var(--text-muted); }
.zone-sum .crit { color: var(--critical); font-weight: 750; }
.zone-dot { width: 3px; height: 3px; border-radius: 50%; background: var(--axis); align-self: center; }
.zone-grid {
  display: grid; gap: var(--wall-gap); min-height: 0;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  grid-auto-rows: 1fr;
}

/* ── the farm strip ────────────────────────────────────────────────────────
   Read before the eye reaches a tile. Grey unless a figure is actually abnormal: a zero
   rendered in red trains people to ignore red, which is the failure ISA-18.2 is about. */
#strip {
  display: flex; gap: var(--wall-gap);
  padding: 0 var(--wall-pad); flex: none;
}
.strip-cell {
  flex: 1 1 0; min-width: 0;
  display: flex; flex-direction: column; gap: 1px;
  padding: 10px 14px;
  background: var(--surface-1);
  border: 2px solid var(--border-strong);
  border-radius: var(--radius-sm);
}
.strip-v {
  font-size: var(--t-strip-v); font-weight: 750; line-height: 1;
  font-variant-numeric: tabular-nums; letter-spacing: -.02em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.strip-k {
  font-size: var(--t-strip-k); font-weight: 650; letter-spacing: .05em;
  text-transform: uppercase; color: var(--text-secondary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.strip-cell.critical { border-color: var(--critical); background: color-mix(in srgb, var(--critical) 8%, var(--surface-1)); }
.strip-cell.critical .strip-v { color: var(--critical); }
.strip-cell.warning { border-color: var(--warning); }
.strip-cell.warning .strip-v { color: var(--warning-text); }
.strip-cell.flagged { border-color: var(--serious); }
.strip-cell.flagged .strip-v { color: var(--serious); }
.strip-cell.uninstrumented { border-style: dashed; border-color: var(--axis); }
.strip-cell.uninstrumented .strip-v { color: var(--text-secondary); }

.cage-tile {
  appearance: none; font: inherit; text-align: left; cursor: pointer;
  background: var(--surface-1); color: var(--text-primary);
  border: 2px solid var(--border-strong); border-radius: var(--radius);
  padding: 14px 16px; min-width: 0; min-height: 0; overflow: hidden;
  display: flex; flex-direction: column; gap: var(--s2);
}
/* Nothing in a tile may shrink. A flex child that gives up height clips its own text
   from the top, which is how a cage silently loses its name. */
.cage-tile > * { flex: none; }
/* The body sets 14px/1.5. At 31px that leading is 15px of air per line and it was
   pushing the metrics out of the tile — data rows are set solid instead. */
.cage-tile { line-height: 1.16; }
.tile-metric .v, .tile-metric .k, .tile-metric .a { line-height: 1.02; }
.tile-status { line-height: 1.1; }
.wall.dense .cage-tile { padding: 9px 11px; border-radius: var(--radius-sm); gap: 3px; }

.tile-id { display: flex; flex-direction: column; gap: 3px; }
.tile-id .tile-status { margin-top: 5px; }
.tile-head { display: flex; align-items: center; gap: var(--s2); min-width: 0; }
.tile-head .spacer { flex: 1 1 auto; min-width: 4px; }
.tile-head .tile-name { flex: 0 1 auto; }
.tile-head .tile-status { flex: none; }
.cage-tile:active { background: var(--surface-hover); }

/* Status is carried by a border, an icon and a word. Never by hue alone, and never by
   hue on the surface where glare would wash it out.

   GREY-SCALE FIRST. `good` gets NO colour: on a farm where one cage of thirty is
   instrumented, colouring the normal state would paint the whole wall and leave the one
   reading that matters competing with twenty-nine reassurances. Colour is reserved for
   abnormal, which is what makes abnormal visible from the door. */
.cage-tile.critical { border-color: var(--critical); background: color-mix(in srgb, var(--critical) 7%, var(--surface-1)); }
.cage-tile.serious { border-color: var(--serious); }
.cage-tile.warning { border-color: var(--warning); }
.cage-tile.good { border-color: var(--border-strong); }
.cage-tile.silent { border-color: var(--axis); background: var(--surface-sunken); }
.cage-tile.flagged { border-color: var(--serious); background: color-mix(in srgb, var(--serious) 6%, var(--surface-1)); }

/* NOT INSTRUMENTED — twenty-nine of thirty cages today, and the state the client will
   look at on day one. A dashed border and a sunken plane: the berth is real and empty. It
   must not read as an error and it must never read as green. */
.cage-tile.uninstrumented {
  border-style: dashed; border-color: var(--axis);
  background: var(--surface-sunken);
}
.cage-tile.uninstrumented .tile-name { color: var(--text-secondary); font-weight: 650; }
.tile-state.uninstrumented { color: var(--text-muted); }

/* ── the dominant number ─────────────────────────────────────────────────── */
/* The one exception to "nothing in a tile may shrink": the dominant number is allowed to
   own the free space and centre in it. It cannot clip, because it is the only thing in the
   box — and without this the number sat under the name with a void beneath it. */
.tile-big {
  display: flex; align-items: center; gap: 4px; min-width: 0;
  flex: 1 1 auto; min-height: 0;
}
.tile-value {
  font-size: var(--t-big); font-weight: 750; line-height: .92;
  font-variant-numeric: tabular-nums; letter-spacing: -.03em;
}
.tile-uom { font-size: var(--t-uom); font-weight: 650; color: var(--text-secondary); }
.tile-big.critical .tile-value { color: var(--critical); }
.tile-big.warning .tile-value { color: var(--warning-text); }
/* A reading that cannot resolve its own threshold is not styled as a confident value.
   It is not an error either — the instrument is working and honest about its limits. */
/* Deliberately no rule for .unresolved here. See tile(): the state belongs to the footnote,
   not to the number, or a third of the wall is coloured and colour stops meaning anything. */
.tile-big.bare { margin-top: auto; }
.tile-none {
  font-size: var(--t-value); font-weight: 650; color: var(--text-muted);
  letter-spacing: .02em;
}
.tile-trend {
  font-size: var(--t-uom); font-weight: 700; line-height: 1; margin-left: 2px;
  color: var(--text-secondary);
}
.tile-trend.down { color: var(--warning-text); }
.tile-trend.up { color: var(--text-secondary); }

.tile-spark { height: 26px; flex: none; margin-top: 2px; }
.wall.dense .tile-spark { height: 16px; }
.tile-spark svg { width: 100%; height: 100%; display: block; }
.tile-spark.empty { border-bottom: 2px dotted var(--grid); height: 0; margin-top: 10px; }
.spark { fill: none; stroke-width: 2.2; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.spark.good, .spark.silent, .spark.uninstrumented { stroke: var(--axis); }
.spark.warning { stroke: var(--warning); }
.spark.critical { stroke: var(--critical); }
.spark.flagged { stroke: var(--serious); }

.tile-state {
  display: flex; align-items: center; gap: 5px; flex: none;
  font-size: var(--t-status); font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
}
.tile-state svg { width: 1.1em; height: 1.1em; flex: none; }
.tile-state.critical { color: var(--critical); }
.tile-state.warning { color: var(--warning-text); }
.tile-state.good { color: var(--text-secondary); }
.tile-state.silent { color: var(--text-secondary); }
.tile-state.flagged { color: var(--serious); }

.tile-name {
  font-size: var(--t-name); font-weight: 700; letter-spacing: -.02em; line-height: 1.05;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tile-where {
  font-size: var(--t-where); font-weight: 600; color: var(--text-secondary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tile-status {
  display: flex; align-items: center; gap: var(--s2);
  font-size: var(--t-status); font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
}
.tile-status svg { width: 1.15em; height: 1.15em; flex: none; }
.tile-status.critical { color: var(--critical); }
.tile-status.serious { color: var(--serious); }
.tile-status.warning { color: var(--warning-text); }
.tile-status.good { color: var(--good-text); }
.tile-status.silent { color: var(--text-secondary); }
.tile-status.flagged { color: var(--serious); }

.tile-rule { border-top: 2px solid var(--grid); margin: 2px 0; }


.tile-metrics { display: flex; flex-direction: column; gap: 2px; }
.wall.dense .tile-metrics { margin-top: auto; gap: 1px; }

/* One row per metric: state, name, value, and the age of THAT value — each metric carries
   its own timestamp and its own reporting verdict, so none of them may share one. The age
   is set at the same size and weight as the value on purpose. It is not a footnote. */
.tile-metric { display: flex; align-items: baseline; gap: var(--s3); min-width: 0; }
.tile-metric .dot { width: .52em; height: .52em; border-radius: 50%; flex: none; align-self: center; }
.tile-metric .dot.good { background: var(--good); }
.tile-metric .dot.warning { background: var(--warning); }
.tile-metric .dot.critical { background: var(--critical); }
.tile-metric .dot.unknown { background: transparent; box-shadow: inset 0 0 0 2px var(--axis); }
/* No text-transform on a metric label: uppercasing "pH" spells it "PH", which is a different
   thing. The labels are written as they are meant to read. */
.tile-metric .k {
  font-size: var(--t-label); font-weight: 700; letter-spacing: .07em;
  color: var(--text-secondary); white-space: nowrap; flex: none;
}
.tile-metric .v {
  font-size: var(--t-value); font-weight: 700; font-variant-numeric: tabular-nums;
  margin-left: auto; white-space: nowrap; flex: none;
}
.tile-metric .v u { font-size: .58em; font-weight: 700; text-decoration: none; color: var(--text-secondary); }
.tile-metric .a {
  font-size: var(--t-age); font-weight: 700; font-variant-numeric: tabular-nums;
  color: var(--text-secondary); white-space: nowrap; flex: none; text-align: right;
  min-width: 9ch;
}
.tile-metric.critical .v { color: var(--critical); }

/* No value at all. The age becomes the loudest thing on the row, because "silent for
   twelve minutes" is the whole message. */
.tile-metric .v.none { color: var(--axis); }
.tile-metric .a.none { color: var(--text-primary); }

/* Flagged by validation: greyed, never styled as live, and labelled with the verdict. */
.tile-metric.flagged .v { color: var(--text-muted); }
.tile-metric .a.flag {
  font-size: calc(var(--t-age) * .62); letter-spacing: .07em; text-transform: uppercase;
  color: var(--serious);
}
.tile-metric .a.derived { font-size: calc(var(--t-age) * .78); color: var(--text-muted); }

/* The reason a reading is not trusted, once per tile. Grey without a reason is just grey. */
.tile-why {
  font-size: var(--t-where); font-weight: 600; color: var(--text-secondary);
  border-top: 2px solid var(--grid); padding-top: 5px; margin-top: 4px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}


.tile-fed {
  display: flex; align-items: center; gap: var(--s2);
  font-size: var(--t-where); font-weight: 700;
  color: var(--good-text); border-top: 2px solid var(--grid); padding-top: 6px; margin-top: 4px;
}
.tile-fed.queued { color: var(--text-secondary); }
.tile-fed.rejected { color: var(--critical); }
.tile-fed svg { width: 1.05em; height: 1.05em; flex: none; }

/* ─────────────────────────────────────────────────────────── foot */
#foot {
  display: flex; align-items: center; gap: var(--s5);
  padding: 0 var(--wall-pad);
  background: var(--surface-1);
  border-top: 2px solid var(--border-strong);
  font-size: 15px; font-weight: 600; color: var(--text-secondary);
}
#foot .spacer { flex: 1; }
#foot .q {
  display: inline-flex; align-items: center; gap: var(--s2); white-space: nowrap; flex: none;
  font-weight: 700; color: var(--text-primary);
  border: 2px solid var(--border-strong); border-radius: 999px; padding: 6px 14px;
}
#foot .q svg { width: 18px; height: 18px; flex: none; }
#foot #note { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#foot .q.pending { border-color: var(--warning); }
#foot .q.rejected { border-color: var(--critical); color: var(--critical); }

/* ─────────────────────────────────────────────────────────── feed sheet */
#sheet {
  position: fixed; inset: 0; z-index: 100;
  background: var(--surface-2);
  display: grid; grid-template-rows: auto 1fr auto;
}
#sheet[hidden] { display: none; }
/* The detail panel is a centred card over a dimmed wall, not a full-bleed task surface.
   The wall behind it does not reflow, so closing returns the eye where it left. */
#sheet.detail {
  display: grid; place-items: center;
  grid-template-rows: none;
  background: color-mix(in srgb, var(--text-primary) 34%, transparent);
  padding: var(--wall-pad);
}

.sheet-top {
  display: flex; align-items: center; gap: var(--s5);
  padding: 18px var(--wall-pad); background: var(--surface-1);
  border-bottom: 2px solid var(--border-strong);
}
.sheet-top .what { min-width: 0; }
.sheet-top .step {
  font-size: 15px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase;
  color: var(--text-secondary);
}
/* A sentence stays a sentence. Uppercase is for the two-word step marker only. */
.sheet-top .sub {
  font-size: 19px; font-weight: 600; color: var(--text-secondary); margin-top: 2px;
}
.sheet-top h1 { font-size: 40px; font-weight: 700; letter-spacing: -.025em; margin: 0; }
.sheet-top .spacer { flex: 1; }

.big {
  appearance: none; font: inherit; cursor: pointer;
  min-height: 84px; padding: 0 34px;
  border: 2px solid var(--border-strong); border-radius: var(--radius);
  background: var(--surface-1); color: var(--text-primary);
  font-size: 23px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s3);
}
.big:active { background: var(--surface-hover); }
.big svg { width: 24px; height: 24px; }
.big.go { background: var(--brand-mid); border-color: var(--brand-mid); color: #fff; }
.big.go:active { background: var(--brand-dark); }
.big.go[disabled] {
  background: var(--surface-sunken); border-color: var(--border-strong);
  color: var(--text-muted); cursor: default;
}

.w-body {
  /* Renamed off .sheet-body deliberately: styles.css already owns that name for the
     dashboard's two-column record form, and the wall was inheriting its columns. */
  padding: var(--wall-pad); min-height: 0; overflow: hidden;
  display: grid; grid-template-columns: 1fr; grid-auto-rows: min-content; gap: var(--s5);
  align-content: start;
}
/* On a wall-mounted panel the lower half is the reachable half. The pad and the Confirm
   bar sit together at the bottom so the two things a glove touches are adjacent. */
.w-body.low { align-content: end; }

/* Recommended ration. Information, never a default: it is not a button, it cannot be
   tapped, and nothing here is preselected. The worker records what happened. */
.advice {
  display: flex; align-items: center; gap: var(--s6); flex-wrap: wrap;
  padding: 16px 20px; border-radius: var(--radius);
  border: 2px dashed var(--border-strong); background: var(--surface-1);
}
.advice .k {
  font-size: 15px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase;
  color: var(--text-secondary);
}
.advice .v { font-size: 31px; font-weight: 700; font-variant-numeric: tabular-nums; }
.advice .v u { font-size: .55em; text-decoration: none; color: var(--text-secondary); }
.advice .n { font-size: 15px; font-weight: 600; color: var(--text-secondary); }

.pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s4); align-content: start; }
.amt {
  appearance: none; font: inherit; cursor: pointer;
  min-height: 168px; padding: 12px;
  border: 3px solid var(--border-strong); border-radius: var(--radius);
  background: var(--surface-1); color: var(--text-primary);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
}
.amt .qty { font-size: 40px; font-weight: 700; letter-spacing: -.02em; }
.amt .kg { font-size: 18px; font-weight: 700; color: var(--text-secondary); }
.amt:active { background: var(--surface-hover); }
.amt.on {
  border-color: var(--brand-mid); background: var(--brand-pale);
  box-shadow: inset 0 0 0 3px var(--brand-mid);
}
.amt.on .kg { color: var(--brand-dark); }

/* Sign-in is one screen with one question on it, so the targets get the whole panel.
   Four names on a 1920 wall means four 300px targets, not four buttons in a corner. */
.w-body.centre { display: flex; align-items: center; justify-content: center; }
/* Column count is set inline from the number of names — auto-fit collapses to one
   track when the container is centred and therefore sized to its own content. */
.names { display: grid; gap: var(--s5); justify-content: center; }
.name {
  appearance: none; font: inherit; cursor: pointer;
  min-height: 240px; padding: 20px;
  border: 3px solid var(--border-strong); border-radius: var(--radius);
  background: var(--surface-1); color: var(--text-primary);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--s4);
}
.name .initial {
  width: 92px; height: 92px; border-radius: 50%;
  background: var(--brand-pale); color: var(--brand-dark);
  display: grid; place-items: center; font-size: 44px; font-weight: 700;
}
.name .nm { font-size: 34px; font-weight: 700; letter-spacing: -.02em; }
.name:active { background: var(--surface-hover); }

.w-foot {
  display: flex; align-items: center; gap: var(--s4);
  padding: 18px var(--wall-pad); background: var(--surface-1);
  border-top: 2px solid var(--border-strong);
}
.w-foot .spacer { flex: 1; }
.w-foot .summary { font-size: 21px; font-weight: 700; }
.w-foot .summary .muted { color: var(--text-secondary); font-weight: 600; }

/* The one authored moment: a state change, not a fade. The whole screen becomes the
   receipt, at a size that is unmistakable from three metres, and it holds long enough
   to be read before it clears itself. No animation is involved. */
.receipt {
  position: fixed; inset: 0; z-index: 110;
  background: var(--brand-dark); color: #fff;
  display: grid; place-content: center; justify-items: center; gap: var(--s5);
  padding: var(--wall-pad); text-align: center;
}
.receipt svg { width: 132px; height: 132px; stroke-width: 2.4; }
.receipt .headline { font-size: 76px; font-weight: 700; letter-spacing: -.03em; line-height: 1; }
.receipt .detail { font-size: 34px; font-weight: 700; }
.receipt .by { font-size: 23px; font-weight: 600; color: #cfe6cf; }
.receipt.queued { background: #4a3f0a; }
.receipt.queued .by { color: #f4e2a8; }

.fatal, .signedout-panel {
  position: fixed; inset: 0; z-index: 120;
  background: var(--critical); color: #fff;
  display: grid; place-content: center; justify-items: center; gap: var(--s4);
  padding: 48px; text-align: center;
}
.signedout-panel .headline { font-size: 62px; font-weight: 700; letter-spacing: -.02em; }
.signedout-panel .detail { font-size: 27px; font-weight: 600; max-width: 26ch; }

/* A tablet propped at the feed store rather than the wall panel. Same rules, fewer
   columns, and the pad stays thumb-sized. */
@media (max-width: 1100px) {
  :root { --wall-bar: 78px; --wall-foot: 60px; --t-name: 25px; --t-value: 24px; --t-age: 24px; --t-status: 16px; }
  #bar .clock { display: none; }
  .sheet-top h1 { font-size: 31px; }
  .names { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 720px) {
  /* A phone in a pocket at the feed store. The bar has to give up width, not overflow. */
  body.wall { overflow: auto; }
  #grid { overflow-y: auto; }
  #bar { gap: var(--s3); padding: 10px var(--s4); flex-wrap: wrap; }
  #bar .farm { font-size: 19px; }
  #bar .ident .station { display: none; }
  #bar .link { margin-left: auto; }
  .state { font-size: 13px; padding: 5px 10px; letter-spacing: .02em; }
  .state svg { width: 15px; height: 15px; }
  .whobtn { min-height: 48px; padding: 6px 14px; }
  .whobtn .sub { display: none; }
  .whobtn.none .sub { display: block; font-size: 11px; }
  #foot { font-size: 12px; padding: 0 var(--s4); }
  #foot #note { display: none; }
  .pad { grid-template-columns: repeat(2, 1fr); }
  .names { grid-template-columns: repeat(2, 1fr); }
  .receipt .headline { font-size: 48px; }
  .receipt svg { width: 88px; height: 88px; }
}

/* Reduced motion has nothing to switch off here — there is no motion. Kept so the
   intent is on the record rather than assumed. */
@media (prefers-reduced-motion: reduce) {
  .wall *, .wall *::before, .wall *::after { animation: none !important; transition: none !important; }
}

/* The placeholder warning is a line of text, not a panel. It stops someone believing the
   increments are calibrated; it does not deserve a quarter of the screen. */
.provisional {
  font-size: 17px; font-weight: 600; color: var(--text-secondary);
  display: flex; align-items: center; gap: var(--s3);
}
.provisional::before {
  content: ""; width: 10px; height: 10px; border-radius: 50%;
  background: var(--warning); flex: none;
}

/* Nothing loaded. An unattended panel with a blank screen is worse than one showing bad
   numbers, because nobody can tell it apart from a dead machine. */
.nodata {
  display: grid; place-content: center; justify-items: center; gap: var(--s4);
  text-align: center; padding: var(--s7);
  border: 3px dashed var(--border-strong); border-radius: var(--radius);
  background: var(--surface-1); color: var(--text-secondary);
}
.nodata svg { width: 88px; height: 88px; color: var(--axis); }
.nodata .headline { font-size: 44px; font-weight: 700; color: var(--text-primary); letter-spacing: -.02em; }
.nodata .detail { font-size: 21px; font-weight: 600; max-width: 44ch; }

/* A threshold breach the headline could not carry, because the server ranked "cannot hear
   this cage" above it. Both facts are true and both are labelled; neither is colour alone. */
.tile-alert {
  display: flex; align-items: center; gap: var(--s2);
  font-size: var(--t-where); font-weight: 700; color: var(--critical);
  border-top: 2px solid color-mix(in srgb, var(--critical) 35%, var(--grid));
  padding-top: 5px; margin-top: 4px; white-space: nowrap; overflow: hidden;
}
.tile-alert svg { width: 1.15em; height: 1.15em; flex: none; }

/* Only when the tiles could not otherwise fit. The bar and the foot stay pinned; the grid
   itself is what moves, so the link state and the queue never scroll out of sight. */
.wall.scrolls #grid { overflow-y: auto; align-content: start; }

/* At array scale a tile can have to carry everything at once: head, four metric rows, a
   validation reason AND today's feed. That combination measured 187px against the 184px a
   1080 wall can give a row of five, so the separators give up their margins rather than
   the wall giving up its promise not to scroll. */
.wall.dense .tile-rule { margin: 0; }
.wall.dense .tile-why,
.wall.dense .tile-fed,
.wall.dense .tile-alert { padding-top: 3px; margin-top: 2px; line-height: 1.05; }

/* One footer line. It replaced three, which is where the 22px of overflow was. */
.tile-foot {
  display: flex; align-items: center; gap: var(--s2);
  font-size: var(--t-where); font-weight: 700;
  border-top: 2px solid var(--grid); padding-top: 3px; margin-top: 2px;
  min-width: 0; color: var(--text-secondary);
}
.tile-foot svg { width: 1.05em; height: 1.05em; flex: none; }
.tile-foot .ft { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
/* An exception's reason gets two lines. A tile that says "rate of change 4.8 mg/L per mi..."
   has spent its space on the words the reader already knew. */
.tile-foot.why .ft {
  white-space: normal; display: -webkit-box; -webkit-box-orient: vertical;
  -webkit-line-clamp: 2; line-clamp: 2; line-height: 1.25;
}
.tile-foot.fed { color: var(--good-text); }
.tile-foot.queued { color: var(--text-secondary); }
.tile-foot.rejected, .tile-foot.why { color: var(--serious); }
.wall.dense .tile-foot { padding-top: 2px; margin-top: 1px; }

/* The metric row now carries the envelope, so the age slot gives up its fixed floor —
   with a graphic between them the columns still read without it. */
.tile-metric .a { min-width: 0; }
.wall.dense .tile-metric { gap: var(--s2); }

/* ─────────────────────────────────────────────────────────── report by exception
   ANSI/ISA-101 reserves colour for alarm and deviation. A green tick on a healthy cage is
   the "everything is bright, so nothing is" failure: nineteen green chips on a wall of
   thirty train the eye to ignore chips. Normal is therefore neutral — the icon and the word
   stay, so status is never colour alone, but the colour goes.

   The whole wall is grey when the farm is fine. Any colour at all means look here. */
.cage-tile.good { border-color: var(--border-strong); }
.tile-status.good { color: var(--text-secondary); }
.tile-metric .dot.good { background: var(--axis); }
.wall .env:not(.dev) .env-now { fill: var(--text-secondary); }

/* ═══════════════════════════════════════════════════════════════════════════
   THE DETAIL PANEL — ISA-101 Level 2, on top of the wall.

   Everything the tile stopped carrying. Deliberately NOT wall-scale type: this is read at
   arm's length by somebody who has walked over and selected a cage, so it can afford
   sentences. The wall behind it stays exactly as it was — nothing reflows, so the panel
   closing returns the eye to the same place it left.
   ═══════════════════════════════════════════════════════════════════════════ */
.tile-foot .ft.muted { color: var(--text-muted); font-weight: 600; }

.dt {
  display: flex; flex-direction: column;
  /* Wide enough for three metric cards and three instrument cards side by side, which is
     what keeps the card short enough to fit without scrolling on a wall. */
  width: min(1120px, 94vw);
  max-height: calc(100vh - 2 * var(--wall-pad));
  background: var(--surface-1); color: var(--text-primary);
  border: 2px solid var(--border-strong); border-radius: var(--radius);
  overflow: hidden;
}
.dt-head {
  display: flex; align-items: center; gap: var(--s3);
  padding: 16px 18px; border-bottom: 2px solid var(--grid);
  background: var(--surface-2); flex: none;
}
.dt-head .spacer { flex: 1 1 auto; }
.dt-title { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.dt-cage { font-size: 26px; font-weight: 750; letter-spacing: -.02em; line-height: 1.05; }
.dt-where {
  font-size: 13px; font-weight: 650; letter-spacing: .05em; text-transform: uppercase;
  color: var(--text-secondary);
}
.dt-state {
  display: flex; align-items: center; gap: 6px; flex: none;
  font-size: 14px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
}
.dt-state svg { width: 1.15em; height: 1.15em; }
.dt-state.critical { color: var(--critical); }
.dt-state.warning { color: var(--warning-text); }
.dt-state.flagged { color: var(--serious); }
.dt-state.good, .dt-state.silent { color: var(--text-secondary); }
.dt-state.uninstrumented { color: var(--text-muted); }
.dt-close {
  appearance: none; font: inherit; cursor: pointer; flex: none;
  /* Clearance for the focus ring, which is drawn 2px outside the button and was landing on
     top of the status word. */
  margin-left: 10px;
  width: 44px; height: 44px; border-radius: var(--radius-sm);
  border: 2px solid var(--border-strong); background: var(--surface-1);
  color: var(--text-secondary); font-size: 18px; line-height: 1;
}
.dt-close:active { background: var(--surface-hover); }
.dt-close:focus-visible { outline: 3px solid var(--focus, var(--text-primary)); outline-offset: 2px; }

/* min-height: 0 is load-bearing. Without it this flex child will not shrink below its
   content, the card's max-height cannot apply, and the head scrolls off the top. */
.dt-body { padding: 18px; overflow-y: auto; min-height: 0;
  display: flex; flex-direction: column; gap: 20px; }
.dt-block { display: flex; flex-direction: column; gap: 8px; }
.dt-h {
  margin: 0; font-size: 13px; font-weight: 700; letter-spacing: .07em;
  text-transform: uppercase; color: var(--text-secondary);
}
.dt-empty {
  font-size: 13.5px; line-height: 1.45; color: var(--text-secondary);
  padding: 10px 12px; background: var(--surface-sunken);
  border-radius: var(--radius-sm);
}

.dt-mgrid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.dt-metric {
  display: flex; flex-direction: column; gap: 3px;
  padding: 12px 14px; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.dt-mhead { display: flex; align-items: baseline; gap: var(--s2); flex-wrap: wrap; }
.dt-mhead .spacer { flex: 1 1 auto; }
.dt-mname { font-size: 13px; font-weight: 700; color: var(--text-secondary); }
.dt-chip {
  font-size: 10.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  padding: 2px 7px; border-radius: 999px; border: 1px solid var(--border-strong);
  color: var(--text-secondary); white-space: nowrap;
}
.dt-chip.critical { color: var(--critical); border-color: var(--critical); }
.dt-chip.warning { color: var(--warning-text); border-color: var(--warning); }
.dt-chip.indeterminate, .dt-chip.overlap { color: var(--serious); border-color: var(--serious); }
.dt-mvalue { display: flex; align-items: baseline; gap: 4px; }
.dt-mvalue.none { font-size: 15px; font-weight: 650; color: var(--text-muted); }
.dt-num { font-size: 32px; font-weight: 750; line-height: 1; font-variant-numeric: tabular-nums; }
.dt-uom { font-size: 14px; font-weight: 650; color: var(--text-secondary); }
/* Depth is not a footnote. The buoy floats, the cable sets the depth, and a crash kills
   from the bottom up — a reading labelled "the cage" hides the one fact that decides
   whether it means anything. */
.dt-depth { font-size: 12.5px; font-weight: 650; color: var(--text-primary); }
.dt-age { font-size: 12px; color: var(--text-muted); }
.dt-uncert {
  margin-top: 4px; font-size: 12.5px; line-height: 1.45; color: var(--serious);
  border-top: 1px solid var(--border); padding-top: 6px;
}
.dt-flag { font-size: 12.5px; line-height: 1.4; color: var(--serious); font-weight: 650; }

.dt-dev {
  display: flex; flex-direction: column; gap: 2px;
  padding: 12px 14px; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.dt-devid {
  font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums;
  margin-bottom: 4px;
}
.dt-kv { display: flex; align-items: baseline; gap: var(--s3); font-size: 13px; }
.dt-k { flex: 0 0 40%; color: var(--text-secondary); font-weight: 650; }
.dt-v { font-weight: 700; font-variant-numeric: tabular-nums; }
.dt-v.none { color: var(--text-muted); font-weight: 600; }
.dt-note { color: var(--text-muted); font-size: 12px; }
.dt-kv.warn .dt-v { color: var(--serious); }

/* Turnover. "Not monitored" is a statement about the instrumentation, and it is set as a
   fact rather than as a reassurance — a screen implying turnover is watched when it is not
   is worse than one admitting the gap. */
.dt-notmon { font-size: 14px; font-weight: 700; color: var(--serious); }

.dt-actions {
  display: flex; gap: var(--s3); padding: 14px 18px; flex: none;
  border-top: 2px solid var(--grid); background: var(--surface-2);
}
.dt-primary {
  appearance: none; font: inherit; cursor: pointer; flex: 1 1 auto;
  min-height: 52px; border-radius: var(--radius-sm);
  border: 2px solid var(--border-strong); background: var(--surface-1);
  color: var(--text-primary); font-size: 16px; font-weight: 700;
}
.dt-primary:active { background: var(--surface-hover); }
.dt-primary:focus-visible { outline: 3px solid var(--focus, var(--text-primary)); outline-offset: 2px; }

/* The wall does not scroll, but the array can outgrow 1080 on a tablet. */
body.wall.scrolls #grid { overflow-y: auto; }
.dt-env { margin-top: 6px; }

/* UNRESOLVED — the instrument cannot adjudicate its own reading against a limit.
   Grey surface, grey border: the water is not abnormal. The state is carried by the
   number's colour, the footnote and the strip count, which is enough to find it and not
   enough to compete with a genuine breach two tiles away. */
.cage-tile.unresolved { border-color: var(--border-strong); }
.tile-state.unresolved { color: var(--serious); }
.spark.unresolved { stroke: var(--axis); }
.tile-foot.why .ft { color: var(--serious); font-weight: 650; }

/* The unresolved footnote: legible, not loud. One weight up from muted and no colour, so it
   is found by reading the tile rather than by the eye being pulled across the room. */
.tile-foot .ft.note { color: var(--text-secondary); font-weight: 600; }
.strip-cell.unresolved { border-color: var(--border-strong); }
.strip-cell.unresolved .strip-v { color: var(--text-primary); }

/* One instrument card per device, side by side. Stacked, three probes on one buoy made the
   panel twice the height of the screen. */
.dt-block.devs { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.dt-block.devs > .dt-h { grid-column: 1 / -1; }
.dt-block.devs > .dt-empty { grid-column: 1 / -1; }


/* v16 · the wall never overlaps. A zone keeps the height its tiles need; when the farm
   outgrows the panel the grid scrolls rather than letting the next zone's header draw
   over the last row of tiles (seen with the simulator's 254 legacy units at 1920×1000). */
.zone { flex: none; }
#grid { overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.zone-grid { grid-auto-rows: minmax(88px, auto); }

/* v16 · the phone-width wall: the bar wraps, so it may not keep a fixed height (the roster
   pill was drawing over the strip), and five strip cells become a 3+2 wrap instead of five
   clipped captions. */
@media (max-width: 720px) {
  #bar { height: auto; min-height: var(--wall-bar); row-gap: 8px; }
  #strip { flex-wrap: wrap; }
  .strip-cell { flex: 1 1 30%; min-width: 30%; }
  .strip-k { white-space: normal; overflow: visible; text-overflow: clip; line-height: 1.2; }
  .cage-tile .name, .cage-tile .cage-name { overflow: hidden; text-overflow: ellipsis; }
}

/* v16 · the tile breathes: name, then a clear 10px, then the value or its absence. */
.wall:not(.dense) .cage-tile { gap: 10px; }

/* ── 2026-09-07 redesign: silence, bench, tonight, cage map ────────────────────────────── */
#silence {
  flex: none; margin: 0 var(--wall-pad) var(--wall-gap); padding: 10px 16px;
  display: flex; align-items: center; gap: var(--s3);
  border: 2px solid var(--critical); border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--critical) 10%, var(--surface-1));
  color: var(--text-primary);
}
#silence[hidden] { display: none; }
#silence svg { width: 26px; height: 26px; color: var(--critical); flex: none; }
#silence .hd { font-size: 22px; font-weight: 750; white-space: nowrap; }
#silence .sub { font-size: 15px; font-weight: 600; color: var(--text-secondary); min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#focus {
  flex: none; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: var(--wall-gap); padding: var(--wall-gap) var(--wall-pad) 0;
}
#focus[hidden] { display: none; }
@media (max-width: 1100px) { #focus { grid-template-columns: 1fr; } }
.panel {
  min-width: 0; display: flex; flex-direction: column; gap: 8px;
  padding: 12px 16px; background: var(--surface-1);
  border: 2px solid var(--border-strong); border-radius: var(--radius-sm);
}
.panel-head {
  display: flex; align-items: baseline; gap: var(--s3);
  font-size: var(--t-zone); font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--text-primary);
}
.panel-head .sub {
  margin-left: auto; font-size: 14px; font-weight: 600; letter-spacing: 0; text-transform: none;
  color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0;
}
.panel-note { font-size: 14px; font-weight: 600; color: var(--text-secondary); }
.panel-note.foot { margin-top: auto; padding-top: 6px; border-top: 1px solid var(--border); }
.bench-rows { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--wall-gap); }
.bench-row {
  display: flex; flex-direction: column; gap: 4px; min-width: 0;
  padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.bench-row.flagged { border-color: var(--serious); }
.bench-k {
  display: flex; align-items: baseline; gap: 8px; font-size: 13px; font-weight: 650;
  letter-spacing: .05em; text-transform: uppercase; color: var(--text-secondary); min-width: 0;
}
.bench-k .dev { margin-left: auto; font-size: 11px; letter-spacing: 0; text-transform: none;
  color: var(--text-muted); font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bench-v { font-size: 40px; font-weight: 750; line-height: 1; letter-spacing: -.02em; font-variant-numeric: tabular-nums; color: var(--text-primary); }
.bench-v .uom { font-size: 16px; font-weight: 600; color: var(--text-secondary); margin-left: 6px; letter-spacing: 0; }
.bench-row .tile-spark { height: 34px; }
.bench-age { font-size: 14px; font-weight: 600; color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.bench-age.late { color: var(--warning-text); }
.tonight svg { display: block; width: 100%; height: auto; }
.ta-limit { font-size: 12px; font-weight: 650; fill: var(--text-muted); }
.ta-axis { font-size: 12px; font-weight: 650; fill: var(--text-secondary); letter-spacing: .04em; text-transform: uppercase; }
.ta-tick { font-size: 12px; font-weight: 650; fill: var(--text-secondary); font-variant-numeric: tabular-nums; }
.zone.compact { gap: 6px; }
.map-wrap { display: flex; flex-direction: column; gap: 6px; }
.cage-map { display: flex; flex-wrap: wrap; gap: 4px; align-content: flex-start; }
.cm {
  appearance: none; padding: 0; cursor: pointer; width: 26px; height: 26px; border-radius: 5px;
  border: 2px solid var(--axis); background: transparent;
}
.cm.bare { border-style: dashed; opacity: .6; }
.cm.good { border-color: var(--good, #16a34a); background: color-mix(in srgb, var(--good, #16a34a) 35%, var(--surface-1)); }
.cm.warning { border-color: var(--warning); background: color-mix(in srgb, var(--warning) 35%, var(--surface-1)); }
.cm.critical, .cm.serious { border-color: var(--critical); background: color-mix(in srgb, var(--critical) 45%, var(--surface-1)); }
.cm.silent, .cm.flagged { border-color: var(--text-muted); background: var(--surface-sunken); }
.cm:active { transform: scale(.94); }
.wall.dense .cm { width: 20px; height: 20px; border-radius: 4px; }
.map-legend { font-size: 13px; font-weight: 600; color: var(--text-secondary); }
