/* ============================================================
   Beacon Admin — warm-gray canvas, near-ink text, one accent.
   8px grid, 8px radii, borders over shadows, system fonts.
   ============================================================ */

:root {
  --accent: #0E7A5F;
  --accent-ink: color-mix(in srgb, var(--accent) 82%, #000);
  --accent-soft: color-mix(in srgb, var(--accent) 8%, #fff);
  --accent-soft-2: color-mix(in srgb, var(--accent) 14%, #fff);
  --accent-line: color-mix(in srgb, var(--accent) 32%, #fff);

  --canvas: #F4F3EF;
  --surface: #FFFFFF;
  --surface-2: #FAF9F6;
  --surface-3: #EFEDE7;

  --ink: #1D1C18;
  --ink-2: #454239;
  --muted: #7C786C;
  --faint: #A6A295;

  --line: #E6E3DB;
  --line-strong: #D5D1C6;

  --danger: #B2422E;
  --danger-soft: #FBEFEC;
  --amber: #93690B;
  --amber-soft: #FAF3E0;

  /* Health semantics — fixed, never rebranded: a monitoring tool's
     online/offline colors must not follow the accent. */
  --ok: #1E7A3B;
  --ok-soft: #E7F1E5;

  --r: 8px;
  --r-lg: 12px;
  --font: -apple-system, "Segoe UI", Roboto, Inter, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;

  --shadow-pop: 0 12px 32px rgba(29, 28, 24, .14), 0 2px 8px rgba(29, 28, 24, .08);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { height: 100%; }
body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--canvas);
  min-height: 100%;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
::placeholder { color: var(--faint); }
.num, .badge, .stat-n, .code-box, td { font-variant-numeric: tabular-nums; }

/* ---------- Shell ---------- */

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

.sidebar {
  width: 232px; flex: 0 0 232px;
  display: flex; flex-direction: column;
  border-right: 1px solid var(--line);
  background: var(--canvas);
  position: sticky; top: 0; height: 100vh;
  padding: 20px 12px 16px;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none; padding: 4px 10px 20px;
}
.brand-mark { width: 26px; height: 26px; }
.brand-name { font-size: 17px; font-weight: 700; letter-spacing: -0.02em; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: var(--r);
  text-decoration: none; color: var(--ink-2); font-weight: 500;
  position: relative; transition: background .12s ease, color .12s ease;
}
.nav-item svg { width: 19px; height: 19px; color: var(--muted); transition: color .12s ease; }
.nav-item:hover { background: var(--surface-3); color: var(--ink); }
.nav-item:hover svg { color: var(--ink-2); }
.nav-item.active { background: var(--accent-soft-2); color: var(--accent-ink); font-weight: 600; }
.nav-item.active svg { color: var(--accent); }
.nav-item.active::before {
  content: ""; position: absolute; left: -12px; top: 7px; bottom: 7px;
  width: 3px; border-radius: 0 2px 2px 0; background: var(--accent);
}
.nav-badge {
  margin-left: auto; font-size: 11px; font-weight: 600;
  color: var(--muted); background: var(--surface-3);
  border-radius: 999px; padding: 1px 7px;
  font-variant-numeric: tabular-nums;
}
.nav-item.active .nav-badge { background: color-mix(in srgb, var(--accent) 16%, #fff); color: var(--accent-ink); }
.nav-badge.live { background: color-mix(in srgb, var(--accent) 16%, #fff); color: var(--accent-ink); }

.sidebar-foot { margin-top: auto; padding: 12px 10px 0; border-top: 1px solid var(--line); }
.side-org { font-size: 13px; font-weight: 600; margin-bottom: 10px; color: var(--ink-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-label { font-size: 10.5px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--faint); margin-bottom: 4px; }
.side-url {
  display: flex; align-items: center; gap: 6px; width: 100%;
  background: var(--surface); border: 1px solid var(--line); border-radius: 6px;
  padding: 5px 8px; cursor: pointer; text-align: left;
  transition: border-color .12s ease;
}
.side-url:hover { border-color: var(--line-strong); }
.side-url svg { width: 14px; height: 14px; color: var(--muted); flex: none; }
.side-url-text {
  font-family: var(--mono); font-size: 11px; color: var(--ink-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1;
}
.side-stat { margin-top: 10px; font-size: 12px; color: var(--muted); }
.side-stat b { color: var(--ink-2); font-weight: 600; }

.main { flex: 1; min-width: 0; padding: 28px 32px 64px; max-width: 1280px; }

/* ---------- Page head ---------- */

.page-head { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 20px; }
.page-head-info { flex: 1; min-width: 0; }
.page-title { font-size: 21px; font-weight: 650; letter-spacing: -0.015em; margin: 0; }
.page-sub { color: var(--muted); font-size: 13px; margin-top: 3px; }
.page-sub b { color: var(--ink-2); font-weight: 600; }
.page-actions { display: flex; gap: 8px; align-items: center; flex: none; padding-top: 2px; }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 7px 14px; border-radius: var(--r);
  border: 1px solid var(--line-strong); background: var(--surface);
  font-size: 13.5px; font-weight: 550; color: var(--ink); cursor: pointer;
  transition: background .12s ease, border-color .12s ease, transform .06s ease, box-shadow .12s ease;
  white-space: nowrap; user-select: none;
}
.btn:hover { background: var(--surface-2); border-color: var(--faint); }
.btn:active { transform: translateY(1px); }
.btn svg { width: 15px; height: 15px; }
.btn:disabled { opacity: .5; cursor: default; pointer-events: none; }

.btn-primary {
  background: var(--accent); border-color: var(--accent); color: #fff;
}
.btn-primary:hover { background: var(--accent-ink); border-color: var(--accent-ink); }
.btn-danger { color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 35%, #fff); }
.btn-danger-solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger-solid:hover { background: color-mix(in srgb, var(--danger) 85%, #000); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--surface-3); border-color: transparent; }
.btn-sm { padding: 4px 10px; font-size: 12.5px; border-radius: 6px; }
.btn-sm svg { width: 13px; height: 13px; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 6px;
  border: none; background: transparent; color: var(--muted); cursor: pointer;
  transition: background .12s ease, color .12s ease;
}
.icon-btn:hover { background: var(--surface-3); color: var(--ink); }
.icon-btn.danger:hover { background: var(--danger-soft); color: var(--danger); }
.icon-btn svg { width: 15px; height: 15px; }

/* ---------- Forms ---------- */

.field { margin-bottom: 14px; }
.field-label { display: block; font-size: 12.5px; font-weight: 600; color: var(--ink-2); margin-bottom: 5px; }
.field-hint { font-size: 12px; color: var(--muted); margin-top: 5px; }
.input, .select, .textarea {
  width: 100%; padding: 7px 10px;
  border: 1px solid var(--line-strong); border-radius: var(--r);
  background: var(--surface); font-size: 13.5px;
  transition: border-color .12s ease, box-shadow .12s ease;
}
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 15%, transparent);
}
.textarea { resize: vertical; min-height: 64px; font-family: var(--mono); font-size: 12.5px; line-height: 1.6; }
.select {
  appearance: none; padding-right: 26px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M7 10l5 5 5-5' fill='none' stroke='%237C786C' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 7px center; background-size: 14px;
}
.select-sm, .input-sm { padding: 4px 8px; font-size: 12.5px; border-radius: 6px; }
.select-sm { padding-right: 24px; background-position: right 5px center; }
.form-row { display: flex; gap: 10px; }
.form-row > * { flex: 1; min-width: 0; }

/* Toggle switch */
.switch { position: relative; display: inline-block; width: 34px; height: 20px; flex: none; }
.switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.switch-track {
  position: absolute; inset: 0; border-radius: 999px;
  background: var(--line-strong); transition: background .15s ease; pointer-events: none;
}
.switch-track::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px;
  border-radius: 50%; background: #fff; transition: transform .15s ease;
  box-shadow: 0 1px 2px rgba(0,0,0,.2);
}
.switch input:checked + .switch-track { background: var(--accent); }
.switch input:checked + .switch-track::after { transform: translateX(14px); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Cards & panels ---------- */

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); }
.panel-head {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; border-bottom: 1px solid var(--line);
}
.panel-title { font-size: 13.5px; font-weight: 650; }
.panel-body { padding: 16px; }

.eyebrow {
  font-size: 10.5px; font-weight: 650; letter-spacing: .08em;
  text-transform: uppercase; color: var(--muted);
}

/* ---------- Badges & chips ---------- */

.badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 600; letter-spacing: .02em;
  padding: 1px 7px; border-radius: 999px;
  background: var(--surface-3); color: var(--ink-2);
}
.badge.on { background: color-mix(in srgb, var(--accent) 14%, #fff); color: var(--accent-ink); }
.badge.warn { background: var(--amber-soft); color: var(--amber); }
.badge.err { background: var(--danger-soft); color: var(--danger); }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 600; padding: 3px 10px;
  border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink-2);
}
.chip-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); flex: none; }
.chip.live { border-color: var(--accent-line); color: var(--accent-ink); background: var(--accent-soft); }
.chip.live .chip-dot { background: var(--accent); }
.chip.warn { border-color: color-mix(in srgb, var(--amber) 35%, #fff); color: var(--amber); background: var(--amber-soft); }
.chip.warn .chip-dot { background: var(--amber); }

/* ---------- Status dot with beacon pulse ---------- */

.dot { position: relative; width: 9px; height: 9px; border-radius: 50%; background: var(--faint); flex: none; }
.dot.online { background: var(--ok); }
.dot.off { background: transparent; border: 1.5px solid var(--danger); width: 8px; height: 8px; }
.dot.pairing { background: var(--amber); }
.dot.online::after {
  content: ""; position: absolute; inset: -4px; border-radius: 50%;
  border: 1.5px solid var(--ok); opacity: 0;
  animation: beacon 2.6s ease-out infinite;
}
@keyframes beacon {
  0% { transform: scale(.5); opacity: .7; }
  70% { transform: scale(1.5); opacity: 0; }
  100% { transform: scale(1.5); opacity: 0; }
}

/* ---------- Screens page ---------- */

.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); gap: 14px; }

.device-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 14px 16px 12px; display: flex; flex-direction: column; gap: 10px;
  transition: border-color .12s ease, opacity .25s ease, transform .25s ease;
}
.device-card:hover { border-color: var(--line-strong); }
.device-card.removing { opacity: 0; transform: scale(.97); }
.device-card.pending { border-style: dashed; background: var(--surface-2); }

.device-top { display: flex; align-items: center; gap: 9px; min-height: 28px; }
.device-name { font-size: 14.5px; font-weight: 650; letter-spacing: -0.01em; flex: 1; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.device-name-input {
  flex: 1; min-width: 0; font-size: 14.5px; font-weight: 650;
  border: 1px solid var(--accent); border-radius: 6px; padding: 2px 7px;
  background: var(--surface); outline: none;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 15%, transparent);
}
/* Actions stay visible — hidden-until-hover made them undiscoverable. */
.device-acts { display: flex; gap: 2px; }

.device-meta { display: flex; flex-wrap: wrap; gap: 4px 8px; font-size: 12.5px; color: var(--muted); align-items: center; }
.device-meta .sep { color: var(--line-strong); }
.device-meta svg { width: 13px; height: 13px; vertical-align: -2px; margin-right: 3px; }

.device-assign { display: flex; align-items: center; gap: 8px; }
.device-assign-label { font-size: 12px; color: var(--muted); flex: none; }
.device-assign .select { flex: 1; }

.device-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px;
  border-top: 1px solid var(--line); padding-top: 9px; margin-top: 2px;
  font-size: 12px; color: var(--muted); }

.pending-code {
  font-family: var(--mono); font-variant-numeric: tabular-nums;
  font-size: 17px; font-weight: 650; letter-spacing: .22em; color: var(--ink-2);
}

/* ---------- Fleet monitoring: pills, toolbar, table, drawer ---------- */

.pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11.5px; font-weight: 650; letter-spacing: .01em;
  padding: 2px 9px 2px 7px; border-radius: 999px; white-space: nowrap;
}
.pill-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.down { background: var(--danger-soft); color: var(--danger); }
.pill.pairing { background: var(--amber-soft); color: var(--amber); }

.fleet-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.fleet-toolbar[hidden] { display: none; }

.search-box { position: relative; width: 220px; }
.search-box svg { position: absolute; left: 9px; top: 50%; transform: translateY(-50%); width: 14px; height: 14px; color: var(--faint); pointer-events: none; }
.search-input {
  width: 100%; padding: 6px 10px 6px 29px;
  border: 1px solid var(--line-strong); border-radius: var(--r);
  background: var(--surface); font-size: 13px;
  transition: border-color .12s ease, box-shadow .12s ease;
}
.search-input:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 15%, transparent);
}

.seg {
  display: inline-flex; align-items: center; gap: 2px;
  background: var(--surface-3); border: 1px solid var(--line); border-radius: var(--r);
  padding: 2px;
}
.seg-btn {
  display: inline-flex; align-items: center; gap: 6px;
  border: none; background: transparent; cursor: pointer;
  font-size: 12.5px; font-weight: 550; color: var(--ink-2);
  padding: 4px 10px; border-radius: 6px;
  transition: background .12s ease, color .12s ease;
}
.seg-btn:hover { color: var(--ink); }
.seg-btn.active { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(29,28,24,.08); font-weight: 650; }
.seg-count { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.seg-btn.active .seg-count { color: var(--ink-2); }
.seg-btn.icon-only { padding: 4px 8px; }
.seg-btn.icon-only svg { width: 15px; height: 15px; }

.device-name.as-link {
  border: none; background: none; padding: 0; cursor: pointer;
  text-align: left; color: inherit; font: inherit;
  font-size: 14.5px; font-weight: 650; letter-spacing: -0.01em;
}
.device-name.as-link:hover { color: var(--accent-ink); text-decoration: underline; text-underline-offset: 3px; }

.device-pushline { min-height: 0; margin-top: -4px; }
.device-pushline:empty { display: none; }

.cstat { font-size: 12px; font-weight: 550; }
.cstat.ok { color: var(--ok); }
.cstat.warn { color: var(--amber); }
.cstat.muted { color: var(--muted); }

.push-chip {
  display: none; align-items: center; gap: 5px;
  font-size: 11.5px; font-weight: 600; white-space: nowrap;
}
.push-chip.show { display: inline-flex; animation: pushpop .18s ease; }
.push-chip.ok { color: var(--ok); }
.push-chip.warn { color: var(--amber); }
.push-chip.err { color: var(--danger); }
.push-chip.busy { color: var(--muted); }
@keyframes pushpop { from { opacity: 0; transform: translateY(2px); } }

/* Table view */
.table-wrap {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  overflow-x: auto;
}
.fleet-table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 760px; }
.fleet-table th {
  text-align: left; font-size: 11px; font-weight: 650; letter-spacing: .05em;
  text-transform: uppercase; color: var(--muted);
  padding: 9px 14px; border-bottom: 1px solid var(--line);
  background: var(--surface-2); white-space: nowrap;
}
.fleet-table th:first-child { border-top-left-radius: var(--r-lg); }
.fleet-table th:last-child { border-top-right-radius: var(--r-lg); }
.th-sort {
  border: none; background: none; padding: 0; cursor: pointer;
  font: inherit; color: inherit; letter-spacing: inherit; text-transform: inherit;
  display: inline-flex; align-items: center; gap: 4px;
}
.th-sort:hover, .th-sort.active { color: var(--ink); }
.sort-arrow { font-size: 11px; min-width: 9px; display: inline-block; }
.fleet-table td { padding: 9px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.fleet-table tbody tr:last-child td { border-bottom: none; }
.fleet-table tbody tr { cursor: pointer; transition: background .1s ease; }
.fleet-table tbody tr:hover { background: var(--surface-2); }
.td-name .link-name {
  border: none; background: none; padding: 0; cursor: pointer;
  font-size: 13.5px; font-weight: 650; color: var(--ink); letter-spacing: -0.01em;
}
.td-name .link-name:hover { color: var(--accent-ink); text-decoration: underline; text-underline-offset: 3px; }
.td-playlist { min-width: 190px; }
.td-playlist-inner { display: flex; flex-direction: column; gap: 3px; }
.td-playlist-inner .select { max-width: 220px; }
.td-res { white-space: nowrap; color: var(--ink-2); }
.res-orient {
  margin-left: 7px; font-size: 10px; font-weight: 650; color: var(--muted);
  border: 1px solid var(--line-strong); border-radius: 4px; padding: 0 4px;
}
.td-browser { color: var(--muted); white-space: nowrap; }
.td-seen { white-space: nowrap; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.seen-now { color: var(--ok); font-weight: 600; }
.th-acts { width: 1%; }
.td-acts { text-align: right; }
.row-acts { display: flex; gap: 2px; justify-content: flex-end; }
.pending-row { background: var(--surface-2); }
.pending-row td { border-bottom-style: dashed; }
.code-chip {
  font-family: var(--mono); font-size: 12px; font-variant-numeric: tabular-nums;
  background: var(--surface-3); border-radius: 5px; padding: 1px 6px;
  letter-spacing: .08em; color: var(--ink-2); word-break: break-all;
}

/* Detail drawer */
.modal-veil:has(.modal.drawer) {
  justify-content: flex-end; align-items: stretch;
  padding: 0; overflow: hidden;
}
.modal.drawer {
  max-width: 480px; width: 100%; height: 100dvh; max-height: none;
  border-radius: 0; border: none; border-left: 1px solid var(--line);
  display: flex; flex-direction: column;
  animation: drawer-in .22s cubic-bezier(.2, 1, .4, 1);
}
.modal.drawer .modal-body { flex: 1; overflow-y: auto; padding-bottom: 24px; }
@keyframes drawer-in { from { transform: translateX(28px); opacity: 0; } to { transform: none; opacity: 1; } }

.drawer-status { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.drawer-seen { font-size: 12.5px; color: var(--muted); }

.drawer-sec { margin-bottom: 18px; }
.sec-label {
  font-size: 10.5px; font-weight: 650; letter-spacing: .08em;
  text-transform: uppercase; color: var(--faint); margin-bottom: 7px;
}
.drawer-assign { display: flex; flex-direction: column; gap: 5px; }
.drawer-assign .select { width: 100%; }

.tvframe {
  position: relative; aspect-ratio: 16 / 9; width: 100%;
  background: #101010; border-radius: 10px; overflow: hidden;
  border: 1px solid #000;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.05);
}
.tvframe-scale { position: absolute; top: 0; left: 0; width: 1280px; height: 720px; transform-origin: 0 0; }
.tvframe-iframe { width: 100%; height: 100%; border: 0; pointer-events: none; background: #101010; }
.tvframe-idle {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 4px; text-align: center; padding: 16px;
}
.tvframe-idle-title { color: #8f8d86; font-size: 13.5px; font-weight: 600; }
.tvframe-idle-sub { color: #62605a; font-size: 12px; }
.tvframe-flag {
  position: absolute; top: 8px; right: 8px;
  font-size: 10.5px; font-weight: 650; letter-spacing: .04em;
  color: #F2B8AC; background: rgba(20, 12, 10, .78);
  border: 1px solid rgba(242, 184, 172, .35);
  border-radius: 999px; padding: 2px 9px;
}
.tvframe-cap { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; font-size: 12px; color: var(--ink-2); margin-top: 7px; }
.tvframe-cap .muted { color: var(--muted); }
.cap-link { color: var(--accent-ink); font-weight: 600; text-decoration: none; }
.cap-link:hover { text-decoration: underline; text-underline-offset: 3px; }

.diag-grid {
  display: grid; grid-template-columns: 112px 1fr; gap: 6px 12px;
  margin: 0; font-size: 12.5px;
}
.diag-grid dt { color: var(--muted); }
.diag-grid dd { margin: 0; color: var(--ink); min-width: 0; overflow-wrap: anywhere; }

.drawer-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.empty.slim { padding: 40px 20px; }
.empty.slim .btn { margin-top: 12px; }

@media (prefers-reduced-motion: reduce) {
  .modal.drawer { animation: none; }
  .dot.online::after { animation: none; }
}

/* ---------- Code input (6 boxes) ---------- */

.code-row { display: flex; gap: 8px; align-items: center; justify-content: center; }
.code-box {
  width: 46px; height: 56px; text-align: center;
  font-size: 26px; font-weight: 650; text-transform: uppercase;
  font-variant-numeric: tabular-nums;
  border: 1.5px solid var(--line-strong); border-radius: var(--r);
  background: var(--surface); caret-color: var(--accent);
  transition: border-color .12s ease, box-shadow .12s ease;
}
.code-box:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent);
}
.code-box.filled { border-color: var(--ink-2); }
.code-gap { width: 10px; height: 2px; background: var(--line-strong); border-radius: 1px; flex: none; }
.code-row.shake { animation: shake .35s ease; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  50% { transform: translateX(5px); }
  75% { transform: translateX(-3px); }
}

/* Pair success */
.pair-success { text-align: center; padding: 12px 0 4px; }
.pair-check {
  width: 56px; height: 56px; margin: 0 auto 14px; border-radius: 50%;
  background: var(--accent-soft-2); display: flex; align-items: center; justify-content: center;
  animation: pop .35s cubic-bezier(.2, 1.4, .5, 1);
}
.pair-check svg { width: 28px; height: 28px; color: var(--accent); }
.pair-check svg path { stroke-dasharray: 26; stroke-dashoffset: 26; animation: draw .45s .15s ease forwards; }
@keyframes pop { from { transform: scale(.5); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes draw { to { stroke-dashoffset: 0; } }
.pair-success-title { font-size: 16px; font-weight: 650; }
.pair-success-sub { color: var(--muted); font-size: 13px; margin-top: 4px; }

/* ---------- Media page ---------- */

.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(196px, 1fr)); gap: 14px; }

.media-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  overflow: hidden; cursor: pointer; position: relative;
  transition: border-color .12s ease, opacity .25s ease, transform .25s ease;
}
.media-card:hover { border-color: var(--line-strong); }
.media-card.removing { opacity: 0; transform: scale(.96); }

.media-thumb {
  aspect-ratio: 16 / 10; background: var(--surface-3); position: relative;
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.media-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.media-thumb .kind-glyph { width: 34px; height: 34px; color: var(--faint); }
.media-badges { position: absolute; top: 8px; left: 8px; display: flex; gap: 5px; z-index: 2; }
.media-badges .badge { background: rgba(20, 19, 16, .72); color: #fff; backdrop-filter: blur(3px); }
.media-del {
  position: absolute; top: 6px; right: 6px; z-index: 2;
  background: rgba(20, 19, 16, .72); color: #fff; opacity: 0;
}
.media-card:hover .media-del, .media-card:focus-within .media-del { opacity: 1; }
.media-del:hover { background: var(--danger); color: #fff; }

.media-info { padding: 9px 12px 10px; }
.media-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.media-sub { font-size: 11.5px; color: var(--muted); margin-top: 2px; font-variant-numeric: tabular-nums; }

.media-processing {
  position: absolute; inset: 0; z-index: 3;
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  font-size: 12px; font-weight: 600; color: var(--ink-2);
}

.spinner {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid var(--line-strong); border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}
.spinner.lg { width: 26px; height: 26px; }
@keyframes spin { to { transform: rotate(360deg); } }

.media-processing-sub { font-size: 10.5px; font-weight: 500; color: var(--muted); }

.media-used {
  display: flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 600; color: var(--accent-ink); margin-top: 4px;
}
.media-used svg { width: 12px; height: 12px; flex: none; }

/* Selection mode */
.media-check {
  position: absolute; bottom: 8px; right: 8px; z-index: 4;
  width: 22px; height: 22px; border-radius: 50%;
  border: 1.5px solid #fff; background: rgba(20, 19, 16, .45); color: #fff;
  display: none; align-items: center; justify-content: center;
  box-shadow: 0 1px 3px rgba(0,0,0,.25);
}
.media-check svg { width: 13px; height: 13px; opacity: 0; }
.media-grid.selecting .media-check { display: flex; }
.media-grid.selecting .media-del { display: none; }
.media-card.sel { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 28%, transparent); }
.media-card.sel .media-check { background: var(--accent); border-color: #fff; }
.media-card.sel .media-check svg { opacity: 1; }

.selbar {
  display: flex; align-items: center; gap: 10px;
  background: var(--accent-soft); border: 1px solid var(--accent-line);
  border-radius: var(--r); padding: 7px 12px; margin-bottom: 14px;
  font-size: 13px; font-weight: 600; color: var(--accent-ink);
  font-variant-numeric: tabular-nums;
}
.selbar[hidden] { display: none; }

.conv-chip { cursor: pointer; transition: border-color .12s ease; font-variant-numeric: tabular-nums; }
.conv-chip[hidden] { display: none; }
.conv-chip .spinner { width: 12px; height: 12px; border-width: 2px; border-top-color: var(--amber); }
.conv-chip:hover { border-color: var(--amber); }
.conv-chip.active { border-color: var(--amber); box-shadow: 0 0 0 2px color-mix(in srgb, var(--amber) 22%, transparent); }

a.btn { text-decoration: none; }

/* Upload dialog */
.upzone {
  border: 1.5px dashed var(--line-strong); border-radius: var(--r-lg);
  background: var(--surface-2); padding: 26px 20px; text-align: center;
  cursor: pointer; transition: border-color .12s ease, background .12s ease;
}
.upzone:hover, .upzone.over { border-color: var(--accent); background: var(--accent-soft); }
.upzone > svg { width: 30px; height: 30px; color: var(--accent); margin-bottom: 8px; }
.upzone-title { font-size: 14.5px; font-weight: 650; letter-spacing: -0.01em; }
.upzone-sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.upzone-sub .link { color: var(--accent-ink); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.upzone-formats {
  display: flex; justify-content: center; gap: 8px 18px; flex-wrap: wrap;
  margin-top: 14px; font-size: 11px; color: var(--muted); letter-spacing: .01em;
}
.upzone-formats b { color: var(--ink-2); font-weight: 650; margin-right: 3px; }

.upnote { display: flex; gap: 8px; align-items: flex-start; font-size: 12px; color: var(--muted); margin-top: 10px; }
.upnote svg { width: 14px; height: 14px; flex: none; color: var(--accent); transform: translateY(1.5px); }
.upnote b { color: var(--ink-2); font-weight: 600; }

.upstage { margin-top: 14px; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.upstage[hidden] { display: none; }
.upstage-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 7px 8px 7px 12px; background: var(--surface-2); border-bottom: 1px solid var(--line);
  font-size: 12px; font-weight: 650; color: var(--ink-2); font-variant-numeric: tabular-nums;
}
.upstage-list { max-height: 250px; overflow-y: auto; }
.uprow { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--line); }
.uprow:last-child { border-bottom: none; }
.uprow > svg { width: 17px; height: 17px; color: var(--muted); flex: none; }
.uprow-main { flex: 1; min-width: 0; }
.uprow-name { font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.uprow-sub { font-size: 11px; color: var(--muted); display: flex; align-items: center; gap: 6px; font-variant-numeric: tabular-nums; margin-top: 1px; }
.uprow-bar { height: 3px; border-radius: 2px; background: var(--surface-3); margin-top: 5px; overflow: hidden; }
.uprow-bar[hidden] { display: none; }
.uprow-bar-fill { height: 100%; width: 0%; background: var(--accent); border-radius: 2px; transition: width .2s ease; }
.uprow-bar-fill.err { background: var(--danger); }
.uprow-state {
  flex: none; display: flex; align-items: center; gap: 5px;
  font-size: 11.5px; font-weight: 650; color: var(--muted); font-variant-numeric: tabular-nums;
  max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.uprow-state.ok { color: var(--ok); }
.uprow-state.warn { color: var(--amber); }
.uprow-state.err { color: var(--danger); }
.uprow-state svg { width: 13px; height: 13px; flex: none; }
.uprow-state .spinner { width: 12px; height: 12px; border-width: 2px; border-top-color: var(--amber); }

.up-foot { flex: 1; display: flex; align-items: center; gap: 8px; min-width: 0; }
.up-foot-note {
  display: flex; align-items: center; gap: 7px;
  font-size: 12.5px; font-weight: 550; color: var(--muted); min-width: 0;
}
.up-foot-note.ok { color: var(--ok); font-weight: 650; }
.up-foot-note svg { width: 15px; height: 15px; flex: none; }
.up-foot-note .spinner { width: 13px; height: 13px; }

/* Asset detail */
.detail-converting {
  display: flex; align-items: center; gap: 12px;
  border: 1px solid var(--line); border-radius: var(--r);
  background: var(--surface-2); padding: 16px; font-size: 13px;
}
.detail-converting.err { border-color: color-mix(in srgb, var(--danger) 30%, #fff); background: var(--danger-soft); }
.detail-converting.err > svg { width: 20px; height: 20px; color: var(--danger); flex: none; }
.use-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.use-chips a.chip { text-decoration: none; cursor: pointer; transition: border-color .12s ease, background .12s ease; }
.use-chips a.chip:hover { border-color: var(--accent-line); background: var(--accent-soft); }
.use-chips a.chip svg { width: 13px; height: 13px; color: var(--accent); }

/* Upload tray */
.upload-tray {
  position: fixed; right: 20px; bottom: 20px; width: 320px; z-index: 60;
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-lg);
  box-shadow: var(--shadow-pop); overflow: hidden;
  animation: rise .25s ease;
}
@keyframes rise { from { transform: translateY(10px); opacity: 0; } to { transform: none; opacity: 1; } }
.upload-tray-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; border-bottom: 1px solid var(--line);
  font-size: 13px; font-weight: 650;
}
.upload-tray-list { max-height: 260px; overflow-y: auto; }
.upload-row { padding: 9px 14px; border-bottom: 1px solid var(--line); }
.upload-row:last-child { border-bottom: none; }
.upload-row-top { display: flex; align-items: baseline; gap: 8px; font-size: 12.5px; }
.upload-row-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 550; }
.upload-row-pct { color: var(--muted); font-size: 11.5px; font-variant-numeric: tabular-nums; }
.upload-row-pct.done { color: var(--accent-ink); font-weight: 650; }
.upload-row-pct.err { color: var(--danger); font-weight: 650; }
.upload-bar { height: 3px; border-radius: 2px; background: var(--surface-3); margin-top: 6px; overflow: hidden; }
.upload-bar-fill { height: 100%; background: var(--accent); border-radius: 2px; width: 0%; transition: width .2s ease; }
.upload-bar-fill.err { background: var(--danger); }

/* Drop veil */
.dropveil[hidden] { display: none; }
.dropveil {
  position: fixed; inset: 0; z-index: 90;
  background: color-mix(in srgb, var(--canvas) 72%, transparent);
  backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center;
}
.dropveil-card {
  background: var(--surface); border: 1.5px dashed var(--accent); border-radius: var(--r-lg);
  padding: 36px 56px; text-align: center; color: var(--accent-ink);
}
.dropveil-card svg { width: 34px; height: 34px; margin-bottom: 10px; }
.dropveil-title { font-size: 16px; font-weight: 650; }
.dropveil-sub { font-size: 12.5px; color: var(--muted); margin-top: 3px; }

/* ---------- Playlists index ---------- */

.pl-index { display: flex; flex-direction: column; }
.pl-row {
  display: flex; align-items: center; gap: 16px;
  padding: 13px 18px; border-bottom: 1px solid var(--line);
  text-decoration: none; transition: background .1s ease;
}
.pl-row:last-child { border-bottom: none; }
.pl-row:hover { background: var(--surface-2); }
.pl-row-icon {
  width: 38px; height: 38px; flex: none; border-radius: var(--r);
  background: var(--accent-soft-2); color: var(--accent);
  display: flex; align-items: center; justify-content: center;
}
.pl-row-icon svg { width: 19px; height: 19px; }
.pl-row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.pl-row-name { font-size: 14px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl-row-sub { font-size: 12.5px; color: var(--muted); margin-top: 1px; font-variant-numeric: tabular-nums; }
.pl-row-side { display: flex; align-items: center; gap: 10px; flex: none; }
.pl-row .icon-btn { opacity: 0; }
.pl-row:hover .icon-btn, .pl-row:focus-within .icon-btn { opacity: 1; }

/* ---------- Playlist editor ---------- */

.editor-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.back-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: var(--r);
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-2);
  text-decoration: none; transition: background .12s ease; flex: none;
}
.back-btn:hover { background: var(--surface-2); }
.back-btn svg { width: 16px; height: 16px; }
.editor-name {
  font-size: 19px; font-weight: 650; letter-spacing: -0.015em;
  border: 1px solid transparent; border-radius: var(--r); padding: 3px 8px;
  background: transparent; min-width: 0; max-width: 360px; width: auto;
  transition: border-color .12s ease, background .12s ease;
}
.editor-name:hover { border-color: var(--line-strong); }
.editor-name:focus { outline: none; border-color: var(--accent); background: var(--surface);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 14%, transparent); }
.save-note { font-size: 12px; color: var(--faint); min-width: 64px; transition: color .15s ease; }
.save-note.saving { color: var(--muted); }

.editor-cols { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 20px; align-items: start; }
.editor-left { min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.editor-right { position: sticky; top: 24px; }

/* Item list */
.pl-items { display: flex; flex-direction: column; }
.pl-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-bottom: 1px solid var(--line);
  background: var(--surface); position: relative;
}
.pl-item:last-child { border-bottom: none; }
.pl-item.drag-src { opacity: .35; }
.pl-item.drag-hidden { display: none; }
.drag-slot {
  border: 1.5px dashed var(--accent-line); border-radius: var(--r);
  background: var(--accent-soft); margin: 2px 8px;
}
.pl-item.drag-ghost {
  position: fixed; z-index: 100; pointer-events: none;
  border: 1px solid var(--line-strong); border-radius: var(--r);
  box-shadow: var(--shadow-pop); opacity: .97; margin: 0;
}
.pl-grip {
  cursor: grab; color: var(--faint); background: none; border: none;
  padding: 4px 2px; border-radius: 4px; flex: none; touch-action: none;
  display: flex; align-items: center;
}
.pl-grip:hover { color: var(--ink-2); }
.pl-grip:active { cursor: grabbing; }
.pl-grip svg { width: 14px; height: 14px; }
.pl-idx { font-size: 11px; color: var(--faint); width: 18px; text-align: right; flex: none; font-variant-numeric: tabular-nums; }
.pl-thumb {
  width: 58px; height: 36px; border-radius: 5px; background: var(--surface-3);
  overflow: hidden; flex: none; display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--line);
}
.pl-thumb img { width: 100%; height: 100%; object-fit: cover; }
.pl-thumb svg { width: 17px; height: 17px; color: var(--muted); }
.pl-thumb.widget { background: var(--accent-soft-2); border-color: transparent; }
.pl-thumb.widget svg { color: var(--accent); }
.pl-item-main { flex: 1; min-width: 0; }
.pl-item-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl-item-name .link-edit { border: none; background: none; padding: 0; font: inherit; cursor: pointer; color: inherit; }
.pl-item-name .link-edit:hover { color: var(--accent-ink); text-decoration: underline; }
.pl-item-sub { font-size: 11.5px; color: var(--muted); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl-item-ctrls { display: flex; align-items: center; gap: 6px; flex: none; }
.dur-wrap { position: relative; }
.dur-input { width: 70px; padding-right: 19px; text-align: right; font-variant-numeric: tabular-nums; }
.dur-input::placeholder { font-size: 11px; letter-spacing: 0; }
.dur-unit { position: absolute; right: 7px; top: 50%; transform: translateY(-50%); font-size: 11px; color: var(--faint); pointer-events: none; }
.dur-per-page { font-size: 11px; color: var(--muted); white-space: nowrap; align-self: center; }
.pl-item .icon-btn { opacity: 0; }
.pl-item:hover .icon-btn, .pl-item:focus-within .icon-btn { opacity: 1; }

.add-row { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--line); flex-wrap: wrap; }

/* Overlays panel */
.ov-row { border-bottom: 1px solid var(--line); }
.ov-row:last-child { border-bottom: none; }
.ov-head { display: flex; align-items: center; gap: 10px; padding: 11px 16px; }
.ov-head svg { width: 16px; height: 16px; color: var(--muted); flex: none; }
.ov-title { flex: 1; font-size: 13px; font-weight: 600; }
.ov-body { padding: 2px 16px 14px 42px; display: flex; flex-direction: column; gap: 10px; max-width: 460px; }
.ov-body .field { margin-bottom: 0; }

/* Display mode (SPEC v7 — Infoskjerm) at the top of the overlays panel */
.mode-row { display: flex; flex-direction: column; gap: 10px; padding: 12px 16px 14px; border-bottom: 1px solid var(--line); max-width: 460px; }
.mode-row .field { margin-bottom: 0; }
.mode-cfg { display: flex; flex-direction: column; gap: 10px; }
.mode-cfg .color-field { min-height: 34px; }
.mode-pattern { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 13px; }

/* Preview pane */
.preview-panel { display: flex; flex-direction: column; gap: 10px; }
.preview-bar { display: flex; align-items: center; gap: 8px; }
.preview-bar .eyebrow { flex: 1; }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--r); overflow: hidden; background: var(--surface); }
.seg button {
  border: none; background: none; padding: 4px 10px; cursor: pointer;
  font-size: 12px; font-weight: 600; color: var(--muted);
  display: inline-flex; align-items: center; gap: 5px;
  transition: background .12s ease, color .12s ease;
}
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on { background: var(--accent-soft-2); color: var(--accent-ink); }
.seg button svg { width: 13px; height: 13px; }

.tv-frame {
  background: #161613; border-radius: 14px; padding: 10px;
  border: 1px solid #000; position: relative;
}
.tv-screen { position: relative; overflow: hidden; border-radius: 4px; background: #000; }
.tv-screen iframe { position: absolute; top: 0; left: 0; border: none; background: #000; transform-origin: 0 0; }
.tv-led {
  position: absolute; bottom: 3px; left: 50%; transform: translateX(-50%);
  width: 14px; height: 3px; border-radius: 2px;
  background: color-mix(in srgb, var(--accent) 70%, #fff); opacity: .9;
}
.tv-stand { width: 88px; height: 5px; margin: 0 auto; background: #2a2a26; border-radius: 0 0 5px 5px; }
.preview-foot { font-size: 11.5px; color: var(--muted); display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.preview-foot a { color: var(--accent-ink); text-decoration: none; font-weight: 600; }
.preview-foot a:hover { text-decoration: underline; }

/* Media picker modal */
.picker-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(128px, 1fr));
  gap: 10px; max-height: 46vh; overflow-y: auto; padding: 2px;
}
.pick-card {
  border: 1.5px solid var(--line); border-radius: var(--r); overflow: hidden;
  cursor: pointer; background: var(--surface); padding: 0; text-align: left;
  transition: border-color .1s ease;
  position: relative;
}
.pick-card:hover { border-color: var(--line-strong); }
.pick-card.sel { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 25%, transparent); }
.pick-thumb { aspect-ratio: 16/10; background: var(--surface-3); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.pick-thumb img { width: 100%; height: 100%; object-fit: cover; }
.pick-thumb svg { width: 22px; height: 22px; color: var(--faint); }
.pick-name { font-size: 11.5px; font-weight: 600; padding: 6px 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pick-tick {
  position: absolute; top: 6px; right: 6px; width: 20px; height: 20px; border-radius: 50%;
  background: var(--accent); color: #fff; display: none; align-items: center; justify-content: center;
}
.pick-tick svg { width: 12px; height: 12px; }
.pick-card.sel .pick-tick { display: flex; }

/* Typeahead */
.typeahead { position: relative; }
.typeahead-list {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 30;
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r);
  box-shadow: var(--shadow-pop); overflow: hidden; max-height: 240px; overflow-y: auto;
}
.typeahead-opt {
  display: block; width: 100%; text-align: left; padding: 8px 12px;
  border: none; background: none; cursor: pointer; font-size: 13px;
}
.typeahead-opt:hover, .typeahead-opt.hi { background: var(--accent-soft); }
.typeahead-opt small { color: var(--muted); }
.typeahead-empty { padding: 10px 12px; font-size: 12.5px; color: var(--muted); }

/* Feed test */
.feed-test {
  border: 1px solid var(--line); border-radius: var(--r);
  background: var(--surface-2); padding: 10px 12px; font-size: 12.5px;
}
.feed-test-title { font-weight: 650; margin-bottom: 5px; display: flex; align-items: center; gap: 6px; }
.feed-test-title svg { width: 14px; height: 14px; color: var(--accent); }
.feed-test ul { margin: 0; padding-left: 18px; color: var(--ink-2); }
.feed-test li { margin: 2px 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed-test.err { border-color: color-mix(in srgb, var(--danger) 30%, #fff); background: var(--danger-soft); color: var(--danger); }

/* ---------- Settings ---------- */

.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; max-width: 980px; }
.settings-grid .panel.wide { grid-column: 1 / -1; }

.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 1px; background: var(--line); border-radius: var(--r-lg); overflow: hidden; border: 1px solid var(--line); }
.stat-cell { background: var(--surface); padding: 14px 16px; }
.stat-n { font-size: 22px; font-weight: 650; letter-spacing: -0.02em; }
.stat-l { font-size: 11.5px; color: var(--muted); margin-top: 1px; }
.stat-cell.ok .stat-n { color: var(--accent-ink); }

.brand-preview {
  height: 72px; border: 1px solid var(--line); border-radius: var(--r);
  background: var(--surface-3); display: flex; align-items: center; justify-content: center;
  overflow: hidden; margin-bottom: 8px; position: relative;
}
.brand-preview img { max-height: 56px; max-width: 90%; object-fit: contain; }
.brand-preview.bg img { position: absolute; inset: 0; width: 100%; height: 100%; max-height: none; max-width: none; object-fit: cover; }
.brand-preview .none { font-size: 12px; color: var(--faint); }

.color-field { display: flex; align-items: center; gap: 10px; }
.color-well {
  width: 40px; height: 34px; padding: 0; border: 1px solid var(--line-strong);
  border-radius: var(--r); background: none; cursor: pointer;
}
.color-well::-webkit-color-swatch-wrapper { padding: 3px; }
.color-well::-webkit-color-swatch { border: none; border-radius: 5px; }
.color-well::-moz-color-swatch { border: none; border-radius: 5px; }
.hex-input { width: 96px; font-family: var(--mono); font-size: 12.5px; text-transform: uppercase; }
.swatches { display: flex; gap: 6px; }
.swatch { width: 22px; height: 22px; border-radius: 6px; border: 1px solid rgba(0,0,0,.12); cursor: pointer; padding: 0;
  transition: transform .1s ease; }
.swatch:hover { transform: scale(1.12); }

.url-helper {
  display: flex; align-items: center; gap: 8px;
  border: 1px solid var(--line); border-radius: var(--r);
  background: var(--surface-2); padding: 8px 12px;
}
.url-helper code { font-family: var(--mono); font-size: 13px; color: var(--ink); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.url-helper > svg { width: 17px; height: 17px; flex: none; color: var(--muted); }

/* ---------- Empty states ---------- */

.empty {
  border: 1.5px dashed var(--line-strong); border-radius: var(--r-lg);
  padding: 48px 24px; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  background: color-mix(in srgb, var(--surface) 55%, transparent);
}
.empty-art { margin-bottom: 12px; color: var(--faint); }
.empty-art .acc { color: var(--accent); }
.empty-title { font-size: 15.5px; font-weight: 650; letter-spacing: -0.01em; }
.empty-sub { font-size: 13px; color: var(--muted); max-width: 400px; }
.empty-steps {
  display: flex; gap: 20px; margin: 14px 0 6px; text-align: left; flex-wrap: wrap; justify-content: center;
}
.empty-step { display: flex; gap: 8px; align-items: baseline; font-size: 12.5px; color: var(--ink-2); max-width: 180px; }
.empty-step-n {
  font-size: 11px; font-weight: 650; color: var(--accent-ink);
  background: var(--accent-soft-2); border-radius: 999px;
  width: 18px; height: 18px; display: inline-flex; align-items: center; justify-content: center;
  flex: none; transform: translateY(2px);
}
.empty-step code { font-family: var(--mono); font-size: 11px; background: var(--surface-3); padding: 1px 5px; border-radius: 4px; }
.empty .btn { margin-top: 12px; }

/* Error / offline state */
.error-state { text-align: center; padding: 56px 24px; color: var(--muted); }
.error-state .empty-title { color: var(--ink); }

/* ---------- Modal ---------- */

.modal-veil {
  position: fixed; inset: 0; z-index: 70;
  background: rgba(29, 28, 24, .4);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 8vh 16px 16px; overflow-y: auto;
  animation: veil .15s ease;
}
@keyframes veil { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--surface); border-radius: var(--r-lg); border: 1px solid var(--line);
  width: 100%; max-width: 440px; box-shadow: var(--shadow-pop);
  animation: modal-in .18s cubic-bezier(.2, 1.1, .4, 1);
}
.modal.md { max-width: 560px; }
.modal.lg { max-width: 720px; }
@keyframes modal-in { from { transform: translateY(10px) scale(.98); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 16px 20px 0; }
.modal-title { font-size: 16px; font-weight: 650; letter-spacing: -0.01em; flex: 1; }
.modal-body { padding: 14px 20px 8px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 8px 20px 18px; }
.modal-foot .left { margin-right: auto; }

/* ---------- Toasts ---------- */

.toasts {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 8px; z-index: 95;
  pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 9px;
  background: #23221E; color: #F2F1EC;
  border-radius: 10px; padding: 9px 16px;
  font-size: 13px; font-weight: 550;
  box-shadow: var(--shadow-pop); pointer-events: auto;
  animation: toast-in .22s cubic-bezier(.2, 1.2, .4, 1);
  max-width: min(480px, 90vw);
}
.toast.out { animation: toast-out .2s ease forwards; }
@keyframes toast-in { from { transform: translateY(12px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes toast-out { to { transform: translateY(8px); opacity: 0; } }
.toast svg { width: 15px; height: 15px; flex: none; }
.toast.ok svg { color: #5BD3AC; }
.toast.err svg { color: #F09B8B; }

/* ---------- Utilities ---------- */

.muted { color: var(--muted); }
.hidden { display: none !important; }
.mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; } .mb-16 { margin-bottom: 16px; }
.flex { display: flex; align-items: center; gap: 8px; }
.grow { flex: 1; min-width: 0; }

.skeleton { border-radius: var(--r-lg); background: linear-gradient(100deg, var(--surface-3) 40%, var(--surface-2) 50%, var(--surface-3) 60%); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; border: 1px solid var(--line); }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- Responsive ---------- */

@media (max-width: 1100px) {
  .editor-cols { grid-template-columns: 1fr; }
  .editor-right { position: static; max-width: 480px; }
}
@media (max-width: 860px) {
  .app { flex-direction: column; }
  .sidebar {
    width: 100%; flex: none; height: auto; position: static;
    flex-direction: row; align-items: center; padding: 10px 16px;
    border-right: none; border-bottom: 1px solid var(--line);
  }
  .brand { padding: 0 12px 0 0; }
  .nav { flex-direction: row; gap: 2px; flex: 1; overflow-x: auto; }
  .nav-item { padding: 6px 10px; }
  .nav-item.active::before { display: none; }
  .nav-item span:not(.nav-badge) { display: none; }
  .nav-badge { margin-left: 4px; }
  .sidebar-foot { display: none; }
  .main { padding: 20px 16px 48px; }
  .page-head { flex-wrap: wrap; }
}

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

/* ---------- Media tags: filter row, card chips, chip editor ---------- */

.tag-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: -4px 0 14px; }
.tag-row[hidden] { display: none; }
.tag-row-label {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 650; color: var(--muted);
  text-transform: uppercase; letter-spacing: .05em; margin-right: 2px;
}
.tag-row-label svg { width: 13px; height: 13px; }
.tag-chip {
  display: inline-flex; align-items: center; gap: 6px;
  font: inherit; font-size: 12px; font-weight: 600;
  padding: 3px 10px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-2);
  cursor: pointer; transition: border-color .12s ease, background .12s ease, color .12s ease;
}
button.tag-chip:hover { border-color: var(--accent-line); background: var(--accent-soft); color: var(--accent-ink); }
.tag-chip.active { border-color: var(--accent); background: var(--accent-soft-2); color: var(--accent-ink); }
.tag-count { font-size: 10.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.tag-chip.active .tag-count { color: var(--accent-ink); opacity: .75; }
.tag-clear {
  border: none; background: none; font: inherit; font-size: 12px; font-weight: 600;
  color: var(--muted); cursor: pointer; padding: 3px 6px;
}
.tag-clear:hover { color: var(--ink); text-decoration: underline; }

.card-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.mini-tag {
  font-size: 10.5px; font-weight: 600; color: var(--ink-2);
  background: var(--surface-3); border: 1px solid var(--line);
  border-radius: 999px; padding: 1px 7px; max-width: 110px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.mini-tag.more { color: var(--muted); }

.tags-edit {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
  padding: 6px; border: 1px solid var(--line-strong); border-radius: var(--r);
  background: var(--surface); cursor: text;
}
.tags-edit:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 15%, transparent);
}
.tag-chip.static { cursor: default; padding-right: 5px; }
.tag-x {
  display: inline-flex; align-items: center; justify-content: center;
  border: none; background: none; padding: 2px; margin: 0;
  color: var(--muted); cursor: pointer; border-radius: 50%;
}
.tag-x:hover { color: var(--danger); background: var(--danger-soft); }
.tag-x svg { width: 11px; height: 11px; }
.tag-in { flex: 1; min-width: 90px; border: none; background: none; font: inherit; font-size: 12.5px; padding: 3px 4px; }
.tag-in:focus { outline: none; }

/* ---------- Schedules: index chips, editor grid, palette, specials ---------- */

/* Index "what plays now" chip */
.sched-now-chip {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12px; font-weight: 600; color: var(--ink-2);
  padding: 3px 10px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface);
  white-space: nowrap;
}
.sched-now-chip.idle { color: var(--muted); }
.sched-now-until { color: var(--muted); font-weight: 500; font-variant-numeric: tabular-nums; }
.sched-now-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); flex: none; }
.sched-now-dot.big { width: 10px; height: 10px; }

/* Applies-immediately banner */
.sched-banner {
  display: flex; align-items: flex-start; gap: 9px;
  border: 1px solid var(--accent-line); background: var(--accent-soft);
  border-radius: var(--r); padding: 9px 14px; margin-bottom: 16px;
  font-size: 12.5px; color: var(--ink-2);
}
.sched-banner svg { width: 15px; height: 15px; color: var(--accent); flex: none; margin-top: 1px; }
.sched-banner b { color: var(--accent-ink); font-weight: 650; }
.sched-banner a { color: var(--accent-ink); font-weight: 600; }

/* Editor layout */
.sched-cols { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; align-items: start; }
.sched-left { min-width: 0; }
.sched-right { display: flex; flex-direction: column; gap: 16px; position: sticky; top: 24px; }

/* Paint palette */
.brush-row {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  padding: 10px 16px; border-bottom: 1px solid var(--line);
}
.brush-row.nudge { animation: shake .35s ease; }
.brush-label { font-size: 11px; font-weight: 650; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); margin-right: 4px; }
.brush-chip {
  display: inline-flex; align-items: center; gap: 7px;
  font: inherit; font-size: 12px; font-weight: 600; color: var(--ink-2);
  padding: 3px 11px 3px 6px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); cursor: pointer;
  transition: border-color .12s ease, background .12s ease, box-shadow .12s ease;
}
.brush-chip:hover { border-color: var(--bk-line); background: var(--bk-bg); }
.brush-chip.on {
  border-color: var(--bk-solid); background: var(--bk-bg); color: var(--bk-ink);
  box-shadow: inset 0 0 0 1px var(--bk-solid);
}
.brush-swatch { width: 13px; height: 13px; border-radius: 4px; background: var(--bk-solid); flex: none; }
.brush-none { font-size: 12.5px; color: var(--muted); }
.brush-none a { color: var(--accent-ink); font-weight: 600; }

/* Weekly grid — 34px per hour (mirrored in schedule-editor.js HOUR_PX) */
.sg-headrow {
  display: grid; grid-template-columns: 48px repeat(7, 1fr);
  border-bottom: 1px solid var(--line);
}
.sg-dayhead {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 4px; font-size: 12px; font-weight: 650; color: var(--ink-2);
  border-left: 1px solid var(--line);
}
.sg-dayhead.today { color: var(--accent-ink); }
.sg-today-tag {
  font-size: 9px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  background: var(--accent-soft-2); color: var(--accent-ink);
  border-radius: 999px; padding: 1px 6px;
}
.sg-scroll { max-height: min(64vh, 700px); overflow-y: auto; position: relative; border-radius: 0 0 var(--r-lg) var(--r-lg); }
.sg-canvas {
  display: grid; grid-template-columns: 48px repeat(7, 1fr);
  position: relative; user-select: none; -webkit-user-select: none;
}
.sg-gutter { position: relative; }
.sg-hour {
  position: absolute; right: 7px; transform: translateY(-50%);
  font-size: 10.5px; color: var(--faint); font-variant-numeric: tabular-nums;
}
.sg-daycol {
  position: relative; border-left: 1px solid var(--line);
  background-image: repeating-linear-gradient(to bottom, var(--line) 0 1px, transparent 1px 34px);
  touch-action: none; cursor: crosshair;
}
.sg-daycol.today { background-color: color-mix(in srgb, var(--accent) 3%, transparent); }

/* Painted blocks */
.sg-block {
  position: absolute; z-index: 2; box-sizing: border-box; min-width: 0;
  display: flex; flex-direction: column; align-items: flex-start; overflow: hidden;
  border: 1px solid var(--bk-line); border-left: 3px solid var(--bk-solid);
  background: var(--bk-bg); color: var(--bk-ink);
  border-radius: 6px; padding: 3px 6px 3px 7px; margin: 0;
  font: inherit; text-align: left; cursor: pointer;
  transition: border-color .1s ease, box-shadow .1s ease;
}
.sg-block:hover { border-color: var(--bk-solid); box-shadow: 0 1px 6px rgba(29, 28, 24, .12); z-index: 3; }
.sg-block.cont-down { border-bottom-style: dashed; border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.sg-block.cont-up { border-top-style: dashed; border-top-left-radius: 0; border-top-right-radius: 0; }
.sg-block.missing { border-style: dashed; background: var(--surface-3); color: var(--muted); border-left-style: solid; }
.sg-block-name { font-size: 11.5px; font-weight: 650; line-height: 1.25; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sg-block-time { font-size: 10.5px; font-weight: 550; opacity: .8; font-variant-numeric: tabular-nums; }
.sg-block-label { font-size: 10.5px; opacity: .75; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sg-rz { position: absolute; left: 0; right: 0; height: 9px; cursor: ns-resize; touch-action: none; }
.sg-rz.top { top: 0; }
.sg-rz.bot { bottom: 0; }

/* Paint ghost */
.sg-ghost {
  position: absolute; left: 2%; width: 96%; z-index: 5; pointer-events: none;
  border: 1.5px dashed var(--bk-solid); background: color-mix(in srgb, var(--bk-bg) 75%, transparent);
  border-radius: 6px; display: flex; align-items: flex-start; padding: 3px 6px;
}
.sg-ghost-time { font-size: 10.5px; font-weight: 650; color: var(--bk-ink); font-variant-numeric: tabular-nums; }

/* Now line */
.sg-nowline { position: absolute; left: 0; right: 0; z-index: 6; border-top: 2px solid var(--danger); pointer-events: none; }
.sg-nowdot { position: absolute; left: -3.5px; top: -4.5px; width: 7px; height: 7px; border-radius: 50%; background: var(--danger); }
.sg-nowtag {
  position: absolute; right: 3px; top: -8px;
  font-size: 9.5px; font-weight: 700; font-variant-numeric: tabular-nums;
  background: var(--danger); color: #fff; border-radius: 4px; padding: 0 4px; line-height: 1.5;
}

/* Empty-grid hint */
.sg-hint {
  position: absolute; left: calc(48px + 8%); right: 8%; top: 282px;
  text-align: center; pointer-events: none; z-index: 4;
}
.sg-hint-title { font-size: 13.5px; font-weight: 650; color: var(--ink-2); }
.sg-hint-sub { font-size: 12.5px; color: var(--muted); margin-top: 3px; }

/* Block modal bits */
.day-chips { display: flex; gap: 5px; flex-wrap: wrap; }
.day-chip {
  font: inherit; font-size: 12px; font-weight: 600; color: var(--muted);
  border: 1px solid var(--line-strong); background: var(--surface);
  border-radius: 999px; padding: 4px 10px; cursor: pointer;
  transition: background .12s ease, color .12s ease, border-color .12s ease;
}
.day-chip:hover { color: var(--ink); border-color: var(--faint); }
.day-chip.on { background: var(--accent-soft-2); border-color: var(--accent-line); color: var(--accent-ink); }
.form-row > .time-dash { flex: 0 0 auto; align-self: center; color: var(--faint); }

/* Live readout */
.now-body { padding: 14px 16px; }
.now-line { display: flex; align-items: center; gap: 9px; min-width: 0; }
.now-name { font-size: 14.5px; font-weight: 650; letter-spacing: -0.01em; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.now-name.idle { color: var(--muted); font-weight: 600; }
.now-sub { font-size: 12.5px; color: var(--muted); margin-top: 6px; font-variant-numeric: tabular-nums; }

/* Specials list */
.sp-list { display: flex; flex-direction: column; }
.sp-row {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 10px 16px; border: none; border-bottom: 1px solid var(--line);
  background: none; font: inherit; text-align: left; cursor: pointer;
  transition: background .1s ease;
}
.sp-row:last-child { border-bottom: none; border-radius: 0 0 var(--r-lg) var(--r-lg); }
.sp-row:hover { background: var(--surface-2); }
.sp-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.sp-name { font-size: 13px; font-weight: 650; display: flex; align-items: center; gap: 7px; min-width: 0; }
.sp-name .badge { flex: none; }
.sp-sub { font-size: 11.5px; color: var(--muted); margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-variant-numeric: tabular-nums; }
.sp-edit { color: var(--muted); opacity: 0; transition: opacity .1s ease; flex: none; display: flex; }
.sp-edit svg { width: 14px; height: 14px; }
.sp-row:hover .sp-edit, .sp-row:focus-visible .sp-edit { opacity: 1; }
.sp-empty { padding: 14px 16px; font-size: 12.5px; color: var(--muted); }

@media (max-width: 1100px) {
  .sched-cols { grid-template-columns: 1fr; }
  .sched-right { position: static; }
}

/* ---------- Auth (SPEC v3): login view, password fields, secure card ---------- */

/* Sign out — a button living among the nav links */
.nav-logout {
  border: none; background: none; font: inherit; text-align: left;
  cursor: pointer; margin-top: 6px; color: var(--muted);
}
.nav-logout:hover { color: var(--ink); }
.nav-logout[hidden] { display: none; }

/* Password input with show/hide toggle */
.pw-field { position: relative; }
.pw-field .input { padding-right: 38px; }
.pw-toggle {
  position: absolute; right: 3px; top: 50%; transform: translateY(-50%);
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 28px; border: none; border-radius: 6px;
  background: none; color: var(--muted); cursor: pointer;
  transition: color .12s ease, background .12s ease;
}
.pw-toggle:hover { color: var(--ink); background: var(--surface-3); }
.pw-toggle svg { width: 16px; height: 16px; }

/* Inline validation */
.input.invalid { border-color: var(--danger); }
.input.invalid:focus {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 13%, transparent);
}
.field-error { font-size: 12px; font-weight: 550; color: var(--danger); margin-top: 5px; }
.mb-0 { margin-bottom: 0; }

/* Full-screen login — the first thing a public visitor sees: keep it composed */
.login {
  position: fixed; inset: 0; z-index: 60;
  background: var(--canvas);
  display: flex; align-items: center; justify-content: center;
  padding: 32px 20px 10vh; overflow-y: auto;
}
.login-inner {
  width: 100%; max-width: 340px;
  display: flex; flex-direction: column; align-items: center; text-align: center;
  animation: rise .4s cubic-bezier(.2, 1, .4, 1);
}
.login-brand { display: flex; align-items: center; justify-content: center; min-height: 56px; margin-bottom: 18px; }
.login-mark { width: 52px; height: 52px; color: var(--accent); }
/* the mark sweeps once every few seconds — same beacon language as the online dots */
.login-mark .arc-1 { animation: login-arc 3.2s ease-out infinite; }
.login-mark .arc-2 { animation: login-arc-dim 3.2s ease-out .25s infinite; }
@keyframes login-arc {
  0%, 72%, 100% { opacity: 1; }
  80% { opacity: .25; }
  88% { opacity: 1; }
}
@keyframes login-arc-dim {
  0%, 72%, 100% { opacity: .45; }
  80% { opacity: .12; }
  88% { opacity: .45; }
}
.login-logo { max-height: 64px; max-width: 220px; object-fit: contain; }
.login-title { font-size: 20px; font-weight: 650; letter-spacing: -0.015em; margin: 0; }
.login-sub { font-size: 12.5px; color: var(--muted); margin: 5px 0 0; }
.login-card {
  width: 100%; margin-top: 20px; text-align: left;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 18px 18px 16px;
}
.login-card.nudge { animation: shake .35s ease; }
.login-card .input { padding: 9px 38px 9px 11px; font-size: 14px; }
.login-btn { width: 100%; margin-top: 12px; padding: 9px 14px; }
.login-err {
  display: flex; align-items: flex-start; gap: 8px;
  background: var(--danger-soft);
  border: 1px solid color-mix(in srgb, var(--danger) 28%, #fff);
  border-radius: var(--r); padding: 8px 11px; margin-bottom: 12px;
  font-size: 12.5px; font-weight: 550; color: var(--danger);
}
.login-err svg { width: 14px; height: 14px; flex: none; margin-top: 1px; }
.login-err[hidden] { display: none; }
.login-foot { font-size: 12px; color: var(--muted); margin: 16px 0 0; max-width: 300px; }

/* Secure-this-server card (Settings) */
.sec-badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 650; letter-spacing: .04em; text-transform: uppercase;
  color: var(--amber); background: var(--amber-soft);
  border-radius: 999px; padding: 2px 9px;
}
.sec-badge svg { width: 12px; height: 12px; }
.sec-badge.on { color: var(--ok); background: var(--ok-soft); }
.sec-copy { font-size: 13px; color: var(--ink-2); margin: 0 0 14px; }
.sec-status { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 16px; }
.sec-status > svg { width: 18px; height: 18px; color: var(--ok); flex: none; margin-top: 1px; }
.sec-status-title { font-size: 13.5px; font-weight: 650; }
.sec-remove { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); }

/* ---------- Oppslag / posts (SPEC v6) ---------- */

/* Index: drag hint + trash note */
.po-list-hint {
  display: flex; align-items: center; gap: 7px;
  padding: 8px 16px; border-bottom: 1px solid var(--line);
  font-size: 11.5px; color: var(--muted);
}
.po-list-hint svg { width: 13px; height: 13px; color: var(--faint); }
.po-trash-note {
  display: flex; align-items: center; gap: 7px;
  padding: 9px 16px; border-top: 1px solid var(--line);
  font-size: 12px; color: var(--muted); background: var(--surface-2);
  border-radius: 0 0 var(--r-lg) var(--r-lg);
}
.po-trash-note svg { width: 14px; height: 14px; flex: none; color: var(--faint); }

/* Row bits */
.po-row .pl-item-ctrls .icon-btn { opacity: 1; } /* actions stay discoverable */
.po-main { flex: 1; min-width: 0; display: flex; flex-direction: column; text-decoration: none; }
.po-main:hover .pl-item-name { color: var(--accent-ink); text-decoration: underline; text-underline-offset: 3px; }
.po-thumb {
  width: 58px; height: 36px; border-radius: 5px; overflow: hidden; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); position: relative;
}
.po-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.po-thumb svg { width: 17px; height: 17px; color: rgba(255,255,255,.85); }
.po-thumb.lg { width: 76px; height: 48px; border-radius: 6px; }
.po-shelf { opacity: .92; }

/* Editor: content sheet */
.poe-toolbar {
  display: flex; align-items: center; gap: 2px;
  padding: 8px 12px; border-bottom: 1px solid var(--line);
  background: var(--surface-2); flex-wrap: wrap;
}
.poe-tool {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 30px; height: 30px; padding: 0 7px; border-radius: 6px;
  border: none; background: none; cursor: pointer;
  font-size: 13px; font-weight: 600; color: var(--ink-2);
  transition: background .12s ease, color .12s ease;
}
.poe-tool:hover { background: var(--surface-3); color: var(--ink); }
.poe-tool svg { width: 16px; height: 16px; }
.poe-tool b { font-weight: 750; }
.poe-tool i { font-family: Georgia, 'Times New Roman', serif; }
.poe-tool-sep { width: 1px; height: 18px; background: var(--line-strong); margin: 0 6px; flex: none; }

.poe-sheet { padding: 14px 18px 16px; }
.poe-title {
  width: 100%; border: none; background: none; padding: 2px 0 8px;
  font-size: 22px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.25;
  border-bottom: 1px solid var(--line); border-radius: 0;
}
.poe-title:focus { outline: none; border-bottom-color: var(--accent); }
.poe-title::placeholder { color: var(--faint); font-weight: 650; }
.poe-body {
  min-height: 140px; padding: 12px 0 4px;
  font-size: 15px; line-height: 1.55; color: var(--ink);
  outline: none; overflow-wrap: break-word;
}
.poe-body:empty::before { content: attr(data-ph); color: var(--faint); pointer-events: none; }
/* the sanitizer's size/align classes, mirrored so the editor shows what airs */
.poe-body .sz1, .poe-body font[size="1"] { font-size: .62em; }
.poe-body .sz2, .poe-body font[size="2"] { font-size: .8em; }
.poe-body .sz3, .poe-body font[size="3"] { font-size: 1em; }
.poe-body .sz4, .poe-body font[size="4"] { font-size: 1.25em; }
.poe-body .sz5, .poe-body font[size="5"] { font-size: 1.6em; }
.poe-body .sz6, .poe-body font[size="6"] { font-size: 2em; }
.poe-body .sz7, .poe-body font[size="7"] { font-size: 2.6em; }
.poe-body .al-center { text-align: center; }
.poe-body .al-right { text-align: right; }
.poe-body .al-left { text-align: left; }

/* Image row */
.poe-img-row {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 18px; border-top: 1px solid var(--line); flex-wrap: wrap;
}
.poe-img-meta {
  font-size: 12.5px; color: var(--muted); min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px;
}

/* Look: theme swatches + duration */
.poe-look { display: flex; gap: 28px; flex-wrap: wrap; align-items: flex-start; }
.poe-swatches { display: flex; gap: 10px; flex-wrap: wrap; }
.poe-swatch {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  border: none; background: none; padding: 0; cursor: pointer;
}
.poe-swatch-fill {
  width: 74px; height: 46px; border-radius: 7px;
  border: 2px solid transparent; box-shadow: inset 0 0 0 1px rgba(0,0,0,.12);
  transition: transform .1s ease, border-color .1s ease;
}
.poe-swatch:hover .poe-swatch-fill { transform: scale(1.04); }
.poe-swatch.on .poe-swatch-fill {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 28%, transparent);
}
.poe-swatch-name { font-size: 11px; font-weight: 600; color: var(--muted); }
.poe-swatch.on .poe-swatch-name { color: var(--accent-ink); }

/* TIDSSTYRING */
.poe-timing-cols { gap: 28px; }
.poe-periods { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.poe-period {
  display: grid; grid-template-columns: 34px minmax(0, max-content) 30px;
  gap: 5px 6px; align-items: center;
  padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--r);
  background: var(--surface-2);
}
.poe-period .input { width: auto; font-variant-numeric: tabular-nums; }
.poe-period > .poe-period-label:nth-child(1) { grid-area: 1 / 1; }
.poe-period > .input:nth-child(2) { grid-area: 1 / 2; }
.poe-period > .poe-period-label:nth-child(3) { grid-area: 2 / 1; }
.poe-period > .input:nth-child(4) { grid-area: 2 / 2; }
.poe-period > .icon-btn { grid-area: 1 / 3 / 3 / 4; }
.poe-period-label { font-size: 12px; color: var(--muted); }
.poe-days { display: flex; flex-direction: column; gap: 5px; }
.poe-day { display: flex; align-items: center; gap: 8px; }
.poe-day.off .poe-time { opacity: .45; }
.poe-day-name {
  width: 38px; flex: none; font-size: 11px; font-weight: 700;
  letter-spacing: .05em; text-transform: uppercase; color: var(--ink-2);
}
.poe-day.off .poe-day-name { color: var(--faint); }
.poe-time { width: 86px; font-variant-numeric: tabular-nums; }
.poe-endaction { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; }
.poe-radio {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--ink-2); cursor: pointer;
}
.poe-radio input { accent-color: var(--accent); margin: 0; }

@media (max-width: 760px) {
  .poe-timing-cols { flex-direction: column; }
}
