/* Lara Portal — visual language ported from the legacy Angular frontend:
   cyan #17B8D1 primary, Montserrat, white pill cards over full-bleed photo. */

:root {
  --primary: #17B8D1;
  --primary-light: #b0e4ec;
  --text: #00191D;
  --text-muted: rgba(0, 25, 29, .5);
  --divider: rgba(0, 25, 29, .2);
  --ok: #34A853;
  --warn: #FF9900;
  --err: #EB0000;
  --card-err-bg: #f7b8b8;
  --panel: rgba(255, 255, 255, .88);   /* was .5 — text on a half-transparent panel over the dark photo
                                          background was washed out everywhere, worst on the dashboard */
  --icon-neutral: #808C8E;
}

* { box-sizing: border-box; margin: 0; font-family: Montserrat, Roboto, "Helvetica Neue", sans-serif; }

[hidden] { display: none !important; }

body {
  min-height: 100vh;
  color: var(--text);
  background: url("assets/background.jpg") 50% 50% / cover fixed no-repeat;
  background-color: #0d4f5c; /* painted behind the fixed image, so a page taller than the viewport
                                (e.g. the registration card on a short screen) never shows bare white */
}

/* ------------------------------------------------------------ login screen */

#login-screen, #station-screen {
  min-height: 100vh;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 48px;
}
.login-logo { width: 340px; max-width: 80vw; }
.station-note { max-width: 520px; padding: 0 16px; text-align: center; color: #fff; font-size: 18px; line-height: 1.5; }
.btn-big {
  height: 56px; padding: 0 64px;
  border: none; border-radius: 34px;
  background: #fff; color: var(--primary);
  font-size: 24px; font-weight: 700; cursor: pointer;
}
.btn-big:hover { background: var(--primary); color: #fff; }

/* -------------------------------------------------------------- app shell */

header {
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: 30px 40px 10px 40px;
}
.logo { width: 170px; }
.head-right { display: flex; align-items: center; gap: 20px; color: #fff; font-size: 14px; }
.conn { display: inline-flex; align-items: center; gap: 8px; }
/* R13: header live clock + timezone selector */
.tz-indicator { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; white-space: nowrap; }
.tz-clock { font-variant-numeric: tabular-nums; letter-spacing: .02em; opacity: .9; }
.tz-clock #tz-clock-zone { opacity: .7; margin-left: 2px; }
.tz-select {
  font-size: 12px; color: #fff; background: rgba(255, 255, 255, .12);
  border: 1px solid rgba(255, 255, 255, .3); border-radius: 6px; padding: 2px 6px; cursor: pointer;
}
.tz-select option { color: #222; }
.user-chip { display: inline-flex; align-items: center; gap: 12px; font-weight: 700; }
.btn-pill-sm {
  border: 1px solid #fff; border-radius: 16px; background: transparent; color: #fff;
  padding: 4px 16px; font-size: 12px; cursor: pointer;
}
.btn-pill-sm:hover { background: #fff; color: var(--primary); }

.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; background: gray; }
.dot.on { background: var(--ok); }
.dot.off { background: var(--err); }

.shell { display: flex; min-height: calc(100vh - 110px); }

/* nav — legacy menu: transparent buttons, right-rounded, cyan when active */
#menu { min-width: 250px; display: flex; flex-direction: column; gap: 6px; padding-top: 30px; }
.menu-btn {
  height: 41px; border: none; cursor: pointer;
  border-radius: 0 20px 20px 0;
  background: transparent; color: #fff;
  font-size: 14px; font-weight: 500; text-align: left; padding-left: 15%;
}
.menu-btn:hover { background: rgba(255, 255, 255, .2); }
.menu-btn.active { background: var(--primary); }

main { flex: 1; padding: 20px 40px 60px 20px; overflow-x: hidden; }

/* custom scrollbar (legacy) */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: rgba(255, 255, 255, .25); border-radius: 10px; }
::-webkit-scrollbar-thumb { background: #fff; border-radius: 10px; }

.tabpane { display: none; }
.tabpane.active { display: block; }

/* ------------------------------------------------------------ device cards */

.grid { display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start; }

.card {
  width: 403px; background: #fff; border-radius: 8px;
  padding: 20px 0 16px 0;
  display: flex; flex-direction: column;
}
.card.error { background: var(--card-err-bg); }

/* offline device: greyed + desaturated (apparent, but not hidden — the card stays interactive so
   values can still be edited; only Start is inert). */
.card.offline { filter: grayscale(.7); opacity: .62; }
.card.offline:hover, .card.offline:focus-within { opacity: .82; } /* lift the veil while working on it */
.card.offline .ring-wrap { cursor: not-allowed; }
.offline-tag {
  font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  color: #fff; background: var(--icon-neutral); border-radius: 16px; padding: 2px 10px; white-space: nowrap;
}
/* Start rendered inert while offline (the click handler is already a no-op there) */
.btn.primary.disabled-look { background: #cfd6d8; border-color: #cfd6d8; color: #fff; cursor: not-allowed; }
.btn.primary.disabled-look:hover { background: #cfd6d8; color: #fff; }

/* "Stale": device reports available but the liveness heartbeat lapsed — amber pill, distinct from the
   grey offline veil. The card is not greyed (still commandable), just flagged. */
.stale-tag {
  font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  color: #fff; background: var(--warn); border-radius: 16px; padding: 2px 10px; white-space: nowrap;
}
/* #24: "Maintenance due" pill — only rendered when maintenance is overdue/due (amber, same pill shape). */
.maint-tag {
  font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  color: #fff; background: var(--warn); border-radius: 16px; padding: 2px 10px; white-space: nowrap;
}
/* R14 (D-39): the setup pill. The two states are one hue told apart by TREATMENT rather than by colour
   (owner, D-85): complete is a filled tangerine with a solid darker rim, incomplete is a pale ground with a
   DASHED rim — a broken outline reads as "unfinished" on its own, before the words are read.
   Tangerine, not amber: `--warn` #FF9900 is already Maintenance due and Stale/Offline on this very row, and
   purple #AD00FF is the LaraCompact badge, so both were unavailable. The redder tone keeps the setup pair
   separable from an amber maintenance pill sitting beside it. */
.setup-tag {
  font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  border-radius: 16px; padding: 2px 10px; white-space: nowrap;
  /* Incomplete: light, dashed, low-shout — the missing-field list is one hover away. */
  color: #9A4B0A; background: #FFF1E3; border: 1.5px dashed #F0A268;
  cursor: help;
}
/* Complete: the same pill filled in and closed up — solid rim, solid ground, white text. [D-85] */
.setup-tag.ok {
  /* Black rim to match the variant badge (owner, D-86), hairline as above [D-87] — was #C2410C. */
  color: #fff; background: #F97316; border: .5px solid #000;
  cursor: default;
}
/* R14: Start greyed + inert for non-admins on a setup-incomplete device (click handler no-ops it). */
.btn.primary.setup-locked { background: #cfd6d8; border-color: #cfd6d8; color: #fff; cursor: not-allowed; }
.btn.primary.setup-locked:hover { background: #cfd6d8; color: #fff; }
.last-seen { font-size: 11px; color: var(--text-muted); padding-top: 4px !important; }
.last-seen:empty { display: none; }

/* Team member management (Teams tab) */
.team-detail { padding: 8px 0; }
.team-members h4 { font-size: 14px; margin: 4px 0 8px; color: var(--text); }
.member-table { width: 100%; margin-bottom: 10px; }
.member-table td { padding: 4px 8px; }
.team-add-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.team-add-sel { max-width: 260px; }
.team-detail-msg { margin-top: 0; }
/* #8 two-column team builder (available | members) */
.team-builder { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
@media (max-width: 720px) { .team-builder { grid-template-columns: 1fr; } }
.team-builder .member-table { margin-bottom: 0; }
.team-reassign-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.team-leader-sel { max-width: 260px; }
.badge-warn { display: inline-block; font-size: .74em; font-weight: 600; padding: 2px 8px; border-radius: 10px;
  background: #fdecc8; color: #8a5a00; text-transform: uppercase; letter-spacing: .03em; }
.tag-invited { display: inline-block; font-size: .7em; font-weight: 600; padding: 1px 6px; border-radius: 8px;
  background: #e3e8f2; color: #55607a; text-transform: uppercase; letter-spacing: .03em; margin-left: 4px; }
.co-row { cursor: pointer; }
.co-row:hover { background: #f2f4f8; }
.pc-view { padding: 4px 0; }

.card > div { padding: 0 20px; }

/* Card header is a vertical stack: device id line (with the edit affordance), the hw/fw line,
   then a dedicated row for the status labels — labels never share the line with the device id. */
.card-head {
  border-bottom: 3px double var(--divider);
  padding-bottom: 12px !important;
}
.card-title-row {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 8px;
}
/* The card's action icons sit together at the right, not spread by the row's space-between (which used
   to push them apart into three separate positions). [D-52] */
.card-icons { display: flex; align-items: center; gap: 2px; margin-left: auto; flex: 0 0 auto; margin-top: 1px; }
.card-title-row .icon-btn { flex: 0 0 auto; }
.card-head .serial { font-size: 20px; font-weight: 700; display: block; line-height: 1.25; }
/* No name configured: the card falls back to the serial, in italics, so the placeholder reads as a
   placeholder. [D-92] */
.card-head .serial.unnamed { font-style: italic; }
.card-head .hw { font-size: 14px; color: var(--text-muted); display: block; margin-top: 2px; }
.card-tag-row {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  margin-top: 10px;
}
.badge {
  /* Sized and weighted to match the setup pill beside it (11px/700/.04em tracking, D-88) so the tag row
     reads as one family — but NOT uppercased: "LaraSystems"/"LaraCompact" are product names and their
     casing is part of them. */
  font-size: 11px; font-weight: 700; letter-spacing: .04em;
  color: #fff; background: var(--primary);
  border-radius: 16px; padding: 2px 10px; white-space: nowrap;
  /* Black rim (owner, D-86) — the variant is the card's identity label, and the outline gives the two
     variant colours a common frame so they read as one kind of tag rather than two unrelated pills.
     Hairline width: .5px is one device pixel on a HiDPI screen and antialiases lighter on a 1x one, so it
     reads thin either way — 1.5px rounded to a full pixel and looked heavy. [D-87] */
  border: .5px solid #000;
}
.badge.lrc { background: #AD00FF; }

.error-banner { color: var(--err); font-size: 12px; font-weight: 700; padding-top: 6px !important; }
.error-banner:empty { display: none; }

/* status icon row — recolorable via CSS mask */
/* Temperature/humidity sit at the right end; the icons centre in the space LEFT OVER beside them — two
   tracks, [remaining space][readings], with the icons centred inside the first. (An earlier version added a
   mirror spacer, which centred them on the whole row instead.) [D-73] */
.status-row {
  display: grid; grid-template-columns: 1fr auto; align-items: center;
  padding: 14px 20px !important;
  border-bottom: 1px solid var(--divider);
}
.status-icons { display: flex; gap: 20px; justify-content: center; grid-column: 1; }
.sicon {
  width: 26px; height: 26px;
  background-color: var(--icon-neutral);
  -webkit-mask: var(--icon) center / contain no-repeat;
  mask: var(--icon) center / contain no-repeat;
}
.sicon.ok { background-color: var(--ok); }
.sicon.bad { background-color: var(--err); }
.sicon.na { background-color: gray; }

/* liquid + environment */
.level-row {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 20px !important;
  font-size: 14px;
}
.level-row .lvl-icon {
  width: 22px; height: 22px; background-color: var(--primary);
  -webkit-mask: url("assets/liquid_indicator.svg") center / contain no-repeat;
  mask: url("assets/liquid_indicator.svg") center / contain no-repeat;
}
.level-value { font-size: 16px; font-weight: 700; }
.level-value.low { color: var(--err); }
.level-value.mid { color: var(--warn); }
.level-value.ok { color: var(--ok); }
.pill {
  font-size: 12px; color: #fff; border-radius: 16px; padding: 2px 12px;
  background: var(--ok);
}
.pill.mid { background: var(--warn); }
.pill.low { background: var(--err); }
.pill.na { background: gray; }
.env-chips { grid-column: 2; justify-self: end; padding-left: 14px; font-size: 12px; color: var(--text-muted); text-align: right;
  line-height: 1.35; white-space: nowrap; }

/* Same 12 px as before — the legibility came from contrast, not size: --text-muted is 50% of the ink, which
   is fine for a caption but thin for a line carrying a tag id and a volume. [D-116] */
.cartridge { font-size: 12px; color: rgba(0, 25, 29, .72); padding: 0 20px 10px !important; }
.cartridge .uid { font-family: monospace; color: var(--text); }
.cartridge .valid { color: var(--ok); font-weight: 700; }
.cartridge .invalid { color: var(--err); font-weight: 700; }
.cartridge .warn { color: var(--mid, #c98a00); font-weight: 700; }

/* LaraCompact per-slot cartridge list — three rows standing in for the LaraSystems level row + canister
   line, and sized to occupy about the same height (~70 px vs 71 px measured), so both variants hand the
   dispense row below them the same starting point and a mixed grid does not look ragged. The rows were 10 px
   and barely readable; the extra room went into the type rather than into padding. [D-109] */
.cart-slots { padding: 0 20px 10px !important; margin: 0; display: flex; flex-direction: column; gap: 3px; }
.cart-slot { display: flex; align-items: center; gap: 8px; font-size: 12px; line-height: 1.35; min-height: 18px; padding: 0; margin: 0; border: 0; }
.cart-slot-n { color: var(--text-muted); font-weight: 700; flex: none; min-width: 40px; padding: 0; }
.cart-slot-name { color: var(--text); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0; }
/* Reset the global `.empty` placeholder rule (padding:40px; font-size:1.1rem; text-align:center)
   which otherwise leaks in via the shared `.empty` class and blows each slot row up to ~101px. */
.cart-slot-name.empty { color: var(--text-muted); font-style: italic; padding: 0; font-size: 12px; text-align: left; }
.cart-slot-dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: gray; padding: 0; margin: 0; }
.cart-slot-dot.on { background: var(--ok); }
.cart-slot-dot.off { background: var(--err); }
.cart-slot-dot.unknown { background: gray; }

/* disinfection ring + channels */
.dispense-row {
  display: flex; align-items: center; gap: 18px;
  border-top: 1px solid var(--divider);
  padding: 14px 20px !important;
}
.ring-wrap { position: relative; width: 76px; height: 76px; cursor: pointer; flex: none; }
.ring-wrap svg { transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: #F0F0F0; stroke-width: 3; }
.ring-fg { fill: none; stroke: var(--primary); stroke-width: 3; stroke-linecap: round; transition: stroke-dashoffset .3s; }
.ring-center {
  position: absolute; inset: 10px;
  background: center / contain no-repeat;
}
.ring-center.play { background-image: url("assets/playbutton.svg"); }
/* Running: a rectangular STOP glyph — clicking the ring stops the run, so a pause icon (the old
   inprogress.svg) misdescribed what the control does. */
.ring-center.busy { background-image: url("assets/stopbutton.svg"); }
/* The ring is the ONLY start/stop control (the duplicate lower buttons are gone), so it carries both
   inert states: offline (nothing to command) and R14 setup-incomplete for non-admins. */
.ring-wrap.offline-lock, .ring-wrap.setup-locked { cursor: not-allowed; opacity: .55; }

.channels { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.channel { display: flex; align-items: center; gap: 6px; font-size: 12px; }
.channel .name { font-weight: 700; width: 28px; flex: none; }
.state-chip {
  font-size: 11px; border-radius: 10px; padding: 1px 8px;
  background: #F0F0F0; color: var(--text-muted); text-align: center; flex: none;
  /* Uppercased in CSS, not in JS: the labels are translated now (D-89) and the case belongs to the style,
     not to the string — so Hungarian and Czech read in the same case as English. */
  text-transform: uppercase;
}
/* Width = exactly the longest ChannelState label, measured in the chip's own font by a zero-height hidden
   copy — so every chip lines up and no state can overflow or get clipped. The labels are translated
   (D-89), so the reserved word is set per language into --chip-reserve by applyI18n; the English fallback
   keeps the old behaviour if that variable is ever missing. */
.state-chip::before { content: var(--chip-reserve, "SPINDOWN"); display: block; height: 0; overflow: hidden; visibility: hidden; }
.state-chip.RUN { background: var(--primary); color: #fff; }
.state-chip.SEL, .state-chip.SPU, .state-chip.SPD, .state-chip.CLN { background: var(--primary-light); color: var(--text); }
/* The bar itself is twice as thick (6 -> 12 px). The track carries no padding, so the filled (green)
   bar is the full 12 px. */
.progress { flex: 1; min-width: 0; height: 12px; border-radius: 6px; background: #F0F0F0; overflow: hidden; }
.progress-fill { height: 100%; width: 0; background: var(--primary); transition: width .3s; }
.channel .ml { width: 52px; text-align: right; font-weight: 700; flex: none; }

/* controls — pure configuration now that start/stop lives only on the ring. Read top-down in the order
   a run is set up: channels -> program (duration) -> flow rate -> admin. */
.controls { border-top: 1px solid var(--divider); padding: 12px 20px !important; }
.controls .row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 8px; font-size: 13px; }
.controls label { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
.ctl-channels { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 10px; font-size: 13px; }
.ctl-channels label { display: inline-flex; align-items: center; gap: 6px; }
.ctl-fields { display: grid; gap: 8px; margin-bottom: 10px; }
/* label column fixed so Program / Custom / Flow read as one aligned form, not three stray rows */
.ctl-field { display: grid; grid-template-columns: 62px 1fr; align-items: center; gap: 10px; font-size: 13px; }
.ctl-label { color: var(--text-muted); }
.ctl-value { display: inline-flex; align-items: center; gap: 6px; }
.ctl-field select { width: 100%; max-width: 190px; min-width: 0; }
.ctl-field input[type="number"] { width: 74px; }
.ctl-unit { color: var(--text-muted); }

.btn {
  border: 1px solid var(--primary); border-radius: 16px;
  background: #fff; color: var(--primary);
  padding: 6px 18px; font-size: 13px; font-weight: 700; cursor: pointer;
}
.btn:hover { background: var(--primary); color: #fff; }
.btn.primary { background: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-light); color: var(--text); }
.btn.danger { border-color: var(--err); color: var(--err); }
.btn.danger:hover { background: var(--err); color: #fff; }
.btn.small { padding: 3px 12px; font-size: 12px; }
.btn.toggled { background: var(--primary); color: #fff; }
.btn.active-bad { background: var(--err); border-color: var(--err); color: #fff; }

input, select {
  border: 1px solid var(--primary); border-radius: 16px;
  height: 30px; padding: 0 12px; font-size: 13px; color: var(--text);
  background: #fff;
}
input[type="checkbox"] { height: auto; accent-color: var(--primary); }
input[type="range"] { border: none; padding: 0; accent-color: var(--primary); }

/* simulator */
details.sim { border-top: 1px solid var(--divider); padding: 10px 20px 0 !important; font-size: 13px; }
details.sim summary { cursor: pointer; color: var(--text-muted); }
.sim-body { padding-top: 10px; }
.sim-body .row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 8px; }
.sim-note { font-size: 11px; color: var(--text-muted); }

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

.panel {
  background: var(--panel); border-radius: 8px;
  padding: 24px; margin-bottom: 24px;
  backdrop-filter: blur(6px);
}
.panel h2 { font-size: 1.3rem; margin-bottom: 16px; color: var(--text); }

.chem-form { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end; }
.chem-form label { display: flex; flex-direction: column; gap: 4px; font-size: .87rem; opacity: .9; }
.chem-form input { height: 38px; border-radius: 16px; border: none; }
.uid-row { display: flex; gap: 6px; }
.msg { margin-top: 10px; font-size: 13px; color: var(--ok); font-weight: 700; }
.msg.err { color: var(--err); }

table { width: 100%; border-collapse: collapse; font-size: 13px; background: #fff; border-radius: 8px; overflow: hidden; }
th { text-align: left; padding: 10px 12px; color: var(--text-muted); font-weight: 400; border-bottom: 1px solid var(--divider); }
td { padding: 8px 12px; border-bottom: 1px solid rgba(0, 25, 29, .08); }
.mono { font-family: monospace; }

/* The two PAGED tables keep stable column PROPORTIONS. With the default `table-layout: auto` the browser
   sizes each column from the rows CURRENTLY rendered, so every page turn re-measured them: a page whose
   events are all short ("online") has nothing to fill the Event column and the slack lands in Time
   (measured: Time swinging 178px -> 510px across four pages) — the huge indent between columns.
   Fixed layout + PERCENTAGE widths keep the table filling 100% of the panel at any window size while the
   split stays identical on every page: the percentages come from the measured worst-case content at the
   ~922px panel — time "12/31/2026, 11:17:34 PM" 139px, 16-char mono serial 125px, bold "completed" ~78px,
   "waterPressureLost" 121px, 14-char cartridge 110px, headers "Progress"/"Dispensed" 57/70px. Percentages
   (not px) so a resize scales every column instead of dumping the slack into the last one. [D-45] */
#log-table, #history-table { table-layout: fixed; }
/* Below the width its columns actually need, the table scrolls sideways instead of wrapping every row
   into two lines (at a 1024px viewport the panel gives the 8-column table only 666px, which wrapped all
   100 rows). min-width = the summed content need, so the proportions above only ever divide up space
   that genuinely fits. */
.table-scroll { overflow-x: auto; }
#log-table { min-width: 640px; }
#history-table { min-width: 880px; }
#log-table th:nth-child(1) { width: 18%; }   /* Time   */
#log-table th:nth-child(2) { width: 17%; }   /* Device */
#log-table th:nth-child(3) { width: 65%; }   /* Event  */
/* 8 columns want ~945px of content in a ~922px panel, so this table's horizontal cell padding is 8px
   rather than 12px — that frees 8px per column, enough for every value to stay on one line. */
#history-table th, #history-table td { padding-left: 8px; padding-right: 8px; }
#history-table th:nth-child(1) { width: 17.5%; }  /* Started   */
#history-table th:nth-child(2) { width: 16%; }    /* Device    */
#history-table th:nth-child(3) { width: 5%; }     /* Ch        */
#history-table th:nth-child(4) { width: 10.5%; }  /* Status    */
#history-table th:nth-child(5) { width: 15.5%; }  /* Reason    */
#history-table th:nth-child(6) { width: 8.5%; }   /* Progress  */
#history-table th:nth-child(7) { width: 10%; }    /* Dispensed */
#history-table th:nth-child(8) { width: 17%; }    /* Cartridge */
/* break-word, not `anywhere`: a value only splits when it genuinely cannot fit, so a serial or a status
   never breaks mid-word just because the column is a pixel tight. */
#log-table td, #history-table td { white-space: normal; overflow-wrap: break-word; }
.status-Completed { color: var(--ok); font-weight: 700; }
.status-Aborted { color: var(--err); font-weight: 700; }
.status-Running { color: var(--primary); font-weight: 700; }

.level-bar { height: 8px; border-radius: 4px; background: #F0F0F0; overflow: hidden; min-width: 60px; }
.level-fill { height: 100%; background: var(--ok); }
.level-fill.mid { background: var(--warn); }
.level-fill.low { background: var(--err); }

/* White text made sense when panels were half-transparent over the dark photo; since the panels went to
   88% white (D-62) it was white-on-white — invisible in EVERY empty state, not just the dashboard's. [D-64] */
.empty { color: rgba(0, 25, 29, .68); font-size: 1.05rem; padding: 40px; text-align: center; }

/* The dashboard's "nothing selected" state is the whole panel, so it gets to look like a real empty state
   rather than a stray sentence: bigger, centred in a dashed frame, pointing at the table it refers to. */
#dash-hint {
  margin: 8px 0 4px; padding: 34px 24px; font-size: 1.12rem; font-weight: 500;
  color: rgba(0, 25, 29, .72);
  border: 2px dashed rgba(0, 25, 29, .16); border-radius: 14px; background: rgba(255, 255, 255, .5);
}
#dash-hint::after { content: "↓"; display: block; margin-top: 10px; font-size: 1.5rem; color: var(--primary); }

/* read-only mode (viewer / reseller): hide command surfaces */
body.readonly .controls, body.readonly details.sim, body.readonly #chem-register-panel { display: none; }

@media (max-width: 900px) {
  .shell { flex-direction: column; }
  #menu { flex-direction: row; min-width: 0; padding: 10px 0; }
  .menu-btn { border-radius: 20px; padding: 0 14px; text-indent: 0; }
  main { padding: 10px 16px 40px; }
  .card { width: 100%; max-width: 403px; }
}

/* device filter bar (IT2-7) */
.filter-bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 0 0 14px; }
.filter-bar input, .filter-bar select { padding: 6px 10px; border-radius: 8px; }
.filter-bar #dev-f-text { min-width: 240px; flex: 1 1 240px; max-width: 360px; }
.filter-bar .muted { color: #8a94a6; font-size: .88em; margin-left: auto; }
/* The range pair + its reset wrap as ONE unit, so "To" is never orphaned on a line of its own when the
   bar runs out of room. */
.filter-bar .range-group { display: inline-flex; align-items: center; gap: 10px; flex-wrap: nowrap; }
/* date-range filter pair (activity log / dispense history) */
/* From/To captions render in full text colour at the row's own size — as muted .88em they were the
   faintest thing in the bar despite naming what the two most consequential controls do. */
.filter-bar .range-f { display: inline-flex; align-items: center; gap: 6px; }
.filter-bar .range-f > span { color: var(--text); font-size: 13px; } /* 13px = the global input/select size */
/* The range reset is one of the row's controls, not a compact action, so it carries the SAME metrics as
   the inputs beside it — same padding, same font size, same 8px corner — not the small pill size. */
.filter-bar .range-group .btn { padding: 6px 14px; border-radius: 8px; }

/* Pager under a paged table. The rows-per-page control lives here, with the paging it governs, rather
   than up in the filter bar — it changes how the result set is sliced, not what is in it. [D-44] */
.pager { display: flex; align-items: center; gap: 8px; margin: 12px 0 2px; font-size: .9em; }
.pager .btn.small { min-width: 34px; }
.pager .btn.small:disabled { opacity: .4; cursor: not-allowed; }
.pager-info { color: var(--text-muted); }
.pager-size { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; color: var(--text-muted); }
.pager-size select { padding: 4px 8px; border-radius: 8px; }

/* GroupBy: dropdown collapses into a filled pill-button once a grouping is active */
.group-active-btn {
  display: inline-flex; align-items: center; gap: 7px;
  border: 1px solid var(--primary); border-radius: 8px;
  background: var(--primary); color: #fff;
  padding: 6px 12px; font-size: 13px; font-weight: 700; cursor: pointer; height: 32px;
}
.group-active-btn:hover { background: var(--primary-light); color: var(--text); }
.group-active-btn .gb-x {
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px; border-radius: 50%;
  background: rgba(255, 255, 255, .28); font-size: 11px; line-height: 1;
}
.group-active-btn:hover .gb-x { background: rgba(0, 25, 29, .18); }

/* #26: sort asc/desc toggle — compact square button next to the Sort-by dropdown */
.sort-dir-btn {
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--divider); border-radius: 8px; background: #fff; color: var(--text);
  width: 32px; height: 32px; font-size: 15px; font-weight: 700; cursor: pointer;
}
.sort-dir-btn:hover { background: #f2f4f8; }

/* grouped device layout: stack sections vertically, each with a header + its own card grid.
   Header uses filled pills (not bare text) so it stays legible over the full-bleed photo AND the
   light content area — matching the cyan pill language used across the portal. */
#device-grid.grouped { display: block; }
.dev-group { margin-bottom: 26px; }
.dev-group-head { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; }
.dev-group-name {
  font-size: 13px; font-weight: 700; color: #fff; background: var(--primary);
  border-radius: 16px; padding: 3px 14px; white-space: nowrap;
}
.dev-group-count {
  font-size: 12px; font-weight: 700; color: var(--text);
  background: #fff; border-radius: 16px; padding: 2px 10px; min-width: 22px; text-align: center;
  box-shadow: 0 1px 3px rgba(0, 25, 29, .18);
}
.dev-group-head::after { content: ""; flex: 1; height: 2px; border-radius: 2px; background: rgba(23, 184, 209, .35); }

/* IT2-9 searchable combobox */
.combo { position: relative; }
.combo-input { width: 100%; padding: 6px 10px; border-radius: 8px; box-sizing: border-box; }
.combo.disabled { opacity: .55; }
.combo-list { position: absolute; z-index: 30; left: 0; right: 0; top: 100%; margin-top: 3px; max-height: 260px;
  overflow-y: auto; background: #fff; border: 1px solid #d7dce5; border-radius: 10px; box-shadow: 0 8px 28px rgba(20,30,60,.14); }
.combo-opt { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 8px 11px; cursor: pointer; }
.combo-opt:hover { background: #eef4ff; }
.combo-lbl { font-weight: 500; }
.combo-sub { color: #8a94a6; font-size: .82em; white-space: nowrap; }
.combo-empty { padding: 9px 11px; color: #8a94a6; }

/* IT2-8 role-aware edit form: clearly-marked readonly vs editable */
.field-ro { opacity: .8; }
.field-ro input, .field-ro select, .field-ro .combo-input { background: #f2f4f8; color: #55607a; cursor: not-allowed; }
.ro-badge { font-size: .72em; color: #8a94a6; margin-left: 6px; text-transform: uppercase; letter-spacing: .04em; }

/* IT2-8 device edit modal + card edit button */
.icon-btn { background: none; border: none; cursor: pointer; font-size: 1.25rem; line-height: 1; opacity: .6;
  padding: 4px 6px; border-radius: 8px; }
.icon-btn:hover { opacity: 1; background: #eef4ff; }
.modal-overlay { position: fixed; inset: 0; background: rgba(20,28,48,.45); display: flex; align-items: center;
  justify-content: center; z-index: 100; padding: 20px; }
.modal { background: #fff; border-radius: 14px; padding: 22px 24px; width: min(560px, 96vw); max-height: 92vh;
  overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.modal h2 { margin: 0 0 16px; font-size: 1.1rem; }
.edit-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
.edit-grid > label { display: grid; gap: 4px; }
.edit-grid > label > span:first-child { font-size: .85em; color: #55607a; }
.modal-actions { display: flex; align-items: center; gap: 10px; margin-top: 20px; }

/* Per-device certificate list (D-48): the 🗎 card icon's modal. Same shape as the legacy
   "Disinfection diary" dialog — newest first, location + date + a PDF button per row. */
.cert-list { max-height: 52vh; overflow-y: auto; }
.cert-table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.cert-table th { text-align: left; font-weight: 600; color: var(--text-muted);
  border-bottom: 1px solid var(--divider); padding: 6px 8px; position: sticky; top: 0; background: #fff; }
.cert-table td { padding: 7px 8px; border-bottom: 1px solid var(--divider); vertical-align: middle; }
.cert-table tr:last-child td { border-bottom: 0; }
.cert-table td:last-child { text-align: right; white-space: nowrap; }

/* ---- Device dashboard (D-49): the legacy main/devices/dashboard, ported.
   Kept from the original because the customer knows this page: three columns divided by thin rules,
   a label above every control, and one Save under the grid. Adapted to this portal's white-card
   surface instead of the old photo background, so the pill inputs become normal portal inputs. */
.dash-panel { padding-bottom: 18px; }

.dash-strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 22px;
  padding-bottom: 18px; border-bottom: 1px solid var(--divider); }
.dash-strip > div { display: flex; flex-direction: column; gap: 4px; }

.dashboard { display: grid; grid-template-columns: repeat(var(--dash-cols, 3), 1fr); gap: 24px;
  border-bottom: 1px solid var(--divider); padding-bottom: 20px; }
.dash-col { display: flex; flex-direction: column; padding-right: 22px; border-right: 1px solid var(--divider); }
.dash-col:last-child { border-right: 0; padding-right: 0; }
/* Column headings were cyan-on-white — brand-correct but the weakest text on the page. Dark ink carries
   the heading and the cyan becomes an underline accent, so it still reads as a section marker. */
.dash-col h3 { text-align: center; font-size: 1rem; font-weight: 800; letter-spacing: 1.4px;
  color: var(--text); margin: 0 0 18px; padding-bottom: 8px; text-transform: uppercase;
  border-bottom: 2px solid var(--primary); }
/* Field labels at 50% opacity were barely there; these name the data, so they get real contrast. */
/* The label should lead the eye, just slightly, over the value it names. [D-66] */
.dash-col .input-label, .dash-strip .input-label {
  font-size: 13px; font-weight: 600; color: rgba(0, 25, 29, .82); margin: 10px 0 4px; }
.dash-col input, .dash-col select, .dash-strip input { color: var(--text); }
.dash-col input, .dash-col select, .dash-strip input { height: 40px; border-radius: 20px; border: 1px solid var(--divider);
  padding: 0 14px; font-size: .95rem; background: #fff; width: 100%; }
/* Two DIFFERENT kinds of "you can't type here", and they should not look alike [D-63]:

   READ-ONLY — a value that is derived or filled from another choice (serial, the contact name/email/phone
   that follow the selected user, the bound cartridge). The strongest signal that something isn't an input
   is for it to stop looking like one: drop the pill, the border and the fill, and let it read as printed
   information sitting on the panel. */
.dash-col input[readonly], .dash-strip input[readonly] {
  background: transparent; border-color: transparent; box-shadow: none;
  /* Same weight and colour as an editable input — the "not an input" signal comes from losing the pill,
     border and fill, NOT from shouting. Bolder text made derived values the loudest thing on the row. */
  color: rgba(0, 25, 29, .75); font-weight: 400; padding-left: 2px; cursor: default;
}
.dash-col input[readonly]:focus, .dash-strip input[readonly]:focus { outline: none; box-shadow: none; }
/* Empty derived fields would otherwise be invisible — a faint baseline keeps the layout readable. */
.dash-col input[readonly], .dash-strip input[readonly] { border-bottom: 1px dashed rgba(0, 25, 29, .18); border-radius: 0; }

/* A read-only field that HAS a value gets a faint tinted slab so the value sits on something, while
   staying obviously not-an-input: a flat, inset-looking tint with a small radius, versus the editable
   field's white 20px pill with a border. (`:placeholder-shown` is how we detect "empty" — every read-only
   input carries a blank placeholder purely so this selector works.) [D-66] */
.dash-col input[readonly]:not(:placeholder-shown),
.dash-strip input[readonly]:not(:placeholder-shown) {
  background: rgba(0, 25, 29, .032);   /* barely off the panel — present, not a block of grey [D-66] */
  border-radius: 8px; border-bottom-color: transparent;
  padding-left: 11px; padding-right: 11px;
}

/* DISABLED — a real field this ROLE may not change. It keeps its input shape (someone else can edit it)
   but is visibly locked: flat grey, a padlock, and a not-allowed cursor. */
.dash-col input:disabled, .dash-col select:disabled {
  background-color: #e8edef; border-color: #d4dbde; color: rgba(0, 25, 29, .55);
  cursor: not-allowed; opacity: 1;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='13' height='13' viewBox='0 0 24 24' fill='none' stroke='%2300191d' stroke-opacity='.45' stroke-width='2.2' stroke-linecap='round'><rect x='4' y='11' width='16' height='10' rx='2'/><path d='M8 11V7a4 4 0 0 1 8 0v4'/></svg>");
  background-repeat: no-repeat; background-position: right 13px center; padding-right: 34px;
}
.dash-col select:disabled { appearance: none; }
.dash-col .combo { margin: 0; }

.dash-save { display: flex; align-items: center; gap: 12px; justify-content: center; margin-top: 20px; }
.dash-save .btn { min-width: 340px; height: 54px; font-size: 1.08rem; border-radius: 27px; letter-spacing: .3px; }

#dash-table tbody tr { cursor: pointer; }
#dash-table tbody tr:hover { background: rgba(23, 184, 209, .07); }
#dash-table tbody tr.selected { background: rgba(23, 184, 209, .16); font-weight: 600; }

/* Below the width the three columns need, scroll sideways rather than crushing them — same call the
   legacy page made (it never stacked). */
@media (max-width: 900px) { .dashboard { min-width: 860px; } .dash-panel { overflow-x: auto; } }

/* ---- Invite registration card [D-50] ------------------------------------------------------------
   The first screen a new customer ever sees, and previously the admin `.chem-form` layout (an inline
   flex-wrap toolbar) dropped onto the photo background — five unaligned inputs floating over an image.
   This is a proper centred auth card: one column, full-width controls, label above each field, inline
   per-field errors, and the invite context shown as a small summary so the invitee can confirm they are
   accepting the right thing before typing a password. */
#register-screen {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 32px 16px;
}
.auth-card {
  width: 100%; max-width: 440px;
  background: #fff; border-radius: 22px;
  box-shadow: 0 24px 60px rgba(0, 25, 29, .28);
  display: flex; flex-direction: column;
  overflow: hidden;                 /* so the header band follows the rounded corners */
}
/* The wordmark asset is white-on-transparent (it lives on the photo background), so it needs a coloured
   band — on the white card it was simply invisible. Same teal bar as the disinfection certificate. */
.auth-head { background: var(--primary); padding: 22px 0; display: flex; justify-content: center; }
.auth-logo { width: 170px; }
.auth-title { font-size: 1.5rem; font-weight: 700; color: var(--text); text-align: center; margin: 26px 0 6px; }
.auth-sub { font-size: .9rem; color: var(--text-muted); text-align: center; margin: 0 0 22px; padding: 0 32px; }

/* Invite summary — who you are joining as, before you commit to a password. */
.auth-invite {
  background: rgba(23, 184, 209, .08);
  border: 1px solid rgba(23, 184, 209, .3);
  border-radius: 14px; padding: 14px 16px; margin: 0 32px 22px;
  font-size: .88rem; color: var(--text);
}
/* Stacked rows, not a two-column grid: a long address gets the card's full width instead of being
   hyphen-broken into a narrow value column. */
.auth-invite dl { margin: 0; display: flex; flex-direction: column; gap: 10px; }
.auth-invite dt { color: var(--text-muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .4px; }
.auth-invite dd { margin: 2px 0 0; font-weight: 600; overflow-wrap: break-word; }

.auth-form { display: flex; flex-direction: column; gap: 16px; padding: 0 32px; }
.auth-field { display: flex; flex-direction: column; gap: 6px; }
.auth-field label { font-size: .82rem; font-weight: 600; color: var(--text-muted); letter-spacing: .2px; }
.auth-field input {
  height: 46px; width: 100%;
  border: 1px solid var(--divider); border-radius: 12px;
  padding: 0 14px; font-size: .98rem; color: var(--text); background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
.auth-field input:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(23, 184, 209, .18);
}
.auth-field input:disabled { background: #f3f6f7; }
.auth-hint { font-size: .76rem; color: var(--text-muted); }
.auth-err { font-size: .78rem; color: var(--err); font-weight: 600; display: none; }
/* A field in error: red border + its message revealed. */
.auth-field.invalid input { border-color: var(--err); }
.auth-field.invalid input:focus { box-shadow: 0 0 0 3px rgba(235, 0, 0, .15); }
.auth-field.invalid .auth-err { display: block; }

.auth-submit {
  height: 50px; margin-top: 6px;
  border: none; border-radius: 25px;
  background: var(--primary); color: #fff;
  font-size: 1.02rem; font-weight: 700; cursor: pointer;
  transition: filter .15s;
}
.auth-submit:hover:not(:disabled) { filter: brightness(1.08); }
.auth-submit:disabled { opacity: .55; cursor: default; }

.auth-msg { font-size: .86rem; font-weight: 600; margin: 0; min-height: 1.1em; text-align: center; }
.auth-msg.err { color: var(--err); }
.auth-msg.ok { color: var(--ok); }

.auth-alt { margin: 20px 0 0; padding: 0 32px 26px; text-align: center; font-size: .86rem; color: var(--text-muted); }
.auth-alt a { color: var(--primary); font-weight: 600; text-decoration: none; }
.auth-alt a:hover { text-decoration: underline; }

/* Success state: the form is replaced by a confirmation, so nothing invites a second submit. */
.auth-done { text-align: center; padding: 8px 32px 28px; }
.auth-done .auth-tick {
  width: 54px; height: 54px; border-radius: 50%; margin: 0 auto 14px;
  background: rgba(52, 167, 83, .12); color: var(--ok);
  display: flex; align-items: center; justify-content: center; font-size: 28px; font-weight: 700;
}

@media (max-width: 480px) {
  .auth-card { border-radius: 18px; }
  .auth-logo { width: 140px; }
  .auth-form, .auth-sub, .auth-alt { padding-left: 20px; padding-right: 20px; }
  .auth-invite { margin-left: 20px; margin-right: 20px; }
}
.accept-warn { display: inline-block; margin-top: 8px; color: var(--err); font-weight: 600; font-size: .88rem; }


/* An email/phone input holding something malformed [D-53]. Paired with .field-err where the markup has one. */
.input-invalid { border-color: var(--err) !important; box-shadow: 0 0 0 2px rgba(235, 0, 0, .12); }
.field-err { display: block; font-size: .76rem; color: var(--err); font-weight: 600; margin-top: 3px; }

/* A panel holding an OPEN combo is lifted above its siblings. Needed because .panel sets backdrop-filter,
   which makes each panel its own stacking context — without this the dropdown is painted behind whatever
   panel follows it, no matter what z-index the list itself carries. [D-56] */
.panel.combo-open { position: relative; z-index: 60; }
/* The field itself is a stacking context too (.chem-form label has opacity: .9), so the list would sit
   behind the NEXT field unless the owning label is lifted as well — and its opacity dropped, since that is
   what creates the context in the first place. [D-56] */
.chem-form label.combo-open, label.combo-open { position: relative; z-index: 61; opacity: 1; }

/* Disinfection schedule window (D-57): two clearly separated blocks — a one-off run and the recurring one —
   each with its own date+time picker, instead of controls scattered across the card. */
.sched-modal { width: min(520px, 96vw); }
.sched-block { border-top: 1px solid var(--divider); padding-top: 14px; margin-top: 14px; }
.sched-block:first-of-type { border-top: 0; padding-top: 0; margin-top: 4px; }
.sched-block h3 { margin: 0 0 4px; font-size: .98rem; color: var(--text); }
.sched-note { margin: 0 0 12px; font-size: .82rem; color: var(--text-muted); }
.sched-row { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; }
.sched-field { display: flex; flex-direction: column; gap: 4px; font-size: .8rem; color: var(--text-muted); }
.sched-row input[type="datetime-local"], .sched-row select {
  height: 38px; border-radius: 10px; border: 1px solid var(--divider); padding: 0 10px; background: #fff;
  font-size: .92rem; color: var(--text);
}
.sched-list { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.sched-list li { display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: #fff; border: 1px solid var(--divider); border-radius: 10px; padding: 7px 10px; font-size: .9rem; }
.sched-list li.sched-empty { justify-content: flex-start; color: var(--text-muted); background: transparent;
  border-style: dashed; }

/* Dashboard: which device is being edited, and a way out of it. [D-58] */
/* Three tracks so the button is centred on the PANEL, not merely between the label and the edge — the
   label's length would otherwise shift it around as devices change. [D-58] */
.dash-head { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px; margin-bottom: 16px; }
.dash-head .dash-selected { grid-column: 1; }
.dash-head #dash-clear { grid-column: 2; justify-self: center; }
.dash-selected { font-weight: 700; font-size: 1.05rem; color: var(--text); }
.dash-selected .dash-dirty { margin-left: 8px; font-weight: 600; font-size: .8rem; color: var(--warn); }
/* Sized to read as the header's action rather than an afterthought next to the device name. [D-58] */
/* Clear selection is a CLOSING action, not the panel's primary one, so it stays quiet at rest and turns
   red on hover — never the solid cyan fill every other .btn uses, which reads as "go". The background stays
   white throughout and the red arrives as an inner ring + red text: enough to say "this removes something"
   without the alarm of a filled danger button (nothing is destroyed — unsaved edits are still guarded). */
#dash-clear { height: 42px; min-width: 280px; padding: 0 32px; font-size: .95rem; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  /* Visible at rest — dark ink text on a softly red-tinted border, with the x already red. It reads as a
     real, findable action and hints at what it does, while hover still deepens to the full red. [D-63] */
  background: #fff; color: var(--text); border-color: rgba(235, 0, 0, .45); border-width: 2px;
  transition: color .15s, border-color .15s, box-shadow .15s; }
#dash-clear:hover, #dash-clear:focus-visible {
  background: #fff;                      /* override .btn:hover's solid fill */
  color: var(--err);
  border-color: var(--err);
  box-shadow: inset 0 0 0 1px var(--err); /* the inner red border */
  outline: none;
}
/* The ✕ says the action CLOSES this device's details, rather than clearing the fields in them. */
.dash-clear-x { font-size: 1.1rem; line-height: 1; color: var(--err); opacity: .85; transition: opacity .15s; }
#dash-clear:hover .dash-clear-x, #dash-clear:focus-visible .dash-clear-x { opacity: 1; }

/* Unsaved-changes prompt: the actual changes, not just a scary sentence. */
.dirty-list { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px;
  max-height: 40vh; overflow-y: auto; }
.dirty-list li { background: #fff; border: 1px solid var(--divider); border-radius: 10px; padding: 8px 11px;
  font-size: .88rem; }
.dirty-field { font-weight: 700; display: block; margin-bottom: 2px; }
.dirty-from { color: var(--text-muted); text-decoration: line-through; }
.dirty-to { color: var(--text); font-weight: 600; }

/* Scheduled disinfections — a labelled section on the device card (D-68). */
/* Breathing room after the section so the admin row below it isn't crowded. [D-68] */
.card-sched-section { border-top: 1px solid var(--divider); margin-top: 12px; padding-top: 10px;
  padding-bottom: 14px; }
.card-sched-title { font-size: 12px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase;
  color: var(--text-muted); margin-bottom: 8px; }
/* The section never shrinks when something IS scheduled — it holds at least the empty slot's height and
   only grows from there, so a card doesn't jump as schedules come and go. [D-68] */
.card-sched-body { display: flex; flex-direction: column; gap: 6px; min-height: 58px; justify-content: center; }
/* Fixed icon track + flexible label + right-aligned date: identical tracks on every row, so the three
   parts line up column-wise however long the label or date is. [D-68] */
.sched-item { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; align-items: center;
  gap: 9px; font-size: 13.5px; color: var(--text);
  background: rgba(23, 184, 209, .1); border: 1px solid rgba(23, 184, 209, .3);
  border-radius: 10px; padding: 7px 11px; cursor: pointer; transition: background .15s, border-color .15s; }
.sched-item:hover { background: rgba(23, 184, 209, .18); border-color: var(--primary); }
.sched-ico { font-size: 1.15rem; line-height: 1; text-align: center; }
.sched-what { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sched-when { font-weight: 700; white-space: nowrap; text-align: right; }
/* Empty state: a real target, so "nothing scheduled" is also the way to schedule something. */
.sched-slot { width: 100%; min-height: 58px; text-align: center; font-size: 13.5px; color: var(--text-muted);
  background: transparent; border: 1.5px dashed rgba(0, 25, 29, .22); border-radius: 10px;
  padding: 16px 12px; cursor: pointer; transition: border-color .15s, color .15s, background .15s; }
.sched-slot:hover { border-color: var(--primary); color: var(--primary); background: rgba(23, 184, 209, .07); }

/* Schedule window footer (D-57): Save and Close share one row and one size — Save had been a small button
   buried in the Automatic block while Close sat alone at the bottom. */
.sched-actions { display: flex; align-items: center; gap: 12px; margin-top: 20px; }
.sched-actions .btn { min-width: 150px; height: 44px; font-size: .98rem; border-radius: 22px;
  transition: background .15s, color .15s, border-color .15s; }
/* The two buttons used to SWAP identities on hover: the generic .btn:hover fills solid cyan, so Close
   started looking like the primary action, while .btn.primary:hover faded Save to pale cyan with dark text.
   Give them a stable hierarchy instead — Save stays solid and merely darkens, Close is a neutral secondary
   that warms slightly. Neither changes rank under the cursor. [D-57] */
.sched-actions .btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.sched-actions .btn.primary:hover { background: #119cb2; border-color: #119cb2; color: #fff; }
.sched-actions .btn:not(.primary) { background: #fff; border-color: var(--divider); color: var(--text-muted); }
.sched-actions .btn:not(.primary):hover { background: #eef1f3; border-color: rgba(0, 25, 29, .32); color: var(--text); }
/* Device-admin presentation override checkbox [D-74] */
.da-check { display: flex !important; flex-direction: row !important; align-items: center; gap: 8px; margin-top: 4px; }
.da-check input { width: 16px; height: 16px; }

/* ---------------------------------------------------------------- card hover-preview bubble (D-77)
   Hovering a card's serial opens a translucent chat bubble: small with a spinner first, then grown to
   the identity panel. It lives on <body> (a card clips its own children), so it is positioned fixed and
   placed in JS. 30% transparent as asked — .7 alpha over a blur, which keeps the text readable against
   the dark photo background without turning the bubble into a solid panel. */
.serial.peekable {
  /* An eye, so it reads as "look at this" rather than "click this". zoom-in is the fallback for
     browsers that reject the data-URI cursor. */
  cursor: url("data:image/svg+xml;utf8,\
<svg xmlns='http://www.w3.org/2000/svg' width='26' height='26' viewBox='0 0 26 26'>\
<g fill='none' stroke='%2300191D' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'>\
<path d='M2 13s4-6 11-6 11 6 11 6-4 6-11 6-11-6-11-6z' fill='rgba(255,255,255,.85)'/>\
<circle cx='13' cy='13' r='3.2' fill='%2317B8D1'/></g></svg>") 13 13, zoom-in;
}

.peek-bubble {
  position: fixed;
  z-index: 1200;                       /* above cards and their icon rows, below modal overlays */
  /* It floats over white-ish cards, so a white-on-white bubble at .7 barely read as a separate surface.
     Lifted to .82, given a cyan hairline (the brand accent, not a generic grey) and a deeper shadow with a
     tight contact ring, so it detaches from whatever is under it. [D-80] */
  background: rgba(255, 255, 255, .82);
  backdrop-filter: blur(12px) saturate(1.1);
  border: 1px solid rgba(23, 184, 209, .55);
  border-radius: 12px;
  box-shadow: 0 0 0 1px rgba(0, 25, 29, .06), 0 12px 28px rgba(0, 25, 29, .3);
  padding: 10px 12px;
  min-width: 64px;
  color: var(--text);
  pointer-events: none;                /* never steals the hover that opened it */
  transition: width .18s ease, min-width .18s ease, padding .18s ease;
}

/* The tail — a small rotated square tucked under the top edge, pointing back at the serial. */
.peek-bubble::before {
  content: "";
  position: absolute;
  top: -5px; left: 16px;
  width: 10px; height: 10px;
  background: rgba(255, 255, 255, .82);
  border-left: 1px solid rgba(23, 184, 209, .55);
  border-top: 1px solid rgba(23, 184, 209, .55);
  transform: rotate(45deg);
  backdrop-filter: blur(10px);
}

.peek-bubble.open { min-width: 320px; padding: 14px 18px; }   /* roomier panel [D-79] */

.peek-spin {
  width: 20px; height: 20px; margin: 2px auto;
  border: 2.5px solid rgba(0, 25, 29, .18);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: peek-spin .8s linear infinite;
}
@keyframes peek-spin { to { transform: rotate(360deg); } }

.peek-row { display: flex; gap: 12px; align-items: baseline; padding: 5px 0; }
.peek-row + .peek-row { border-top: 1px solid rgba(0, 25, 29, .08); }
.peek-k {
  flex: 0 0 112px;
  font-size: 12.5px; font-weight: 600; letter-spacing: .02em;
  color: var(--text-muted);
}
.peek-v { flex: 1; font-size: 15px; font-weight: 500; word-break: break-word; }

/* Fitted-channel picker on the dashboard: three checkboxes reading as one field, matching the height and
   background of the inputs around them. [D-102] */
.dash-channel-picker { display: flex; gap: 14px; align-items: center; padding: 6px 2px; }
.dash-channel-picker label { display: inline-flex; align-items: center; gap: 5px; font-size: 14px; cursor: pointer; }
.dash-channel-picker input { margin: 0; cursor: pointer; }
.dash-channel-picker.locked { opacity: .6; }
.dash-channel-picker.locked label, .dash-channel-picker.locked input { cursor: default; }

/* Device admin: the display-only overrides boxed together, so it is obvious they belong to each other and
   that none of them changes what the machine actually does. [D-108] */
.da-overrides {
  border: 1px solid var(--divider); border-radius: 8px;
  padding: 8px 12px 10px; margin: 6px 0; display: flex; flex-direction: column; gap: 6px;
}
.da-overrides legend {
  font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  color: var(--text-muted); padding: 0 6px;
}
/* The fake temperature belongs to the checkbox above it — indented to say so. */
.da-overrides .da-sub { display: flex; align-items: center; gap: 6px; margin-left: 22px; font-size: 13px; }
.da-overrides .da-sub input { width: 90px; }
.da-overrides .da-unit { color: var(--text-muted); font-size: 12px; }
