/* Fleet page. Additions only.
 *
 * Every colour here resolves a token from app.css. There is no palette in this
 * file and there must not be one: the fleet page and the station console are the
 * same instrument seen at two distances, and a second set of hexes is how they
 * drift apart.
 */

/* ---------------------------------------------------------------- station state */

/* One vocabulary, used by the row, the dot and the badge, so a station reads the
 * same in the table as it does in its own panel.
 *
 *   online   --sig    answering within three of its own poll intervals
 *   deaf     --warn   answering, but its receiver has stopped: shown as `not receiving`
 *   stale    --warn   late, but a narrowband node is allowed to be slow
 *   offline  --alarm  ten intervals of silence: it has stopped
 *   paused   --ink-3  deliberately not followed. Not a fault, so not a colour.
 *   never    --alarm  has never answered at all, which is usually a wrong URL
 */
.st-online  { --state: var(--sig); }
.st-deaf    { --state: var(--warn); }
.st-stale   { --state: var(--warn); }
.st-offline { --state: var(--alarm); }
.st-paused  { --state: var(--ink-3); }
.st-never   { --state: var(--alarm); }

.st-dot {
  display: inline-block;
  width: 7px; height: 7px;
  border-radius: 50%;
  margin-right: 7px;
  background: var(--state, var(--ink-4));
  vertical-align: baseline;
}
/* Only a station that has stopped earns motion. Everything else is still, so the
 * blink means "look here" rather than "this page is alive". */
.st-offline .st-dot,
.st-never .st-dot { animation: st-pulse 1.6s ease-in-out infinite; }
@keyframes st-pulse { 50% { opacity: .25; } }

.badge.st-online  { color: var(--sig);   border-color: var(--sig); }
.badge.st-deaf    { color: var(--warn);  border-color: var(--warn); }
.badge.st-stale   { color: var(--warn);  border-color: var(--warn); }
.badge.st-offline { color: var(--alarm); border-color: var(--alarm); }
.badge.st-never   { color: var(--alarm); border-color: var(--alarm); }
.badge.st-paused  { color: var(--ink-3); border-color: var(--line-2); }

/* ------------------------------------------------------------------- station tiles */

/* The fleet as tiles rather than a table. A table of twenty stations answers "what are
 * their round-trip times"; nobody asks that. The question is "which of these can I trust
 * right now", and that is a shape and a colour, not a column.
 *
 * auto-fill rather than auto-fit: with two stations a fit would stretch each to half the
 * width of a desktop, and a tile carrying six readings does not need 800px. 230px is the
 * measured minimum that keeps `0.0000 % loss` on one line.
 */
.stationstrip {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 8px;
  padding: 10px 12px 12px;
}

.st-tile {
  border: 1px solid var(--line);
  border-left: 3px solid var(--state, var(--ink-4));
  border-radius: 4px;
  background: var(--raised);
  padding: 7px 9px 8px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.st-tile:hover { border-color: var(--line-2); }
.st-tile:focus-visible { outline: 1px solid var(--sel); outline-offset: 1px; }
/* Two different states, so two different marks: `filtering` is what the log below is
 * showing, `open` is whose link controls are on screen. They are frequently not the
 * same station, and one highlight for both was unreadable. */
.st-tile.filtering { box-shadow: inset 0 0 0 1px var(--sel); }
.st-tile.open { border-color: var(--sel); }
/* A stopped station tints its whole tile: across twenty, the tile is what is seen. */
.st-tile.st-offline, .st-tile.st-never { background: var(--alarm-wash); }
.st-tile.st-paused { opacity: .6; }

.st-tile header { display: flex; align-items: center; gap: 0; }
.st-tile .st-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.st-state {
  color: var(--state, var(--ink-2));
  text-transform: uppercase;
  letter-spacing: .5px;
  font-size: 10px;
  margin-left: 6px;
}
/* Hidden until the tile is hovered or holds the open editor: tuning a link is rare beside
 * reading one, and twenty always-on buttons read as a form. */
.st-gear { margin-left: 6px; padding: 1px 5px; font-size: 10px; opacity: 0; }
.st-tile:hover .st-gear, .st-tile.open .st-gear, .st-gear:focus-visible { opacity: 1; }
@media (hover: none) { .st-gear { opacity: 1; } }

/* An hour of overs, 2.5 minutes per bar. Not a graph -- there are no axes and no scale,
 * because the only questions are "is this station hearing anything" and "was it hearing
 * anything an hour ago", and both are shapes. */
.st-spark {
  display: flex;
  align-items: flex-end;
  gap: 1px;
  height: 14px;
}
.st-spark i {
  flex: 1;
  min-width: 2px;
  background: var(--sig);
  opacity: .75;
  border-radius: 1px;
}
.st-spark i.none { background: var(--line-2); opacity: 1; }

.st-facts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px 10px;
  font: 400 11px/1.5 var(--mono);
}
.st-fact { display: flex; justify-content: space-between; gap: 6px; }
.st-fact span { color: var(--ink-3); }
.st-fact b { font-weight: 600; }
/* A version and its build are wider than half a tile. */
.st-fact.st-wide { grid-column: 1 / -1; }

/* Only conditions appear here, so an empty row means nothing is wrong -- which is why the
 * container is not rendered at all when there is nothing to say. */
.st-flags { display: flex; flex-wrap: wrap; gap: 4px; }
.st-flag {
  font: 400 10px/1.4 var(--mono);
  padding: 0 4px;
  border: 1px solid var(--line-2);
  border-radius: 3px;
  color: var(--ink-3);
}
.st-flag.warn { color: var(--warn); border-color: var(--warn); }
.st-flag.err  { color: var(--alarm); border-color: var(--alarm); }
/* Not a condition: something its owner may like to set. Said without a box and without a
 * colour, so that it is never read as one of the flags beside it. */
.st-hint { font: 400 10px/1.4 var(--mono); color: var(--ink-4); }
.set-table .c-place { font: 400 11px/1.5 var(--mono); white-space: nowrap; }

.pill.pill-live b { color: var(--sig); }

.st-name { font-weight: 600; }

/* ------------------------------------------------------------------- annotations */

/* Earned, never decorative: `warn` is a reading that wants attention, `err` is one
 * that is already wrong, `ok` is a confirmation that has just happened. */
.set-val.warn, .hint.warn { color: var(--warn); }
.set-val.err,  .hint.err  { color: var(--alarm); }
.hint.ok { color: var(--sig); }

.pill.pill-warn b { color: var(--warn); }

/* A link that leaves the hub, wearing .ghost from app.css. Only the two properties a
 * button gets for free and an anchor does not. */
.btnlink { text-decoration: none; display: inline-block; }

/* --------------------------------------------------------------------- responsive */

/* No media queries here on purpose. app.css already defines the column tiers for the
 * whole design system -- .col-sm hidden below 560, .col-md below 900, .col-lg below
 * 1240 -- and a second set in this file was not just duplication: I had two of them
 * inverted, which hid the wrong columns on a phone.
 *
 * Station, State, Link and Behind carry no tier: "is this station being heard from" is
 * the question a phone gets opened to answer. RTT and Skew are commissioning readings
 * and go first.
 */

/* The topbar is sticky, so scrolling an element to the top of the viewport puts its
 * heading underneath it. */
#panelStation { scroll-margin-top: 64px; }

/* ------------------------------------------------------------------------ fleet log */

/* Which station heard it. Wide enough for a vessel name, and it never hides: on a fleet
 * log the station is half the meaning of a row. */
#txTable .c-station { width: 148px; }
#txTable .c-station .st-name { font-weight: 600; }

/* A displayed time that is not the time the station recorded.
 *
 * The hub orders the fleet on a corrected clock, so a station that booted without a time
 * source sits where it belongs rather than where it thinks it belongs. That correction
 * must be visible: a derived reading presented as a measured one is the kind of thing an
 * operator later discovers at the worst moment. Only rows corrected by more than a minute
 * are marked -- a second is measurement noise, and marking those would train the eye to
 * ignore the sign.
 */
#txTable td.c-time.corrected { color: var(--warn); }
.corr {
  font-style: normal;
  margin-left: 3px;
  opacity: .7;
}

/* Reserving 260px for a Translation column that no row in view fills costs a line of
 * wrap on every transcript beside it -- which on a 1024x600 panel is a third of the
 * visible log. Driven from the data by fleet.js, the same way `dated` is. */
#txTable.notrans .c-trans { display: none; }

/* What a live channel is costing, beside the transport that is spending it. Muted, because
 * it is a number to glance at rather than a warning -- until it is not, and the page turns
 * it amber past a megabyte. */
.lb-cost {
  font: 400 11px/1 var(--mono);
  color: var(--ink-3);
  letter-spacing: .5px;
  margin-left: 4px;
}
.lb-cost.dear { color: var(--warn); }

/* The playhead's word while a channel is wanted and no sound is in hand yet: waiting, which
 * is neither live nor behind, so it is muted as `stopped` is and not amber. */
.listenbar .lb-pos.buffering { color: var(--ink-3); }

/* Listen from a row: the channel this station is hearing, opened live. Hidden until the
 * row is hovered, like the console's per-channel controls, so a table of a hundred rows is
 * a log rather than a wall of buttons. */
#txTable td.c-ch .op-listen {
  margin-left: 6px;
  opacity: 0;
  transition: opacity .12s;
}
#txTable tbody tr:hover td.c-ch .op-listen,
#txTable td.c-ch .op-listen.on { opacity: 1; }
#txTable td.c-ch .op-listen.on { color: var(--sig); border-color: var(--sig); }
@media (hover: none) {
  /* A touch screen has no hover, so an always-hidden control is an unreachable one. */
  #txTable td.c-ch .op-listen { opacity: 1; }
}
/* Where this hub may not listen (a station whose owner lets it only watch): the mark is
 * there, dimmed, and is not a button. The reason is its tooltip. */
#txTable td.c-ch .op-listen.denied { cursor: help; border-style: dashed; }
#txTable tbody tr:hover td.c-ch .op-listen.denied { opacity: .45; }
@media (hover: none) {
  #txTable td.c-ch .op-listen.denied { opacity: .45; }
}

/* The fleet's transport carries two things the station console's does not: which station
 * is being heard, and what it is costing. At 800px those pushed the close button past the
 * right edge of a Raspberry Pi panel -- an operator could watch a channel spend
 * 1.92 MB/min with no way to stop it. Measured: the console's own bar does not clip there,
 * so this belongs here rather than in the shared stylesheet.
 *
 * Wrapping rather than hiding controls: a second row costs one line of the log, and every
 * control stays reachable. A fixed height is what made the overflow invisible. */
#listenBar .listenbar {
  flex-wrap: wrap;
  height: auto;
  min-height: 30px;
  padding: 3px 10px;
  row-gap: 3px;
}

/* One transport for each channel being listened to, one under another. The holder takes the
 * place in the topbar that the console's single transport has, and scrolls rather than
 * pushing the log off a small screen. */
#listenBar {
  display: flex;
  flex-direction: column;
  align-self: center;
  max-height: 40vh;
  overflow-y: auto;
}
#listenBar[hidden] { display: none; }
#listenBar .listenbar + .listenbar { border-top: 1px solid var(--line); }
@media (max-width: 1399.98px) {
  #listenBar { order: 1; flex: 0 0 100%; border-top: 1px solid var(--line); }
  #listenBar .listenbar { border-left: 0; padding-left: 0; padding-right: 0; }
}
/* Why a channel is not playing, in the hub's or the station's words, beside its transport. */
.lb-why { font-size: 11px; color: var(--ink-3); }
.lb-why.err { color: var(--alarm); }
.lb-why:empty { display: none; }

/* A long station name -- "Harbour office (roof)", or any vessel with a real name -- wrapped
 * onto a second line and doubled the height of every row in the log. A log wants one row per
 * transmission, so the name is clipped with the whole of it in the cell's tooltip. Same
 * bargain the console makes with a long transcript. */
#txTable .c-station,
#recTable .c-station { max-width: 148px; }
#recTable .c-station .st-name {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* On the fleet log the cell carries a name *and* the count of other stations that heard the
 * same transmission. As two blocks the count wrapped underneath and took every row from 35px
 * to 48px -- a third of the rows on a 1024x600 panel. One flex line inside the cell: the name
 * gives way, the count never does, because a truncated name is a tooltip away and a hidden
 * count is a merged transmission an operator cannot see. The cell itself stays a table cell:
 * as a flex box its heading lost its place in the row. */
#txTable .heard {
  display: flex;
  align-items: center;
  min-width: 0;
  max-width: 148px;
}
#txTable .heard .st-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#txTable .heard .heard-more { flex: none; }

/* ------------------------------------------------------------------ one over, many ears */

/* Six stations hearing one over is the normal case on a fleet, and six lines of the same
 * sentence is not a log -- so the log shows the strongest accepted copy and this button
 * says how many others exist. It is a count rather than a chevron because the count is the
 * information: "+5" means five receivers heard it, which is itself a fact about the over.
 */
.heard-more {
  margin-left: 6px;
  padding: 0 4px;
  font: 600 10px/1.5 var(--mono);
  color: var(--ink-3);
  background: none;
  border: 1px solid var(--line-2);
  border-radius: 3px;
  cursor: pointer;
}
.heard-more:hover { color: var(--ink); border-color: var(--ink-3); }
.heard-more.on { color: var(--sig); border-color: var(--sig); }

/* The stations wrote this transmission down differently. A plain sign beside the count, in
 * the count's own grey: it is a reason to open the copies, not an alarm. */
.heard-differs {
  flex: none;
  margin-left: 5px;
  font: 600 11px/1 var(--mono);
  color: var(--ink-3);
  cursor: help;
}

/* The hub itself is not well. Under the top bar on the page, in the colour of something that
 * wants attention: the stations may be fine, and what is shown may be falling behind. */
.hub-health {
  padding: 7px 14px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--ink);
  background: color-mix(in srgb, var(--warn) 22%, var(--panel));
  border-bottom: 1px solid var(--warn);
}
.hub-health[hidden] { display: none; }
.hub-health b { font-weight: 600; margin-right: 8px; }

/* Every station's own version, opened under the row. Each copy carries its own signal, its
 * own recording and its own words, always: two receivers of the same transmission routinely
 * disagree about a word, and which one is right is the operator's call, not the hub's. The
 * words a copy has that the one above does not are marked, with the same mark a search uses. */
tr.copies td { padding: 0 8px 8px; background: var(--raised); }
.copy-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 6px;
}
.copy {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 8px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 5px 7px;
}
/* The copy that the collapsed row is showing. Marked so expanding cannot make an operator
 * wonder which of six lines they were reading a moment ago. */
.copy.chosen { border-color: var(--line-2); background: var(--bg); }
.copy.rejected { opacity: .7; }
.copy-station {
  font: 600 11px/1.4 var(--sans);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.copy-tag { font: 400 10px/1.4 var(--mono); color: var(--ink-3); }
/* When that station heard it, on the fleet's clock, and what else is true of its copy. */
.copy-meta { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; }
.copy-when { font: 400 10px/1.4 var(--mono); color: var(--ink-3); }
.copy-audio { grid-column: 1 / -1; }
.copy-text {
  grid-column: 1 / -1;
  font: 400 11px/1.5 var(--sans);
  color: var(--ink-2);
  border-top: 1px dotted var(--line-2);
  padding-top: 4px;
}

/* ------------------------------------------------------------------------------ the map */

/* Chart beside its index. The chart is the bigger half because a position is spatial, and
 * the list is the only place a vessel with no position can appear at all.
 *
 * Explicit heights rather than aspect ratios: a canvas in a flexible box either drives its
 * own container's height or is driven by it, and the version where the canvas won grew by a
 * few pixels every resize observation until the page scrolled.
 */
.mapmain {
  display: grid;
  /* A fixed list column, not a fraction. Sized to what its own columns need: as 1fr of the
   * page it got 414px on a desktop and 250px on a Pi panel, and the last three columns --
   * including how many stations heard the vessel -- were off the right edge of the panel. */
  grid-template-columns: minmax(0, 1fr) 484px;
  grid-template-areas: "chart list" "card card";
  gap: 8px;
  padding: 8px;
  align-items: start;
}
.mapwrap { grid-area: chart; }
.vessellist { grid-area: list; }
.vesselcard { grid-area: card; }

/* 62vh keeps the chart the tallest thing on the page at every size that matters, and clears
 * the topbar and the panel head on a 600px panel. */
.mapbox { position: relative; height: 62vh; min-height: 260px; }
#chart {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--panel);
  cursor: grab;
}
#chart:active { cursor: grabbing; }
#chart:focus-visible { outline: 1px solid var(--sel); outline-offset: -1px; }

/* Said over the chart rather than instead of it: the graticule and the vessel list are both
 * still useful when nothing has a position. */
.maphint {
  position: absolute;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  margin: 0;
  padding: 6px 10px;
  background: var(--raised);
  border: 1px solid var(--line);
  border-radius: 4px;
  pointer-events: none;
}
/* With stations on the chart, the middle of it is where a station is: the same words go to
 * the top, clear of the marks. */
.maphint.top { top: 14px; transform: translateX(-50%); }

.vessellist .table-wrap { max-height: 62vh; }
#vsTable .c-vessel {
  min-width: 100px;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* Degrees and decimal minutes in a mono font needs 170px: at 150 it wrapped onto three
 * lines and took every row in the list to 60px. A position is the reason the list exists, so
 * the vessel name gives way instead. */
#vsTable .c-pos {
  width: 150px;
  font: 400 11px/1.5 var(--mono);
  white-space: nowrap;
}
/* Speed and course live on the card. In the list they cost 64px of the column that carries
 * the position, and the map already draws both as a heading. */
#vsTable .c-speed  { width: 56px; }
/* A count, not a list of names: the card names them, and at 110px two station names were
 * clipped to "MV B..." and "Shore...", which is worse than the number. */
#vsTable .c-heard  { width: 44px; text-align: right; font: 400 11px/1.5 var(--mono); }
#vsTable .c-seen   { width: 44px; }
#vsTable tbody tr { cursor: pointer; }
#vsTable tbody tr:hover td { background: var(--raised); }
#vsTable tbody tr.sel td { background: var(--raised); box-shadow: inset 0 0 0 1px var(--sel); }
/* Listed but not drawable. Dimmed rather than hidden or badged red: it is the normal early
 * life of every AIS contact, not a fault. */
#vsTable tbody tr.unplaced .c-vessel { opacity: .75; }
.v-name { font-weight: 600; }
.v-type { color: var(--ink-3); font-size: 10px; margin-left: 5px; }
.v-more { color: var(--ink-3); font: 400 10px/1 var(--mono); margin-left: 4px; }
/* The stations above the vessels: the same columns under their own headings, a few rows
 * tall at the most, and ruled off from the vessels they hear. */
.vessellist .station-rows { max-height: 22vh; border-bottom: 1px solid var(--line-2); }
#stTable .c-vessel { min-width: 100px; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#stTable .c-pos { font: 400 11px/1.5 var(--mono); white-space: nowrap; }
#stTable .c-seen { width: 1%; white-space: nowrap; }
#stTable tbody tr { cursor: pointer; }
#stTable tbody tr:hover td { background: var(--raised); }
#stTable tbody tr.sel td { background: var(--raised); box-shadow: inset 0 0 0 1px var(--sel); }
#stTable tbody tr.unplaced .c-vessel { opacity: .75; }
/* A vessel named on a station's card opens that vessel's. */
.vesselcard .set-row.pick { cursor: pointer; }
.vesselcard .set-row.pick:hover .set-label { color: var(--ink); }

/* One column below 900px: a 300px list beside a chart on a phone leaves neither usable. */
/* Below 1100 the two do not both fit: a chart beside a 400px list leaves the chart
 * narrower than its own controls, and a Raspberry Pi panel is 1024. Measured, not guessed. */
@media (max-width: 1100px) {
  .mapmain {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "chart" "list" "card";
  }
  .mapbox { height: 46vh; }
  .vessellist .table-wrap { max-height: 40vh; }
}

/* ------------------------------- one station's panel, and the Stations section of Settings */

/* A control, its label and the message the route sent back share these rows. Wrapping is what
 * keeps all three on a 800x480 panel rather than pushing the message past the right edge --
 * and the message is the part carrying "already following Shoreline West". */
#panelStation .set-row.wrap { flex-wrap: wrap; }

/* app.css dresses search, date, number and range inputs, because that is every input the
 * station console has. An address and a key are this panel's own need, and the lock bar's;
 * an undressed native text box beside them would be the loudest thing on the page. */
#panelStation input[type=url],
#panelStation input[type=password],
.set-bar input[type=password],
#passBar input[type=password],
.fp-field {
  background: var(--inset);
  border: 1px solid var(--line-2);
  color: var(--ink);
  border-radius: var(--r);
  padding: 3px 6px;
  font: 12px/1.3 var(--mono);
  min-width: 0;
  flex: 1 1 190px;
  max-width: 264px;
}
#panelStation input[type=url]:focus,
#panelStation input[type=password]:focus,
.set-bar input[type=password]:focus,
#passBar input[type=password]:focus,
.fp-field:focus { outline: none; border-color: var(--sel); }

/* The status beside a button in the Stations section of Settings is a line of figures or a
 * sentence: it takes what room is left, and a line of its own when there is none. */
#pane-stations .set-row .hint { flex: 1; min-width: 160px; line-height: 1.5; }

/* A certificate's fingerprint is 95 characters in pairs, and it is there to be compared by
 * eye with the one a station's own page shows: it wraps where it stands rather than
 * scrolling inside a one-line box. */
.fp-field {
  flex: 1 1 260px;
  max-width: 720px;
  font-size: 11px;
  line-height: 1.5;
  resize: none;
  word-break: break-all;
}
/* On the Settings page a row stacks at a phone's width, where 260px of basis would be 260px
 * of height: there the field asks for its width another way. */
#pane-stations .fp-field { flex: 1; min-width: min(260px, 100%); }

/* Locked: the controls say so by themselves, whatever dressed them. */
fieldset[data-lock]:disabled { opacity: .55; }

/* A table inside a settings section, not a log. The sticky heading every other table gets
 * from app.css would float over the section's own heading as the page scrolls past it. */
.set-table th {
  position: static;
  background: none;
  padding: 4px 10px 4px 0;
  border-bottom: 1px solid var(--line);
}
.set-table td { padding: 5px 10px 5px 0; vertical-align: middle; }
.set-table tr:last-child td { border-bottom: 0; }
.set-table .c-addr { font: 400 11px/1.5 var(--mono); color: var(--ink-2); word-break: break-all; }
.set-table .c-rows { font: 400 11px/1.5 var(--mono); text-align: right; white-space: nowrap; }
/* The controls column: right-aligned so add and forget line up down the table however long
 * the names beside them are, and never wrapped, because a button on two lines reads as two. */
.set-table .c-act { text-align: right; white-space: nowrap; width: 1%; }
.set-table .c-act button + button { margin-left: 6px; }
.set-table .c-source { white-space: nowrap; }
/* Followed: how a station is reached. `linked` has no address; `at its address` has it
 * under the word, small. What the hub may do there and until when are words, kept whole. */
.set-table .c-how, .set-table .c-may, .set-table .c-until { white-space: nowrap; }
.set-table .how-addr {
  display: block; white-space: normal; word-break: break-all;
  font: 400 10px/1.5 var(--mono); color: var(--ink-3);
}
.set-table .how-open { margin-left: 6px; }
/* An invitation is one long line, shown once: a field wide enough to see that it is all
 * there, in the face a token is read in. */
#pane-stations #invLine { flex: 1; min-width: min(320px, 100%); font: 11px/1.4 var(--mono); }

/* A candidate that says it wants a key gets the field in its own row. The alternative is an
 * add that fails with a 401 the operator has to translate. */
.disc-add { display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
#pane-stations .disc-key { width: 116px; }

/* The confirmation for forgetting, under the row it is about rather than in a dialog: the
 * name and the row count are what the decision turns on, and both are already on screen.
 * --warn, not --alarm: forgetting is undone by adding the receiver again, and only the
 * checkbox inside it is not. */
tr.confirming td { background: var(--raised); }
tr.forget-row td { background: var(--raised); box-shadow: inset 2px 0 0 var(--warn); }
.forget {
  display: flex; align-items: center; flex-wrap: wrap; gap: 10px;
  font-size: 11px; color: var(--ink-2);
  padding: 2px 0;
}
.forget-go { color: var(--warn); border-color: var(--warn); }
.forget-go:hover { color: var(--alarm); border-color: var(--alarm); }

/* ------------------------------------------------------------------ small panels */

/* The fleet log carries one column the station console's does not -- which station heard the
 * over -- and at 1024px that is exactly what pushes the table 84px past its panel: the two
 * text columns have 260px floors in app.css that were measured for a table without it. Their
 * floors come down here rather than in the shared sheet, because the extra column is this
 * page's own cost. Measured on the Pi panel: 1108px of table in a 1024px wrap, now 919. */
@media (min-width: 900.02px) and (max-width: 1239.98px) {
  #txTable .c-text  { min-width: 180px; }
  #txTable .c-trans { min-width: 150px; }
}

/* A 7-inch panel is 800x480, and there the strip is competing with the log for the only
 * thing that matters on a wall: the traffic. Six full tiles took two rows and 230px of a
 * 480px screen, leaving no log at all.
 *
 * Keyed on height as well as width, because the shape of the problem is vertical: a 1024x600
 * panel has the width for full tiles and not the height. What survives is what is watched --
 * the state dot, how far behind, and whether it is hearing anything. The preset, the byte
 * counter and the hour of history are commissioning readings, and commissioning happens at a
 * desk.
 */
@media (max-width: 900px), (max-height: 620px) {
  .stationstrip {
    grid-template-columns: repeat(auto-fill, minmax(158px, 1fr));
    gap: 5px;
    padding: 6px 8px 8px;
  }
  .st-tile { padding: 4px 7px 5px; gap: 2px; }
  .st-spark, .st-extra { display: none; }
  .st-facts { grid-template-columns: 1fr 1fr; gap: 0 8px; }
  .st-flag { font-size: 9px; }
  /* The gear is the way into the link editor and there is no hover on a touch panel. */
  .st-gear { opacity: 1; padding: 0 4px; }
}

/* ----------------------------------------------------------------- clips in the log */

/* A clip's player with, under it, the hub's sentence when the clip would not load. The
 * sentence wraps inside the column: it is the reason, and a reason cut short is none. The
 * player itself is one line, as it is on the console. */
.clip { display: inline-flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.clip .ap-t { white-space: nowrap; }
.clip-why { font-size: 10px; line-height: 1.4; color: var(--warn); white-space: normal; max-width: 190px; }
.clip-none .hint { display: inline-block; font-size: 10px; line-height: 1.4; max-width: 190px; }

/* Two ways of saying one thing, by how much room there is: `when-wide` above a phone's
 * width, `when-narrow` at it. Not the column tiers: those hide a column, these swap what a
 * cell says. */
.when-narrow { display: none; }

/* -------------------------------------------------------------- one station's panel */

/* The presets wear the page's button; the one the fields amount to is lit. */
#presetBtns button { padding: 3px 9px; }
/* A status beside its buttons takes the room that is left and wraps under them when there is
 * none, rather than running off the block's edge. */
#panelStation .set-row.wrap .hint { flex: 1 1 120px; line-height: 1.5; }
#cKeyState.bad { color: var(--alarm); }

/* The lock bar's label, field and button are one line wherever there is room for a line. */
@media (min-width: 720.02px) {
  #lockBar .set-unlock { flex-wrap: nowrap; }
  #lockBar .set-unlock label { white-space: nowrap; }
}

/* A followed station's address, under its name where the address column has gone. */
.addr-under { display: none; font: 400 10px/1.5 var(--mono); color: var(--ink-3); word-break: break-all; }

/* ----------------------------------------------------------------------- a phone */

/* Five pages in the top bar. At a phone's width their names are one line that fits a 360px
 * screen, and on a narrower one a line that is drawn across, as the readings under it are,
 * rather than a page wider than its screen. */
@media (max-width: 559.98px) {
  .topbar > .nav { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
  .topbar > .nav::-webkit-scrollbar { display: none; }
  .nav a { padding: 0 6px; }
}

/* At a phone's width a row of the log is two lines: when, who and which channel, with the
 * buttons, and under them the words at the full width of the screen. A table cannot do
 * that, so below 560px each row is laid out as a grid and the headings go: five columns
 * across 390px left the transcript two words a line and the play button off the edge. */
@media (max-width: 559.98px) {
  .when-wide { display: none; }
  .when-narrow { display: inline-block; }
  .addr-under.when-narrow { display: block; }

  #txTable, #txTable tbody { display: block; }
  #txTable thead { display: none; }
  #txTable tbody tr {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto auto;
    column-gap: 8px;
    align-items: center;
    padding: 6px 10px;
    border-bottom: 1px solid var(--line);
  }
  #txTable tbody tr.copies { display: block; padding: 0 8px 8px; }
  #txTable td.c-time, #txTable td.c-station, #txTable td.c-ch,
  #txTable td.c-text, #txTable td.c-audio, #txTable tr.copies td {
    display: block;
    width: auto; min-width: 0; max-width: none;
    padding: 0; border: 0;
  }
  #txTable td.c-ch { display: flex; align-items: center; }
  #txTable td.c-text { grid-column: 1 / -1; grid-row: 2; padding-top: 3px; }
  #txTable td.c-text .text, #txTable .heard { max-width: none; }
  .clip-why { max-width: 40vw; }

  /* Two tiles across: the name gets a line to itself, or two stations called Bifrost
   * something are both "Bifros...". */
  .st-tile header { flex-wrap: wrap; row-gap: 2px; }
  .st-tile .st-name { flex: 1 1 calc(100% - 14px); }
  .st-state { margin-left: 14px; margin-right: auto; }

  /* Ten seconds either way is enough on a phone; the half-minute jumps give their room up. */
  .lb-far { display: none; }
}

/* ---------------------------------------------------------------------- panel bars */

/* A row of controls inside a panel, below its head: the recording bar, "load older", the
 * software page's file and batch rows. Its own class because the obvious one is a trap:
 * `.panel-tools` in app.css is the panel head's tool cluster, opacity 0 until the head is
 * hovered and pinned absolutely on a narrow screen. Borrowed for these rows it laid every
 * control out and painted none of them. They wrap, because the hub's panels are 800 and
 * 1024 pixels wide as well as desktops. */
.panel-bar {
  display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
}
/* A bar at the foot of a panel sits on the panel's own edge; two rules read as a gap. */
.panel-bar:last-child { border-bottom: none; }
.panel-bar[hidden] { display: none; }
.panel-bar .hint { flex: 1 1 260px; line-height: 1.5; font-size: 11px; }

/* ------------------------------------------------------------------------ software */

/* The message line, the hash and the warning colours come from the console's own software
 * page in app.css; the fleet table and the rows' contents are this page's. */
#confirmText { flex: 1 1 260px; line-height: 1.5; font-size: 11px; }
.panel-bar .sw-sha { flex: 1 0 100%; margin: 0; }
.panel-bar .sw-sha:empty { display: none; }
#passBar #swPass { flex: 0 1 220px; }
.sw-ok { color: var(--sig); }

/* Top-aligned, because a refused update carries its reason on a second line and the buttons
 * should stay level with the name. */
#swTable td { vertical-align: top; }
#swTable .c-sel { width: 28px; }
#swTable .c-act { white-space: nowrap; text-align: right; }
#swTable .sw-sha { margin: 2px 0 0; }
/* A station's reason for refusing a file is a sentence, and it is the row's status. */
#swTable .c-status { max-width: 320px; overflow-wrap: anywhere; }

/* ------------------------------------- map, recordings and software: what the audit found
 *
 * One block, appended, for the three pages' own faults: columns that did not fit their
 * figures, and everything that fell off a phone. Nothing above this line is changed by it.
 */

/* "14.8 kn" is one reading: at 56px the unit wrapped under the number on some rows. */
#vsTable .c-speed { width: 64px; white-space: nowrap; }

/* In one column the card goes straight under the chart, not under the whole list: pressing
 * a vessel on a phone opened its card a screen and a half further down, where it looked as
 * though nothing had happened. (map.js also brings it into view.) */
@media (max-width: 1100px) {
  .mapmain { grid-template-areas: "chart" "card" "list"; }
}

/* The transport, then the word for where the audio is. `remote` used to share the Note
 * column, so a recording with a note never showed it and a phone, which drops that column,
 * showed it for none. */
#recTable .c-audio { width: 250px; white-space: nowrap; }
#recTable .c-audio .badge { margin-left: 6px; vertical-align: middle; }
#recTable .c-audio [hidden] { display: none; }
/* Why a recording could not be played, in the hub's words, on its own line under the row:
 * the transport's one word for it is hidden on a phone, and a sentence fits nowhere else. */
#recTable tr.rec-why td {
  padding: 0 12px 8px;
  border-top: 0;
  color: var(--warn);
  font-size: 11px;
  white-space: normal;
}
/* On a phone the transport is its button alone, and the station's name gives up the few
 * pixels that put the last column's badge under the edge of the screen. */
@media (max-width: 559.98px) {
  #recTable .c-audio { width: auto; }
  #recTable .c-audio .badge { margin-left: 4px; }
  #recTable .c-station { max-width: 124px; }
  #recTable td, #recTable th { padding-left: 8px; padding-right: 6px; }
}

/* What is being recorded now: a station, a channel, how long, and its Stop. */
.rec-now-list { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 20px; flex: 1 1 260px; }
.rec-now { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; }
.rec-now::before {
  content: "";
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--alarm);
}

/* The software table on a phone. As a table it was 492px in a 390px screen: Install and
 * Discard were off the right edge and the status broke in the middle of words. Below 720px
 * each station is a block instead -- its name, then each figure on a line with its heading
 * beside it (the cell's `data-label`), then its three buttons -- and nothing is sideways. */
@media (max-width: 720px) {
  #swTable, #swTable tbody, #swTable td { display: block; }
  #swTable thead tr { display: flex; align-items: center; gap: 8px; padding: 6px 12px; }
  #swTable thead th { display: none; padding: 0; border: 0; }
  #swTable thead th.c-sel, #swTable thead th.c-station { display: block; }
  #swTable tbody tr {
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr);
    gap: 2px 0;
    padding: 8px 12px;
    border-bottom: 1px solid var(--line);
  }
  #swTable tbody td { padding: 2px 0; border: 0; grid-column: 2; }
  #swTable tbody td.c-sel { grid-column: 1; grid-row: 1; }
  #swTable tbody td.c-station { grid-row: 1; }
  /* The last update is left off a narrow table for want of room; a block has room. By the
   * cell's own class: the shared width tiers are app.css's, and are not restated here. */
  #swTable tbody td.c-last { display: block; }
  /* The heading sits in a margin of its own, so a figure that runs to a second line (a
   * station's reason, the fingerprint) carries on under itself and not under its heading. */
  #swTable tbody td[data-label] { position: relative; padding-left: 88px; }
  #swTable tbody td[data-label]::before {
    content: attr(data-label);
    position: absolute;
    left: 0; top: 5px;
    color: var(--ink-3);
    font-size: 10px;
    letter-spacing: .06em;
    text-transform: uppercase;
  }
  /* As blocks the cells take the row's width, not the widths their columns had. */
  #swTable tbody td:not(.c-sel) { width: auto; max-width: none; }
  /* The three buttons side by side, full size for a thumb, wrapping only if they must. */
  #swTable tbody td.c-act { display: flex; flex-wrap: wrap; gap: 6px; padding-top: 6px; }
}
