/* ==========================================================================
   CueBox — dark, high-contrast, big touch targets.
   Designed to be readable at arm's length in a dark booth.
   ========================================================================== */

:root {
  --bg: #0b0d10;
  --bg-1: #12161b;
  --bg-2: #1a2028;
  --bg-3: #232b35;
  --line: #2c3644;
  --text: #eef3f8;
  --muted: #93a2b4;
  --accent: #37d4a0;
  --accent-dim: #1f8f6c;
  --accent-text: #04211a;
  --danger: #ff5f56;
  --warn: #ffb44a;
  --radius: 14px;
  --tap: 56px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overscroll-behavior: none;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--bg-3); border-radius: 6px; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- login / setup ------------------------------------------------ */

.auth-wrap {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: radial-gradient(1000px 600px at 50% -10%, #14202a 0%, var(--bg) 60%);
}

.auth-card {
  width: min(420px, 100%);
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 32px 28px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .5);
}

.auth-card h1 {
  margin: 0 0 4px;
  font-size: 26px;
  letter-spacing: -.02em;
}

.auth-card p.sub {
  margin: 0 0 24px;
  color: var(--muted);
  font-size: 15px;
}

.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  margin-bottom: 6px;
}

input[type="text"], input[type="password"], input[type="number"], textarea, select {
  width: 100%;
  min-height: var(--tap);
  padding: 12px 14px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  outline: none;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(55, 212, 160, .18);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--tap);
  padding: 0 20px;
  background: var(--bg-3);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-weight: 600;
  transition: filter .12s ease, transform .06s ease;
}
.btn:hover { filter: brightness(1.15); }
.btn:active { transform: scale(.98); }
.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
}
.btn.danger { color: var(--danger); border-color: #4a2b2b; }
.btn.ghost { background: transparent; }
.btn.wide { width: 100%; }
.btn.small { min-height: 40px; padding: 0 14px; font-size: 14px; }
.btn[disabled] { opacity: .45; pointer-events: none; }

.error-msg {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: rgba(255, 95, 86, .12);
  border: 1px solid rgba(255, 95, 86, .35);
  color: #ffb3ae;
  font-size: 14px;
}
.error-msg:empty { display: none; }

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

.app {
  display: grid;
  grid-template-columns: 260px 1fr;
  grid-template-rows: 1fr auto;
  grid-template-areas: "nav main" "bar bar";
  height: 100dvh;
}

.sidebar {
  grid-area: nav;
  background: var(--bg-1);
  border-right: 1px solid var(--line);
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 10px 18px;
  font-weight: 800;
  font-size: 19px;
  letter-spacing: -.02em;
}
.brand .dot {
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent);
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 50px;
  padding: 0 14px;
  border: 0;
  background: transparent;
  border-radius: 12px;
  font-weight: 600;
  color: var(--muted);
  text-align: left;
}
.nav-btn:hover { background: var(--bg-2); color: var(--text); }
.nav-btn.active { background: var(--bg-3); color: var(--text); }
.nav-btn svg { flex: none; }

.sidebar .spacer { flex: 1; }

.device-picker {
  border-top: 1px solid var(--line);
  padding-top: 14px;
  margin-top: 8px;
}
.device-picker .label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
  margin-bottom: 6px;
  padding: 0 4px;
}

.main {
  grid-area: main;
  overflow-y: auto;
  padding: 28px 32px 32px;
  -webkit-overflow-scrolling: touch;
}

.view { display: none; }
.view.active { display: block; animation: fade .18s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.view-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}
.view-head h2 {
  margin: 0;
  font-size: 28px;
  letter-spacing: -.02em;
}
.view-head .sub { color: var(--muted); font-size: 14px; margin: 2px 0 0; }

/* ---------- now playing -------------------------------------------------- */

.np {
  display: grid;
  grid-template-columns: minmax(0, 340px) minmax(0, 1fr);
  gap: 34px;
  align-items: start;
}

.np-art {
  aspect-ratio: 1;
  border-radius: 20px;
  background: linear-gradient(145deg, var(--bg-3), var(--bg-1));
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  position: relative;
  overflow: hidden;
}
.np-art .glyph { width: 42%; height: 42%; opacity: .3; }
.np-art.playing::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 60%, rgba(55, 212, 160, .16), transparent 65%);
  animation: pulse 3.2s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: .5; } 50% { opacity: 1; } }

.np-title {
  font-size: clamp(24px, 3.4vw, 40px);
  font-weight: 800;
  letter-spacing: -.03em;
  line-height: 1.15;
  margin: 0 0 6px;
  overflow-wrap: anywhere;
}
.np-artist { color: var(--muted); font-size: 18px; margin: 0 0 4px; }
.np-source { color: var(--accent); font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; }

.scrubber { margin: 26px 0 8px; }
.time-row {
  display: flex;
  justify-content: space-between;
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  color: var(--muted);
  margin-top: 6px;
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 28px;
  background: transparent;
  outline: none;
  margin: 0;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 8px;
  border-radius: 99px;
  background: linear-gradient(to right, var(--accent) var(--pct, 0%), var(--bg-3) var(--pct, 0%));
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px; height: 22px;
  margin-top: -7px;
  border-radius: 50%;
  background: #fff;
  border: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .5);
}
input[type="range"]::-moz-range-track {
  height: 8px; border-radius: 99px; background: var(--bg-3);
}
input[type="range"]::-moz-range-progress { height: 8px; border-radius: 99px; background: var(--accent); }
input[type="range"]::-moz-range-thumb {
  width: 22px; height: 22px; border-radius: 50%; background: #fff; border: 0;
}

.transport {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 18px 0 22px;
  flex-wrap: wrap;
}
.tbtn {
  width: 62px; height: 62px;
  border-radius: 50%;
  background: var(--bg-2);
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  transition: transform .06s ease, filter .12s ease;
}
.tbtn:hover { filter: brightness(1.2); }
.tbtn:active { transform: scale(.94); }
.tbtn.play {
  width: 84px; height: 84px;
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
}
.tbtn svg { width: 26px; height: 26px; }
.tbtn.play svg { width: 34px; height: 34px; }

.toggles { display: flex; gap: 10px; flex-wrap: wrap; }
.toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 16px;
  border-radius: 99px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  color: var(--muted);
  font-weight: 600;
  font-size: 14px;
}
.toggle.on {
  background: rgba(55, 212, 160, .16);
  border-color: var(--accent-dim);
  color: var(--accent);
}

.vol-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 22px;
  max-width: 420px;
}
.vol-row svg { flex: none; color: var(--muted); }
.vol-val { font-variant-numeric: tabular-nums; color: var(--muted); width: 46px; text-align: right; font-size: 14px; }

/* ---------- queue / lists ------------------------------------------------ */

.panel {
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  font-weight: 700;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
}

.track-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(44, 54, 68, .5);
  min-height: 64px;
}
.track-row:last-child { border-bottom: 0; }
.track-row:hover { background: var(--bg-2); }
.track-row.current { background: rgba(55, 212, 160, .1); }
.track-row.played .t-title { color: var(--muted); }

.t-index {
  width: 28px;
  text-align: center;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-size: 14px;
  flex: none;
}
.t-main { flex: 1; min-width: 0; }
.t-title {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.t-sub {
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.t-dur { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 14px; flex: none; }
.t-actions { display: flex; gap: 6px; flex: none; }

.icon-btn {
  width: 42px; height: 42px;
  border-radius: 10px;
  background: transparent;
  border: 1px solid transparent;
  display: grid;
  place-items: center;
  color: var(--muted);
}
.icon-btn:hover { background: var(--bg-3); color: var(--text); }
.icon-btn.danger:hover { color: var(--danger); }

.badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 99px;
  background: var(--bg-3);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  color: var(--muted);
  text-transform: uppercase;
}
.badge.ok { background: rgba(55, 212, 160, .16); color: var(--accent); }
.badge.warn { background: rgba(255, 180, 74, .15); color: var(--warn); }

/* ---------- playlists ---------------------------------------------------- */

.pl-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 18px;
}

.pl-card {
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 178px;
  transition: transform .1s ease, border-color .12s ease;
}
.pl-card:hover { transform: translateY(-2px); border-color: var(--accent-dim); }
.pl-card h3 {
  margin: 0;
  font-size: 19px;
  letter-spacing: -.01em;
  overflow-wrap: anywhere;
}
.pl-card .meta { color: var(--muted); font-size: 13px; }
.pl-card .desc {
  color: var(--muted);
  font-size: 13px;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.pl-card .row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.dl-bar {
  height: 6px;
  border-radius: 99px;
  background: var(--bg-3);
  overflow: hidden;
}
.dl-bar > div { height: 100%; background: var(--accent); width: 0; transition: width .2s ease; }

/* ---------- library / upload --------------------------------------------- */

.dropzone {
  border: 2px dashed var(--line);
  border-radius: 18px;
  padding: 34px 20px;
  text-align: center;
  color: var(--muted);
  background: var(--bg-1);
  margin-bottom: 22px;
  transition: border-color .12s ease, background .12s ease;
}
.dropzone.over { border-color: var(--accent); background: rgba(55, 212, 160, .07); }
.dropzone h3 { margin: 10px 0 4px; color: var(--text); font-size: 18px; }

/* Compact drop area used on the playlist screen. */
.dropzone.compact {
  display: flex;
  align-items: center;
  gap: 14px;
  text-align: left;
  padding: 16px 18px;
  margin-bottom: 18px;
}
.dropzone.compact strong { color: var(--text); font-size: 15px; }

/* Playlist cards accept dropped files directly. */
.pl-card.drop-over {
  border-color: var(--accent);
  background: rgba(55, 212, 160, .1);
  transform: translateY(-2px);
  box-shadow: 0 0 0 2px var(--accent-dim) inset;
}
.pl-card .drop-hint {
  display: none;
  color: var(--accent);
  font-weight: 700;
  font-size: 13px;
}
.pl-card.drop-over .drop-hint { display: block; }

/* Upload progress floats above everything, so it stays visible no matter
   which screen you dropped the files onto. */
.upload-tray {
  position: fixed;
  right: 18px;
  bottom: calc(96px + var(--safe-b));
  width: min(380px, calc(100vw - 32px));
  max-height: 46dvh;
  overflow-y: auto;
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .55);
  /* Below the modal (60): an upload in progress must never sit on top of a
     dialog and swallow clicks meant for its buttons. */
  z-index: 50;
}
.upload-tray-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 10px 10px 16px;
  border-bottom: 1px solid var(--line);
  font-weight: 700;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  position: sticky;
  top: 0;
  background: var(--bg-1);
}
@media (max-width: 899px) {
  .upload-tray { right: 12px; left: 12px; width: auto; bottom: calc(140px + var(--safe-b)); }
}

.upload-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid rgba(44, 54, 68, .5);
  font-size: 14px;
}
.upload-item .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-item .state { color: var(--muted); font-size: 13px; flex: none; }
.upload-item.err .state { color: var(--danger); }
.upload-item.done .state { color: var(--accent); }

.search-input { max-width: 320px; }

/* ---------- settings ----------------------------------------------------- */

.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 18px;
  align-items: start;
}
.setting {
  padding: 18px;
  border-bottom: 1px solid rgba(44, 54, 68, .5);
}
.setting:last-child { border-bottom: 0; }
.setting h4 { margin: 0 0 4px; font-size: 15px; }
.setting p { margin: 0 0 12px; color: var(--muted); font-size: 13px; }
.setting .row { display: flex; align-items: center; gap: 12px; }

.switch {
  position: relative;
  width: 56px; height: 32px;
  border-radius: 99px;
  background: var(--bg-3);
  border: 1px solid var(--line);
  flex: none;
  transition: background .15s ease;
}
.switch::after {
  content: "";
  position: absolute;
  top: 3px; left: 3px;
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--muted);
  transition: transform .15s ease, background .15s ease;
}
.switch.on { background: rgba(55, 212, 160, .3); border-color: var(--accent-dim); }
.switch.on::after { transform: translateX(24px); background: var(--accent); }

/* ---------- remote view -------------------------------------------------- */

.device-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  border-bottom: 1px solid rgba(44, 54, 68, .5);
  min-height: 76px;
}
.device-card:last-child { border-bottom: 0; }
.device-card .info { flex: 1; min-width: 0; }
.device-card .info .name { font-weight: 700; font-size: 16px; }
.device-card .info .now { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.device-card.selected { background: rgba(55, 212, 160, .1); }
.pulse-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--muted);
  flex: none;
}
.pulse-dot.live { background: var(--accent); box-shadow: 0 0 0 0 rgba(55, 212, 160, .6); animation: ring 2s infinite; }
@keyframes ring {
  0% { box-shadow: 0 0 0 0 rgba(55, 212, 160, .55); }
  70% { box-shadow: 0 0 0 10px rgba(55, 212, 160, 0); }
  100% { box-shadow: 0 0 0 0 rgba(55, 212, 160, 0); }
}

.conn-url {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: clamp(18px, 4vw, 30px);
  font-weight: 700;
  color: var(--accent);
  word-break: break-all;
}

/* ---------- bottom bar (mini player) ------------------------------------- */

.bar {
  grid-area: bar;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 18px calc(10px + var(--safe-b));
  background: var(--bg-1);
  border-top: 1px solid var(--line);
  min-height: 78px;
}
.bar .bar-info { flex: 1; min-width: 0; }
.bar .bar-title { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar .bar-sub { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar .bar-controls { display: flex; align-items: center; gap: 10px; flex: none; }
.bar .tbtn { width: 52px; height: 52px; }
.bar .tbtn.play { width: 60px; height: 60px; }
.bar-progress {
  position: absolute;
  left: 0; right: 0;
  height: 3px;
  background: var(--bg-3);
}
.bar-progress > div { height: 100%; background: var(--accent); width: 0; }

/* ---------- mobile nav --------------------------------------------------- */

.tabbar { display: none; }

@media (max-width: 899px) {
  .app {
    grid-template-columns: 1fr;
    grid-template-areas: "main" "bar" "tabs";
  }
  .sidebar { display: none; }
  .main { padding: 18px 16px 20px; }
  .tabbar {
    grid-area: tabs;
    display: grid;
    grid-auto-flow: column;
    background: var(--bg-1);
    border-top: 1px solid var(--line);
    padding-bottom: var(--safe-b);
  }
  .tabbar button {
    background: transparent;
    border: 0;
    color: var(--muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 9px 0;
    font-size: 11px;
    font-weight: 600;
    min-height: 62px;
  }
  .tabbar button.active { color: var(--accent); }
  .np { grid-template-columns: 1fr; gap: 20px; }
  .np-art { max-width: 260px; margin: 0 auto; }
  .view-head h2 { font-size: 23px; }
  .bar { min-height: 68px; padding: 8px 14px; }
  .bar .tbtn { width: 46px; height: 46px; }
  .bar .tbtn.play { width: 54px; height: 54px; }
  .settings-grid { grid-template-columns: 1fr; }
}

/* ---------- show mode: giant controls for live operation ----------------- */

body.show-mode .sidebar,
body.show-mode .tabbar,
body.show-mode .bar { display: none; }
body.show-mode .app { grid-template-columns: 1fr; grid-template-areas: "main"; }
body.show-mode .main { padding: 0; display: grid; }
body.show-mode .view { display: none !important; }
body.show-mode #view-show { display: grid !important; }

.show-screen {
  display: none;
  grid-template-rows: auto 1fr auto;
  height: 100dvh;
  padding: 20px clamp(16px, 3vw, 40px) calc(20px + var(--safe-b));
  gap: 16px;
}
.show-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
.show-playlist {
  font-size: clamp(14px, 2vw, 20px);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--accent);
}
.show-mid {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 10px;
  min-height: 0;
}
.show-title {
  font-size: clamp(34px, 7vw, 86px);
  font-weight: 900;
  letter-spacing: -.035em;
  line-height: 1.05;
  margin: 0;
  overflow-wrap: anywhere;
}
.show-artist {
  font-size: clamp(18px, 3vw, 34px);
  color: var(--muted);
  margin: 0;
}
.show-next {
  margin-top: 14px;
  font-size: clamp(14px, 1.8vw, 20px);
  color: var(--muted);
}
.show-next b { color: var(--text); font-weight: 700; }
.show-time {
  font-variant-numeric: tabular-nums;
  font-size: clamp(16px, 2.4vw, 26px);
  color: var(--muted);
}
.show-bar { height: 12px; border-radius: 99px; background: var(--bg-3); overflow: hidden; }
.show-bar > div { height: 100%; background: var(--accent); width: 0; }
.show-controls {
  display: grid;
  grid-template-columns: 1fr 1.5fr 1fr;
  gap: clamp(12px, 2vw, 24px);
}
.show-btn {
  min-height: clamp(90px, 16vh, 150px);
  border-radius: 22px;
  background: var(--bg-2);
  border: 2px solid var(--line);
  display: grid;
  place-items: center;
  gap: 6px;
  font-size: clamp(13px, 1.6vw, 18px);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.show-btn svg { width: clamp(34px, 5vw, 56px); height: clamp(34px, 5vw, 56px); }
.show-btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.show-btn:active { transform: scale(.97); }

/* ---------- modal -------------------------------------------------------- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .65);
  display: none;
  place-items: center;
  padding: 20px;
  z-index: 60;
  backdrop-filter: blur(3px);
}
.modal-backdrop.open { display: grid; }
.modal {
  width: min(620px, 100%);
  max-height: 86dvh;
  overflow-y: auto;
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 24px;
}
.modal h3 { margin: 0 0 16px; font-size: 21px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; flex-wrap: wrap; }

/* ---------- toast -------------------------------------------------------- */

.toasts {
  position: fixed;
  left: 50%;
  bottom: calc(96px + var(--safe-b));
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 80;
  pointer-events: none;
  width: min(440px, calc(100vw - 32px));
}
.toast {
  background: var(--bg-3);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 13px 16px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 12px 32px rgba(0, 0, 0, .5);
  animation: toastin .2s ease;
}
.toast.err { border-color: rgba(255, 95, 86, .5); color: #ffb3ae; }
.toast.action {
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: auto;   /* the container ignores pointers; this one must not */
  border-color: var(--accent-dim);
}
.toast.action .btn { flex: none; }
.toast.ok { border-color: var(--accent-dim); color: var(--accent); }
@keyframes toastin { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ---------- misc --------------------------------------------------------- */

.empty {
  text-align: center;
  padding: 50px 20px;
  color: var(--muted);
}
.empty h3 { color: var(--text); margin: 12px 0 6px; }

.chip-row { display: flex; gap: 8px; flex-wrap: wrap; }
.hidden { display: none !important; }
.mono { font-variant-numeric: tabular-nums; }
.stack { display: flex; flex-direction: column; gap: 18px; }
.rowflex { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }
.muted { color: var(--muted); }
.tiny { font-size: 12px; }

.offline-banner {
  background: rgba(255, 180, 74, .14);
  border: 1px solid rgba(255, 180, 74, .4);
  color: var(--warn);
  padding: 10px 16px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 18px;
}

/* "This isn't on the device yet" warnings. Amber rather than red: nothing is
   broken, but somebody should act before they leave for the venue. */
.warn-banner {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  background: rgba(255, 180, 74, .12);
  border: 1px solid rgba(255, 180, 74, .38);
  color: var(--warn);
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 18px;
}
.warn-banner .btn {
  border-color: rgba(255, 180, 74, .5);
  color: var(--warn);
  background: rgba(255, 180, 74, .1);
  flex: none;
}
.warn-banner b { color: #ffd7a1; }
