/* CloudTV Signage: warm neutral + ink with a teal accent (the TV's Signage colour); follows the system light / dark setting.
   One typeface (Roboto 400–700). Type scale 12 · 13 · 14 · 15 (body) · 17 · 20 · 28; weights 400 text · 500 controls · 600 headings. */
:root {
  color-scheme: light dark;
  --bg: #f6f3ec; --surface: #fffdf9; --card: #fff; --card-2: #f2eee5; --line: #e7e0d2; --line-2: #d6cdbb;
  --text: #1a1c21; --muted: #6e695e; --faint: #9a9486;
  --accent: #00936f; --accent-2: #19b48c; --accent-text: #00785b; --accent-ink: #ffffff; --accent-soft: rgba(0, 147, 111, .1); --accent-line: rgba(0, 147, 111, .45);
  --ink: #15171c; --ink-2: #1f2229; --ink-text: #ece7da; --ink-muted: #9c978a;
  --red: #c2413b; --red-soft: rgba(194, 65, 59, .09); --good: #2f8f57; --good-soft: rgba(47, 143, 87, .1); --warn: #a86b00; --blue: #2f6fb3;
  --ring: 0 0 0 1px rgba(40, 32, 10, .07);
  --shadow: 0 1px 2px rgba(40, 32, 10, .04), 0 4px 16px rgba(40, 32, 10, .05);
  --shadow-lg: 0 2px 6px rgba(20, 16, 6, .08), 0 24px 60px rgba(20, 16, 6, .18);
  --radius: 16px;
  /* motion: quick ease-out for things entering / responding, never linear or bouncy */
  --ease-out: cubic-bezier(.23, 1, .32, 1); --ease-in-out: cubic-bezier(.65, 0, .35, 1);
  --sans: Roboto, system-ui, -apple-system, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --serif: var(--sans); /* one typeface across the dashboard: Roboto */
  font: 400 15px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1014; --surface: #15181d; --card: #181b21; --card-2: #20242b; --line: #2a2e36; --line-2: #3a3f49;
    --text: #efebe2; --muted: #a29d90; --faint: #767165;
    --accent: #2bc79f; --accent-2: #5ad8b6; --accent-text: #5ad8b6; --accent-ink: #04140f; --accent-soft: rgba(43, 199, 159, .12); --accent-line: rgba(43, 199, 159, .45);
    --ink: #0a0b0e; --ink-2: #16181d;
    --red: #ec6a63; --red-soft: rgba(236, 106, 99, .12); --good: #4cc27e; --good-soft: rgba(76, 194, 126, .12); --warn: #f0b84a; --blue: #6aa8ea;
    --ring: 0 0 0 1px rgba(255, 255, 255, .07);
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .22);
    --shadow-lg: 0 24px 70px rgba(0, 0, 0, .6);
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); min-height: 100%; }
body, input, select, textarea { font-family: var(--sans); font-weight: 400; }
button { font-family: var(--sans); font-weight: 500; }
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -.01em; text-wrap: balance; }
h1 { font: 600 28px/1.15 var(--serif); letter-spacing: -.022em; }
h2 { font-size: 17px; letter-spacing: -.012em; }
h3 { font-size: 15px; }
p { text-wrap: pretty; }
p { margin: 0 0 8px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.strong { font-weight: 600; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .92em; letter-spacing: .03em; }
/* small context line above a title: sentence case, quiet; the title carries the weight */
.eyebrow { font-size: 13px; font-weight: 500; color: var(--muted); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }
.loading { display: flex; align-items: center; gap: 10px; color: var(--muted); padding: 30px 0; }
.loading.boot { padding: 40px; }
.spin { width: 16px; height: 16px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }
@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(.97); } }
@keyframes modal-in { from { opacity: 0; transform: translateY(8px) scale(.97); } }
@keyframes fade-out { to { opacity: 0; } }
@keyframes modal-out { to { opacity: 0; transform: scale(.98); } }

/* ---- shell: ink side bar (desktop) · top bar + bottom tabs (phone) ---- */
/* the ink column is painted by the shell too, so it always runs the full height of the page (not just one screen) */
.shell { min-height: 100vh; min-height: 100dvh; }
/* Top bar: brand left (→ overview), page tabs, profile orb right. */
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 12px; padding: 12px 28px; background: var(--ink); color: var(--ink-text);
  border-bottom: 1px solid rgba(255, 255, 255, .06); padding-top: max(12px, env(safe-area-inset-top)); }
.topbar { transition: transform .3s var(--ease-out); will-change: transform; }
.topbar.away { transform: translateY(-100%); }
.brand { display: flex; align-items: center; gap: 11px; font: 600 17px/1.1 var(--serif); letter-spacing: -.005em; }
.brand-logo { height: 26px; width: auto; flex: none; display: block; }
/* The logo is white: on the light sign-in card (light theme) it is drawn dark. */
@media (prefers-color-scheme: light) { .auth-card .brand-logo { filter: invert(1); } }
.brand-link { color: inherit; } .brand-link:hover { text-decoration: none; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
/* Page tabs in the dark bar: quiet labels, a light pill slides under the open page (ui.js glide). */
.navtabs { position: relative; isolation: isolate; display: flex; gap: 2px; margin-left: 20px; padding: 4px; border-radius: 999px;
  background: rgba(255, 255, 255, .05); border: 1px solid rgba(255, 255, 255, .07); overflow-x: auto; scrollbar-width: none; }
.navtabs::-webkit-scrollbar { display: none; }
.navtab { flex: none; padding: 8px 16px; border-radius: 999px; color: var(--ink-muted); font: 500 14px/1 var(--sans); transition: color .2s var(--ease-out); }
.navtab:hover { color: var(--ink-text); text-decoration: none; }
.navtab[aria-selected="true"] { color: var(--ink); }
.navtabs .glider { border-radius: 999px; background: var(--ink-text); }
.navtabs:not(.gliding) .navtab[aria-selected="true"] { background: var(--ink-text); }
.brand-sub { font: 500 13px/1 var(--sans); color: var(--accent-2); letter-spacing: .02em; padding-left: 11px; border-left: 1px solid rgba(255, 255, 255, .16); }
.auth-card .brand-sub { color: var(--accent-text); border-left-color: var(--line-2); }
/* Storage meter: 30 MB per owner. */
.meter { display: grid; gap: 6px; }
.meter-bar { height: 6px; border-radius: 3px; background: var(--card-2); overflow: hidden; }
.meter-bar > span { display: block; height: 100%; border-radius: 3px; background: var(--accent); transition: width .4s var(--ease-out); }
.meter.full .meter-bar > span { background: var(--red); }
.menu-storage { display: grid; gap: 8px; padding: 6px 10px 14px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.orb { height: 42px; min-width: 42px; border-radius: 21px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 12px;
  background: rgba(255, 255, 255, .07); color: var(--ink-text); border: 1px solid rgba(255, 255, 255, .08); font: 600 14px/1 var(--sans); cursor: pointer; }
.orb:hover { background: rgba(255, 255, 255, .13); text-decoration: none; }
.orb svg { width: 19px; height: 19px; flex: none; }
.orb.avatar { width: 42px; padding: 0; background: var(--accent-2); color: var(--accent-ink); border: 0; letter-spacing: .02em; }
.orb.avatar.big { width: 46px; height: 46px; cursor: default; flex: none; }
.profile { position: relative; }
.menu { position: absolute; right: 0; top: calc(100% + 10px); width: 280px; background: var(--card); color: var(--text); border: 1px solid var(--line);
  border-radius: 14px; box-shadow: var(--shadow-lg); padding: 8px; z-index: 50; transform-origin: top right; animation: pop .18s var(--ease-out); }
.menu-who { display: flex; gap: 12px; align-items: center; padding: 10px 10px 14px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.menu-id { min-width: 0; } .menu-id > div { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-item { display: block; width: 100%; text-align: left; padding: 11px 12px; border: 0; background: none; color: inherit; font: inherit; border-radius: 9px; cursor: pointer; }
.menu-item:hover, .menu-item:focus-visible { background: var(--card-2); outline: none; }
.menu-item.danger { color: var(--red); }
main { padding: 36px 44px 96px; max-width: 1320px; width: 100%; min-width: 0; animation: rise .3s var(--ease-out); }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 28px; flex-wrap: wrap; }
.page-head .title { min-width: 0; }
.page-head .title p { margin: 6px 0 0; max-width: 640px; }
.page-head .eyebrow { margin-bottom: 4px; }
@media (max-width: 760px) {
  .topbar { padding: 10px 14px; padding-top: max(10px, env(safe-area-inset-top)); }
  .topbar .brand { font-size: 16px; gap: 9px; } .topbar .brand-logo { height: 22px; }
  .topbar { flex-wrap: wrap; } .topbar .brand-sub { display: none; }
  .navtabs { order: 3; width: 100%; margin: 4px 0 0; }
  main { padding: 22px 16px 40px; }
  h1 { font-size: 25px; }
  .page-head { margin-bottom: 18px; }
}

/* ---- surfaces ---- */
/* cards: depth from a soft shadow + hairline ring (no border on top of a shadow) */
.card { background: var(--card); border-radius: var(--radius); padding: 24px; border: 1px solid transparent; box-shadow: var(--ring), var(--shadow); min-width: 0; }
.card.flush { padding: 4px 8px; }
.card-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 18px; }
.card-head h2 { font: 600 17px/1.3 var(--serif); }
.card-head p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 28px; }
.stat { padding: 16px 18px; }
.stat-label { color: var(--muted); font-size: 13px; }
.stat-value { font: 600 28px/1.1 var(--serif); letter-spacing: -.02em; margin-top: 6px; font-variant-numeric: tabular-nums; }
/* colour carries meaning only: a green dot marks the online count (the teal accent stays for the one main action) */
.stat.on .stat-label::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--good); margin-right: 7px; vertical-align: 1px; }
@media (max-width: 760px) { .card { padding: 18px; } .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; } .stat { padding: 12px; } .stat-label { font-size: 13px; } .stat-value { font-size: 24px; } }

/* ---- controls ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid var(--line-2); background: var(--card); color: var(--text); font: inherit; font-size: 14px; font-weight: 500; padding: 9px 16px; border-radius: 11px; cursor: pointer; white-space: nowrap; text-decoration: none; transition: background .15s var(--ease-out), border-color .15s var(--ease-out), color .15s var(--ease-out), transform .16s var(--ease-out); }
.btn:hover { background: var(--card-2); text-decoration: none; }
/* press feedback: a small scale, released with the same curve */
.btn:active, .chip:active, .sec-tab:active, .seg button:active { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: default; transform: none; }
/* the one main action of a screen: flat accent, no gradient or glow */
.btn.primary { background: var(--accent-2); border-color: var(--accent-2); color: var(--accent-ink); box-shadow: 0 1px 2px rgba(40, 32, 10, .12); }
.btn.primary:hover { background: color-mix(in srgb, var(--accent-2) 88%, #000); border-color: transparent; }
.btn.dark { background: var(--ink); border-color: var(--ink); color: var(--ink-text); }
.btn.danger { background: transparent; border-color: color-mix(in srgb, var(--red) 50%, transparent); color: var(--red); }
.btn.danger:hover { background: var(--red-soft); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--text); background: var(--card-2); }
.btn.sm { padding: 6px 12px; font-size: 13px; border-radius: 9px; }
.btn.lg { padding: 13px 22px; font-size: 15px; border-radius: 13px; }
.btn.saved { background: var(--good); border-color: var(--good); color: #fff; }
.link-btn { background: none; border: 0; padding: 0; font: inherit; color: var(--accent-text); cursor: pointer; font-weight: 500; }
.link-btn:hover { text-decoration: underline; text-underline-offset: 3px; }
.icon-btn { background: transparent; border: 0; color: var(--muted); font: inherit; font-size: 15px; cursor: pointer; padding: 5px 9px; border-radius: 8px; }
.icon-btn:hover { color: var(--text); background: var(--card-2); }
.icon-btn:disabled { opacity: .3; cursor: default; }
input, select, textarea { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--line-2); border-radius: 11px; padding: 10px 12px; width: 100%; min-width: 0; transition: border-color .15s, box-shadow .15s; }
input::placeholder, textarea::placeholder { color: var(--faint); }
textarea { resize: vertical; min-height: 72px; }
/* One dropdown arrow everywhere: same chevron, 12px from the right, centred; text never runs under it. */
select { -webkit-appearance: none; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%239a9486' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); background-repeat: no-repeat;
  background-position: right 12px center; background-size: 12px 8px; padding-right: 36px; text-overflow: ellipsis; cursor: pointer; }
select::-ms-expand { display: none; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
input:disabled { opacity: .6; }
input[type=checkbox], input[type=radio] { width: 18px; height: 18px; accent-color: var(--accent); padding: 0; flex: none; }
.field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.field-label { font-size: 13px; font-weight: 500; }
.field-label .req { color: var(--accent-text); margin-left: 3px; }
.field-label .opt { color: var(--faint); font-weight: 400; margin-left: 6px; }
.hint { font-size: 13px; color: var(--muted); }
.field-err { font-size: 13px; color: var(--red); }
.field-err:empty { display: none; }
.field.bad input, .field.bad select, .field.bad textarea, .field.bad .chips { border-color: var(--red); }
.form { display: grid; gap: 18px; align-content: start; }
.form.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form.three { grid-template-columns: 2fr 1fr 1fr; }
.form .full { grid-column: 1 / -1; }
@media (max-width: 700px) { .form.two, .form.three { grid-template-columns: 1fr; } }
.pw { position: relative; }
.pw input { padding-right: 64px; }
.pw button { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); }

/* chips */
.chips { display: flex; flex-wrap: wrap; gap: 7px; border: 1px solid transparent; border-radius: 12px; }
.chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line-2); background: var(--surface); color: var(--text); font: inherit; font-size: 14px; padding: 7px 14px; border-radius: 999px; cursor: pointer; white-space: nowrap; transition: background .15s var(--ease-out), border-color .15s var(--ease-out), transform .16s var(--ease-out); }
.chip:hover { border-color: var(--accent-line); }
.chip[aria-pressed=true] { background: var(--accent-soft); border-color: var(--accent); color: var(--text); font-weight: 500; }
.chip[aria-pressed=true]::before { content: "✓"; color: var(--accent-text); font-weight: 700; }
.chip .n { font-variant-numeric: tabular-nums; color: var(--muted); font-weight: 500; }
.chip.static { cursor: default; }
.chip.static::before { content: none; }
.chip.tv { font-variant-numeric: tabular-nums; }
.chip.tv.dim { opacity: .5; text-decoration: line-through; }
.chip.x::after { content: "✕"; color: var(--muted); font-size: 11px; }
.seg { display: inline-flex; align-self: flex-start; max-width: 100%; padding: 3px; background: var(--card-2); border-radius: 12px; gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; font: inherit; font-size: 13px; padding: 6px 12px; border-radius: 9px; cursor: pointer; color: var(--muted); transition: color .2s var(--ease-out), transform .16s var(--ease-out); }
.seg button[aria-pressed=true] { background: var(--card); color: var(--text); box-shadow: var(--shadow); font-weight: 500; }

/* checklists */
.checklist { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 9px; }
@media (max-width: 500px) { .checklist { grid-template-columns: 1fr; } }
.choice { display: flex; flex-wrap: wrap; align-items: center; align-content: center; gap: 8px 11px; min-height: 50px; padding: 8px 12px 8px 14px; border: 1px solid var(--line); border-radius: 13px; cursor: pointer; background: var(--surface); transition: border-color .15s, background .15s; }
.choice:hover { border-color: var(--accent-line); }
.choice.on { border-color: var(--accent-line); background: var(--accent-soft); }
.choice .grow { flex: 1 1 0; min-width: 0; overflow-wrap: anywhere; }
.choice select { width: auto; padding: 5px 28px 5px 10px; font-size: 14px; background-position: right 9px center; background-size: 10px 7px; }
/* A ticked item's controls (times, hours, photo) sit on their own line under its name, lined up with the name. */
.choice > .row { flex: 1 0 100%; gap: 6px 8px; flex-wrap: wrap; padding-left: 29px; }
.choice > .row select { max-width: 100%; }
/* Short controls (extension "Dial 9") stay on the item's line, at the right. */
.choice > .row.inline { flex: none; padding-left: 0; margin-left: auto; flex-wrap: nowrap; }

/* setup page */
.sec { padding: 0; overflow: hidden; }
.sec > summary { list-style: none; display: flex; align-items: center; gap: 14px; padding: 18px 22px; cursor: pointer; }
.sec > summary::-webkit-details-marker { display: none; }
.sec > summary::after { content: ""; width: 8px; height: 8px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); margin: -4px 4px 0 auto; transition: transform .2s; flex: none; }
.sec[open] > summary::after { transform: rotate(225deg); margin-top: 4px; }
.sec > summary:hover { background: var(--card-2); }
.sec-ico { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); flex: none; font-size: 17px; }
.sec .sec-t { min-width: 0; }
.sec .sec-t b { display: block; font-size: 15px; font-weight: 600; letter-spacing: -.01em; }
.sec .sec-t span { display: block; color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sec.bad > summary .sec-ico { background: var(--red-soft); color: var(--red); }
.sec-body { padding: 20px 22px 24px; display: grid; gap: 18px; border-top: 1px solid var(--line); }
.card:not(.sec) > .sec-body { padding: 0; border: 0; }
.help { color: var(--muted); font-size: 14px; margin: 0; }
/* a group heading inside a form ("Guest Wi-Fi", "Welcome"): sentence case, like the fields it groups */
.section-title { font-size: 15px; font-weight: 600; letter-spacing: -.01em; color: var(--text); margin: 14px 0 0; padding-top: 18px; border-top: 1px solid var(--line); }
.sec-body > .section-title:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.section-title + .help { margin-top: -12px; }
.later { display: flex; gap: 14px; align-items: center; padding: 16px 20px; border: 1px dashed var(--line-2); border-radius: var(--radius); color: var(--muted); font-size: 14px; }
.later b { color: var(--text); }
.savebar { position: sticky; bottom: 16px; z-index: 6; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 14px 12px 20px; border-radius: 16px; background: var(--ink); color: var(--ink-text); box-shadow: var(--shadow-lg); animation: rise .26s var(--ease-out); }
.savebar .btn.ghost { color: var(--ink-muted); }
.savebar .btn.ghost:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.savebar .msg { font-size: 14px; }
.savebar .msg::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--accent-2); margin-right: 9px; vertical-align: 1px; }
/* the floating save bar never hides what is being edited: scrolling / focus keep fields above it (setup.js nudges a
   focused field that would sit under it), and the page ends with room for it */
html:has(.savebar:not([hidden])) { scroll-padding-bottom: 112px; }
main:has(.savebar:not([hidden])) { padding-bottom: 128px; }
.savebar { margin-top: 8px; }
@media (max-width: 760px) {
  .savebar { bottom: 12px; } .savebar .msg { width: 100%; }
  html:has(.savebar:not([hidden])) { scroll-padding-bottom: 210px; }
  main:has(.savebar:not([hidden])) { padding-bottom: 200px; }
}

/* images */
.img-pick { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.img-box { width: 176px; height: 64px; border: 1.5px dashed var(--line-2); border-radius: 12px; background: var(--card-2) center / contain no-repeat; display: grid; place-items: center; color: var(--faint); font-size: 13px; overflow: hidden; flex: none; cursor: pointer; }
.img-box.has { border-style: solid; border-color: var(--line); }
.img-box.dark { background-color: #15171c; }
.img-box.wide { width: 176px; height: 99px; background-size: cover; }

/* ---- badges / status ---- */
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 500; padding: 3px 10px; border-radius: 999px; background: var(--card-2); color: var(--text); border: 1px solid var(--line); white-space: nowrap; }
.badge.warn { background: color-mix(in srgb, var(--warn) 12%, transparent); border-color: color-mix(in srgb, var(--warn) 40%, transparent); color: var(--warn); }
.badge.ok { background: var(--good-soft); border-color: color-mix(in srgb, var(--good) 40%, transparent); color: var(--good); }
.badge.accent { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent-text); }
.online { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; white-space: nowrap; color: var(--muted); }
.online .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); flex: none; }
.online.on { color: var(--text); }
.online.on .dot { background: var(--good); box-shadow: 0 0 0 3px var(--good-soft); }
.alert { background: var(--red-soft); border: 1px solid color-mix(in srgb, var(--red) 40%, transparent); color: var(--red); padding: 11px 14px; border-radius: 12px; font-size: 14px; }
.note { background: var(--card-2); border: 1px solid var(--line); padding: 13px 16px; border-radius: 12px; font-size: 14px; }
.note.accent { background: var(--accent-soft); border-color: var(--accent-line); }

/* ---- tables ---- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
.table th { text-align: left; color: var(--muted); font-weight: 500; font-size: 13px; padding: 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 13px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; white-space: nowrap; }
.table .chk { width: 40px; }
.table tbody tr { cursor: pointer; }
.table tbody tr:hover td { background: var(--card-2); }
.table tr.sel td { background: var(--accent-soft); }
.table td.num .btn { border-color: transparent; background: transparent; color: var(--muted); }
.table tbody tr:hover td.num .btn, .table td.num .btn:focus-visible { border-color: var(--line-2); background: var(--card); color: var(--text); }
.table .sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
@media (max-width: 760px) {
  .tv-table thead { display: none; }
  .tv-table tr { display: grid; grid-template-columns: 34px 1fr auto; gap: 3px 8px; padding: 12px 4px; border-bottom: 1px solid var(--line); }
  .tv-table tr:last-child { border-bottom: 0; }
  .tv-table td { border: 0; padding: 1px 4px; background: none !important; }
  .tv-table td.chk { grid-row: span 4; padding-top: 3px; }
  .tv-table td.num { grid-column: 3; grid-row: 1 / span 2; }
  .tv-table td:not(.chk):not(.num) { grid-column: 2; }
}

/* toolbar + bulk bar */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .search { max-width: 300px; padding-left: 36px; background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23999180' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") 12px 50% / 16px no-repeat; }
.toolbar select { width: auto; }
.bulk { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; background: var(--ink); color: var(--ink-text); border-radius: var(--radius); padding: 10px 12px 10px 18px; margin-bottom: 14px; position: sticky; top: 12px; z-index: 8; box-shadow: var(--shadow-lg); animation: rise .26s var(--ease-out); }
.bulk select { width: auto; min-width: 160px; padding: 7px 34px 7px 10px; background-color: var(--ink-2); color: var(--ink-text); border-color: rgba(255, 255, 255, .14); }
.bulk .btn { background: var(--ink-2); border-color: rgba(255, 255, 255, .14); color: var(--ink-text); }
.bulk .btn:hover { background: #2a2d35; }
.bulk .btn.danger { color: #ff8f88; }
.bulk .btn.ghost { background: transparent; border-color: transparent; color: var(--ink-muted); }
@media (max-width: 760px) { main:has(.bulk:not([hidden])) { padding-bottom: 300px; } .bulk { position: fixed; left: 10px; right: 10px; top: auto; bottom: 12px; margin: 0; } }

/* room type cards */
.rule { display: inline-block; background: var(--card-2); border: 1px solid var(--line); border-radius: 8px; padding: 3px 9px; }
.preview { background: var(--card-2); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.preview .chips { max-height: 150px; overflow: auto; }

/* ---- modal / toast / empty ---- */
.backdrop { position: fixed; inset: 0; background: rgba(12, 10, 6, .55); backdrop-filter: blur(3px); display: grid; place-items: center; z-index: 50; padding: 16px; animation: fade .2s var(--ease-out); }
.backdrop.closing { pointer-events: none; animation: fade-out .16s var(--ease-out) forwards; }
.backdrop.closing .modal { animation: modal-out .16s var(--ease-out) forwards; }
@keyframes fade { from { opacity: 0; } }
.modal { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; width: 100%; max-width: 500px; max-height: calc(100vh - 32px); display: flex; flex-direction: column; box-shadow: var(--shadow-lg); animation: modal-in .24s var(--ease-out); }
.modal.wide { max-width: 780px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 22px 24px 8px; gap: 12px; }
.modal-head h2 { font: 600 20px/1.25 var(--serif); letter-spacing: -.015em; }
.modal-body { padding: 8px 24px 4px; overflow: auto; display: flex; flex-direction: column; gap: 16px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 16px 24px 22px; flex-wrap: wrap; }
.modal-actions .left { margin-right: auto; }
@media (max-width: 560px) { .backdrop { place-items: end stretch; padding: 0; } .modal, .modal.wide { max-width: none; border-radius: 20px 20px 0 0; max-height: 92vh; } }
#toasts { position: fixed; left: 50%; transform: translateX(-50%); top: 18px; display: flex; flex-direction: column; align-items: center; gap: 8px; z-index: 60; width: max-content; max-width: calc(100vw - 24px); }
.toast { display: flex; align-items: center; gap: 14px; background: var(--ink); color: var(--ink-text); padding: 12px 16px 12px 18px; border-radius: 14px; box-shadow: var(--shadow-lg); transition: opacity .2s var(--ease-out), transform .2s var(--ease-out); animation: pop .26s var(--ease-out); font-size: 14px; }
.toast::before { content: "✓"; color: var(--good); font-weight: 700; }
.toast.err::before { content: "!"; color: #ff8f88; }
.toast button { background: none; border: 0; color: var(--accent-2); font: inherit; font-weight: 600; cursor: pointer; padding: 2px 4px; }
.toast.out { opacity: 0; transform: translateY(-6px); }
@media (max-width: 760px) { #toasts { top: 70px; } }
.empty { text-align: center; padding: 56px 24px; color: var(--muted); background: var(--card); border-radius: var(--radius); border: 1px dashed var(--line-2); }
.empty h3 { color: var(--text); font: 600 17px/1.3 var(--serif); margin-bottom: 6px; }
.empty p { max-width: 460px; margin: 0 auto; }
.empty .btn { margin-top: 18px; }
.pin { font: 600 44px/1 var(--serif); letter-spacing: .32em; text-align: center; padding: 18px 0 18px .32em; background: var(--card-2); border-radius: 14px; font-variant-numeric: tabular-nums; color: var(--accent-text); }
.id-input { text-transform: uppercase; letter-spacing: .1em; font-size: 17px; }
.pin-input { letter-spacing: .45em; font-size: 20px; text-align: center; font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---- first TV / onboarding ---- */
.hero { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); gap: 32px; align-items: center; padding: 32px; }
.hero h2 { font: 600 28px/1.15 var(--serif); letter-spacing: -.022em; margin: 6px 0 8px; }
@media (max-width: 900px) { .hero { grid-template-columns: 1fr; padding: 22px; gap: 22px; } }
.steps { list-style: none; padding: 0; margin: 18px 0 20px; display: grid; gap: 10px; counter-reset: s; }
.steps li { display: flex; gap: 12px; align-items: flex-start; font-size: 15px; }
.steps li::before { counter-increment: s; content: counter(s); flex: none; width: 24px; height: 24px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-text); font-weight: 600; font-size: 13px; display: grid; place-items: center; margin-top: 1px; }
.done-list { display: grid; gap: 8px; }
.done-list .row { padding: 10px 14px; background: var(--card-2); border-radius: 12px; }
.bulk-rows { display: grid; gap: 8px; }
.bulk-row { display: grid; grid-template-columns: minmax(0, 1.6fr) 96px minmax(0, .8fr) 30px; gap: 8px; align-items: start; }
.bulk-row .st { grid-column: 1 / -1; font-size: 13px; margin-top: -2px; }
.bulk-row .st.bad { color: var(--red); }
.bulk-row .st.ok { color: var(--good); }
.bulk-row input { padding: 0 10px; height: 44px; font-size: 16px; }
.bulk-row .pin-input { letter-spacing: .25em; padding: 0 4px 0 calc(4px + .25em); }
.bulk-rows .bulk-row:only-child .icon-btn { visibility: hidden; }
.bulk-head { font-size: 13px; color: var(--muted); font-weight: 500; }

/* ---- auth ---- */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); background: var(--bg); }
.auth-art { background: radial-gradient(900px 600px at 0% 0%, rgba(43, 199, 159, .16), transparent 60%), radial-gradient(700px 500px at 100% 100%, rgba(43, 199, 159, .08), transparent 60%), var(--ink); color: var(--ink-text); padding: 48px; display: flex; flex-direction: column; justify-content: space-between; }
.auth-art blockquote { margin: 0; font: 500 34px/1.2 var(--serif); max-width: 460px; letter-spacing: -.025em; text-wrap: balance; }
.auth-art blockquote em { color: var(--accent-2); font-style: normal; }
.auth-art ul { list-style: none; padding: 0; margin: 28px 0 0; display: grid; gap: 10px; color: var(--ink-muted); }
.auth-art li::before { content: "✓"; color: var(--accent-2); margin-right: 10px; font-weight: 700; }
.auth-side { display: grid; place-items: center; padding: 32px 20px; }
.auth-card { width: 100%; max-width: 400px; }
.auth-card .brand { padding: 0 0 28px; display: none; }
.auth-card h1 { margin-bottom: 6px; }
.auth-card .btn.primary { width: 100%; padding: 13px; font-size: 15px; }
.auth-card .swap { text-align: center; margin-top: 22px; font-size: 14px; color: var(--muted); }
.auth-card .form { margin-top: 22px; }
@media (max-width: 860px) { .auth { grid-template-columns: 1fr; } .auth-art { display: none; } .auth-card .brand { display: flex; } }

/* ui.glass(): smoked fill, lighter at the top, hairline edge */

/* ---- Scan the code on a TV (Add TVs) ---- */
.scan-box { display: grid; gap: 10px; justify-items: start; }
.hero .scan-box { margin-bottom: 16px; } /* first-TV card: scanner above the TV ID / PIN / room row */
.scan-open { width: 100%; justify-content: center; font-size: 15px; padding: 12px 16px; }
.scan-view { position: relative; width: 100%; max-width: 360px; aspect-ratio: 1; border-radius: 14px; overflow: hidden; background: #000; justify-self: center; }
.scan-view video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scan-frame { position: absolute; inset: 18%; border: 3px solid var(--accent-2); border-radius: 16px; box-shadow: 0 0 0 999px rgba(0, 0, 0, .35); }
.scan-msg { font-size: 14px; color: var(--muted); }
.scan-msg.ok { color: var(--good); font-weight: 600; }
.scan-msg.bad { color: var(--red); }


/* Add TVs on a phone: the TV ID gets its own full line ("0000 0000 0000" fits), PIN · room · ✕ below it. */
@media (max-width: 560px) {
  .bulk-row { grid-template-columns: 96px minmax(0, 1fr) 30px; }
  .bulk-row > .field:first-child { grid-column: 1 / -1; }
  .bulk-row.bulk-head { display: none; }
}

/* Setup wizard progress */

/* TV snapshot (TV dialog → Screen) */

/* Phones and touch screens: 16px text in fields (no iOS zoom on tap) and finger-sized targets (≥ 40px). */
@media (max-width: 760px), (pointer: coarse) {
  input, select, textarea { font-size: 16px; }
  .choice select { font-size: 16px; padding: 8px 30px 8px 10px; }
  .btn, .btn.sm, .chip { min-height: 40px; }
  .seg button { min-height: 40px; padding: 8px 14px; font-size: 14px; }
  .icon-btn { min-width: 40px; min-height: 40px; }
  .link-btn, .auth-card .swap a { display: inline-block; padding: 10px 4px; }
  input[type=checkbox], input[type=radio] { width: 22px; height: 22px; }
  .brand-link { display: block; padding: 3px 0; }
}
/* A bare checkbox (TV list) gets a 40px tappable area around it. */
.hit { display: inline-grid; place-items: center; min-width: 40px; min-height: 40px; cursor: pointer; margin: -9px; }
@media (max-width: 760px), (pointer: coarse) { .note a[href^="mailto:"] { display: inline-block; padding: 10px 0; } }


/* Hotel page: one tab per section (scrolls sideways on a phone) */
.sec-tabs { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 2px 2px 4px; margin: 0 -2px; -webkit-overflow-scrolling: touch; }
.sec-tabs::-webkit-scrollbar { display: none; }
.sec-tab { flex: none; border: 1px solid var(--line-2); background: var(--card); color: var(--muted); font: inherit; font-size: 14px; font-weight: 500; padding: 9px 16px;
  min-height: 40px; border-radius: 999px; cursor: pointer; white-space: nowrap; transition: color .2s var(--ease-out), border-color .2s var(--ease-out), transform .16s var(--ease-out); }
.sec-tab:hover { color: var(--text); }
.sec-tab.on { background: var(--text); border-color: var(--text); color: var(--bg); }
.sec-tab.bad { border-color: var(--red); color: var(--red); }
.sec-tab.on.bad { background: var(--red); border-color: var(--red); color: #fff; }
/* The scrollable tab strip must not widen its grid column (phones): columns never grow past the screen. */

/* Sliding selection pill (ui.glide): one pill moves under the chosen segment / tab instead of each one switching on. */
.gliding { position: relative; isolation: isolate; }
.glider { position: absolute; left: 0; top: 0; z-index: -1; pointer-events: none; opacity: 0;
  transition: transform .28s var(--ease-out), width .28s var(--ease-out), height .28s var(--ease-out), opacity .15s; }
.seg .glider { border-radius: 9px; background: var(--card); box-shadow: var(--ring), var(--shadow); }
.seg.gliding button[aria-pressed=true] { background: transparent; box-shadow: none; }
.sec-tabs .glider { border-radius: 999px; background: var(--text); }
.sec-tabs.gliding .sec-tab.on:not(.bad) { background: transparent; border-color: transparent; }

/* Reduced motion: keep fades and state changes, drop movement. */
@media (prefers-reduced-motion: reduce) {
  *, ::before, ::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .spin { animation-duration: .8s !important; animation-iteration-count: infinite !important; }
}

/* ---- Signage: TVs page ---- */
.stats { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.stat.warn .stat-value { color: var(--warn); }
.stat-sub { margin-top: 2px; }
@media (max-width: 760px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
/* The TV's pairing screen beside the first-TV steps (teal-tinted, like the launcher's Signage mode). */
@media (max-width: 900px) { .hero .tvmock { order: -1; } }
.tvmock { aspect-ratio: 16 / 9; border-radius: 12px; background: radial-gradient(120% 90% at 20% 0%, #0f2a23, #0b0c0f 60%); outline: 7px solid #050506; box-shadow: var(--shadow-lg); color: #e6ece9; display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 6%; padding: 7% 8%; font-size: clamp(9px, 1.25vw, 13px); }
.tvmock .t { font: 600 1.7em/1.2 var(--sans); margin-bottom: 1em; }
.tvmock .k { color: #8fa39c; font-size: .8em; letter-spacing: .12em; text-transform: uppercase; }
.tvmock .v { font: 600 1.45em/1.3 ui-monospace, Menlo, monospace; letter-spacing: .08em; margin-bottom: .8em; color: #5ad8b6; }
.tvmock .q { width: 7em; aspect-ratio: 1; border-radius: 6px; background: conic-gradient(#fff 0 25%, #111 0 50%, #fff 0 75%, #111 0) 0 0 / 1.75em 1.75em; outline: .5em solid #fff; }
/* Orientation glyph: a small screen outline, wide or tall. */
.orient { display: inline-block; flex: none; border: 1.6px solid currentColor; border-radius: 3px; opacity: .7; }
.orient.landscape { width: 18px; height: 11px; }
.orient.portrait { width: 11px; height: 18px; }
.tv-name { display: flex; align-items: center; gap: 9px; }
.tv-table .sub { margin-top: 2px; }
.tag { display: inline-flex; align-items: center; font-size: 12px; font-weight: 500; padding: 3px 9px; border-radius: 999px; background: var(--card-2); color: var(--muted); white-space: nowrap; }
.chips.tight { gap: 5px; }
/* Orientation picker: two cards with the screen drawn to scale. */
.orient-pick { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.orient-card { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border: 1px solid var(--line-2); border-radius: 12px; background: var(--surface);
  color: var(--text); font: inherit; text-align: left; cursor: pointer; transition: border-color .15s var(--ease-out), background .15s var(--ease-out); }
.orient-card:hover { border-color: var(--accent-line); }
.orient-card.on { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 1px var(--accent) inset; }
.orient-screen { flex: none; border: 2px solid var(--text); border-radius: 4px; background: linear-gradient(135deg, var(--accent-soft), transparent); }
.orient-screen.landscape { width: 44px; height: 26px; }
.orient-screen.portrait { width: 26px; height: 44px; margin: 0 9px; }
.orient-text { display: grid; gap: 2px; }
.tag-pick { display: grid; gap: 12px; }
.tag-group { display: grid; gap: 6px; }
.tag-add { display: flex; gap: 6px; align-items: center; }
.tag-add input { width: 200px; }
.grid-2, .grid-3 { display: grid; gap: 12px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 600px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } .orient-pick { grid-template-columns: 1fr; } }
.tv-info { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px 18px; padding: 14px 16px; border-radius: 12px; background: var(--card-2); }
.kv { display: grid; gap: 3px; min-width: 0; } .kv > span:last-child { overflow: hidden; text-overflow: ellipsis; }

/* ---- Signage: media page ---- */
.storage-card { display: grid; gap: 14px; margin-bottom: 22px; }
.storage-top { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.storage-of { font: 400 15px/1 var(--sans); letter-spacing: 0; }
.storage-split { display: flex; gap: 16px; flex-wrap: wrap; }
.storage-split .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: 0; }
.storage-split .dot.img { background: var(--accent); } .storage-split .dot.vid { background: var(--blue); }
.storage-card .meter-label { display: none; }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 16px; }
.media-card { display: grid; gap: 0; padding: 0; text-align: left; border: 1px solid var(--line); border-radius: 14px; background: var(--card); color: inherit; font: inherit;
  overflow: hidden; cursor: pointer; box-shadow: var(--ring); transition: transform .2s var(--ease-out), box-shadow .2s var(--ease-out), border-color .2s; }
.media-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--line-2); }
.media-thumb { position: relative; aspect-ratio: 16 / 10; background: #0d0f12; display: grid; place-items: center; overflow: hidden; }
.media-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; display: block; }
.media-none { color: #6d7480; font-size: 28px; }
.media-dur, .media-warn { position: absolute; bottom: 8px; font: 600 12px/1 var(--sans); padding: 5px 8px; border-radius: 6px; background: rgba(0, 0, 0, .7); color: #fff; }
.media-dur { right: 8px; font-variant-numeric: tabular-nums; } .media-warn { left: 8px; background: rgba(168, 107, 0, .9); }
.media-meta { display: grid; gap: 3px; padding: 12px 14px 14px; min-width: 0; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.media-view { border-radius: 12px; overflow: hidden; background: #000; display: grid; place-items: center; max-height: 56vh; }
.media-view img, .media-view video { max-width: 100%; max-height: 56vh; display: block; }
/* Drop zone + page-wide drag highlight. */
.drop { display: grid; justify-items: center; gap: 6px; width: 100%; padding: 28px; border: 1.5px dashed var(--line-2); border-radius: 16px; background: var(--surface);
  color: inherit; font: inherit; cursor: pointer; transition: border-color .2s, background .2s; }
.drop.big { padding: 64px 24px; }
.drop:hover, body.dragging .drop { border-color: var(--accent); background: var(--accent-soft); }
.drop-ico { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); font-size: 20px; font-weight: 700; }
body.dragging main { outline: 2px dashed var(--accent); outline-offset: -12px; border-radius: 18px; }
/* Upload queue. */
.upq-card { display: grid; gap: 12px; margin-bottom: 18px; }
.upq-head { display: flex; justify-content: space-between; align-items: center; }
.upq-row { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(80px, 1fr) minmax(0, 1.3fr); gap: 14px; align-items: center; }
.upq-name { display: flex; align-items: center; gap: 9px; min-width: 0; }
.upq-ico { flex: none; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; background: var(--card-2); color: var(--muted); }
.upq-row.done .upq-ico { background: var(--good-soft); color: var(--good); } .upq-row.err .upq-ico { background: var(--red-soft); color: var(--red); }
.upq-bar { height: 6px; border-radius: 3px; background: var(--card-2); overflow: hidden; }
.upq-bar > span { display: block; height: 100%; background: var(--accent); border-radius: 3px; transition: width .2s linear; }
.upq-row.err .upq-bar > span { background: var(--red); }
.bad-text { color: var(--red); } .warn-text { color: var(--warn); }
@media (max-width: 700px) { .upq-row { grid-template-columns: 1fr; gap: 6px; } .media-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; } }
