/* The design system. Loaded FIRST on every screen; each page's own <style> only lays things out
   with these tokens. One quiet sans, a light ground, hairlines, pills, frosted bars, and a lot
   of air. Colours come from the tokens below and nowhere else, so dark mode is automatic. */

:root {
  color-scheme: light dark;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Helvetica Neue",
          "Segoe UI Variable Display", "Segoe UI", Inter, Roboto, system-ui, sans-serif;
  --mono: "SF Mono", ui-monospace, Menlo, Consolas, "Cascadia Mono", monospace;

  --bg: #ffffff;            /* page */
  --bg2: #f5f5f7;           /* sections, sidebars, cards on white */
  --bg3: #e8e8ed;           /* gray pills, segmented control track, hover fills */
  --card: #ffffff;          /* cards on bg2 */
  --text: #1d1d1f;
  --text2: #6e6e73;
  --text3: #86868b;
  --hair: rgba(0,0,0,.08);  /* dividers */
  --hair2: #d2d2d7;         /* field borders */
  --ink: #1d1d1f;           /* the one action: graphite, never a colour */
  --blue: var(--ink);       /* kept as a name older rules use; it is graphite now */
  --blue-hover: #000000;
  --accent: var(--ink);     /* chrome stays neutral; a room's own colour lives in --tint */
  --on-accent: #ffffff;
  --red: #e30000;
  --green: #1d9d4b;
  --orange: #f56300;
  --red-bg: rgba(227,0,0,.08);
  --green-bg: rgba(29,157,75,.10);
  --orange-bg: rgba(245,99,0,.10);
  --accent-bg: color-mix(in srgb, var(--accent) 10%, transparent);

  --r-sm: 10px; --r: 14px; --r-lg: 20px; --r-xl: 28px; --pill: 980px;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 8px 24px rgba(0,0,0,.06);
  --shadow-lg: 0 2px 6px rgba(0,0,0,.05), 0 24px 60px rgba(0,0,0,.12);
  --ring: 0 0 0 4px rgba(0,0,0,.16);
  --glass: rgba(255,255,255,.72);
  --blur: saturate(180%) blur(20px);
  --ease: cubic-bezier(.4,0,.2,1);
}
@media (prefers-color-scheme: dark) {
  /* Unless this screen has been told to be paper. */
  :root:not([data-theme="light"]) {
    --bg: #000000; --bg2: #1d1d1f; --bg3: #2c2c2e; --card: #1d1d1f;
    --text: #f5f5f7; --text2: #a1a1a6; --text3: #86868b;
    --hair: rgba(255,255,255,.12); --hair2: #424245;
    --ink: #f5f5f7; --blue: var(--ink); --blue-hover: #ffffff; --on-accent: #1d1d1f;
    --red: #ff453a; --green: #30d158; --orange: #ff9f0a;
    --red-bg: rgba(255,69,58,.14); --green-bg: rgba(48,209,88,.14); --orange-bg: rgba(255,159,10,.14);
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.5);
    --shadow-lg: 0 2px 6px rgba(0,0,0,.5), 0 24px 60px rgba(0,0,0,.7);
    --ring: 0 0 0 4px rgba(255,255,255,.22);
    --glass: rgba(29,29,31,.72);
  }
}

/* Told, rather than guessed. Settings says what the venue wants and a member of staff may
   say something else for the machine in front of them; look.js puts the answer on <html>.
   The values are the same as above and written twice because a media query and an
   attribute cannot be one selector. */
:root[data-theme="dark"] {
    --bg: #000000; --bg2: #1d1d1f; --bg3: #2c2c2e; --card: #1d1d1f;
    --text: #f5f5f7; --text2: #a1a1a6; --text3: #86868b;
    --hair: rgba(255,255,255,.12); --hair2: #424245;
    --ink: #f5f5f7; --blue: var(--ink); --blue-hover: #ffffff; --on-accent: #1d1d1f;
    --red: #ff453a; --green: #30d158; --orange: #ff9f0a;
    --red-bg: rgba(255,69,58,.14); --green-bg: rgba(48,209,88,.14); --orange-bg: rgba(255,159,10,.14);
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.5);
    --shadow-lg: 0 2px 6px rgba(0,0,0,.5), 0 24px 60px rgba(0,0,0,.7);
    --ring: 0 0 0 4px rgba(255,255,255,.22);
    --glass: rgba(29,29,31,.72);
}

/* ---------- reset & type ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); }
body, button, input, textarea, select {
  font-family: var(--font); font-size: 17px; line-height: 1.47; letter-spacing: -0.022em;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; color: var(--text); }
h1 { font-size: 48px; line-height: 1.08; letter-spacing: -0.003em; }
h2 { font-size: 32px; line-height: 1.12; letter-spacing: 0.004em; }
h3 { font-size: 21px; line-height: 1.19; letter-spacing: 0.011em; }
h4 { font-size: 17px; line-height: 1.24; }
p { margin: 0; }
a { color: var(--text); text-decoration: none; }
a:hover { text-decoration: underline; }
small, .small { font-size: 14px; line-height: 1.43; letter-spacing: -0.016em; }
.caption { font-size: 12px; line-height: 1.33; letter-spacing: -0.01em; color: var(--text2); }
.muted, .text2 { color: var(--text2); }
.text3 { color: var(--text3); }
.eyebrow { font-size: 14px; font-weight: 600; color: var(--accent); letter-spacing: -0.01em; }
.lede { font-size: 21px; line-height: 1.38; letter-spacing: 0.011em; color: var(--text2); font-weight: 400; }
.mono, .num { font-family: var(--mono); font-variant-numeric: tabular-nums; letter-spacing: 0; }
.tabular { font-variant-numeric: tabular-nums; }
.clock { font-family: var(--font); font-variant-numeric: tabular-nums; font-weight: 300; letter-spacing: -0.02em; }
::selection { background: color-mix(in srgb, var(--accent) 25%, transparent); }
hr { border: 0; border-top: 1px solid var(--hair); margin: 0; }

/* ---------- controls: every button is a pill ---------- */
button, .btn {
  appearance: none; -webkit-appearance: none; border: 0; margin: 0; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 0 20px; border-radius: var(--pill);
  background: var(--bg3); color: var(--text);
  font-size: 15px; font-weight: 500; line-height: 1; letter-spacing: -0.01em; white-space: nowrap;
  text-decoration: none;
  transition: background .18s var(--ease), color .18s var(--ease), transform .12s var(--ease),
              opacity .18s var(--ease), box-shadow .18s var(--ease); }
button:hover:not(:disabled), .btn:hover { background: color-mix(in srgb, var(--bg3) 80%, var(--text) 8%); text-decoration: none; }
button:active:not(:disabled), .btn:active { transform: scale(.97); }
button:disabled, .btn.disabled { opacity: .4; cursor: default; }
button:focus-visible, .btn:focus-visible, a:focus-visible { outline: 0; box-shadow: var(--ring); }
/* the one action on a screen */
button.primary, .btn.primary { background: var(--accent); color: var(--on-accent); font-weight: 600; }
button.primary:hover:not(:disabled), .btn.primary:hover { background: var(--accent); filter: brightness(1.06); }
/* large call to action */
button.lg, .btn.lg { min-height: 48px; padding: 0 28px; font-size: 17px; }
button.sm, .btn.sm { min-height: 38px; padding: 0 14px; font-size: 14px; }
/* text only */
button.plain, .btn.plain { background: none; color: var(--blue); padding: 0 10px; }
button.plain:hover:not(:disabled), .btn.plain:hover { background: var(--accent-bg); }
button.quiet, .btn.quiet { background: none; color: var(--text2); padding: 0 12px; }
button.quiet:hover:not(:disabled), .btn.quiet:hover { background: var(--bg3); color: var(--text); }
/* destructive */
button.danger, .btn.danger { background: var(--red-bg); color: var(--red); }
button.danger:hover:not(:disabled) { background: color-mix(in srgb, var(--red) 16%, transparent); }
button.danger.arm, button.arm { background: var(--red); color: #fff; }
/* round icon buttons */
button.icon, .btn.icon { width: 40px; min-height: 40px; padding: 0; border-radius: 50%; }
button.icon svg { width: 18px; height: 18px; }

/* segmented control */
.seg { display: inline-flex; align-items: center; padding: 3px; border-radius: var(--pill);
  background: var(--bg3); gap: 2px; }
.seg button, .seg a { display: inline-flex; align-items: center; justify-content: center;
  min-height: 38px; padding: 0 16px; font-size: 14px; font-weight: 500; color: var(--text2);
  white-space: nowrap; background: transparent; border-radius: var(--pill); }
.seg button:hover:not(:disabled), .seg a:hover { background: transparent; color: var(--text); }
/* The chosen one keeps its pill under the pointer. The hover rule above carries a
   pseudo-class, so unless .on says hover too it loses on specificity and the bar looks
   like nothing is chosen for as long as the hand is on it. */
.seg button.on, .seg a.on,
.seg button.on:hover:not(:disabled), .seg a.on:hover { background: var(--card); color: var(--text);
  box-shadow: 0 1px 2px rgba(0,0,0,.10), 0 2px 6px rgba(0,0,0,.06); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .seg button.on, :root:not([data-theme="light"]) .seg a.on,
  :root:not([data-theme="light"]) .seg button.on:hover:not(:disabled),
  :root:not([data-theme="light"]) .seg a.on:hover { background: #636366; color: #fff; }
}
:root[data-theme="dark"] .seg button.on, :root[data-theme="dark"] .seg a.on,
:root[data-theme="dark"] .seg button.on:hover:not(:disabled),
:root[data-theme="dark"] .seg a.on:hover { background: #636366; color: #fff; }

/* ---------- fields ---------- */
input[type=text], input[type=number], input[type=color], input:not([type]), input[type=search], input[type=url],
input[type=password], input[type=email], input[type=tel], input[type=date], input[type=time],
textarea, select {
  width: 100%; appearance: none; -webkit-appearance: none; margin: 0;
  background: var(--card); color: var(--text); border: 1px solid var(--hair2); border-radius: 12px;
  font-size: 17px; line-height: 1.3; padding: 11px 16px; outline: none;
  transition: border-color .18s var(--ease), box-shadow .18s var(--ease), background .18s var(--ease); }
input:hover, textarea:hover, select:hover { border-color: color-mix(in srgb, var(--hair2) 60%, var(--text2)); }
input:focus, textarea:focus, select:focus { border-color: var(--blue); box-shadow: var(--ring); }
input::placeholder, textarea::placeholder { color: var(--text3); }
textarea { resize: vertical; min-height: 96px; line-height: 1.47; }
select { padding-right: 40px; cursor: pointer;
  background-image: 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='%236e6e73' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 16px center; }
input[type=color] { padding: 4px; height: 44px; width: 64px; cursor: pointer; }
input[type=color]::-webkit-color-swatch-wrapper { padding: 0; }
input[type=color]::-webkit-color-swatch { border: 0; border-radius: 8px; }
input[type=file] { font-size: 14px; color: var(--text2); }
input[type=checkbox] { accent-color: var(--accent); width: 18px; height: 18px; }
label { display: block; font-size: 14px; font-weight: 500; color: var(--text); margin-bottom: 6px; letter-spacing: -0.01em; }
.help { font-size: 13px; color: var(--text2); margin-top: 6px; }
/* iOS toggle */
.switch { position: relative; display: inline-block; width: 51px; height: 31px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; border-radius: var(--pill); background: var(--bg3); transition: background .2s var(--ease); cursor: pointer; }
.switch span::after { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%;
  background: #fff; box-shadow: 0 3px 8px rgba(0,0,0,.15), 0 1px 1px rgba(0,0,0,.08); transition: transform .2s var(--ease); }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(20px); }
.switch input:focus-visible + span { box-shadow: var(--ring); }

/* ---------- surfaces ---------- */
.card { background: var(--card); border-radius: var(--r-lg); padding: 24px; box-shadow: var(--shadow); }
.panel { background: var(--bg2); border-radius: var(--r-lg); padding: 24px; }
.tile { background: var(--bg2); border-radius: var(--r); padding: 16px 18px; }
.hairline { border-top: 1px solid var(--hair); }
.pillbadge { display: inline-flex; align-items: center; gap: 6px; min-height: 24px; padding: 0 10px; border-radius: var(--pill);
  background: var(--bg3); color: var(--text2); font-size: 12px; font-weight: 600; letter-spacing: 0; }
.pillbadge.good { background: var(--green-bg); color: var(--green); }
.pillbadge.bad { background: var(--red-bg); color: var(--red); }
.pillbadge.warn { background: var(--orange-bg); color: var(--orange); }
.pillbadge.accent { background: var(--accent-bg); color: var(--accent); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--text3); }
.dot.live { background: var(--green); box-shadow: 0 0 0 3px var(--green-bg); }

/* frosted top bar */
.nav { position: sticky; top: 0; z-index: 50; display: flex; align-items: center; gap: 8px;
  height: 58px; padding: 0 20px; background: var(--glass); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  border-bottom: 1px solid var(--hair); }
.nav .brand { font-size: 17px; font-weight: 600; color: var(--text); margin-right: 16px; letter-spacing: -0.02em; text-decoration: none; }
.nav .spacer { flex: 1; }
.nav a:not(.brand) { color: var(--text2); font-size: 14px; font-weight: 500; padding: 6px 12px; border-radius: var(--pill); }
.nav a:not(.brand):hover { color: var(--text); background: var(--bg3); text-decoration: none; }
.nav a.on { color: var(--text); font-weight: 600; }

/* tables */
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th { text-align: left; font-size: 12px; font-weight: 600; color: var(--text2); padding: 8px 12px; border-bottom: 1px solid var(--hair); }
td { padding: 12px; border-bottom: 1px solid var(--hair); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }

/* lists that behave like iOS grouped lists */
.list { background: var(--card); border-radius: var(--r); overflow: hidden; box-shadow: var(--shadow); }
.list > * { padding: 14px 18px; border-bottom: 1px solid var(--hair); }
.list > *:last-child { border-bottom: 0; }

/* empty states, notes */
.empty { color: var(--text2); font-size: 15px; padding: 24px 0; }
.note { color: var(--text2); font-size: 14px; }
.alert { padding: 12px 16px; border-radius: 12px; font-size: 14px; background: var(--red-bg); color: var(--red); }
.alert.ok { background: var(--green-bg); color: var(--green); }
.alert.warn { background: var(--orange-bg); color: var(--orange); }

/* The operator's bar: who this is, where you are, and what else there is. The tabs are placed
   against the bar rather than after the name, so moving between Console, Rooms and Settings does
   not move the control you are moving through: only the lit segment changes. */
.nav.desk { display: grid; align-items: center; gap: 12px; height: auto; min-height: 58px;
  /* The name is given a column of its own rather than pushing what follows it: the tabs then
     start at the same place on every operator screen, whatever the venue is called, and what is
     left over is the room the rest of the bar has. */
  grid-template-columns: minmax(0, clamp(110px, 20vw, 220px)) auto minmax(0, 1fr); }
.nav.desk .brand { justify-self: start; min-width: 0; margin: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav.desk .seg { justify-self: start; flex: none; }
.nav.desk .spacer { display: none; }
.nav.desk .deskend { justify-self: end; display: flex; align-items: center; gap: 6px; min-width: 0; }
.nav.desk .deskend a { display: inline-flex; align-items: center; min-height: 38px; padding: 0 10px; border-radius: var(--pill); }
@media (pointer: coarse) { .nav.desk .deskend a, .nav.desk .deskend button { min-height: 44px; } }
/* Too narrow to hold three things in a row: the bar keeps the name and the tabs, and everything
   else drops to a line of its own rather than crushing them. */
/* A phone: the name and the links share the first row, and the tabs take a row of their own at
   full width, each the same size, the way a phone's own segmented controls are laid out. Four
   tabs crushed beside a name was a bar that could not be read. */
@media (max-width: 760px) {
  .nav.desk { grid-template-columns: minmax(0, 1fr) auto; padding: 8px 14px 10px; row-gap: 8px; }
  .nav.desk .brand { grid-row: 1; grid-column: 1; }
  .nav.desk .deskend { grid-row: 1; grid-column: 2; }
  .nav.desk .seg { grid-row: 2; grid-column: 1 / -1; justify-self: stretch; display: flex; width: 100%; }
  .nav.desk .seg a, .nav.desk .seg button { flex: 1 1 0; padding: 0 6px; min-width: 0; }
  .nav.desk .deskend a { padding: 0 8px; font-size: 14px; }
}

/* a choice of a few named things: .seg's look, but each pill is a real radio, so a form reads
   it back the way it reads back every other field */
.pills { display: inline-flex; flex-wrap: wrap; max-width: 100%; padding: 2px; gap: 2px;
  border-radius: var(--pill); background: var(--bg3); }
.pills label { display: inline-flex; align-items: center; justify-content: center; margin: 0;
  min-height: 38px; padding: 0 16px; border-radius: var(--pill); background: transparent;
  font-size: 14px; font-weight: 500; color: var(--text2); cursor: pointer; white-space: nowrap;
  transition: background .18s var(--ease), color .18s var(--ease); }
.pills label:hover { color: var(--text); }
.pills input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.pills label:has(input:checked) { background: var(--card); color: var(--text);
  box-shadow: 0 1px 3px rgba(0,0,0,.12), 0 3px 8px rgba(0,0,0,.06); }
.pills label:has(input:focus-visible) { box-shadow: var(--ring); }
@media (prefers-color-scheme: dark) {   /* the same pair .seg button.on gets */
  :root:not([data-theme="light"]) .pills label:has(input:checked) { background: #636366; color: #fff; }
}
:root[data-theme="dark"] .pills label:has(input:checked) { background: #636366; color: #fff; }

/* an amount, with the number said next to it */
.slider { display: flex; align-items: center; gap: 14px; }
.slider input[type=range] { flex: 1; min-width: 0; height: 38px; margin: 0; padding: 0;
  appearance: none; -webkit-appearance: none; background: none; border: 0; cursor: pointer; }
.slider input[type=range]:focus { box-shadow: none; }
.slider input[type=range]::-webkit-slider-runnable-track { height: 6px; border-radius: var(--pill); background: var(--bg3); }
.slider input[type=range]::-webkit-slider-thumb { appearance: none; -webkit-appearance: none; margin-top: -9px;
  width: 24px; height: 24px; border-radius: 50%; background: var(--card);
  box-shadow: 0 1px 3px rgba(0,0,0,.2), 0 0 0 1px var(--hair2); }
.slider input[type=range]:focus-visible::-webkit-slider-thumb { box-shadow: var(--ring); }
.slider input[type=range]::-moz-range-track { height: 6px; border-radius: var(--pill); background: var(--bg3); }
.slider input[type=range]::-moz-range-thumb { width: 22px; height: 22px; border: 1px solid var(--hair2);
  border-radius: 50%; background: var(--card); }
.slider .val { flex: none; min-width: 52px; text-align: right; font-size: 15px; color: var(--text2);
  font-variant-numeric: tabular-nums; }

/* scrollbars stay thin and quiet */
* { scrollbar-width: thin; scrollbar-color: var(--hair2) transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb { background: var(--hair2); border-radius: 8px; border: 2px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-track { background: transparent; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }
