/* Little Screens: "glass on paper". Paper-white pages, iPads drawn as dark glass, Little Bits
   periwinkle for what's chosen. Shared by every page, signed in or not. The CSP allows only
   same-origin styles, so there are no inline styles anywhere: sizes and positions that come from
   data are set through element.style properties in the scripts. */

@font-face {
  font-family: 'Plus Jakarta Sans';
  font-style: normal;
  font-display: swap;
  font-weight: 200 800;
  src: url('/assets/fonts/plus-jakarta-sans-latin-wght-normal.woff2') format('woff2-variations');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122,
    U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Plus Jakarta Sans';
  font-style: normal;
  font-display: swap;
  font-weight: 200 800;
  src: url('/assets/fonts/plus-jakarta-sans-latin-ext-wght-normal.woff2') format('woff2-variations');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF,
    U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --paper: #f5f6f8;
  --rail-bg: #fbfbfc;
  --surface: #ffffff;
  --surface-2: #f8f9fb;
  --ink: #1f2733;
  --ink-2: #3b4556;
  --muted: #566173;
  --line: #e2e5eb;
  --line-strong: #d5dae3;
  --line-soft: #eef0f4;
  --hover: #eceef3;
  --hover-2: #f0f2f6;
  --accent: #4f6ef7;
  --accent-soft: #eef1fe;
  --accent-soft-2: #e6eafe;
  --accent-ink: #24379a;
  --link: #3e56c1;
  --link-hover: #2b3f99;
  --primary: #3e56c1;
  --primary-hover: #2f45a6;
  --on-primary: #ffffff;
  --glass: #1a2030;
  --glass-edge: #313a4e;
  --screen: #0e121b;
  --region-main: #2a3349;
  --region-strap: #5b6fb5;
  --region-label: #dde3ee;
  --region-sub: #aeb8cc;
  --region-empty: #8d98ae;
  --holding: #d9a441;
  --holding-ink: #2a1d00;
  --holding-sub: #4a3608;
  --blackout: #000000;
  --offline: #b42318;
  --warning: #8a4b00;
  --warning-dot: #c77a0a;
  --online: #1e7f55;
  --bad-bg: #fbe9e7;
  --warn-bg: #fff6e6;
  --warn-line: #f0d9a8;
  --ok-bg: #e6f4ed;
  --pending-bg: #fffaf0;
  --bar-bg: #1f2733;
  --bar-ink: #ffffff;
  --bar-muted: #c8cfdc;
  --bar-link: #c9d3ff;
  --radius: 12px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #111419;
    --rail-bg: #15181e;
    --surface: #1b1f27;
    --surface-2: #181c23;
    --ink: #e6e9ef;
    --ink-2: #c2c8d3;
    --muted: #98a2b3;
    --line: #2a303b;
    --line-strong: #394150;
    --line-soft: #232831;
    --hover: #242a34;
    --hover-2: #242a34;
    --accent: #7d93ff;
    --accent-soft: #222b4d;
    --accent-soft-2: #222b4d;
    --accent-ink: #c9d3ff;
    --link: #9cb0ff;
    --link-hover: #c2ceff;
    --primary: #4f6ef7;
    --primary-hover: #6580fa;
    --glass: #0a0d13;
    --glass-edge: #343c4f;
    --screen: #05070b;
    --offline: #f28b82;
    --warning: #f2b661;
    --warning-dot: #f2b661;
    --online: #63c995;
    --bad-bg: #3a1b19;
    --warn-bg: #352a14;
    --warn-line: #5a4520;
    --ok-bg: #16301f;
    --pending-bg: #2b2414;
    --bar-bg: #2a3140;
    --bar-ink: #e6e9ef;
    --bar-muted: #b8c0cd;
    --bar-link: #c9d3ff;
    color-scheme: dark;
  }
}

/* ---------- Base ---------- */

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
p,
ul,
ol,
dl,
dd,
figure {
  margin: 0;
}

ul,
ol {
  padding: 0;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

a {
  color: var(--link);
}

a:hover {
  color: var(--link-hover);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.hidden {
  display: none !important;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.num {
  font-variant-numeric: tabular-nums;
}

.muted,
.help-text,
.screens-muted {
  color: var(--muted);
}

.help-text {
  font-size: 14px;
}

.help-text:empty {
  display: none;
}

.strong {
  font-weight: 600;
}

.status-online {
  color: var(--online);
  font-weight: 600;
}

.status-offline {
  color: var(--offline);
  font-weight: 600;
}

.status-warning,
.status-pending {
  color: var(--warning);
  font-weight: 600;
}

/* ---------- The frame: the rail beside the page ---------- */

.frame {
  display: flex;
  flex-wrap: wrap;
  min-height: 100vh;
}

.rail {
  flex: 1 1 220px;
  max-width: 248px;
  padding: 28px 16px;
  border-right: 1px solid var(--line);
  background: var(--rail-bg);
  display: flex;
  flex-direction: column;
  gap: 24px;
  /* Beside a long page, the rail stays put so its foot (Live, Sign out) is always in view. */
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.rail-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -0.01em;
}

.rail-brand:hover {
  color: var(--ink);
}

.rail-org {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 0 4px;
}

.rail-org .field {
  width: 100%;
  min-height: 36px;
  font-size: 14px;
  font-weight: 600;
}

.rail-sections {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.rail-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.rail-head {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  padding: 0 12px 4px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 12px;
  border-radius: 8px;
  color: var(--ink-2);
  text-decoration: none;
  font-weight: 500;
  font-size: 14px;
}

.nav-link:hover {
  background: var(--hover);
  color: var(--ink);
}

.nav-link.current {
  background: var(--accent-soft-2);
  color: var(--accent-ink);
  font-weight: 600;
}

.nav-count {
  margin-left: auto;
  min-width: 22px;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--warn-bg);
  color: var(--warning);
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}

.rail-foot {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  padding: 0 12px;
  font-size: 14px;
}

.rail-foot a {
  font-weight: 500;
}

.rail-foot a.current {
  color: var(--accent-ink);
  font-weight: 700;
}

.live {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--online);
}

.live::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}

.live.off {
  color: var(--warning);
}

.page {
  flex: 999 1 560px;
  min-width: 0;
  padding: 40px 48px 80px;
}

.page-inner {
  max-width: 1120px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.page-inner.wide {
  max-width: 1320px;
}

.page-inner.narrow {
  max-width: 760px;
}

.page-head {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.page-head-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}

.page-head h1,
.page h1 {
  font-size: 30px;
  line-height: 1.15;
  font-weight: 700;
  letter-spacing: -0.015em;
}

.intro {
  color: var(--muted);
  max-width: 66ch;
}

.back-link {
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}

.summary-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
}

.summary-line {
  font-weight: 500;
}

.summary-line a {
  color: var(--offline);
  font-weight: 600;
}

/* ---------- Controls ---------- */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 8px;
  border: 1px solid var(--primary);
  background: var(--primary);
  color: var(--on-primary);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}

.button:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
  color: var(--on-primary);
}

.button.secondary {
  border-color: var(--line-strong);
  background: var(--surface);
  color: var(--ink);
}

.button.secondary:hover {
  background: var(--hover-2);
  color: var(--ink);
}

.button.quiet {
  border-color: transparent;
  background: transparent;
  color: var(--link);
  padding: 0 10px;
}

.button.quiet:hover {
  background: var(--hover);
  color: var(--link-hover);
}

.button.danger {
  color: var(--offline);
}

.button.small {
  min-height: 32px;
  padding: 0 10px;
  font-size: 13px;
}

.button:disabled,
.button[aria-disabled='true'] {
  opacity: 0.5;
  cursor: not-allowed;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.button-row.tight {
  gap: 2px;
}

.link-button {
  padding: 0;
  border: 0;
  background: none;
  color: var(--link);
  font-size: inherit;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
}

.link-button:hover {
  color: var(--link-hover);
  text-decoration: underline;
}

.field {
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  min-width: 0;
}

textarea.field {
  padding: 10px 12px;
  min-height: 96px;
  resize: vertical;
  line-height: 1.4;
}

.field:focus {
  outline: 2px solid var(--accent);
  outline-offset: 0;
  border-color: var(--accent);
}

.field.small-field {
  min-height: 36px;
}

.field.number {
  width: 88px;
  text-align: right;
}

input[type='checkbox'],
input[type='radio'] {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--primary);
}

.label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}

/* A segmented control: Cue / Holding screen / Blackout, and the like. */
.seg {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
}

.seg button,
.seg a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 14px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--ink-2);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  text-decoration: none;
}

.seg.compact button {
  min-height: 34px;
  padding: 0 11px;
  font-size: 13px;
}

.seg button:hover,
.seg a:hover {
  background: var(--hover-2);
  color: var(--ink);
}

.seg button[aria-pressed='true'],
.seg a[aria-current='page'] {
  background: var(--ink);
  color: var(--paper);
}

.seg button[data-cover='holding'][aria-pressed='true'] {
  background: var(--holding);
  color: var(--holding-ink);
}

.seg button[data-cover='blackout'][aria-pressed='true'] {
  background: var(--blackout);
  color: #ffffff;
}

.seg .count {
  opacity: 0.7;
  font-weight: 500;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  background: var(--line-soft);
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-2);
}

.tag.group-setting {
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-size: 12px;
  font-weight: 600;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.message {
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 14px;
  background: var(--ok-bg);
  color: var(--online);
}

.message.error {
  background: var(--bad-bg);
  color: var(--offline);
}

.message.warning {
  background: var(--warn-bg);
  color: var(--warning);
}

.status-line {
  font-size: 14px;
  color: var(--muted);
}

.status-line.error {
  color: var(--offline);
  font-weight: 600;
}

/* An inline "Delete this?" in place of the button that asked. */
.confirm {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
  font-size: 14px;
}

/* ---------- Panels and tables ---------- */

.panel,
.screens-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.panel h2,
.screens-panel h2 {
  font-size: 17px;
  font-weight: 700;
}

.screens-panel-head,
.panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.screens-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.screens-grow {
  flex: 1 1 220px;
}

.screens-table-wrap {
  overflow-x: auto;
}

/* Boxes that scroll sideways hold anything positioned inside them (a visually hidden label),
   so it can't widen the page. */
.screens-table-wrap,
.device-table,
.marks,
.board {
  position: relative;
}

.screens-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.screens-table th {
  text-align: left;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
}

.screens-table td {
  padding: 10px;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: middle;
}

.screens-table tr:last-child td {
  border-bottom: 0;
}

.screens-row-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.empty {
  color: var(--muted);
  padding: 8px 0;
}

/* A list in a bordered box, one item per row. */
.list-box {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}

.list-box > * + * {
  border-top: 1px solid var(--line-soft);
}

details.more {
  border-top: 1px solid var(--line-soft);
  padding-top: 6px;
}

details.more summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  padding: 6px 0;
}

details.more > :not(summary) {
  margin-bottom: 8px;
}

dl.facts {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  gap: 6px 14px;
  font-size: 14px;
}

dl.facts dt {
  color: var(--muted);
}

dl.facts dd {
  overflow-wrap: anywhere;
}

/* ---------- iPads drawn as glass ---------- */

.glass {
  display: block;
  position: relative;
  background: var(--glass);
  border-radius: 9px;
  padding: 3px;
  box-shadow: inset 0 0 0 1px var(--glass-edge);
  flex: none;
}

.glass.offline {
  opacity: 0.35;
}

.glass.large {
  padding: 6px;
  border-radius: 16px;
}

.glass.large .screen {
  border-radius: 11px;
}

.screen {
  display: block;
  position: relative;
  aspect-ratio: 1.43;
  border-radius: 6px;
  overflow: hidden;
  background: var(--screen);
}

.screen.portrait {
  aspect-ratio: 0.7;
}

.screen img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.screen.holding {
  background: var(--holding);
}

.screen.blackout {
  background: var(--blackout);
}

.region {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 0 10px;
  overflow: hidden;
  background: var(--region-main);
}

.region.strapline {
  background: var(--region-strap);
}

.region.faint {
  opacity: 0.3;
}

.region-label,
.screen-label {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 700;
  color: var(--region-label);
}

.region-sub,
.screen-sub {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  color: var(--region-sub);
}

.region.empty .region-label {
  color: var(--region-empty);
}

.screen-caption {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 0 12px;
  text-align: center;
}

.screen.holding .screen-label {
  color: var(--holding-ink);
}

.screen.holding .screen-sub {
  color: var(--holding-sub);
}

.glass.w-tile {
  width: 92px;
}

.glass.w-cue {
  width: 88px;
}

.glass.w-row {
  width: 72px;
}

.glass.w-head {
  width: 52px;
  padding: 2px;
  border-radius: 6px;
}

.glass.w-head .screen {
  border-radius: 4px;
}

.glass.w-preview {
  width: 100%;
  max-width: 560px;
}

.glass.w-preview.portrait {
  max-width: 340px;
}

.glass.w-wall {
  width: 100%;
}

.glass.w-panel {
  width: 100%;
  padding: 5px;
  border-radius: 14px;
}

.glass.w-panel .screen {
  border-radius: 9px;
}

.tile {
  position: relative;
  display: block;
}

.tile-dot {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  box-shadow: 0 0 0 2px var(--paper);
  background: var(--offline);
}

.tile-dot.warn {
  background: var(--warning-dot);
}

/* A cue to pick: its layout and its name. */
.cue-pick {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  padding: 6px 6px 8px;
  border: 1.5px solid transparent;
  border-radius: 12px;
  background: transparent;
  cursor: pointer;
  color: var(--ink-2);
  font-weight: 600;
  font-size: 13px;
  text-align: left;
  max-width: 132px;
}

.cue-pick:hover {
  background: var(--hover);
}

.cue-pick[aria-pressed='true'] {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--ink);
}

.cue-picks {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 6px;
}

/* ---------- Groups ---------- */

.every-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 28px;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.every-group h2 {
  font-size: 15px;
  font-weight: 700;
}

.inline-control {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
}

.inline-control > .control-label {
  font-size: 14px;
  color: var(--muted);
}

.bands {
  display: flex;
  flex-direction: column;
}

.band {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 30px 0 34px;
  border-top: 1px solid var(--line);
}

.band-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
}

.band-title {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 14px;
}

.band-title h2 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.band-title h2 a {
  color: var(--ink);
  text-decoration: none;
}

.band-title h2 a:hover {
  color: var(--link);
}

.band-count {
  font-size: 14px;
  color: var(--muted);
}

.strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.strip-more {
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  padding-left: 4px;
}

.band-grid {
  display: grid;
  grid-template-columns: 104px minmax(0, 1fr);
  gap: 16px 18px;
  align-items: center;
}

.band-grid > .control-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
}

.cover-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 18px;
}

.cover-note {
  font-size: 14px;
  color: var(--muted);
  flex: 1 1 280px;
}

.pending-band {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  padding: 26px 0;
  border-top: 1px solid var(--line);
}

.pending-band h2 {
  font-size: 17px;
  font-weight: 700;
}

.callout {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  padding: 18px 20px;
  border: 1px solid var(--warn-line);
  border-radius: var(--radius);
  background: var(--pending-bg);
}

.start-empty {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  padding: 28px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
}

/* ---------- Switchboard ---------- */

.board {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
}

.board-inner {
  min-width: 820px;
}

.board-row {
  display: grid;
  gap: 0 8px;
  align-items: center;
  padding: 10px 18px;
  border-top: 1px solid var(--line-soft);
}

.board-row.head {
  border-top: 0;
  padding-top: 16px;
  padding-bottom: 12px;
  background: var(--surface-2);
  align-items: end;
}

.board-row.foot {
  border-top: 1px solid var(--line);
  background: var(--surface-2);
  padding-top: 14px;
  padding-bottom: 14px;
}

.board-col-head {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  padding-bottom: 4px;
}

.board-cue {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
  text-align: center;
}

.board-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.board-group a {
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
  text-decoration: none;
}

.board-group .band-count {
  font-size: 13px;
}

.cell {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 78px;
  padding: 6px;
  border: 1.5px solid transparent;
  border-radius: 12px;
  background: transparent;
  cursor: pointer;
}

.cell:hover {
  background: var(--hover);
}

.cell[aria-pressed='true'] {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.cell .glass.unchosen {
  background: transparent;
  box-shadow: inset 0 0 0 1.5px var(--line-strong);
}

.cell .glass.unchosen .screen {
  background: transparent;
}

.board-cover {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}

.board-cover-note {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-2);
}

.board-cover-note.holding {
  color: var(--warning);
}

.board-set-all {
  display: flex;
  justify-content: center;
}

/* ---------- Group ---------- */

.group-show {
  display: grid;
  grid-template-columns: minmax(0, 560px) minmax(0, 1fr);
  gap: 24px 32px;
  align-items: start;
}

.group-controls {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.section {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 16px;
}

.section h2 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

/* In a column, controls keep their own width. */
:is(.section, .connect-step, .panel, .device-panel, .form, .editor, .editor-section, .region-editor, .page-head) > :is(.seg, .button, .confirm, a.button) {
  align-self: flex-start;
}

.rename-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

/* Settings rows: Global settings and a group's own. */
.setting {
  display: grid;
  grid-template-columns: minmax(150px, 220px) minmax(0, 1fr) auto;
  gap: 4px 20px;
  align-items: start;
  padding: 16px 20px;
}

.setting-name {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  font-weight: 600;
}

.setting-value {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.setting-value .value {
  font-weight: 500;
}

.setting-note {
  font-size: 13px;
  color: var(--muted);
}

.setting-differs {
  font-size: 14px;
  font-weight: 600;
}

.setting-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 2px;
}

.setting-edit {
  grid-column: 2 / 4;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  padding-top: 8px;
}

.setting-edit .field {
  max-width: 420px;
  width: 100%;
}

.settings-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.settings-section h2 {
  font-size: 17px;
  font-weight: 700;
}

.mini-device {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) auto;
  gap: 4px 14px;
  align-items: center;
  padding: 10px 16px;
}

.mini-device .name {
  font-weight: 600;
}

/* ---------- Devices ---------- */

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
}

.toolbar .search {
  flex: 0 1 280px;
}

.toolbar .views {
  margin-left: auto;
}

.selection-bar {
  position: sticky;
  top: 8px;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  padding: 10px 12px 10px 16px;
  border-radius: var(--radius);
  background: var(--bar-bg);
  color: var(--bar-ink);
}

.selection-bar .count {
  font-weight: 700;
  margin-right: 6px;
}

.selection-bar label {
  font-size: 14px;
  color: var(--bar-muted);
}

.selection-bar .field {
  min-height: 36px;
}

.selection-bar .clear {
  margin-left: auto;
  color: var(--bar-link);
}

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

.device-table {
  flex: 999 1 600px;
  min-width: 0;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.device-table-inner {
  min-width: 640px;
}

.device-row {
  display: grid;
  grid-template-columns: 28px 76px minmax(170px, 1.4fr) minmax(190px, 1.3fr) 120px;
  gap: 0 16px;
  align-items: center;
  padding: 8px 16px;
  border-top: 1px solid var(--line-soft);
}

.device-row.head {
  border-top: 0;
  padding-top: 12px;
  padding-bottom: 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.device-row.pending {
  background: var(--pending-bg);
}

.device-row.open {
  background: var(--accent-soft);
}

.device-row .name-button {
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink);
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  overflow-wrap: anywhere;
}

.device-row .name-button:hover {
  color: var(--link);
  text-decoration: underline;
}

.device-row .name-button.unnamed,
.unnamed {
  color: var(--muted);
  font-style: italic;
}

.device-name {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.device-status {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}

.sub {
  font-size: 13px;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.sub.warning {
  color: var(--warning);
  font-weight: 600;
}

.matching {
  font-size: 13px;
  color: var(--ink-2);
}

.matching strong {
  letter-spacing: 0.06em;
  font-variant-numeric: tabular-nums;
}

.device-section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 12px;
  padding: 18px 16px 8px;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
}

.device-section-head a,
.device-section-head span.name {
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
  text-decoration: none;
}

.device-panel {
  flex: 1 1 340px;
  max-width: 420px;
  min-width: 0;
  position: sticky;
  top: 16px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
}

.device-panel h2 {
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
}

.panel-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.panel-title > div {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.field-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.field-row > label {
  font-size: 14px;
  font-weight: 600;
  width: 56px;
}

.field-row > label.help-text {
  width: auto;
  font-weight: 500;
}

.field-row > .field {
  flex: 1 1 160px;
}

.shot-strip {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.shot-pick {
  flex: none;
  width: 64px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 6px;
  background: none;
  cursor: pointer;
}

.shot-pick[aria-pressed='true'] {
  border-color: var(--accent);
}

.shot-pick img {
  display: block;
  width: 100%;
  border-radius: 4px;
}

.timeline {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 14px;
}

.log {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
}

.log .when {
  color: var(--muted);
  margin-right: 8px;
}

.log .error {
  color: var(--offline);
}

.log .warn {
  color: var(--warning);
}

/* The wall: every iPad's latest screenshot. */
.wall-section {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.wall {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px 16px;
}

.wall-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 0;
  border: 0;
  background: none;
  text-align: left;
  cursor: pointer;
  color: inherit;
}

.wall-item:hover .glass {
  box-shadow:
    inset 0 0 0 1px var(--glass-edge),
    0 0 0 2px var(--accent);
}

.wall-item .name {
  font-weight: 600;
}

.wall-item > .button {
  align-self: flex-start;
}

/* ---------- Add screens and first run ---------- */

.steps-head {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  list-style: none;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
}

.steps-head li {
  display: flex;
  align-items: center;
  gap: 8px;
}

.steps-head .step-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1.5px solid var(--line-strong);
  font-size: 13px;
}

.steps-head .done .step-number {
  border-color: var(--online);
  background: var(--online);
  color: #ffffff;
}

.steps-head .current {
  color: var(--ink);
}

.steps-head .current .step-number {
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
}

.connect-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(260px, 1fr);
  gap: 24px;
  align-items: start;
}

.connect-steps-list {
  display: flex;
  flex-direction: column;
  gap: 26px;
}

.connect-step {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.connect-step h3 {
  font-size: 16px;
  font-weight: 700;
}

.config-keys {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.config-key {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr) auto;
  gap: 4px 14px;
  align-items: center;
  padding: 12px 16px;
}

.config-key + .config-key {
  border-top: 1px solid var(--line-soft);
}

.config-key .key {
  font-weight: 600;
}

.config-key .value {
  overflow-wrap: anywhere;
}

.secret-value {
  font-weight: 700;
  letter-spacing: 0.02em;
  overflow-wrap: anywhere;
}

.qr-block {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 20px 28px;
}

.qr {
  width: 200px;
  height: 200px;
  padding: 8px;
  border-radius: 10px;
  background: #ffffff;
  border: 1px solid var(--line);
}

.typed {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px 14px;
  align-items: center;
}

.typed dt {
  color: var(--muted);
  font-size: 14px;
}

.typed dd {
  font-weight: 700;
  overflow-wrap: anywhere;
}

.pairing-code {
  font-size: 22px;
  letter-spacing: 0.08em;
  font-variant-numeric: tabular-nums;
}

.choice-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.choice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  cursor: pointer;
}

.choice:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.choice input {
  margin-top: 2px;
}

.arrivals {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.arrival {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) auto;
  gap: 4px 12px;
  align-items: center;
}

.waiting-for {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
}

.spinner {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--line-strong);
  border-top-color: var(--accent);
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .spinner {
    animation: none;
  }
}

.made-list {
  display: flex;
  flex-direction: column;
}

.made {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 4px 16px;
  padding: 14px 0;
  border-top: 1px solid var(--line-soft);
}

.made:first-child {
  border-top: 0;
}

.made .what {
  font-weight: 700;
}

.made .note {
  grid-column: 2;
  font-size: 13px;
  color: var(--muted);
}

.first-show {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 28px;
  align-items: start;
}

.form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.form .field {
  width: 100%;
}

/* ---------- Cues and layouts ---------- */

.split {
  display: grid;
  grid-template-columns: minmax(220px, 300px) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.picklist {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.pick-item {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 2px 12px;
  align-items: center;
  padding: 8px 10px;
  border: 1.5px solid transparent;
  border-radius: 12px;
  color: var(--ink);
  text-decoration: none;
}

.pick-item:hover {
  background: var(--hover);
  color: var(--ink);
}

.pick-item[aria-current='page'] {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.pick-item .glass {
  grid-row: span 2;
  width: 64px;
  padding: 2px;
  border-radius: 6px;
}

.pick-item .glass .screen {
  border-radius: 4px;
}

.pick-item .name {
  font-weight: 700;
}

.pick-item .sub {
  font-size: 12px;
}

.editor {
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
}

.editor-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.editor-head h2 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.editor-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.editor-section > h3 {
  font-size: 14px;
  font-weight: 700;
}

.part-row {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  gap: 4px 14px;
  align-items: center;
}

.part-row label {
  font-weight: 600;
  font-size: 14px;
}

.part-row > .field {
  max-width: 420px;
}

.part-row .sub {
  grid-column: 2;
}

.part-row .button-row {
  grid-column: 2;
}

.save-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  padding-top: 6px;
  border-top: 1px solid var(--line-soft);
}

.save-row .status-line {
  flex: 1 1 260px;
}

.region-editor {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.region-editor h3 {
  font-size: 15px;
  font-weight: 700;
}

.frame-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
}

.frame-fields .label {
  flex-direction: row;
  align-items: center;
  gap: 8px;
}

.percent {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.checks {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
}

/* ---------- Bookmarks ---------- */

.marks {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.marks-inner {
  min-width: 780px;
}

.mark-row {
  display: grid;
  grid-template-columns: minmax(130px, 0.8fr) minmax(220px, 1.7fr) minmax(110px, 0.7fr) minmax(130px, 0.9fr) 150px;
  gap: 6px 18px;
  align-items: center;
  padding: 14px 18px;
  border-top: 1px solid var(--line-soft);
}

.mark-row.head {
  border-top: 0;
  padding-top: 12px;
  padding-bottom: 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.mark-row .name {
  font-weight: 600;
}

.mark-row .address {
  overflow-wrap: anywhere;
}

.mark-row.editing {
  background: var(--accent-soft);
}

/* A form whose fields lay out in its parent's grid. */
.contents {
  display: contents;
}

.mark-add {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px;
  padding: 16px 18px;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
}

.mark-add .label:nth-child(1) {
  flex: 1 1 160px;
}

.mark-add .label:nth-child(2) {
  flex: 3 1 300px;
}

.mark-add .label:nth-child(3) {
  flex: 1 1 180px;
}

.token-hint {
  font-size: 13px;
  color: var(--muted);
  max-width: 80ch;
}

.token-hint code {
  font-family: inherit;
  font-weight: 600;
  color: var(--ink-2);
}

/* ---------- Holding screens ---------- */

.asset {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr) auto;
  gap: 6px 20px;
  align-items: center;
  padding: 14px 18px;
}

.asset-preview {
  display: block;
  width: 160px;
  aspect-ratio: 1.43;
  object-fit: cover;
  border-radius: 8px;
  background: var(--glass);
}

.asset-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.asset-info .name {
  font-weight: 600;
  overflow-wrap: anywhere;
}

.upload-button input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

/* ---------- Activity ---------- */

.activity {
  list-style: none;
}

.activity li {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 2px 18px;
  padding: 12px 18px;
}

.activity .when {
  font-size: 14px;
  color: var(--muted);
}

.activity .who {
  font-weight: 600;
}

.activity .detail {
  grid-column: 2;
  font-size: 13px;
  color: var(--muted);
}

/* ---------- Sign-in and account pages ---------- */

.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 16px;
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.login-card h1 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.login-card label {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: -8px;
}

.login-card p {
  font-size: 14px;
}

.login-card .button {
  width: 100%;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 15px;
  color: var(--ink);
}

.login-links {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 13px;
}

.login-links .link-button {
  font-size: 13px;
  font-weight: 500;
}

.login-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}

.login-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.login-actions a:not(.button) {
  font-size: 13px;
}

.connect-steps {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-left: 20px;
}

.connect-typed {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 16px;
}

.connect-typed dt {
  color: var(--muted);
}

.connect-typed dd {
  font-weight: 700;
  overflow-wrap: anywhere;
}

.account-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.account-form label {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.account-form .field {
  max-width: 420px;
}

.account-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.account-steps {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding-left: 20px;
}

.account-steps li {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.account-qr {
  width: 200px;
  height: 200px;
  background: #ffffff;
  border-radius: 8px;
}

.account-key {
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.04em;
  user-select: all;
}

.account-codes {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 6px;
  list-style: none;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
}

.account-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
}

.account-subhead {
  font-size: 15px;
  margin-top: 8px;
}

.activity-failed {
  color: var(--offline);
}

/* ---------- Narrow screens: the rail stacks above the page ---------- */

@media (max-width: 960px) {
  .group-show,
  .connect-layout,
  .first-show,
  .split {
    grid-template-columns: minmax(0, 1fr);
  }

  .device-panel {
    position: static;
    max-width: none;
  }
}

@media (max-width: 760px) {
  .rail {
    max-width: none;
    flex-basis: 100%;
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 16px;
    gap: 14px;
  }

  .rail-sections {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 4px 16px;
  }

  .rail-group {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
  }

  .rail-head {
    display: none;
  }

  .nav-link {
    min-height: 36px;
  }

  .rail-foot {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 16px;
    margin-top: 0;
  }

  .page {
    padding: 24px 16px 56px;
  }

  .page-inner {
    gap: 22px;
  }

  .page-head h1,
  .page h1 {
    font-size: 26px;
  }

  .band-grid,
  .setting,
  .config-key,
  .part-row,
  .made,
  .activity li,
  .asset {
    grid-template-columns: minmax(0, 1fr);
  }

  .setting-edit,
  .made .note,
  .part-row .sub,
  .part-row .button-row,
  .activity .detail {
    grid-column: 1;
  }

  .setting-actions {
    justify-content: flex-start;
  }

  .asset-preview {
    width: 100%;
    max-width: 260px;
  }

  .typed {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .typed .button {
    grid-column: 2;
    justify-self: start;
  }

  .toolbar .views {
    margin-left: 0;
  }

  .cue-pick {
    max-width: 112px;
  }
}

/* Platform → Terminal software: what each channel runs, side by side. */
.lp-channel {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0 28px 10px 0;
}
