/* Kiosk console, in the same nobox language as the launcher and the tablets'
   service menu (brand book: https://brand-book.nobox.pt/):
   flat colour on paper grey, navy type, square blocks (cards, tiles, panels,
   inputs), fully round buttons, dots and chips, Tiempos only for the one
   dominant line of a screen, the original wordmark, no blur and no shadows.
   Brand tokens: ../brand/tokens.css.

   Modes: html[data-theme="light|dark"] (else follows the system) and
   html[data-mode="tablet"] (touch-first: bigger targets, bottom tabs in
   portrait, bottom sheet that swipes down). */

:root {
  /* Square blocks; only buttons, dots and chips are round. */
  --r-card: 0;
  --r-tile: 0;
  --r-row: 0;
  --r-pill: 999px;
  --track-display: 0;
  --track-title: 0;
  --w-bold: 700;
  --font-ui: var(--font-sans);
  --font-head: var(--font-sans);
  --font-big: var(--font-display);   /* Tiempos: the one dominant line of a screen */

  --tap: 44px;                                   /* minimum target; 52px in tablet mode */
  --gutter: 24px;
  --nav-h: 52px;

  --ease-out: cubic-bezier(.2, .8, .2, 1);       /* entrances */
  --ease-in-out: cubic-bezier(.4, 0, .2, 1);     /* moves */
  --spring: cubic-bezier(.32, 1.25, .5, 1);      /* small overshoot for sheets and taps */
  --t-fast: 140ms;
  --t-med: 260ms;
  --t-slow: 420ms;

  /* Light appearance (default) */
  --bg: var(--nobox-gray);
  --card: var(--nobox-white);
  --tile: #F6F6F7;
  --tile-hover: #EFEFF1;
  --text: var(--nobox-navy);
  --text-2: var(--nobox-navy-1);
  --text-3: var(--nobox-navy-2);                 /* decorative / large only (3:1) */
  --text-soft: #7D8494;                          /* the soft half of headlines: 3.3:1 on grey, large text */
  --hair: rgb(16 28 56 / .09);
  --accent: var(--nobox-navy);                    /* primary actions, selection, links in lists */
  --accent-press: #22304F;
  --accent-text: var(--nobox-white);
  --link: #1F5C9C;                                 /* nobox blue deepened for text on white (AA) */
  --soft-btn: rgb(16 28 56 / .06);
  --soft-btn-press: rgb(16 28 56 / .11);
  --line: var(--nobox-navy);                       /* outline buttons, strong rules */
  --bar: var(--nobox-gray);
  --danger: #C8402A;                              /* nobox red, darkened for text on white (4.6:1) */
  --danger-fill: var(--nobox-red);
  --scrim: rgb(16 28 56 / .32);
  --toast-bg: var(--nobox-navy);
  --toast-text: var(--nobox-white);
  --input-bg: var(--nobox-white);
  --input-line: rgb(16 28 56 / .18);
  --scroll-thumb: rgb(16 28 56 / .28);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: var(--nobox-navy); --card: #1C2742; --tile: #253150; --tile-hover: #2C3A5C;
    --text: #F5F6F8; --text-2: var(--nobox-navy-3); --text-3: var(--nobox-navy-2); --text-soft: var(--nobox-navy-2); --hair: rgb(255 255 255 / .09);
    --accent: #F5F6F8; --accent-press: var(--nobox-navy-3); --accent-text: var(--nobox-navy); --link: var(--nobox-blue-1);
    --soft-btn: rgb(255 255 255 / .09); --soft-btn-press: rgb(255 255 255 / .15); --line: #F5F6F8; --bar: var(--nobox-navy);
    --danger: var(--nobox-red-1); --danger-fill: var(--nobox-red); --scrim: rgb(0 0 0 / .5);
    --toast-bg: #F5F6F8; --toast-text: var(--nobox-navy); --input-bg: #253150; --input-line: rgb(255 255 255 / .16); --scroll-thumb: rgb(255 255 255 / .25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: var(--nobox-navy); --card: #1C2742; --tile: #253150; --tile-hover: #2C3A5C;
  --text: #F5F6F8; --text-2: var(--nobox-navy-3); --text-3: var(--nobox-navy-2); --text-soft: var(--nobox-navy-2); --hair: rgb(255 255 255 / .09);
  --accent: #F5F6F8; --accent-press: var(--nobox-navy-3); --accent-text: var(--nobox-navy); --link: var(--nobox-blue-1);
  --soft-btn: rgb(255 255 255 / .09); --soft-btn-press: rgb(255 255 255 / .15); --line: #F5F6F8; --bar: var(--nobox-navy);
  --danger: var(--nobox-red-1); --danger-fill: var(--nobox-red); --scrim: rgb(0 0 0 / .5);
  --toast-bg: #F5F6F8; --toast-text: var(--nobox-navy); --input-bg: #253150; --input-line: rgb(255 255 255 / .16); --scroll-thumb: rgb(255 255 255 / .25);
  color-scheme: dark;
}

:root[data-mode="tablet"] { --tap: 52px; --gutter: 28px; --nav-h: 60px; }

/* ===========================================================================
   Base
   =========================================================================== */

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 17px;
  line-height: 1.47;
  -webkit-font-smoothing: antialiased;
  transition: background var(--t-med) ease, color var(--t-med) ease;
}
[data-mode="tablet"] body { overscroll-behavior-y: none; }
h1, h2, h3, p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--link); text-decoration: none; }
:focus-visible { outline: 3px solid var(--nobox-blue); outline-offset: 2px; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--text-2); }
.eyebrow { font-size: 13px; line-height: 1.3; text-transform: uppercase; color: var(--text); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ===========================================================================
   Shell: translucent top bar; bottom tab bar in tablet portrait and on phones
   =========================================================================== */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 24px;
  min-height: var(--nav-h);
  padding: env(safe-area-inset-top) max(var(--gutter), env(safe-area-inset-right)) 0 max(var(--gutter), env(safe-area-inset-left));
  background: var(--bar);
  border-bottom: 1px solid var(--hair);
}
.topbar .brand { font-weight: var(--w-bold); letter-spacing: var(--track-title); white-space: nowrap; }
.topbar .logo { height: 20px; width: auto; display: block; }
/* The wordmark: navy on light, the light version on navy. */
.logo-dark { display: none !important; }
:root[data-theme="dark"] .logo-light { display: none !important; }
:root[data-theme="dark"] .logo-dark { display: block !important; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .logo-light { display: none !important; }
  :root:not([data-theme="light"]) .logo-dark { display: block !important; }
}
.topbar .spacer { flex: 1; }
.topbar .home { display: inline-flex; align-items: center; min-height: var(--tap); }
.nav { display: flex; gap: 6px; align-self: stretch; align-items: center; }
.nav a {
  display: inline-flex; align-items: center; min-height: 36px; padding: 0 14px;
  border-radius: var(--r-pill); color: var(--text-2); font-size: 15px;
  transition: background var(--t-fast) ease, color var(--t-fast) ease;
}
.nav a:hover { color: var(--text); }
.nav a[aria-current="page"] { color: var(--accent-text); background: var(--accent); }
.count-badge { display: inline-grid; place-items: center; min-width: 20px; height: 20px; margin-left: 6px; padding: 0 6px; border-radius: var(--r-pill); background: var(--danger-fill); color: var(--nobox-navy); font-size: 12px; font-weight: var(--w-bold); font-variant-numeric: tabular-nums; }
[data-mode="tablet"] .nav a { min-height: 44px; padding: 0 18px; font-size: 16px; }
.live { display: inline-flex; align-items: center; gap: 8px; color: var(--text-2); font-size: 15px; white-space: nowrap; }
.who { min-height: 36px; padding: 0 16px; border: 2px solid var(--line); border-radius: var(--r-pill); background: transparent; font-size: 15px; font-weight: 700; }
[data-mode="tablet"] .who { min-height: 44px; }

.page { max-width: 1200px; margin: 0 auto; padding: 48px max(var(--gutter), env(safe-area-inset-right)) 120px max(var(--gutter), env(safe-area-inset-left)); display: grid; gap: 36px; align-content: start; }
.page > * { min-width: 0; }

/* Bottom tab bar (tablet portrait, phones) */
@media (max-width: 900px) and (orientation: portrait), (max-width: 640px) {
  /* A blurred ancestor would trap the fixed tab bar: keep the top bar solid here. */
  .topbar { background: var(--bg); }
  .topbar .nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 45;
    display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 0;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    background: var(--bar);
    border-top: 1px solid var(--hair);
  }
  .topbar .nav a { justify-content: center; min-height: 52px; border-radius: var(--r-pill); font-size: 15px; }
  .page { padding-bottom: 140px; }
}
@media (max-width: 640px) {
  .topbar { gap: 12px; }
  .topbar .who { display: none; }
  .page { padding-top: 28px; gap: 28px; }
}

/* ===========================================================================
   Type
   =========================================================================== */

.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px 24px; }
.page-head .eyebrow { margin-bottom: 6px; }
.page-title { font-family: var(--font-big); font-weight: 500; font-size: clamp(36px, 4.4vw, 52px); line-height: 1.1; }
.headline { font-family: var(--font-big); font-weight: 500; font-size: clamp(44px, 6vw, 76px); line-height: 1.05; max-width: 22ch; }
.headline .soft { color: var(--text-soft, var(--text-3)); }
.lede { font-size: 21px; line-height: 1.38; color: var(--text-2); max-width: 48ch; }
h2.section, .section-title h2 { font-size: 28px; font-weight: var(--w-bold); letter-spacing: var(--track-title); line-height: 1.14; }
h2.section { margin: 8px 0 0; }
.section-title { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 14px; margin-bottom: 16px; }
.section-title .aside { color: var(--text-2); }
.section-title .end { margin-left: auto; }
h3 { font-size: 20px; font-weight: var(--w-bold); letter-spacing: var(--track-title); margin: 8px 0 4px; }
.lead { font-size: 19px; font-weight: 500; }

/* ===========================================================================
   Buttons, chips, dots
   =========================================================================== */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tap); padding: 0 20px;
  border: 2px solid var(--line); border-radius: var(--r-pill);
  background: transparent; color: var(--text);
  font-size: 15px; font-weight: 700; white-space: nowrap;
  transition: transform var(--t-fast) var(--spring), background var(--t-fast) ease, opacity var(--t-fast) ease;
  touch-action: manipulation;
}
.btn:hover { background: var(--soft-btn); }
.btn:active { transform: scale(.96); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn.primary:hover { background: var(--accent-press); border-color: var(--accent-press); }
.btn.danger { background: var(--danger-fill); border-color: var(--danger-fill); color: var(--nobox-navy); }    /* marinho sobre vermelho */
.btn.small { min-height: 36px; padding: 0 14px; font-size: 14px; }
[data-mode="tablet"] .btn.small { min-height: 44px; padding: 0 18px; }
.btn.big { min-height: 56px; font-size: 17px; }
.btn:disabled { opacity: .4; pointer-events: none; }
.link-btn { min-height: var(--tap); padding: 0 8px; border: 0; background: none; color: var(--link); font-size: 15px; text-decoration: underline; text-underline-offset: 3px; }
.link-btn:active { opacity: .6; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; }
.actions.end { justify-content: flex-end; margin-top: 20px; }
.action-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }

.chip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: var(--r-pill); background: var(--soft-btn); font-size: 13px; line-height: 1.6; white-space: nowrap; }
.chip.ok, .chip.state-done { background: color-mix(in srgb, var(--nobox-turquoise) 22%, transparent); }
.chip.error, .chip.state-failed, .chip.state-rejected { background: color-mix(in srgb, var(--nobox-red) 22%, transparent); }
.chip.warn, .chip.state-deferred, .chip.state-expired { background: color-mix(in srgb, var(--nobox-yellow) 30%, transparent); }
.chip.info, .chip.state-pending { background: color-mix(in srgb, var(--nobox-blue) 20%, transparent); }

.dot { display: inline-block; flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--text-3); }
.dot.online, .dot.c-ok { background: var(--nobox-turquoise); }
.dot.stale, .dot.c-busy { background: var(--nobox-yellow); }
.dot.offline, .dot.c-bad { background: var(--nobox-red); }
.dot.c-off { background: var(--nobox-navy-2); }
.dot.control, .dot.c-control { background: var(--text); }
.ov-bar .c-ok { background: var(--nobox-turquoise); }
.ov-bar .c-busy { background: var(--nobox-yellow); }
.ov-bar .c-bad { background: var(--nobox-red); }
.ov-bar .c-off { background: var(--nobox-navy-2); }
.ov-bar .c-sleep, .dot.c-sleep { background: var(--nobox-blue); }
.tile.st-sleep { opacity: .6; }
.live .dot.online { animation: breathe 2.4s ease-in-out infinite; }
@keyframes breathe { 50% { box-shadow: 0 0 0 5px color-mix(in srgb, var(--nobox-turquoise) 25%, transparent); } }

/* ===========================================================================
   Board
   =========================================================================== */

.board > *, .hero > * { min-width: 0; }
.hero { position: relative; display: grid; gap: 14px; padding: 8px 0 12px; }
/* The board's brand shape: bled off the top-right, behind the cards, never over the type. */
.hero-mass {
  position: absolute; z-index: -1; top: -96px; right: max(-9vw, -120px);
  width: min(34vw, 460px); height: auto; pointer-events: none;
  animation: mass-in .9s var(--ease-out) both;
}
@keyframes mass-in { from { opacity: 0; transform: translate(8%, -8%); } }
.board { position: relative; z-index: 0; }
/* Bled brand shapes reach the screen edge but never cause sideways scrolling.
   (On body this would pass to the window and not apply.) */
#app { overflow-x: clip; }
.overview, .attn, .room, .setup { position: relative; z-index: 1; }
@media (max-width: 900px) { .hero-mass { width: 40vw; top: -70px; right: -12vw; } }
@media (max-width: 640px) { .hero-mass { display: none; } }
.event-pick {
  justify-self: start; display: inline-flex; align-items: center; gap: 6px;
  min-height: 36px; padding: 0 32px 0 14px; border: 0; border-radius: var(--r-pill);
  background: var(--soft-btn) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23878D9C' stroke-width='2'/%3E%3C/svg%3E") no-repeat right 12px center;
  color: var(--text-2); font-size: 15px; appearance: none; -webkit-appearance: none; max-width: 100%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
[data-mode="tablet"] .event-pick { min-height: 44px; }

.overview { background: var(--card); border-radius: var(--r-card); padding: 26px; display: grid; gap: 18px; }
.ov-bar { display: flex; gap: 3px; height: 16px; overflow: hidden; background: var(--tile); }
.ov-bar span { display: block; height: 100%; flex: 0 1 0; min-width: 0; transition: flex-grow var(--t-slow) var(--ease-in-out); }
.ov-legend { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; }
.ov-item { display: grid; gap: 2px; justify-items: start; padding: 10px 12px; border: 0; border-radius: var(--r-row); background: transparent; text-align: left; transition: background var(--t-fast) ease, transform var(--t-fast) var(--spring); }
.ov-item:hover { background: var(--tile); }
.ov-item:active { transform: scale(.97); }
.ov-item[aria-pressed="true"] { background: var(--tile); box-shadow: inset 0 0 0 2px var(--text); }
.ov-n { font-family: var(--font-big); font-size: 48px; font-weight: 500; line-height: 1.05; }
.ov-l { display: inline-flex; align-items: center; gap: 8px; color: var(--text-2); font-size: 15px; }

.attn-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 16px; }
.attn { position: relative; background: var(--card); border-radius: var(--r-card); padding: 22px; display: grid; gap: 12px; align-content: space-between; min-height: 190px; }
.attn-top { display: flex; align-items: center; gap: 10px; color: var(--text-2); font-size: 15px; }
.attn-label { font-family: var(--font-head); font-size: 28px; font-weight: var(--w-bold); letter-spacing: var(--track-title); line-height: 1.1; }
.attn-what { display: grid; gap: 2px; font-size: 17px; line-height: 1.35; }
.attn-act { display: flex; gap: 8px; flex-wrap: wrap; }

.rooms { display: grid; gap: 20px; }
.room { background: var(--card); border-radius: var(--r-card); padding: 22px; }
.room-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 12px; margin-bottom: 16px; }
.room-head h3 { margin: 0; font-size: 24px; }
.room-head .chip { align-self: center; }
.room-head .game { color: var(--text-2); }
.room-head .count { margin-left: auto; color: var(--text-2); font-size: 15px; }
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.tile {
  position: relative; display: grid; gap: 3px; align-content: start; min-height: 148px; padding: 16px 18px;
  border: 0; border-radius: var(--r-tile); background: var(--tile); color: var(--text); text-align: left;
  touch-action: manipulation;
}
.tile:hover { background: var(--tile-hover); }
.tile:active { transform: scale(.97); }
.tile-top { display: flex; justify-content: space-between; gap: 8px; color: var(--text-2); font-size: 13px; }
.tile-pos { font-family: var(--font-head); font-size: 22px; font-weight: var(--w-bold); letter-spacing: var(--track-title); line-height: 1.15; margin-top: 4px; overflow-wrap: anywhere; }
.tile-ident { color: var(--text-2); font-size: 15px; }
.tile-state { display: flex; align-items: center; gap: 8px; margin-top: auto; padding-top: 10px; font-size: 15px; min-width: 0; }
.tile-state span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile-state { padding-right: 26px; }
.tile.st-bad .tile-state, .tile.st-off .tile-state { font-weight: 500; }
.tile.st-off { opacity: .72; }
.tile.dimmed { opacity: .28; }
.tile .check {
  position: absolute; top: 12px; right: 12px; width: 26px; height: 26px; border-radius: 50%;
  border: 2px solid var(--text-3); background: var(--card); display: none;
}
.selecting .tile .check { display: block; }
.selecting .tile .tile-top span:last-child { visibility: hidden; }
.tile.selected { box-shadow: inset 0 0 0 3px var(--accent); }
.tile.selected .check { border-color: var(--accent); background: var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='11' viewBox='0 0 14 11'%3E%3Cpath d='M1.5 5.5l4 4 7-8' fill='none' stroke='white' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat center; }

/* Selection: quick picks above the rooms, an action dock at the bottom. */
.board.selecting { padding-bottom: 150px; }  /* room for the dock under the last tiles */
.scope { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: -6px 0 18px; animation: fade-up var(--t-med) var(--ease-out); }
.scope-label { margin-right: 4px; font-size: 12px; letter-spacing: .04em; text-transform: uppercase; color: var(--text-2); }
.pick {
  display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 8px 0 16px;
  border: 2px solid var(--line); border-radius: var(--r-pill); background: transparent; color: var(--text); font-size: 15px; font-weight: 700;
  transition: background var(--t-fast) ease, color var(--t-fast) ease, transform var(--t-fast) var(--spring);
}
[data-mode="tablet"] .pick { min-height: 46px; }
.pick:hover { background: var(--soft-btn); }
.pick:active { transform: scale(.95); }
.pick-n { display: inline-grid; place-items: center; min-width: 26px; height: 26px; padding: 0 7px; border-radius: var(--r-pill); background: var(--soft-btn); font-size: 13px; }
.pick[aria-pressed="true"] { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.pick[aria-pressed="true"] .pick-n { background: color-mix(in srgb, var(--accent-text) 22%, transparent); }
.room-pick {
  margin-left: auto; display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 14px 0 10px;
  border: 2px solid var(--line); border-radius: var(--r-pill); background: transparent; color: var(--text); font-size: 14px; font-weight: 700;
  animation: fade var(--t-med) ease; transition: background var(--t-fast) ease, color var(--t-fast) ease;
}
.room-pick::before { content: ""; width: 16px; height: 16px; border: 2px solid currentColor; border-radius: 50%; }
.room-pick[data-state="all"] { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.room-pick[data-state="all"]::before { border-color: transparent; background: currentColor; -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3 8.5l3 3 7-7' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 14px no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3 8.5l3 3 7-7' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 14px no-repeat; }
.room-pick[data-state="some"]::before { background: radial-gradient(circle, currentColor 3px, transparent 3.5px); }
.room-head .count + .room-pick { margin-left: 16px; }

.bulkbar {
  position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); z-index: 50;
  width: min(1040px, calc(100% - 32px)); background: var(--toast-bg); color: var(--toast-text);
  transform: translateX(-50%); animation: dock-in 460ms var(--spring) both;
}
.bulkbar[hidden] { display: none; }
@keyframes dock-in { from { opacity: 0; transform: translate(-50%, 24px); } }
.bulk-row { display: flex; align-items: center; gap: 16px; padding: 12px 12px 12px 22px; }
.bulk-count { display: flex; align-items: baseline; gap: 10px; min-width: 0; flex: 1; }
.bulk-count b { font-family: var(--font-big); font-size: 34px; font-weight: 500; line-height: 1; }
.bulk-count span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; opacity: .78; }
.bulk-actions { display: flex; gap: 8px; }
.bulk-end { display: flex; align-items: center; gap: 12px; }
.bulkbar .btn { background: transparent; border-color: currentColor; color: inherit; }
.bulkbar .btn.primary { background: var(--toast-text); border-color: var(--toast-text); color: var(--toast-bg); }
.bulkbar .btn:disabled { opacity: .35; }
.bulkbar .link-btn { color: inherit; opacity: .8; }
.bulkbar .round { border-color: currentColor; color: inherit; font-size: 22px; line-height: 1; }
.bulk-more::after { content: ""; display: inline-block; width: 10px; height: 6px; margin-left: 8px; background: currentColor; transition: transform var(--t-med) var(--spring);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3E%3Cpath d='M1 5l4-4 4 4' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3E%3Cpath d='M1 5l4-4 4 4' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat; }
.bulk-more.open::after { transform: rotate(180deg); }

/* The last bulk action, live */
.bulk-progress { display: grid; grid-template-columns: minmax(0, 1fr) 160px auto; align-items: center; gap: 14px; padding: 10px 12px 10px 22px; border-bottom: 1px solid rgb(255 255 255 / .14); font-size: 14px; animation: fade var(--t-med) ease; }
:root[data-theme="dark"] .bulk-progress { border-bottom-color: var(--hair); }
.bp-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bp-bar { display: flex; gap: 2px; height: 6px; }
.bp-bar i { flex: 0 1 0; min-width: 0; transition: flex-grow var(--t-slow) var(--ease-out); }
.bp-bar i.ok { background: var(--nobox-turquoise); } .bp-bar i.bad { background: var(--nobox-red); } .bp-bar i.go { background: currentColor; opacity: .3; }
.bp-close { width: 28px; height: 28px; border: 0; border-radius: 50%; background: transparent; color: inherit; font-size: 18px; opacity: .7; }

/* Every action, above the dock */
.bulk-panel {
  position: absolute; right: 0; bottom: calc(100% + 8px); width: min(440px, calc(100vw - 32px)); max-height: min(560px, 62vh);
  display: grid; grid-template-rows: auto minmax(0, 1fr); gap: 10px; padding: 14px;
  background: var(--bg); color: var(--text); border: 2px solid var(--line);
  transform-origin: bottom right;
}
.bulk-panel.opening { animation: panel-in 360ms var(--spring) both; }  /* on open only, never on a live update */
@keyframes panel-in { from { opacity: 0; transform: translateY(10px) scale(.97); } }
.bulk-panel .tm-actions { overflow: auto; overscroll-behavior: contain; }
.bulk-panel .tm-a:disabled { cursor: default; color: var(--text-3); }
.bulk-panel .tm-a:disabled:hover { background: transparent; }
.bulk-panel .tm-a-hint { font-variant-numeric: tabular-nums; }

@media (max-width: 900px) and (orientation: portrait), (max-width: 640px) {
  .bulkbar { bottom: calc(92px + env(safe-area-inset-bottom)); }
  .bulk-row { flex-wrap: wrap; gap: 10px; padding: 12px; }
  .bulk-count { flex-basis: 100%; }
  .bulk-actions { flex: 1; overflow-x: auto; }
  .bulk-progress { grid-template-columns: minmax(0, 1fr) auto; }
  .bp-bar { grid-column: 1 / -1; grid-row: 2; }
}

/* ===========================================================================
   Motion: list enter/leave, state change pulse
   =========================================================================== */

.attn, .tile, .room { transition: opacity var(--t-med) var(--ease-out), transform var(--t-med) var(--ease-out), background var(--t-fast) ease, box-shadow var(--t-fast) ease; }
.entering { opacity: 0; transform: translateY(10px) scale(.98); }
.leaving { opacity: 0 !important; transform: scale(.96) !important; pointer-events: none; }
.changed { animation: pulse 900ms var(--ease-out); }
@keyframes pulse {
  0% { box-shadow: inset 0 0 0 0 transparent; }
  25% { box-shadow: inset 0 0 0 3px var(--pulse, var(--accent)); }
  100% { box-shadow: inset 0 0 0 0 transparent; }
}
.st-bad.changed, .st-off.changed { --pulse: var(--nobox-red); }
.st-ok.changed { --pulse: var(--nobox-turquoise); }
.st-busy.changed { --pulse: var(--nobox-yellow); }
@keyframes rise { from { opacity: 0; transform: translate(-50%, 16px) scale(.96); } }
@keyframes fade-up { from { opacity: 0; transform: translateY(12px); } }
.view-in > * { animation: fade-up var(--t-slow) var(--ease-out) both; }
.view-in > *:nth-child(2) { animation-delay: 40ms; }
.view-in > *:nth-child(3) { animation-delay: 80ms; }
.view-in > *:nth-child(4) { animation-delay: 120ms; }
.view-in > *:nth-child(n+5) { animation-delay: 160ms; }

/* ===========================================================================
   Sheet (tablet panel): side panel; bottom sheet in portrait, swipe to close
   =========================================================================== */

.scrim { position: fixed; inset: 0; z-index: 70; background: var(--scrim); opacity: 0; transition: opacity var(--t-med) ease; }
.scrim.open { opacity: 1; }
.sheet {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 75;
  width: min(480px, 100%);
  display: flex; flex-direction: column;
  border-radius: 0; background: var(--bg); overflow: hidden;
  transform: translateX(calc(100% + 24px));
  transition: transform var(--t-slow) var(--ease-out);
  will-change: transform;
}
.sheet.open { transform: none; }
.sheet .grab { display: none; }
.sheet-scroll { flex: 1 1 auto; min-height: 0; overflow: auto; overscroll-behavior: contain; padding: 18px 18px calc(28px + env(safe-area-inset-bottom)); display: grid; grid-auto-rows: max-content; gap: 22px; align-content: start; }
/* (max-content rows: a section with overflow:hidden must never be squeezed to 0 by the scroll box.) */
.sheet-close { justify-self: end; }
.sheet-head { display: grid; gap: 6px; padding: 0 4px; }
.sheet-head h2 { font-family: var(--font-big); font-size: 48px; font-weight: 500; line-height: 1.05; }
.sheet-head .where { font-size: 19px; color: var(--text-2); }
.sheet-head .now { display: flex; align-items: center; gap: 8px; font-size: 15px; color: var(--text-2); }
.quick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.quick .btn { min-height: 64px; border: 0; border-radius: 0; background: var(--card); color: var(--text); font-size: 15px; white-space: normal; text-align: center; line-height: 1.2; }
.quick .btn:hover { background: var(--tile-hover); }
.group { display: grid; gap: 6px; }
.group-title { padding: 0 16px; font-size: 12px; color: var(--text-2); text-transform: uppercase; }
.list { background: var(--card); border-radius: var(--r-row); overflow: hidden; }
.row { display: flex; align-items: center; gap: 12px; min-height: 50px; padding: 10px 16px; border: 0; width: 100%; background: transparent; text-align: left; font-size: 17px; color: var(--text); }
[data-mode="tablet"] .row { min-height: 56px; }
.row + .row { box-shadow: inset 0 1px 0 var(--hair); }
.row .v { margin-left: auto; color: var(--text-2); text-align: right; overflow-wrap: anywhere; }
.row .chev { margin-left: auto; color: var(--text-2); font-size: 20px; transition: transform var(--t-fast) var(--ease-out); }
.row.action:active .chev { transform: translateX(4px); }
.row.action { color: var(--text); font-weight: 500; transition: background var(--t-fast) ease; }
.row.action:hover, .row.action:active { background: var(--tile); }
.row.destructive { color: var(--danger); }
.row .txt { display: grid; min-width: 0; }
.row .txt small { color: var(--text-2); font-size: 14px; overflow-wrap: anywhere; }
.row .btn { margin-left: auto; flex: none; }
.row .row-end { margin-left: auto; flex: none; display: inline-flex; }
.log-row { font-size: 15px; }
.log-row .when { margin-left: auto; color: var(--text-2); font-size: 13px; }
.log-row .chip { transition: background var(--t-med) ease; }

@media (max-width: 900px) and (orientation: portrait), (max-width: 640px) {
  .sheet { top: auto; left: 0; right: 0; bottom: 0; width: 100%; max-height: 92dvh; border-radius: 0; border-top: 2px solid var(--line); transform: translateY(100%); }
  .sheet .grab { display: block; flex: none; width: 100%; height: 28px; border: 0; background: transparent; touch-action: none; cursor: grab; }
  .sheet .grab::before { content: ""; display: block; width: 40px; height: 5px; margin: 10px auto 0; border-radius: 3px; background: var(--text-2); }
  .sheet.dragging { transition: none; }
}

/* ===========================================================================
   Dialogs (confirmations, forms): centred card that scales in
   =========================================================================== */

.dialog {
  width: min(520px, calc(100% - 32px)); max-height: calc(100dvh - 48px);
  padding: 0; border: 0; border-radius: 0;
  background: var(--card); color: var(--text);
  overflow: auto;
}
.dialog.wide { width: min(860px, calc(100% - 32px)); }
.dialog[open] { animation: dialog-in var(--t-med) var(--spring); }
.dialog::backdrop { background: var(--scrim); animation: fade var(--t-med) ease; }
@keyframes dialog-in { from { opacity: 0; transform: scale(.94); } }
@keyframes fade { from { opacity: 0; } }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 24px 26px 8px; }
.dialog-head h2 { font-size: 22px; font-weight: var(--w-bold); letter-spacing: var(--track-title); }
.dialog-body { padding: 10px 26px 26px; }

.stack { display: grid; gap: 12px; }
.stack.center { justify-items: center; text-align: center; }
ul.plain { margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; }
ul.commands li { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 0; border-bottom: 1px solid var(--hair); }
.note { padding: 12px 16px; border-radius: var(--r-row); background: var(--tile); font-size: 15px; }
.note.warn { background: color-mix(in srgb, var(--nobox-yellow) 22%, var(--card)); }
.note.error { background: color-mix(in srgb, var(--nobox-red) 16%, var(--card)); }
p.error { padding: 12px 16px; border-radius: var(--r-row); background: color-mix(in srgb, var(--nobox-red) 16%, var(--card)); }

/* Forms */
.form { display: grid; gap: 16px; }
.field { display: grid; gap: 6px; }
.field label { font-size: 13px; color: var(--text-2); text-transform: uppercase; }
.field small { color: var(--text-2); font-size: 13px; }
.field input, .field select, .field textarea { width: 100%; min-width: 0; }
input[type=text], input[type=password], input[type=email], input[type=number], input[type=date], input[type=url], input:not([type]), select, textarea {
  min-height: var(--tap); padding: 0 14px;
  border: 2px solid var(--input-line); border-radius: 0;
  background: var(--input-bg); color: var(--text); font-size: 17px;
  transition: border-color var(--t-fast) ease;
}
textarea { padding: 10px 14px; min-height: 96px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--line); }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid var(--nobox-blue); outline-offset: 2px; }
.check { display: flex; align-items: center; gap: 12px; min-height: var(--tap); cursor: pointer; }

.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px 20px; margin: 0; }
.facts dt { font-size: 13px; color: var(--text-2); text-transform: uppercase; }
.facts dd { margin: 2px 0 0; overflow-wrap: anywhere; }

.qr { width: min(300px, 70vw); padding: 14px; background: #fff; }
.qr svg { display: block; width: 100%; height: auto; }
.code { font-family: ui-monospace, Menlo, monospace; font-size: 13px; overflow-wrap: anywhere; }
.empty { padding: 56px 24px; border-radius: var(--r-card); background: var(--card); text-align: center; color: var(--text-2); }

/* ===========================================================================
   Other pages: cards, tabs, tables (cards on narrow screens)
   =========================================================================== */

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.segmented { display: inline-flex; padding: 3px; border-radius: var(--r-pill); background: var(--soft-btn); }
.segmented button { min-height: calc(var(--tap) - 8px); padding: 0 16px; border: 0; border-radius: var(--r-pill); background: transparent; color: var(--text-2); transition: background var(--t-fast) ease, color var(--t-fast) ease; }
.segmented button[aria-pressed="true"] { background: var(--accent); color: var(--accent-text); }

.summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.summary > div { padding: 20px; border-radius: var(--r-card); background: var(--card); }
.summary b { display: block; font-family: var(--font-big); font-size: 44px; font-weight: 500; line-height: 1.1; }
.summary .bad b { color: var(--danger); }

.tabs { display: inline-flex; gap: 4px; padding: 4px; border-radius: var(--r-pill); background: var(--soft-btn); max-width: 100%; overflow-x: auto; justify-self: start; }
.tabs a { display: inline-flex; align-items: center; min-height: calc(var(--tap) - 8px); padding: 0 18px; border-radius: var(--r-pill); color: var(--text-2); white-space: nowrap; transition: background var(--t-fast) ease, color var(--t-fast) ease; }
.tabs a[aria-current="page"] { background: var(--accent); color: var(--accent-text); }

.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.grid-cards.rooms-setup { grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr)); }
.block { padding: 22px; border-radius: var(--r-card); background: var(--card); color: var(--text); }
.block.muted-bg { background: var(--tile); }
a.block { display: block; transition: transform var(--t-fast) var(--spring), background var(--t-fast) ease; }
a.block:hover { background: var(--tile-hover); }
a.block:active { transform: scale(.98); }
.block .title { font-size: 22px; font-weight: var(--w-bold); letter-spacing: var(--track-title); line-height: 1.2; margin: 4px 0 6px; }

.table-wrap { overflow-x: auto; border-radius: var(--r-card); background: var(--card); }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-weight: 400; font-size: 13px; text-transform: uppercase; color: var(--text-2); padding: 14px 16px 10px; white-space: nowrap; }
.table td { padding: 14px 16px; border-top: 1px solid var(--hair); vertical-align: middle; }
.table tr.clickable { cursor: pointer; transition: background var(--t-fast) ease; }
.table tr.clickable:hover td { background: var(--tile); }
.table tr:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; }
.table .label-cell { font-weight: 500; white-space: nowrap; }
.table .err { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
[data-mode="tablet"] .table td { padding: 16px; }

@media (max-width: 900px) {
  .table.responsive thead { display: none; }
  .table.responsive, .table.responsive tbody, .table.responsive tr, .table.responsive td { display: block; width: 100%; }
  .table-wrap:has(.responsive) { background: transparent; border-radius: 0; overflow: visible; }
  .table.responsive tr { margin-bottom: 10px; padding: 14px 18px; border-radius: var(--r-tile); background: var(--card); }
  .table.responsive td { position: relative; border: 0; padding: 4px 0 4px 112px; min-height: 28px; overflow-wrap: anywhere; }
  .table.responsive td[data-label]::before { content: attr(data-label); position: absolute; left: 0; top: 6px; width: 104px; font-size: 12px; text-transform: uppercase; color: var(--text-2); }
  .table.responsive td.label-cell { padding-left: 0; font-size: 20px; font-weight: var(--w-bold); margin-bottom: 4px; }
  .table.responsive td.label-cell::before { display: none; }
  .table.responsive .err { max-width: none; white-space: normal; }
  .table.responsive .chip { white-space: normal; }
}

.room-title { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.slots { width: 100%; border-collapse: collapse; margin-top: 12px; }
.slots td { padding: 8px 8px 8px 0; border-top: 1px solid var(--hair); vertical-align: middle; }
.slots td:first-child { white-space: nowrap; width: 1%; padding-right: 16px; }
.slots select { width: 100%; min-width: 120px; }
.slots td:last-child { white-space: nowrap; width: 1%; }
.check-cell { white-space: nowrap; }
.check-cell .dot { margin-right: 8px; vertical-align: middle; }
.check-cell.ok .dot { background: var(--nobox-turquoise); }
.check-cell.bad .dot { background: var(--nobox-red); }
.check-cell.na .dot { background: var(--text-3); }

.steps { counter-reset: step; list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; }
.steps > li { counter-increment: step; display: grid; grid-template-columns: 52px 1fr; gap: 16px; padding: 22px; border-radius: var(--r-card); background: var(--card); }
.steps > li::before { content: counter(step); display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: var(--soft-btn); font-weight: var(--w-bold); font-size: 20px; }
.steps .title { font-size: 20px; font-weight: var(--w-bold); }

/* ===========================================================================
   Our own controls: dropdowns, checkboxes, scrollbars, number/date fields.
   (The native <select> stays hidden as the source of truth; see select.js.)
   =========================================================================== */

.select-native { position: absolute !important; width: 1px !important; height: 1px !important; min-width: 0 !important; min-height: 0 !important; padding: 0 !important; border: 0 !important; margin: 0 !important; overflow: hidden !important; clip: rect(0 0 0 0) !important; opacity: 0 !important; pointer-events: none !important; }

.select-btn {
  position: relative; display: inline-flex; align-items: center; gap: 8px;
  min-height: var(--tap); max-width: 100%; padding: 0 40px 0 14px;
  border: 2px solid var(--input-line); border-radius: 0;
  background: var(--input-bg); color: var(--text); font-size: 17px; text-align: left;
  transition: border-color var(--t-fast) ease, box-shadow var(--t-fast) ease, transform var(--t-fast) var(--spring);
  touch-action: manipulation;
}
.select-btn::after {
  content: ""; position: absolute; right: 14px; top: 50%; width: 12px; height: 8px; margin-top: -4px;
  background: currentColor; opacity: .55;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
  transition: transform var(--t-med) var(--ease-out);
}
.select-btn[aria-expanded="true"] { border-color: var(--line); }
.select-btn[aria-expanded="true"]::after { transform: rotate(180deg); }
.select-btn:active { transform: scale(.985); }
.select-btn:disabled { opacity: .45; }
.select-btn.placeholder .select-text { color: var(--text-2); }
.select-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.field .select-btn, .slots .select-btn { width: 100%; }
.slots .select-btn { min-width: 120px; }
/* The event picker keeps its pill look. */
.select-btn.event-pick { justify-self: start; min-height: 40px; padding: 0 36px 0 16px; border: 2px solid var(--line); border-radius: var(--r-pill); background: transparent; color: var(--text); font-size: 15px; font-weight: 700; }
[data-mode="tablet"] .select-btn.event-pick { min-height: 44px; }
.bulkbar .select-btn { border: 2px solid currentColor; border-radius: var(--r-pill); background: transparent; color: inherit; font-size: 15px; font-weight: 700; }

/* The list: a floating card (laptop, landscape) or a bottom sheet (portrait). */
.listbox {
  position: fixed; z-index: 100; display: flex; flex-direction: column;
  border-radius: 0; background: var(--card); color: var(--text);
  border: 2px solid var(--line);
  overflow: hidden;
  opacity: 0; transform: scale(.96);
  transition: opacity var(--t-fast) ease, transform var(--t-med) var(--spring);
}
.listbox.open { opacity: 1; transform: none; }
.listbox [role="listbox"] { overflow: auto; overscroll-behavior: contain; padding: 6px; outline: none; }
.listbox-option {
  position: relative; display: flex; align-items: center; min-height: 44px; padding: 8px 40px 8px 14px;
  border-radius: 0; font-size: 16px; cursor: pointer; user-select: none; -webkit-user-select: none;
}
[data-mode="tablet"] .listbox-option { min-height: 52px; font-size: 17px; }
.listbox-option.is-empty { color: var(--text-2); }
.listbox-option.active { background: var(--tile); }
.listbox-option[aria-selected="true"] { font-weight: 600; color: var(--accent); }
.listbox-option[aria-selected="true"]::after {
  content: ""; position: absolute; right: 14px; width: 14px; height: 11px; background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='11' viewBox='0 0 14 11'%3E%3Cpath d='M1.5 5.5l4 4 7-8' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='11' viewBox='0 0 14 11'%3E%3Cpath d='M1.5 5.5l4 4 7-8' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
}
.listbox-option[aria-disabled="true"] { opacity: .4; pointer-events: none; }
.listbox.as-sheet {
  left: 0; right: 0; bottom: 0; max-height: 70dvh;
  border-radius: 0; border-width: 2px 0 0; padding-bottom: env(safe-area-inset-bottom);
  transform: translateY(100%); opacity: 1;
  transition: transform var(--t-slow) var(--ease-out);
}
.listbox.as-sheet.open { transform: none; }
.listbox.as-sheet [role="listbox"] { padding: 4px 12px 16px; }
.listbox-title { padding: 18px 26px 8px; font-size: 13px; color: var(--text-2); text-transform: uppercase; }
.listbox-scrim { position: fixed; inset: 0; z-index: 99; background: var(--scrim); opacity: 0; transition: opacity var(--t-med) ease; }
.listbox-scrim.open { opacity: 1; }

/* Checkboxes: rounded, accent fill, animated tick */
input[type=checkbox] {
  appearance: none; -webkit-appearance: none; flex: none;
  display: inline-grid; place-content: center;
  width: 24px; height: 24px; margin: 0;
  border: 2px solid var(--input-line); border-radius: 0;
  background: var(--input-bg); cursor: pointer;
  transition: background var(--t-fast) ease, border-color var(--t-fast) ease, transform var(--t-fast) var(--spring);
}
[data-mode="tablet"] input[type=checkbox] { width: 28px; height: 28px; }
input[type=checkbox]::after {
  content: ""; width: 14px; height: 11px; background: var(--accent-text);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='11' viewBox='0 0 14 11'%3E%3Cpath d='M1.5 5.5l4 4 7-8' fill='none' stroke='black' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='11' viewBox='0 0 14 11'%3E%3Cpath d='M1.5 5.5l4 4 7-8' fill='none' stroke='black' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
  transform: scale(0); transition: transform var(--t-med) var(--spring);
}
input[type=checkbox]:checked { background: var(--accent); border-color: var(--accent); }
input[type=checkbox]:checked::after { transform: scale(1); }
input[type=checkbox]:active { transform: scale(.9); }
input[type=checkbox]:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
input[type=checkbox]:disabled { opacity: .4; cursor: default; }

/* Scrollbars: thin, rounded, quiet; follow light/dark */
html { scrollbar-color: var(--scroll-thumb) transparent; }
* { scrollbar-width: thin; }
@supports not (scrollbar-color: auto) {
  ::-webkit-scrollbar { width: 10px; height: 10px; }
  ::-webkit-scrollbar-track { background: transparent; }
  ::-webkit-scrollbar-thumb { background: var(--scroll-thumb); border-radius: 999px; border: 3px solid transparent; background-clip: padding-box; }
}

/* Number and date fields: no browser spinners; a softer calendar icon */
input[type=number] { -moz-appearance: textfield; appearance: textfield; }
input[type=number]::-webkit-inner-spin-button, input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }

/* ===========================================================================
   Login, toasts
   =========================================================================== */

.login { position: relative; min-height: 100dvh; display: grid; align-content: center; justify-items: start; gap: 18px; max-width: 520px; margin: 0 auto; padding: 32px; }
.login-mark { position: fixed; left: 40px; bottom: 36px; }
.login-mark .logo { height: 30px; width: auto; display: block; }
.login-mass { position: fixed; z-index: -1; right: -14vw; bottom: -18vh; width: min(48vw, 640px); pointer-events: none; animation: mass-in .9s var(--ease-out) both; }
@media (max-width: 640px) { .login-mass { width: 80vw; right: -34vw; bottom: -14vh; } .login-mark { left: 24px; bottom: 24px; } }
.roles-legend { display: grid; grid-template-columns: max-content 1fr; gap: 8px 20px; margin: 0; }
.roles-legend dt { font-weight: 600; }
.roles-legend dd { margin: 0; }
.readonly-note { margin-bottom: var(--space-4); }
.login-or { margin-top: 8px; color: var(--muted, inherit); font-size: 14px; }
.login h1 { font-family: var(--font-big); font-weight: 500; font-size: 52px; line-height: 1.08; }
.login form { display: grid; gap: 14px; width: 100%; }

.toasts { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); z-index: 90; transform: translateX(-50%); display: grid; gap: 8px; justify-items: center; width: min(520px, calc(100% - 32px)); pointer-events: none; }
@media (max-width: 900px) and (orientation: portrait), (max-width: 640px) { .toasts { bottom: calc(92px + env(safe-area-inset-bottom)); } }
.toast {
  position: relative; overflow: hidden; pointer-events: auto;
  display: flex; align-items: center; gap: 14px; min-height: 52px; padding: 10px 22px;
  border-radius: 0; background: var(--toast-bg); color: var(--toast-text); font-size: 15px;
  animation: toast-in var(--t-med) var(--spring);
}
.toast.has-action { padding-right: 10px; }
.toast .btn { margin-left: auto; min-height: 36px; background: var(--nobox-yellow); color: var(--nobox-navy); }
.toast .drain { position: absolute; left: 0; bottom: 0; height: 3px; background: var(--nobox-yellow); animation: drain linear forwards; }
.toast.out { animation: toast-out var(--t-fast) ease forwards; }
.toast.error::before, .toast.ok::before { content: ""; width: 10px; height: 10px; flex: none; border-radius: 50%; }
.toast.error::before { background: var(--nobox-red); }
.toast.ok::before { background: var(--nobox-turquoise); }
@keyframes toast-in { from { opacity: 0; transform: translateY(16px) scale(.96); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px) scale(.98); } }
@keyframes drain { from { width: 100%; } to { width: 0; } }

/* ===========================================================================
   Responsive grids
   =========================================================================== */

@media (max-width: 1100px) { .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 900px) {
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ov-legend { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .overview, .room, .attn, .block, .steps > li { padding: 18px; }
  .tile { min-height: 132px; padding: 14px; }
  .tile-pos { font-size: 19px; }
  .section-title .aside { display: none; }
  .steps > li { grid-template-columns: 1fr; }
  .slots select, .slots .select-btn { min-width: 0; }
  /* Phone: team + tablet on one line, its actions on the next. */
  .slots tr { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; column-gap: 12px; border-top: 1px solid var(--hair); padding: 6px 0; }
  .slots td { border-top: 0; padding: 0; }
  .slots td:last-child { grid-column: 1 / -1; white-space: normal; width: auto; }
  .block p, .block a { overflow-wrap: anywhere; }
}

/* ===========================================================================
   Polish: loading, page morphs, the living hero, entrances, new cards
   =========================================================================== */

/* Loading: the wordmark and a running bar, never a blank page. */
.boot { min-height: 100dvh; display: grid; place-content: center; justify-items: center; gap: 22px; }
.boot .logo { height: 34px; width: auto; animation: fade-up .6s var(--ease-out) both; }
.boot-bar { position: relative; width: 120px; height: 4px; overflow: hidden; background: var(--soft-btn); animation: fade .4s .25s ease both; }
.boot-bar::after { content: ""; position: absolute; inset: 0; width: 40%; background: var(--nobox-turquoise); animation: boot-slide 1.1s var(--ease-in-out) infinite; }
@keyframes boot-slide { from { transform: translateX(-100%); } to { transform: translateX(250%); } }

/* Page changes: the nav and tab pills slide to the new place (View Transitions);
   the page itself swaps at once and its parts rise in, one after the other. */
.nav a[aria-current="page"] { view-transition-name: nav-pill; }
.tabs a[aria-current="page"] { view-transition-name: tab-pill; }
::view-transition-group(nav-pill), ::view-transition-group(tab-pill) { animation-duration: 440ms; animation-timing-function: var(--spring); }
::view-transition-old(nav-pill), ::view-transition-old(tab-pill) { animation: vt-fade-out 160ms ease both; }
::view-transition-new(nav-pill), ::view-transition-new(tab-pill) { animation: vt-fade-in 220ms 80ms ease both; }
::view-transition-old(root) { animation: vt-fade-out 120ms ease both; }
::view-transition-new(root) { animation: none; }
@keyframes vt-fade-out { to { opacity: 0; } }
@keyframes vt-fade-in { from { opacity: 0; } }

.view-in :is(.tiles, .attn-grid, .grid-cards, .steps) > * { animation: fade-up var(--t-slow) var(--ease-out) both; animation-delay: 60ms; }
.view-in :is(.tiles, .attn-grid, .grid-cards, .steps) > :nth-child(2) { animation-delay: 130ms; }
.view-in :is(.tiles, .attn-grid, .grid-cards, .steps) > :nth-child(3) { animation-delay: 165ms; }
.view-in :is(.tiles, .attn-grid, .grid-cards, .steps) > :nth-child(4) { animation-delay: 200ms; }
.view-in :is(.tiles, .attn-grid, .grid-cards, .steps) > :nth-child(5) { animation-delay: 235ms; }
.view-in :is(.tiles, .attn-grid, .grid-cards, .steps) > :nth-child(6) { animation-delay: 270ms; }
.view-in :is(.tiles, .attn-grid, .grid-cards, .steps) > :nth-child(7) { animation-delay: 305ms; }
.view-in :is(.tiles, .attn-grid, .grid-cards, .steps) > :nth-child(8) { animation-delay: 340ms; }
.view-in :is(.tiles, .attn-grid, .grid-cards, .steps) > :nth-child(9) { animation-delay: 375ms; }
.view-in :is(.tiles, .attn-grid, .grid-cards, .steps) > :nth-child(10) { animation-delay: 410ms; }
.view-in :is(.tiles, .attn-grid, .grid-cards, .steps) > :nth-child(11) { animation-delay: 445ms; }
.view-in :is(.tiles, .attn-grid, .grid-cards, .steps) > :nth-child(12) { animation-delay: 480ms; }

/* New rows in live lists slide in (the log, command lists, tables). */
.table tbody tr, ul.commands li, .wipe-list li { transition: opacity 360ms var(--ease-out), translate 360ms var(--ease-out); }
@starting-style { .table tbody tr, ul.commands li { opacity: 0; translate: 0 6px; } }

/* The hero: the brand shape drifts slowly, and trades places with a bounce
   when the board's mood changes; a new headline rolls in. */
.hero-mass { animation: mass-in .9s var(--ease-out) both, drift 22s ease-in-out 1s infinite alternate; }
.hero-mass.morph { animation: mass-morph .8s var(--spring) both, drift 22s ease-in-out 1s infinite alternate; }
@keyframes drift { to { translate: -3% 4%; rotate: -8deg; } }
@keyframes mass-morph { from { scale: .55; opacity: 0; } }
.swap-in { animation: swap-in 520ms var(--ease-out) both; }
@keyframes swap-in { from { opacity: 0; filter: blur(8px); } }

/* Round icon button (close × on dialogs and sheets). */
.icon-btn {
  display: inline-grid; place-items: center; flex: none; width: 40px; height: 40px; padding: 0;
  border: 2px solid var(--line); border-radius: 50%; background: transparent; color: var(--text);
  transition: transform var(--t-fast) var(--spring), background var(--t-fast) ease, rotate var(--t-med) var(--spring);
  touch-action: manipulation;
}
.icon-btn svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
.icon-btn:hover { background: var(--soft-btn); rotate: 90deg; }
.icon-btn:active { transform: scale(.9); }
[data-mode="tablet"] .icon-btn { width: 48px; height: 48px; }

/* Lists of actions: the chevron leans toward where you're going. */
.chev { display: inline-block; transition: translate var(--t-med) var(--spring); }
.row.action:hover .chev, .row.action:focus-visible .chev { translate: 4px 0; }

/* Events: date as a block, status, and the tablets' health for live / ready events. */
.grid-cards.events { grid-template-columns: repeat(auto-fill, minmax(min(100%, 360px), 1fr)); }
a.block.event-card { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 18px; align-items: start; }
.event-date { display: grid; justify-items: center; align-content: center; width: 64px; height: 72px; background: var(--tile); transition: background var(--t-med) var(--ease-out), color var(--t-med) var(--ease-out); }
.event-date b { font-family: var(--font-big); font-size: 32px; font-weight: 500; line-height: 1; }
.event-date span { margin-top: 2px; font-size: 13px; text-transform: uppercase; color: var(--text-2); transition: color var(--t-med) ease; }
a.event-card:hover .event-date { background: var(--accent); color: var(--accent-text); }
a.event-card:hover .event-date span { color: inherit; }
.event-main { min-width: 0; }
.event-main .title { margin-top: 6px; }
.event-status { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 13px; text-transform: uppercase; color: var(--text-2); }
.dot.ev-live { background: var(--nobox-turquoise); animation: breathe 2.4s ease-in-out infinite; }
.dot.ev-ready { background: var(--nobox-blue); }
.dot.ev-draft, .dot.ev-closed { background: var(--text-3); }
a.event-card.st-closed { opacity: .72; }
.event-health { display: grid; gap: 8px; margin-top: 16px; }
.event-health p { margin: 0; font-size: 14px; color: var(--text-2); }
.event-health .needs { color: var(--danger); font-weight: 700; }
.ov-bar.mini { height: 6px; gap: 2px; }

/* Verificação: how many are ready, as blocks; a quiet table where only what's missing has words. */
.readiness { display: grid; gap: 18px; padding: 26px; border-radius: var(--r-card); background: var(--card); }
.readiness-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 24px; }
.readiness-head p { margin: 0; }
.readiness-n { font-family: var(--font-big); font-size: 28px; }
.readiness-n b { margin-right: 4px; font-size: 64px; font-weight: 500; line-height: 1; }
.readiness-blocks { display: flex; flex-wrap: wrap; gap: 6px; }
.readiness-blocks span { width: 28px; height: 28px; background: var(--tile); transition: background var(--t-med) ease; animation: block-in 520ms var(--spring) both; animation-delay: calc(var(--i, 0) * 35ms); }
.readiness-blocks .ok { background: var(--nobox-turquoise); }
.readiness-blocks .bad { background: var(--nobox-red); }
@keyframes block-in { from { scale: 0; } }
.checklist th, .checklist td { padding-left: 12px; padding-right: 12px; }
.checklist td.label-cell { position: sticky; left: 0; z-index: 1; background: var(--card); }
.checklist tr.needs td.label-cell { box-shadow: inset 4px 0 0 var(--nobox-red); }
.checklist .pos { white-space: nowrap; color: var(--text-2); }
.check-cell .mark { display: inline-block; width: 12px; height: 12px; border-radius: 50%; vertical-align: middle; background: var(--text-3); }
.check-cell.ok .mark { background: var(--nobox-turquoise); }
.check-cell.bad .mark { background: var(--nobox-red); }
.check-cell.na .mark { width: auto; height: auto; border-radius: 0; background: none; color: var(--text-3); }
.check-cell .why { margin-left: 8px; font-size: 13px; color: var(--danger); }
.check.mini { min-height: 0; gap: 8px; font-size: 13px; }

/* Encerrar: what will be wiped, as compact chips. */
.wipe-list { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0; padding: 0; list-style: none; }
.wipe-list li { display: inline-flex; align-items: baseline; gap: 8px; padding: 8px 12px; background: var(--tile); font-size: 14px; }
.wipe-list span { color: var(--text-2); }

/* Phones: five tabs fit the bar. */
@media (max-width: 640px) {
  .topbar .nav { padding-left: 4px; padding-right: 4px; }
  .topbar .nav a { min-width: 0; padding: 0 4px; font-size: 13px; }
  .topbar .nav .count-badge { min-width: 16px; height: 16px; margin-left: 3px; padding: 0 4px; font-size: 11px; }
  .readiness-n b { font-size: 48px; }
}

/* ---- Tiles: the latest command's progress -------------------------------- */
.cmd-badge {
  position: absolute; right: 12px; bottom: 12px; width: 24px; height: 24px; border-radius: 50%;
  display: grid; place-items: center; pointer-events: none;
  opacity: 0; scale: .4; transition: opacity var(--t-med) ease, scale var(--t-med) var(--spring);
}
.cmd-badge::before { content: ""; width: 12px; height: 12px; background: var(--nobox-navy); -webkit-mask: var(--glyph) center / contain no-repeat; mask: var(--glyph) center / contain no-repeat; }
.cmd-badge[data-kind]:not([data-kind=""]) { opacity: 1; scale: 1; }
/* On its way: a turning ring. */
.cmd-badge[data-kind="pending"] { border: 3px solid color-mix(in srgb, var(--text) 18%, transparent); border-top-color: var(--text); animation: spin .9s linear infinite; }
.cmd-badge[data-kind="pending"]::before { display: none; }
/* Waiting for the team: a clock on yellow. */
.cmd-badge[data-kind="waiting"] { background: var(--nobox-yellow); --glyph: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Ccircle cx='6' cy='6' r='4.8' fill='none' stroke='black' stroke-width='1.6'/%3E%3Cpath d='M6 3.4V6l1.8 1.2' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E"); }
/* Done: a tick that pops. */
.cmd-badge[data-kind="done"] { background: var(--nobox-turquoise); animation: badge-pop 520ms var(--spring); --glyph: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2 6.4l2.6 2.6L10 3.4' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
/* Failed, refused or expired: a cross that shakes once. */
.cmd-badge[data-kind="failed"] { background: var(--nobox-red); animation: badge-shake 480ms var(--ease-out); --glyph: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M3 3l6 6M9 3l-6 6' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E"); }
@keyframes spin { to { rotate: 360deg; } }
@keyframes badge-pop { 0% { scale: .3; } 60% { scale: 1.25; } 100% { scale: 1; } }
@keyframes badge-shake { 0%, 100% { translate: 0 0; } 20% { translate: -3px 0; } 40% { translate: 3px 0; } 60% { translate: -2px 0; } 80% { translate: 2px 0; } }
:root[data-theme="dark"] .cmd-badge[data-kind="pending"] { border-top-color: var(--text); }

/* ---- First steps -------------------------------------------------------------- */
.setup { display: grid; gap: 14px; }
.setup-steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; margin: 0; padding: 0; list-style: none; }
.setup-step { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 14px; padding: 22px; background: var(--card); transition: background var(--t-med) ease; }
.setup-step .title { margin: 0 0 4px; font-size: 19px; font-weight: var(--w-bold); }
.setup-step .muted { margin: 0; font-size: 15px; }
.setup-step .actions { margin-top: 14px; }
.setup-mark { position: relative; width: 40px; height: 40px; border-radius: 50%; border: 2px solid var(--line); counter-increment: setup; transition: background var(--t-med) ease, border-color var(--t-med) ease; }
.setup-steps { counter-reset: setup; }
.setup-mark::before { content: counter(setup); position: absolute; inset: 0; display: grid; place-items: center; font-weight: var(--w-bold); transition: opacity var(--t-fast) ease, scale var(--t-med) var(--spring); }
.setup-mark::after {
  content: ""; position: absolute; inset: 0; background: var(--nobox-navy); scale: 0; opacity: 0;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'%3E%3Cpath d='M12 20.5l5.5 5.5L28 15' fill='none' stroke='black' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 100% no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'%3E%3Cpath d='M12 20.5l5.5 5.5L28 15' fill='none' stroke='black' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 100% no-repeat;
  transition: scale 520ms var(--spring), opacity var(--t-fast) ease;
}
.setup-step.done { background: color-mix(in srgb, var(--nobox-turquoise) 14%, var(--card)); }
.setup-step.done .setup-mark { background: var(--nobox-turquoise); border-color: var(--nobox-turquoise); }
.setup-step.done .setup-mark::before { opacity: 0; scale: .4; }
.setup-step.done .setup-mark::after { scale: 1; opacity: 1; }
.setup-step.done .title { text-decoration: line-through; text-decoration-thickness: 2px; text-decoration-color: color-mix(in srgb, var(--text) 35%, transparent); }

/* ---- Tablet sheet: screenshot, timeline, pinned quick actions --------------- */
.shot { position: relative; display: grid; place-items: center; width: 100%; aspect-ratio: 16 / 10; padding: 0; border: 0; overflow: hidden; background: var(--nobox-navy); color: var(--nobox-white); cursor: pointer; }
.shot img { width: 100%; height: 100%; object-fit: cover; transition: scale var(--t-slow) var(--ease-out), opacity var(--t-med) ease; }
@starting-style { .shot img { opacity: 0; } }
.shot:hover img { scale: 1.03; }
.shot.empty { aspect-ratio: auto; min-height: 96px; }
/* Asking the tablet: the last picture dims, a small label with a spinner sits on it. */
.shot.busy img { opacity: .45; }
.shot-busy { position: absolute; left: 14px; bottom: 14px; display: inline-flex; align-items: center; gap: 10px; padding: 8px 16px 8px 12px; border-radius: var(--r-pill); background: var(--nobox-white); color: var(--nobox-navy); font-size: 14px; font-weight: 700; animation: fade var(--t-med) ease; }
.shot-busy i { width: 16px; height: 16px; border-radius: 50%; border: 3px solid rgb(16 28 56 / .18); border-top-color: var(--nobox-navy); animation: spin .9s linear infinite; }
.shot.empty .shot-busy { position: static; }
.shot.fresh img { animation: shot-in 600ms var(--ease-out); }
@keyframes shot-in { from { opacity: 0; scale: 1.02; filter: blur(6px); } }
.error-text { color: var(--danger); }
.shot-empty { font-weight: 700; padding: 10px 18px; border: 2px solid currentColor; border-radius: var(--r-pill); }
.shot-caption { margin: 0; padding: 0 16px; font-size: 13px; }

.timeline { padding: 16px; background: var(--card); }
.timeline svg { display: block; width: 100%; height: 92px; overflow: visible; }
.tl-battery { fill: none; stroke: var(--text); stroke-width: 2; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.tl-low { stroke: var(--nobox-red); stroke-width: 1; stroke-dasharray: 4 4; vector-effect: non-scaling-stroke; opacity: .6; }
.tl-on { fill: var(--nobox-turquoise); }
.tl-off { fill: var(--nobox-navy-2); }
.tl-axis, .tl-legend { display: flex; justify-content: space-between; gap: 12px; margin-top: 6px; color: var(--text-2); font-size: 12px; }
.tl-legend { justify-content: flex-start; gap: 16px; }
.tl-legend span { display: inline-flex; align-items: center; gap: 6px; }
.tl-key { display: inline-block; width: 12px; height: 6px; background: var(--nobox-navy-2); }
.tl-key.on { background: var(--nobox-turquoise); }
.tl-key.battery { height: 2px; background: var(--text); }
/* Draw the battery line in, once, when the sheet opens. */
.timeline.intro .tl-battery { stroke-dasharray: 2000; animation: draw-line 1.2s var(--ease-out) both; }
@keyframes draw-line { from { stroke-dashoffset: 2000; } to { stroke-dashoffset: 0; } }


/* ---- Enrol by QR -------------------------------------------------------------- */
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.qr-enrol.shown { display: grid; grid-template-columns: minmax(0, 340px) minmax(0, 1fr); gap: 28px; align-items: start; }
.qr-enrol .qr { width: min(340px, 80vw); animation: qr-in 520ms var(--spring) both; }
@keyframes qr-in { from { opacity: 0; scale: .9; } }
.qr-steps { display: grid; gap: 12px; margin: 0; padding-left: 22px; font-size: 16px; line-height: 1.45; }
@media (max-width: 760px) { .qr-enrol.shown { grid-template-columns: 1fr; } }

/* ---- The tablet menu: pieces shared with the record ------------------------ */
.tp-pill { --pc: var(--text-3); display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px 6px 12px; border-radius: var(--r-pill); background: color-mix(in srgb, var(--pc) 20%, transparent); font-size: 15px; font-weight: 700; transition: background var(--t-med) ease; }
.tp-pill::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--pc); }
.tp-pill.st-ok { --pc: var(--nobox-turquoise); }
.tp-pill.st-busy { --pc: var(--nobox-yellow); }
.tp-pill.st-bad { --pc: var(--nobox-red); }
.tp-pill.st-off { --pc: var(--nobox-navy-2); }
.tp-pill.st-sleep { --pc: var(--nobox-blue); }
.tp-pill.st-warn { --pc: var(--nobox-yellow); }
.tp-title-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.tp-group-title { margin: 6px 0 0; font-size: 12px; font-weight: 400; text-transform: uppercase; color: var(--text-2); }
.tp-card { padding: 18px 20px; background: var(--card); }

/* ---- The tablet menu: a wide pop-up over the board ----------------------------
   Header tinted by the tablet's state; three columns (Agora | Ecrã e estado |
   Todas as ações), each scrolling on its own. Full screen and one column on a
   phone or a portrait tablet. */
.tm-scrim { position: fixed; inset: 0; z-index: 70; background: var(--scrim); opacity: 0; transition: opacity var(--t-med) ease; }
.tm-scrim.open { opacity: 1; }
.tm {
  --tone: var(--nobox-turquoise);
  position: fixed; z-index: 75; left: 50%; top: 50%;
  width: min(1200px, calc(100vw - 48px)); height: min(780px, calc(100dvh - 48px));
  display: flex; flex-direction: column; overflow: hidden; background: var(--bg); outline: none;
  opacity: 0; transform: translate(-50%, -46%) scale(.96);
  transition: opacity 240ms ease, transform 560ms var(--spring);
}
.tm.open { opacity: 1; transform: translate(-50%, -50%); }
.tm[data-tone="busy"], .tm[data-tone="warn"] { --tone: var(--nobox-yellow); }
.tm[data-tone="bad"] { --tone: var(--nobox-red); }
.tm[data-tone="off"] { --tone: var(--nobox-navy-2); }
.tm[data-tone="sleep"] { --tone: var(--nobox-blue); }
.tm[data-tone="control"] { --tone: var(--nobox-navy); }
:root[data-theme="dark"] .tm[data-tone="control"] { --tone: var(--nobox-white); }
.tm-box { flex: 1; min-height: 0; display: grid; grid-template-rows: auto minmax(0, 1fr); }

/* Header */
.tm-head {
  position: relative; display: flex; align-items: center; gap: 20px; padding: 26px 28px 20px;
  background: color-mix(in srgb, var(--tone) 11%, var(--bg)); box-shadow: inset 0 -1px 0 var(--hair);
  transition: background var(--t-slow) ease;
}
.tm-head::before { content: ""; position: absolute; inset: 0 0 auto; height: 6px; background: var(--tone); transform-origin: left; transition: background var(--t-slow) ease; animation: tm-stripe 700ms var(--ease-out) both; }
.tm-id { flex: 1; min-width: 0; display: grid; gap: 6px; }
.tm-name { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 16px; }
.tm-name h2 { font-family: var(--font-big); font-size: 50px; font-weight: 500; line-height: 1; letter-spacing: -.01em; }
.tm-line { margin: 0; color: var(--text-2); font-size: 17px; }
.tm-seen { color: var(--text-2); font-size: 14px; }
.tm-pager { display: flex; align-items: center; gap: 10px; color: var(--text-2); font-size: 14px; white-space: nowrap; }
.tm-head.alone .tm-pager { display: none; }
.round {
  display: inline-grid; place-items: center; flex: none; width: 46px; height: 46px; padding: 0;
  border: 2px solid var(--line); border-radius: 50%; background: transparent; color: var(--text);
  transition: background var(--t-fast) ease, transform var(--t-fast) var(--spring), opacity var(--t-fast) ease;
}
.round .ic svg { display: block; width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.round:hover { background: var(--soft-btn); }
.round:active { transform: scale(.9); }
.round:disabled { opacity: .25; pointer-events: none; }
.round:focus-visible { outline: 3px solid var(--nobox-blue); outline-offset: 2px; }

/* Columns; their blocks rise in one after the other; ‹ › slides them sideways. */
.tm-cols { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr) minmax(0, 1.05fr); min-height: 0; }
.tm-col { --d: 0ms; min-height: 0; overflow: auto; overscroll-behavior: contain; padding: 24px 28px 32px; display: grid; gap: 18px; align-content: start; }
.tm-col + .tm-col { box-shadow: inset 1px 0 0 var(--hair); }
.tm-col.c2 { --d: 70ms; } .tm-col.c3 { --d: 140ms; }
.tm-col > *, .tm-id { animation: tm-rise 560ms var(--ease-out) both; animation-delay: var(--d); }
.tm-col > :nth-child(2) { animation-delay: calc(var(--d) + 50ms); }
.tm-col > :nth-child(3) { animation-delay: calc(var(--d) + 100ms); }
.tm-col > :nth-child(4) { animation-delay: calc(var(--d) + 150ms); }
.tm-col > :nth-child(n+5) { animation-delay: calc(var(--d) + 200ms); }
.tm-box.from-right .tm-col > *, .tm-box.from-right .tm-id { animation-name: tm-from-right; animation-duration: 420ms; }
.tm-box.from-left .tm-col > *, .tm-box.from-left .tm-id { animation-name: tm-from-left; animation-duration: 420ms; }
@keyframes tm-rise { from { opacity: 0; transform: translateY(14px); } }
@keyframes tm-from-right { from { opacity: 0; transform: translateX(32px); } }
@keyframes tm-from-left { from { opacity: 0; transform: translateX(-32px); } }
@keyframes tm-stripe { from { transform: scaleX(0); } }
@keyframes tm-pop { from { opacity: 0; transform: scale(.96); } }
@keyframes tm-mark { 0% { transform: scale(0); } 70% { transform: scale(1.15); } 100% { transform: scale(1); } }
.tm-col-title { display: flex; align-items: center; gap: 10px; margin: 0; font-size: 12px; letter-spacing: .04em; text-transform: uppercase; color: var(--text-2); }
.tm-col-title::after { content: ""; flex: 1; height: 1px; background: var(--hair); }

/* Agora: the card takes the state colour (navy text on red and yellow, as the brand pairs them). */
.tm-now-slot { display: grid; }
.tm-now { display: grid; gap: 12px; padding: 24px 24px 22px; background: var(--card); animation: tm-pop 420ms var(--spring) both; }
.tm-now p { margin: 0; }
.tm-what { font-family: var(--font-big); font-size: 30px; font-weight: 500; line-height: 1.1; text-wrap: balance; }
.tm-why { color: var(--text-2); font-size: 16px; line-height: 1.4; }
.tm-why:empty { display: none; }
.tm-do { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 4px; }
.btn.big { min-height: 56px; padding: 0 30px; font-size: 17px; }
.tm-now.bad { background: var(--nobox-red); color: var(--nobox-navy); }
.tm-now.warn, .tm-now.busy { background: var(--nobox-yellow); color: var(--nobox-navy); }
.tm-now.off { background: color-mix(in srgb, var(--nobox-navy-2) 22%, var(--card)); }
.tm-now.sleep { background: color-mix(in srgb, var(--nobox-blue) 18%, var(--card)); }
.tm-now.bad .tm-why, .tm-now.warn .tm-why, .tm-now.busy .tm-why { color: var(--nobox-navy); opacity: .82; }
.tm-now.bad .btn.primary, .tm-now.warn .btn.primary, .tm-now.busy .btn.primary { background: var(--nobox-navy); border-color: var(--nobox-navy); color: var(--nobox-white); }
.tm-now.bad .btn:not(.primary), .tm-now.warn .btn:not(.primary) { border-color: var(--nobox-navy); color: var(--nobox-navy); background: transparent; }
.tm-more { display: grid; margin-top: 6px; padding-top: 10px; border-top: 1px solid color-mix(in srgb, currentColor 22%, transparent); }
.tm-more-title { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; opacity: .75; }
.tm-more .row { min-height: 0; padding: 8px 0; font-size: 15px; color: inherit; }
.tm-more .row .txt small { color: inherit; opacity: .78; }
.tm-ok { display: flex; align-items: center; gap: 16px; padding: 22px 24px; background: color-mix(in srgb, var(--nobox-turquoise) 15%, var(--card)); animation: tm-pop 420ms var(--spring) both; }
.tm-ok p { margin: 0; }
.tm-ok-what { font-family: var(--font-big); font-size: 24px; font-weight: 500; line-height: 1.15; }
.tm-ok-why { margin-top: 4px !important; color: var(--text-2); font-size: 15px; }
.tm-ok-mark { position: relative; flex: none; width: 34px; height: 34px; border-radius: 50%; background: var(--nobox-turquoise); animation: tm-mark 520ms var(--spring) 200ms both; }
.tm-ok-mark::after { content: ""; position: absolute; inset: 9px; background: var(--nobox-navy); -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2 6.4l2.6 2.6L10 3.4' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2 6.4l2.6 2.6L10 3.4' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat; }
.tm-ok.control { background: var(--card); }
.tm-ok.control .tm-ok-mark { background: var(--tone); }
.tm-ok.control .tm-ok-mark::after { background: var(--bg); }

/* Four quick actions, always in the same place. */
.tm-quick { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.tm-q {
  position: relative; display: grid; justify-items: center; align-content: center; gap: 8px; min-height: 88px; padding: 10px 6px;
  border: 0; background: var(--card); color: var(--text); font-size: 15px; font-weight: 700;
  transition: background var(--t-fast) ease, color var(--t-fast) ease, transform var(--t-fast) var(--spring);
  touch-action: manipulation;
}
.tm-q .ic svg { display: block; width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; transition: transform var(--t-med) var(--spring); }
.tm-q:hover { background: var(--tile-hover); }
.tm-q:hover .ic svg { transform: translateY(-2px) scale(1.06); }
.tm-q:active { transform: scale(.95); }
.tm-q:focus-visible { outline: 3px solid var(--nobox-blue); outline-offset: 2px; }
.tm-q kbd { position: absolute; top: 8px; right: 10px; font: 400 11px var(--font-sans); color: var(--text-3); }
.tm-q.on { background: var(--accent); color: var(--accent-text); }
.tm-q.on kbd { color: inherit; opacity: .7; }
[data-mode="tablet"] .tm-q kbd { display: none; }
[data-mode="tablet"] .tm-q { min-height: 96px; }

/* Ecrã e estado */
.tm-screen { display: grid; gap: 8px; }
.tm-screen .shot { padding: 10px; transition: transform var(--t-fast) var(--spring); }
.tm-screen .shot:active { transform: scale(.985); }
.tm-screen .shot-caption { padding: 0; }
:root[data-theme="dark"] .tm-screen .shot { background: var(--tile); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tm-screen .shot { background: var(--tile); } }
.tm-facts { background: var(--card); }
.tm-fact { display: flex; align-items: center; justify-content: space-between; gap: 14px; min-height: 48px; padding: 10px 16px; font-size: 15px; box-shadow: inset 0 -1px 0 var(--hair); }
.tm-fact:last-child { box-shadow: none; }
.tm-fk { color: var(--text-2); flex: none; }
.tm-fv { display: inline-flex; align-items: center; justify-content: flex-end; gap: 10px; min-width: 0; text-align: right; overflow-wrap: anywhere; transition: color var(--t-med) ease; }
.tm-fact.out .tm-fv { color: var(--danger); font-weight: 600; }
.tm-fsub { color: var(--text-2); font-size: 13px; }
.tm-ver { color: var(--text-2); white-space: pre; }
.tm-ver-new { white-space: pre; }
.mini-bar { display: inline-block; width: 52px; height: 7px; background: var(--tile); }
.mini-bar i { display: block; height: 100%; background: var(--nobox-turquoise); transition: width .9s var(--ease-out); }
.mini-bar.low i { background: var(--nobox-red); }
.mini-bar.charging i { background: var(--nobox-blue); }
.tm-facts.flat { background: transparent; }
.tm-facts.flat .tm-fact { min-height: 42px; font-size: 14px; }

/* Folds: our own, animated. */
.tm-fold { background: var(--card); }
.tm-fold-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; min-height: 54px; padding: 0 16px;
  border: 0; background: transparent; color: var(--text); font-size: 16px; font-weight: 700; text-align: left;
  transition: background var(--t-fast) ease;
}
.tm-fold-head:hover { background: var(--tile); }
.tm-fold-head:focus-visible { outline: 3px solid var(--nobox-blue); outline-offset: -3px; }
.tm-fold-head .ic svg { display: block; width: 18px; height: 18px; fill: none; stroke: var(--text-2); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; transition: transform var(--t-med) var(--spring); }
.tm-fold-head[aria-expanded="true"] .ic svg { transform: rotate(90deg); }
.tm-fold-body { display: grid; grid-template-rows: 0fr; transition: grid-template-rows var(--t-slow) var(--ease-out); }
.tm-fold-body.open { grid-template-rows: 1fr; }
.tm-fold-in { min-height: 0; overflow: hidden; opacity: 0; transition: opacity var(--t-med) ease; }
.tm-fold-body.open .tm-fold-in { opacity: 1; }
.tm-record { display: grid; gap: 10px; padding: 0 16px 18px; }
.tm-record .tp-card { padding: 14px 16px; background: var(--tile); }
.tm-record .tp-title-row .tp-group-title { margin: 0; }

/* History and activity */
.tm-history { display: grid; gap: 10px; }
.tm-activity { display: grid; gap: 10px; }
.tm-log { position: relative; background: var(--card); padding: 6px 0; }
.tm-log .log-row { position: relative; display: grid; grid-template-columns: 44px 12px minmax(0, 1fr) auto auto; align-items: center; gap: 10px; min-height: 44px; padding: 6px 16px; font-size: 14px; }
.tm-log .log-row time { color: var(--text-3); }
.tm-log-mark { position: relative; z-index: 1; width: 10px; height: 10px; border-radius: 50%; background: var(--nobox-blue); box-shadow: 0 0 0 4px var(--card); }
.tm-log .log-row::before { content: ""; position: absolute; left: 75px; top: 0; bottom: 0; width: 2px; background: var(--hair); }
.tm-log .log-row:first-child::before { top: 50%; }
.tm-log .log-row:last-child::before { bottom: 50%; }
.tm-log .log-row:only-child::before { display: none; }
.tm-log .log-row[data-state="done"] .tm-log-mark { background: var(--nobox-turquoise); }
.tm-log .log-row[data-state="failed"] .tm-log-mark, .tm-log .log-row[data-state="rejected"] .tm-log-mark { background: var(--nobox-red); }
.tm-log .log-row[data-state="deferred"] .tm-log-mark, .tm-log .log-row[data-state="expired"] .tm-log-mark { background: var(--nobox-yellow); }
.tm-log .log-row[data-state="pending"] .tm-log-mark { animation: pulse-dot 1.2s ease-in-out infinite; }
@keyframes pulse-dot { 50% { transform: scale(1.35); } }
.tm-log-what { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tm-log .chip { font-size: 12px; }

/* Todas as ações */
.tm-all-head { display: grid; gap: 12px; }
.tm-all-head h3 { margin: 0; font-size: 20px; font-weight: var(--w-bold); }
.tm-find-wrap { position: relative; display: block; }
.tm-find-wrap .ic { position: absolute; left: 14px; top: 50%; translate: 0 -50%; pointer-events: none; }
.tm-find-wrap .ic svg { display: block; width: 18px; height: 18px; fill: none; stroke: var(--text-3); stroke-width: 2.2; stroke-linecap: round; }
input.tm-find { width: 100%; min-height: 48px; padding-left: 44px; -webkit-appearance: none; appearance: none; }
input.tm-find::-webkit-search-cancel-button { -webkit-appearance: none; display: none; }
.tm-actions { display: grid; gap: 6px; }
.tm-actions.refresh > * { animation: fade-up 260ms var(--ease-out) both; }
.tm-grp { display: flex; justify-content: space-between; margin: 10px 2px 0; font-size: 12px; letter-spacing: .04em; text-transform: uppercase; color: var(--text-2); }
.tm-grp:first-child { margin-top: 2px; }
.tm-grp i { font-style: normal; color: var(--text-3); }
.tm-grp.risky span { color: var(--danger); }
.tm-acts { background: var(--card); }
.tm-a {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 52px; padding: 0 14px 0 16px;
  border: 0; background: transparent; color: var(--text); font-size: 16px; text-align: left;
  box-shadow: inset 0 -1px 0 var(--hair);
  transition: background var(--t-fast) ease, transform var(--t-fast) var(--spring);
  touch-action: manipulation;
}
.tm-a:last-child { box-shadow: none; }
.tm-a-label { flex: 1; min-width: 0; }
.tm-a-hint { white-space: nowrap; }
.tm-a-hint { color: var(--text-3); font-size: 13px; text-align: right; }
.tm-a .ic svg { display: block; width: 16px; height: 16px; fill: none; stroke: var(--text-3); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; transition: transform var(--t-fast) var(--spring); }
.tm-a:hover { background: var(--tile); }
.tm-a:hover .ic svg { transform: translateX(3px); }
.tm-a:active { transform: scale(.985); }
.tm-a:focus-visible { outline: 3px solid var(--nobox-blue); outline-offset: -3px; }
.tm-a.risky { color: var(--danger); }
[data-mode="tablet"] .tm-a { min-height: 58px; }
.tm-none { margin: 8px 2px; color: var(--text-2); }

/* Phone and portrait tablet: full screen, one column, by what matters first. */
@media (max-width: 900px), (orientation: portrait) and (max-width: 1100px) {
  .tm { left: 0; top: 0; width: 100%; height: 100%; transform: translateY(32px); }
  .tm.open { transform: none; }
  .tm-box { display: block; overflow: auto; overscroll-behavior: contain; }
  .tm-head { position: sticky; top: 0; z-index: 2; flex-wrap: wrap; gap: 12px 16px; padding: 22px 16px 14px; background: color-mix(in srgb, var(--tone) 11%, var(--bg)); }
  .tm-head > .round { position: absolute; top: 18px; right: 16px; }
  .tm-id { flex-basis: 100%; padding-right: 56px; }
  .tm-name h2 { font-size: 40px; }
  .tm-cols { display: flex; flex-direction: column; gap: 16px; padding: 16px 16px calc(32px + env(safe-area-inset-bottom)); }
  .tm-col { display: contents; }
  .tm-col > .tm-col-title { display: none; }
  .tm-now-slot { order: 1; } .tm-quick { order: 2; } .tm-facts { order: 3; } .tm-col.c3 > * { order: 4; }
  .tm-screen { order: 5; } .tm-history { order: 6; } .tm-activity { order: 7; } .tm-fold { order: 8; }
}

/* 4. What is it? */
.tp-dl { display: grid; grid-template-columns: minmax(120px, max-content) minmax(0, 1fr); gap: 10px 20px; margin: 0; }
.tp-dl dt { font-size: 14px; color: var(--text-2); }
.tp-dl dd { margin: 0; overflow-wrap: anywhere; }
.tp-form { display: grid; gap: 14px; }
.record-history li { display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--hair); }
.record-history li:first-child { padding-top: 0; }
.record-history li:last-child { padding-bottom: 0; border-bottom: 0; }
.record-history small { display: block; color: var(--text-2); font-size: 13px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }


/* ---- The board at a glance: four questions, four cards ---------------------- */
.glance { display: grid; gap: 14px; }
.glance-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.glance-card {
  --gc: var(--text-3);
  position: relative; display: grid; gap: 6px; align-content: start; min-height: 168px; padding: 18px 20px 16px;
  background: var(--card); cursor: pointer; text-align: left;
  transition: background var(--t-fast) ease, transform var(--t-fast) var(--spring), box-shadow var(--t-fast) ease;
}
.glance-card:hover { background: var(--tile-hover); }
.glance-card:active { transform: scale(.98); }
.glance-card:focus-visible { outline: 3px solid var(--nobox-blue); outline-offset: 2px; }
.glance-card.ok { --gc: var(--nobox-turquoise); }
.glance-card.bad { --gc: var(--nobox-red); }
.glance-card[aria-pressed="true"] { box-shadow: inset 0 0 0 3px var(--text); }
.glance-label { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 12px; text-transform: uppercase; color: var(--text-2); }
.glance-mark { width: 10px; height: 10px; border-radius: 50%; background: var(--gc); transition: background var(--t-med) ease; }
.glance-title { margin: 0; font-family: var(--font-big); font-size: 26px; font-weight: 500; line-height: 1.12; overflow-wrap: anywhere; }
.glance-card.bad .glance-title { color: var(--danger); }
.glance-detail { margin: 0; font-size: 13px; color: var(--text-2); }
.glance-act:empty { display: none; }
.glance-act { margin-top: 4px; }
/* The picture of the answer: a split bar, or one bar per tablet for the battery. */
.glance-split { display: flex; gap: 2px; height: 8px; margin: 4px 0 2px; }
.glance-split i { flex: 0 1 0; min-width: 4px; background: var(--nobox-turquoise); transition: flex-grow var(--t-slow) var(--ease-in-out); }
.glance-split i.off { background: var(--nobox-red); }
.glance-split i.home { background: var(--nobox-navy-2); }
.glance-bars { display: flex; align-items: flex-end; gap: 3px; height: 34px; margin: 4px 0 2px; }
.glance-bars i { flex: 1; max-width: 14px; min-height: 3px; background: var(--nobox-turquoise); transition: height var(--t-slow) var(--ease-out); }
.glance-bars i.low { background: var(--nobox-red); }
.glance-bars i.charging { background: var(--nobox-blue); }
.tile.dimmed, .fleet-list tr.dimmed { opacity: .28; }

/* ---- List view: every tablet, one row; what's out of line is marked ---------- */
.view-switch button { min-height: 36px; padding: 0 14px; font-size: 14px; }
.fleet-list td { white-space: nowrap; }
.fleet-list .label-cell { position: relative; }
.fleet-list .label-cell .cmd-badge { position: static; display: inline-grid; width: 18px; height: 18px; margin-left: 8px; vertical-align: middle; }
.fleet-list td .dot { margin-right: 8px; vertical-align: middle; }
.fleet-list td.out { color: var(--danger); font-weight: 700; }
.mini-batt { display: inline-block; width: 34px; height: 8px; margin-right: 8px; vertical-align: middle; background: var(--tile); }
.mini-batt i { display: block; height: 100%; background: var(--nobox-turquoise); }
.mini-batt.low i { background: var(--nobox-red); }
.fleet-list tr.selected td { background: color-mix(in srgb, var(--accent) 10%, var(--card)); }

/* ===========================================================================
   Reduced motion: no movement
   =========================================================================== */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; }
}

/* ---- Brightness, sound and Wi-Fi dialog ---------------------------------- */
.title-actions { display: flex; gap: 8px; }
.settings .level-row { display: grid; grid-template-columns: 9rem 1fr 3.5rem; align-items: center; gap: 12px; }
.settings .level-row .num { text-align: right; }
.settings .wifi-box { display: grid; gap: 12px; padding-top: 12px; border-top: 1px solid var(--hair); }
.settings .wifi-box > .link-btn { justify-self: start; }
@media (max-width: 520px) { .settings .level-row { grid-template-columns: 1fr 3.5rem; } .settings .level-row .check { grid-column: 1 / -1; } }

/* ===========================================================================
   Our own slider, number stepper, date picker, tooltip and field errors.
   (The native inputs stay hidden as the source of truth; see controls.js.)
   =========================================================================== */

/* Slider: a flat bar with a round thumb; the filled part is the accent. */
.slider {
  --p: 0; position: relative; height: var(--tap); min-width: 120px; cursor: pointer;
  touch-action: none; user-select: none; -webkit-user-select: none; outline: none;
}
.slider::before, .slider-fill { content: ""; position: absolute; left: 0; top: 50%; height: 8px; margin-top: -4px; }
.slider::before { right: 0; background: var(--soft-btn-press, var(--soft-btn)); }
.slider-fill { width: calc(var(--p) * 100%); background: var(--accent); }
.slider-thumb {
  position: absolute; top: 50%; left: calc(var(--p) * (100% - 28px)); width: 28px; height: 28px; margin-top: -14px;
  border: 3px solid var(--accent); border-radius: var(--r-pill); background: var(--card);
  transition: transform var(--t-fast) var(--spring);
}
[data-mode="tablet"] .slider-thumb { width: 34px; height: 34px; margin-top: -17px; left: calc(var(--p) * (100% - 34px)); }
.slider:not(.dragging) .slider-fill, .slider:not(.dragging) .slider-thumb { transition: width var(--t-fast) ease, left var(--t-fast) ease, transform var(--t-fast) var(--spring); }
.slider:hover .slider-thumb, .slider.dragging .slider-thumb { transform: scale(1.12); }
.slider:focus-visible .slider-thumb { outline: 3px solid var(--nobox-blue); outline-offset: 2px; }
.slider.disabled { opacity: .4; cursor: default; }
.slider.disabled .slider-thumb { transform: none; }

/* Number stepper: − and + inside the right end of the field. */
:has(> .stepper) { position: relative; }
input.has-stepper { padding-right: 100px; font-variant-numeric: tabular-nums; }
.stepper { position: absolute; right: 0; display: flex; align-items: center; gap: 4px; padding-right: 6px; }
.stepper-btn {
  display: grid; place-items: center; width: 40px; height: 34px; padding: 0;
  border: 0; border-radius: var(--r-pill); background: var(--soft-btn); color: var(--text);
  transition: background var(--t-fast) ease, transform var(--t-fast) var(--spring);
}
[data-mode="tablet"] .stepper-btn { width: 44px; height: 40px; }
.stepper-btn svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; }
.stepper-btn:hover { background: var(--soft-btn-press, var(--soft-btn)); }
.stepper-btn:active { transform: scale(.9); }
.stepper-btn:disabled { opacity: .35; }

/* Date field: looks like our dropdown, with a calendar mark instead of the chevron. */
.date-btn { width: 100%; }
.date-btn::after {
  width: 16px; height: 16px; margin-top: -8px;
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath d='M2 4h12v10H2zM2 7h12M5 2v3M11 2v3' fill='none' stroke='black' stroke-width='1.8'/%3E%3C/svg%3E");
          mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath d='M2 4h12v10H2zM2 7h12M5 2v3M11 2v3' fill='none' stroke='black' stroke-width='1.8'/%3E%3C/svg%3E");
}
.date-btn[aria-expanded="true"]::after { transform: none; }

.datepick {
  position: fixed; z-index: 100; width: 320px; padding: 14px;
  background: var(--card); color: var(--text); border: 2px solid var(--line);
  opacity: 0; transform: scale(.96);
  transition: opacity var(--t-fast) ease, transform var(--t-med) var(--spring);
}
.datepick.open { opacity: 1; transform: none; }
[data-mode="tablet"] .datepick { width: 364px; }
.datepick-head { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 8px; margin-bottom: 8px; }
.datepick-head .icon-btn:hover { rotate: none; }
.datepick-title { margin: 0; text-align: center; font-weight: var(--w-bold); }
.datepick-title::first-letter { text-transform: uppercase; }
.datepick-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.datepick-dow { display: grid; place-items: center; height: 28px; font-size: 12px; color: var(--text-2); }
.datepick-day {
  aspect-ratio: 1; min-height: 38px; padding: 0; border: 0; border-radius: var(--r-pill);
  background: transparent; color: var(--text); font-size: 15px; font-variant-numeric: tabular-nums;
  transition: background var(--t-fast) ease, transform var(--t-fast) var(--spring);
}
.datepick-day:hover { background: var(--soft-btn); }
.datepick-day:active { transform: scale(.9); }
.datepick-day.today { border: 2px solid var(--line); }
.datepick-day.chosen { background: var(--accent); color: var(--accent-text); font-weight: var(--w-bold); border: 0; }
.datepick-day:disabled { opacity: .3; }
.datepick-day:focus-visible { outline: 3px solid var(--nobox-blue); outline-offset: 1px; }
.datepick-foot { display: flex; justify-content: space-between; gap: 8px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--hair); }

/* Tooltip: a small navy block (paper on navy in dark mode). */
.tip {
  position: fixed; z-index: 120; max-width: 260px; padding: 6px 10px; pointer-events: none;
  background: var(--nobox-navy); color: var(--nobox-white); font-size: 13px; line-height: 1.35;
  opacity: 0; transform: translateY(3px); transition: opacity var(--t-fast) ease, transform var(--t-fast) ease;
}
.tip.open { opacity: 1; transform: none; }
:root[data-theme="dark"] .tip { background: var(--nobox-white); color: var(--nobox-navy); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tip { background: var(--nobox-white); color: var(--nobox-navy); } }

/* Field errors: our message, under the field, instead of the browser bubble. */
.field-error, .field .field-error { display: block; color: var(--danger); font-size: 14px; font-weight: 600; }
input[aria-invalid="true"], textarea[aria-invalid="true"], .select-btn[aria-invalid="true"] { border-color: var(--danger-fill); }

/* ---- Quick switch: the console and the games' facilitator panels -----------------
   A navy strip above everything; the paper thumb slides to the chosen pill. Panels
   live in the stage below it and stay loaded while hidden. */
:root { --sw-h: 52px; }
[data-mode="tablet"] { --sw-h: 60px; }
.switcher {
  position: sticky; top: 0; z-index: 41; display: flex; align-items: center; gap: 10px;
  min-height: calc(var(--sw-h) + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) max(var(--gutter), env(safe-area-inset-right)) 0 max(calc(var(--gutter) - 6px), env(safe-area-inset-left));
  background: var(--nobox-navy); color: var(--nobox-white);
  animation: sw-in 520ms var(--ease-out) both;
}
:root[data-theme="dark"] .switcher { box-shadow: inset 0 -1px 0 var(--hair); }
@keyframes sw-in { from { transform: translateY(-100%); } }
.has-switcher .topbar { top: calc(var(--sw-h) + env(safe-area-inset-top)); padding-top: 0; }
.sw-scroll { position: relative; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.sw-scroll::-webkit-scrollbar { display: none; }
.sw-track { position: relative; z-index: 1; display: flex; gap: 4px; width: max-content; }
.sw-thumb {
  position: absolute; left: 0; top: 50%; height: 40px; margin-top: -20px; border-radius: var(--r-pill);
  background: var(--nobox-gray); pointer-events: none;
  transition: transform 460ms var(--spring), width 460ms var(--spring);
}
[data-mode="tablet"] .sw-thumb { height: 46px; margin-top: -23px; }
.sw-pill {
  position: relative; display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 16px;
  border: 0; border-radius: var(--r-pill); background: transparent; color: var(--nobox-white);
  font-size: 15px; font-weight: 700; white-space: nowrap;
  transition: color 300ms ease, background var(--t-fast) ease, transform var(--t-fast) var(--spring);
  touch-action: manipulation;
}
[data-mode="tablet"] .sw-pill { height: 46px; padding: 0 20px; font-size: 16px; }
.sw-pill:not(.on):hover { background: rgb(255 255 255 / .08); }
.sw-pill:active { transform: scale(.96); }
.sw-pill:focus-visible { outline: 3px solid var(--nobox-turquoise); outline-offset: 2px; }
.sw-pill.on { color: var(--nobox-navy); }
.sw-sub { font-weight: 400; font-size: 13px; opacity: .72; }
.sw-pill .ic svg { display: block; width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linejoin: round; }
.sw-pill .count-badge { margin-left: 0; animation: badge-pop 420ms var(--spring); }
.sw-tools { display: flex; gap: 8px; }
.sw-tools:empty { display: none; }
.sw-tool {
  display: inline-grid; place-items: center; width: 40px; height: 40px; border: 2px solid rgb(255 255 255 / .35); border-radius: 50%;
  background: transparent; color: var(--nobox-white); animation: fade var(--t-med) ease;
  transition: background var(--t-fast) ease, transform var(--t-fast) var(--spring);
}
.sw-tool:hover { background: rgb(255 255 255 / .1); }
.sw-tool:active { transform: scale(.9); }
.sw-tool .ic svg { display: block; width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

[data-surface="panel"] .topbar, [data-surface="panel"] #main { display: none; }
.stage { position: fixed; left: 0; right: 0; bottom: 0; top: calc(var(--sw-h) + env(safe-area-inset-top)); z-index: 30; background: var(--bg); }
.stage-wait { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 12px; margin: 0; color: var(--text-2); font-weight: 700; }
.stage-wait i { width: 18px; height: 18px; border-radius: 50%; border: 3px solid var(--hair); border-top-color: var(--text); animation: spin .9s linear infinite; }
.panel-frame {
  position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: var(--nobox-white);
  visibility: hidden; opacity: 0; transform: scale(.985);
  transition: opacity 300ms ease, transform 420ms var(--spring), visibility 0s linear 300ms;
}
.panel-frame.on.loaded { visibility: visible; opacity: 1; transform: none; transition: opacity 300ms ease, transform 420ms var(--spring), visibility 0s; }

/* The venue's clock, when an event abroad runs (every console time is in that zone). */
.venue-clock { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: var(--r-pill); background: var(--soft-btn); font-size: 14px; font-weight: 700; white-space: nowrap; animation: fade var(--t-med) ease; }
.venue-clock::before { content: ""; width: 14px; height: 14px; background: currentColor; -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 7v5l3 2'/%3E%3C/svg%3E") center / contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 7v5l3 2'/%3E%3C/svg%3E") center / contain no-repeat; }
