:root,
[data-theme="light"] {
  color-scheme: light;
  --bg: #eef2f8;
  --surface: #ffffff;
  --surface-2: #f7f9fc;
  --line: #e3e8f1;
  --text: #1b2437;
  --muted: #5d6b82;
  --brand: #3d4bff;
  --brand-2: #6d5efc;
  --accent: #2f6bff;
  --accent-ink: #ffffff;
  --ok: #0d8a4a;
  --danger: #b42318;
  --shadow: 0 10px 30px rgba(28, 39, 68, 0.08);
  --mark: #4f46e5;
  --mark-a: #1560e8;
  --mark-b: #6d3ee6;
  --mark-c: #c026d3;
  --focus: #2f6bff;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d1320;
  --surface: #171e2e;
  --surface-2: #1e2738;
  --line: #2c364a;
  --text: #f4f7fb;
  --muted: #a8b3c7;
  --brand: #7c8cff;
  --brand-2: #9b8cff;
  --accent: #4c7dff;
  --accent-ink: #ffffff;
  --ok: #3dd68c;
  --danger: #ff8d7a;
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
  --mark: #6d5efc;
  --mark-a: #5ec8ff;
  --mark-b: #9b86ff;
  --mark-c: #e879f9;
  --focus: #9db4ff;
}

[data-theme="warm"] {
  color-scheme: light;
  --bg: #f3efe6;
  --surface: #fffdf8;
  --surface-2: #f6f0e4;
  --line: #e4d9c8;
  --text: #2c241c;
  --muted: #6e6256;
  --brand: #c4552a;
  --brand-2: #a33b22;
  --accent: #c4552a;
  --accent-ink: #fffdf8;
  --ok: #2f7d4a;
  --danger: #a33b22;
  --shadow: 0 10px 30px rgba(68, 42, 18, 0.08);
  --mark: #c4552a;
  --mark-a: #e08a3c;
  --mark-b: #c4552a;
  --mark-c: #8c3a2a;
  --focus: #c4552a;
}

[data-theme="contrast"] {
  color-scheme: dark;
  --bg: #000000;
  --surface: #000000;
  --surface-2: #000000;
  --line: #ffffff;
  --text: #ffffff;
  --muted: #ffffff;
  --brand: #ffe14a;
  --brand-2: #ffe14a;
  --accent: #ffe14a;
  --accent-ink: #000000;
  --ok: #ffe14a;
  --danger: #ffd000;
  --shadow: none;
  --mark: #ffffff;
  --mark-a: #ffe14a;
  --mark-b: #ffe14a;
  --mark-c: #ffe14a;
  --focus: #ffe14a;
}

@font-face {
  font-family: Syne;
  src: url("fonts/syne-700.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: Syne;
  src: url("fonts/syne-800.woff2") format("woff2");
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 "Avenir Next", "Segoe UI", system-ui, sans-serif;
}

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

button { cursor: pointer; }

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.app {
  display: grid;
  grid-template-columns: 248px 1fr;
  min-height: 100vh;
}

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

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

.brand-compact { display: none; }

.mark {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  object-fit: cover;
  flex: none;
  box-shadow: 0 8px 20px color-mix(in srgb, var(--mark-b) 35%, transparent);
}

.wordmark {
  display: flex;
  flex-direction: column;
  font-family: Syne, "Avenir Next", "Segoe UI", sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.32em;
  line-height: 1;
  text-transform: uppercase;
  color: var(--mark-a);
}

.wordmark span {
  margin-top: 2px;
  font-size: 1.55rem;
  font-weight: 800;
  letter-spacing: -0.045em;
  line-height: 0.95;
  text-transform: none;
  background: linear-gradient(105deg, var(--mark-a) 0%, var(--mark-b) 46%, var(--mark-c) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

[data-theme="contrast"] .mark { box-shadow: none; }

[data-theme="contrast"] .wordmark,
[data-theme="contrast"] .wordmark span {
  background: none;
  color: var(--text);
}

.brand-compact .mark { width: 40px; height: 40px; border-radius: 11px; }

.brand-compact .wordmark { font-size: 0.62rem; letter-spacing: 0.26em; }

.brand-compact .wordmark span { font-size: 1.2rem; }

.sidenav, .dock { display: flex; flex-direction: column; gap: 4px; }

.sidenav button, .dock button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 10px 12px;
  color: var(--text);
}

.sidenav button[aria-current="page"], .dock button[aria-current="page"] {
  background: color-mix(in srgb, var(--accent) 14%, var(--surface));
  color: var(--accent);
  font-weight: 600;
}

[data-theme="contrast"] .sidenav button[aria-current="page"],
[data-theme="contrast"] .dock button[aria-current="page"] {
  background: #fff;
  color: #000;
}

.nav-ico {
  width: 18px;
  height: 18px;
  flex: none;
}

.side-apps {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 0;
  margin-top: 18px;
}

.side-label {
  margin: 0 12px 4px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

button.source.side-app {
  flex-direction: row;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 0;
  padding: 8px 10px;
  border-radius: 12px;
  box-shadow: none;
  text-align: left;
}

button.source.side-app .source-mark {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  font-size: 0.68rem;
}

button.source.side-app .source-radio svg { width: 16px; height: 16px; }

button.source.side-app[aria-pressed="true"] {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 14%, var(--surface));
}

[data-theme="contrast"] button.source.side-app[aria-pressed="true"] {
  background: #fff;
  color: #000;
}

.legal {
  margin-top: auto;
  color: var(--muted);
  font-size: 0.78rem;
}

.legal-mobile { display: none; margin-top: 28px; }

.workspace {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 100vh;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 28px 0;
}

.greet h1 { margin: 0; font-size: 1.7rem; letter-spacing: -0.03em; }

.greet p, .hint, .banner, .sub, #deviceMeta, #nowDevice, #devicesIntro {
  color: var(--muted);
  margin: 2px 0 0;
}

.top-actions { display: flex; align-items: center; gap: 8px; }

.themes {
  display: flex;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
}

.themes button, .icon-btn, .text-btn, .btn, .source, .explore-card, .now-stop {
  border-radius: 999px;
}

.themes button, .icon-btn {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  background: transparent;
  border: 0;
  color: var(--muted);
}

.themes button[aria-pressed="true"] {
  background: var(--accent);
  color: var(--accent-ink);
}

.themes svg, .icon-btn svg { width: 18px; height: 18px; }

.text-btn, .btn {
  border: 1px solid transparent;
  background: transparent;
  padding: 8px 12px;
}

[hidden] { display: none !important; }

.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 14px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  border-radius: 999px;
  padding: 10px 16px;
  font-weight: 700;
  box-shadow: var(--shadow);
}

.btn {
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
  padding: 10px 16px;
  display: inline-block;
  text-decoration: none;
}

.btn.secondary {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--line);
}

.btn:disabled { opacity: 0.55; cursor: wait; }

.content { padding: 18px 28px 28px; flex: 1; }

.banner.status { color: var(--danger); font-weight: 650; }

.activity {
  margin: 16px 0 4px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px 14px 10px;
}

.activity .section-head { margin: 0 0 8px; }

.activity-log {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 180px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.activity-log li {
  display: grid;
  grid-template-columns: 5.6rem minmax(0, 1fr);
  gap: 10px;
  align-items: baseline;
  font-size: 0.88rem;
}

.activity-log time { color: var(--muted); font-variant-numeric: tabular-nums; }

.activity-log .is-error span { color: var(--danger); font-weight: 650; }

.activity-log .activity-empty { display: block; color: var(--muted); }

.player-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 14px 16px;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 16px;
  box-shadow: var(--shadow);
}

.speaker {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: var(--surface-2);
  color: var(--text);
}

.speaker svg { width: 36px; height: 36px; }

#deviceLabel { margin: 0; font-size: 0.85rem; }

#deviceName { display: block; font-size: 1.15rem; }

#deviceMeta { margin: 0; font-size: 0.9rem; }

.player-card.is-on #deviceMeta { color: var(--ok); }

.player-controls { display: flex; flex-direction: column; align-items: stretch; gap: 8px; min-width: 240px; }

.refresh-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text);
  border-radius: 999px;
  padding: 10px 14px;
  font-weight: 700;
}

.refresh-btn:hover { border-color: var(--accent); }

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

.cast-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  border-radius: 999px;
  padding: 10px 14px;
  font-weight: 700;
}

.cast-btn[aria-pressed="true"] {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: transparent;
}

.cast-btn svg { width: 18px; height: 18px; flex: none; }

.look-field, .volume-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.8rem;
  color: var(--muted);
}

.look-field[hidden], .volume-field[hidden], .cast-btn[hidden] { display: none; }

input[type="range"] { width: 100%; accent-color: var(--accent); }

#deviceHint, #devicesIntro { grid-column: 1 / -1; margin: 0; }

#devicesIntro { display: none; }

body[data-view="devices"] #devicesIntro { display: block; }

select, input[type="search"] {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 22px 0 10px;
}

h2 { margin: 0; font-size: 1.15rem; }

.keys {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  width: min(100%, 980px);
}

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

.key-slot .text-btn { align-self: flex-start; padding: 0 2px; }

.key {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 12px;
  color: var(--text);
  box-shadow: var(--shadow);
}

.key-num, .key strong { position: relative; z-index: 2; }

.key-num {
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.key strong {
  font-size: 0.92rem;
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.key-art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
}

.key.has-art { color: #fff; border-color: transparent; }

.key.has-art::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.78) 0%, rgba(0, 0, 0, 0.08) 48%, rgba(0, 0, 0, 0.4) 100%);
}

.key.has-art.is-mark::before {
  background: linear-gradient(to top, rgba(0, 0, 0, 0.72) 0%, rgba(0, 0, 0, 0) 46%);
}

.key.has-art .key-num {
  color: #fff;
  background: rgba(0, 0, 0, 0.4);
  border-radius: 999px;
  padding: 2px 7px;
}

.key.is-empty { color: var(--muted); }

.playlist-form {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) minmax(180px, 1.4fr) auto auto auto;
  gap: 10px;
  align-items: end;
  width: 100%;
}

.playlist-form button { justify-self: start; }

@media (max-width: 800px) {
  .playlist-form { grid-template-columns: 1fr; }
}

.playlist-form input { min-width: min(100%, 220px); }

.sources, .cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 12px;
}

.source[hidden], button.source.side-app[hidden] { display: none; }

.source, .explore-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px;
  box-shadow: var(--shadow);
  color: var(--text);
}

.source[aria-pressed="true"] { border-color: var(--accent); }

.source-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  font-weight: 700;
  color: #fff;
}

.source-tunein { background: #14284a; }

.source-radio { background: #178a4b; }

.source-spotify { background: #1db954; color: #06210f; }

.source-deezer { background: #a238ff; }

.source-apple { background: #111; }

.source-soundcloud { background: #ff5500; }

#soundcloudPanel {
  align-items: stretch;
  width: 100%;
  gap: 16px;
}

#soundcloudPanel > * { width: 100%; min-width: 0; }

.sc-hero {
  display: flex;
  align-items: center;
  gap: 14px;
}

.sc-hero h2 { font-size: 1.45rem; letter-spacing: -0.03em; }

.sc-hero p { margin: 2px 0 0; }

.sc-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sc-toolbar .back-btn { margin: 0; flex: none; }

.sc-filters { display: flex; flex-wrap: wrap; gap: 8px; }
.sc-filter {
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 650;
}
.sc-filter[aria-selected="true"] {
  background: #ff5500;
  border-color: #ff5500;
  color: #fff;
}

.sc-genre {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 8px;
}
.sc-genre[hidden] { display: none; }
.sc-genre-key {
  aspect-ratio: 1;
  min-height: 0;
  margin: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  color: inherit;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.15;
  text-align: left;
  display: flex;
  align-items: flex-end;
}
.sc-genre-key[aria-pressed="true"] {
  outline: 3px solid var(--text);
  outline-offset: 2px;
}

.sc-search {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  min-height: 48px;
  padding: 4px 8px 4px 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface-2);
}

.sc-search:focus-within {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.sc-search-ico {
  width: 18px;
  height: 18px;
  flex: none;
  color: #ff5500;
}

.sc-search input[type="search"] {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  padding: 10px 0;
  border-radius: 0;
}

.sc-search input[type="search"]:focus { outline: none; }

.sc-search input[type="search"]::-webkit-search-cancel-button { appearance: none; }

.sc-clear {
  width: 36px;
  height: 36px;
  flex: none;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--text);
  font-size: 1.3rem;
  line-height: 1;
}

.sc-spin {
  width: 16px;
  height: 16px;
  flex: none;
  border: 2px solid var(--line);
  border-top-color: #ff5500;
  border-radius: 50%;
  animation: sc-spin 0.7s linear infinite;
}

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

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

.sc-section {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin: 0;
  font-size: 1.05rem;
}

.sc-section .sc-count {
  color: var(--muted);
  font-weight: 500;
  font-size: 0.9rem;
}

.sc-play-all { min-height: 36px; }

#soundcloudQueueLabel { margin: 0; color: var(--muted); font-size: 0.82rem; }

.sc-results { display: flex; flex-direction: column; gap: 18px; }

.sc-block h3 { margin: 0 0 10px; font-size: 1rem; }
.sc-block h3 .sc-count { margin-left: 8px; color: var(--muted); font-weight: 500; font-size: 0.85rem; }

.sc-grid, .sc-tracks { width: 100%; }

.sc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}

.sc-artist {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  min-height: 132px;
  padding: 16px;
  text-align: left;
  color: inherit;
  font: inherit;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  cursor: pointer;
}

.sc-artist strong, .sc-track strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.sc-artist-copy, .sc-track-copy { min-width: 0; width: 100%; }

.sc-mark, .sc-cover-fallback {
  display: grid;
  place-items: center;
  color: #fff;
  background: #ff5500;
}

.sc-mark {
  width: 48px;
  height: 48px;
  border-radius: 14px;
}

.sc-mark svg, .sc-cover-fallback svg { width: 22px; height: 22px; }

.sc-tracks {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 12px;
}

.sc-pager {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 4px;
}
.sc-pager span { color: var(--muted); font-weight: 650; }

.sc-track {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 10px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 16px;
}

.sc-cover, .sc-cover-fallback {
  width: 72px;
  height: 72px;
  border-radius: 12px;
  object-fit: cover;
  background: var(--surface);
  border: 1px solid var(--line);
}

.sc-play {
  background: #ff5500;
  color: #fff;
  min-height: 44px;
}

.sc-empty { margin: 4px 0; }

#soundcloudPlayer.soundcloud-player {
  position: sticky;
  bottom: 12px;
  z-index: 3;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
  padding: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.soundcloud-player[hidden] { display: none; }

.sc-dock-bar {
  display: flex;
  align-items: center;
  gap: 12px;
}

#soundcloudNow {
  flex: 1;
  min-width: 0;
  margin: 0;
  color: var(--text);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.soundcloud-frame { width: 100%; height: 166px; border: 0; border-radius: 12px; background: #f3f3f3; }
#soundcloudFrameHost {
  position: fixed;
  right: 0;
  bottom: 0;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}
#soundcloudFrameSlot { width: 100%; }
.transport button:disabled { opacity: 0.38; }
.soundcloud-controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.soundcloud-controls .symbol {
  flex: 0 0 46px;
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  background: var(--surface-2);
  border-radius: 12px;
  font-size: 18px;
  line-height: 1;
  padding: 0;
}
.soundcloud-controls .symbol:disabled { opacity: 0.38; }
body[data-playback="playing"] #soundcloudPause,
body[data-playback="paused"] #soundcloudPlay,
#soundcloudStopQueue {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: transparent;
}

[data-theme="contrast"] .sc-mark,
[data-theme="contrast"] .sc-cover-fallback,
[data-theme="contrast"] .sc-play,
[data-theme="contrast"] .sc-search-ico {
  background: #fff;
  color: #000;
}
#soundcloudPanel .sc-tools {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px;
  align-items: start;
}

#soundcloudPanel .sc-tool {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: auto;
  max-width: none;
  margin: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface-2);
}

#soundcloudPanel .sc-tool h2 { font-size: 1.05rem; }

#soundcloudPanel .sc-tool label { font-weight: 600; }

#soundcloudPanel .sc-file { width: 100%; }

#soundcloudPanel .sc-schema {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
}

.soundcloud-contrib { width: min(100%, 42rem); display: flex; flex-direction: column; gap: 10px; margin-top: 18px; }
.soundcloud-actions, .contrib-form, #soundcloudAuth { display: flex; flex-wrap: wrap; gap: 8px; }
.contrib-form { flex-direction: column; align-items: stretch; }
.contrib-form input, #soundcloudAuth input { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.soundcloud-preview { display: flex; gap: 12px; align-items: center; }
.soundcloud-preview img { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; }
.soundcloud-preview .sub, .soundcloud-preview .hint { display: block; }
.soundcloud-importer { width: min(100%, 42rem); display: flex; flex-direction: column; gap: 10px; margin-top: 18px; }
.soundcloud-importer[hidden] { display: none; }
.soundcloud-importer textarea { width: 100%; min-height: 8rem; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--text); }
.import-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.import-stats div { border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; }
.import-stats strong { display: block; font-size: 1.2rem; }
.import-row { display: grid; grid-template-columns: auto 1fr; gap: 8px; align-items: start; }

.spotify-panel {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 14px;
  margin: 8px 0 18px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
}

.spotify-panel[hidden] { display: none; }

.spotify-panel p { margin: 0; max-width: 42rem; color: var(--muted); }

.spotify-setup {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

#spotifyRedirect { font-family: ui-monospace, monospace; font-size: 13px; word-break: break-all; }

.spotify-guide {
  margin: 0;
  padding-left: 1.2rem;
  max-width: 42rem;
  color: var(--muted);
}

.spotify-guide li { margin: 0 0 8px; }

.spotify-guide a { color: inherit; }

.phone-link { margin: 8px 0 22px; }
.phone-code {
  margin: 8px 0 0;
  font-size: 2rem;
  letter-spacing: 0.28em;
  font-weight: 700;
}
#phoneRedirect { font-family: ui-monospace, monospace; }

.spotify-player { width: min(100%, 480px); }

.spotify-player[hidden] { display: none; }

.spotify-player iframe {
  width: 100%;
  height: 352px;
  border: 0;
  border-radius: 12px;
  background: #000;
}

.source-radio svg { width: 22px; height: 22px; }

[data-theme="contrast"] .source-mark,
[data-theme="contrast"] .explore-icon,
[data-theme="contrast"] .row-glyph {
  background: #fff;
  color: #000;
}

.explore-card { flex-direction: row; align-items: center; min-height: 84px; }

.explore-icon {
  width: 42px;
  height: 42px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 14px;
  color: #fff;
  background: var(--tint, var(--accent));
}

.explore-icon svg { width: 22px; height: 22px; }

.explore-card strong, .row strong, #nowTitle { display: block; }

body[data-view="home"] #explorePanel,
body[data-view="devices"] #explorePanel,
body[data-view="devices"] #homePanel,
body[data-view="explore"] #homePanel { display: none; }

body[data-view="home"] .home-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 300px);
  gap: 8px 22px;
  align-items: start;
}

body[data-view="home"] .home-main { min-width: 0; }

body[data-view="home"] .home-rail {
  position: sticky;
  top: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

body:not([data-view="home"]):not([data-view="devices"]) .home-layout { display: none; }

body[data-view="devices"] .home-layout { display: block; }

body[data-view="devices"] .home-rail { display: none; }

body:not([data-view="soundcloud"]) #soundcloudPanel,
body:not([data-view="spotify"]):not([data-view="deezer"]):not([data-view="applemusic"]) #appPanel { display: none; }

.devices-only { display: none; }

body[data-view="devices"] .devices-only { display: flex; }

.view-head { display: flex; align-items: center; gap: 12px; margin: 0 0 16px; }

.view-head .view-title, .view-head .view-mark { display: none; }

.view-head .view-title { margin: 0; font-size: 1.6rem; letter-spacing: -0.03em; }

body[data-view="explore"] .view-title[data-for="explore"],
body[data-view="tunein"] .view-title[data-for="tunein"],
body[data-view="radiobrowser"] .view-title[data-for="radiobrowser"],
body[data-view="spotify"] .view-title[data-for="spotify"],
body[data-view="deezer"] .view-title[data-for="deezer"],
body[data-view="applemusic"] .view-title[data-for="applemusic"] { display: block; }

body[data-view="tunein"] .view-mark[data-for="tunein"],
body[data-view="radiobrowser"] .view-mark[data-for="radiobrowser"],
body[data-view="spotify"] .view-mark[data-for="spotify"],
body[data-view="deezer"] .view-mark[data-for="deezer"],
body[data-view="applemusic"] .view-mark[data-for="applemusic"] { display: grid; }

#exploreSources { display: none; }

body[data-view="explore"] #exploreSources { display: grid; margin-bottom: 16px; }

.service-view { width: 100%; }

body[data-view="home"] .home-rail .activity { margin: 0; }

body[data-view="home"] .home-rail .activity-log { max-height: min(52vh, 420px); }

body[data-view="home"] .home-rail .phone-link {
  margin: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px 14px;
}

body[data-view="home"] .home-rail .phone-link .section-head,
body[data-view="home"] .home-shortcuts .section-head { margin: 0 0 8px; }

body[data-view="home"] .home-shortcuts {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px 14px;
}

body[data-view="home"] .home-shortcut-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

body[data-view="home"] .player-card {
  gap: 8px 12px;
  padding: 12px;
  align-items: center;
}

body[data-view="home"] .speaker { width: 52px; height: 52px; border-radius: 14px; }

body[data-view="home"] .speaker svg { width: 30px; height: 30px; }

body[data-view="home"] .player-controls { min-width: 0; width: min(100%, 240px); gap: 6px; }

body[data-view="home"] .refresh-btn,
body[data-view="home"] .cast-btn { padding: 8px 12px; }

body[data-view="home"] #deviceHint { margin: 0; font-size: 0.82rem; }

body[data-view="home"] .keys { width: 100%; gap: 16px 12px; }

body[data-view="home"] .key { border-radius: 16px; padding: 10px; }

body[data-view="home"] .key-slot { gap: 6px; align-items: center; }

body[data-view="home"] .key-slot .text-btn {
  align-self: center;
  margin: 0;
  padding: 3px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.2;
}

body[data-view="home"] #homePanel > .section-head { margin-top: 26px; }

body[data-view="home"] #homePanel > .section-head h2 { font-size: 1.28rem; letter-spacing: -0.02em; }

body[data-view="home"] #homePanel .sources { gap: 10px; }

body[data-view="home"] .activity-log li:not(.activity-empty) {
  grid-template-columns: 16px 4.8rem minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  padding: 7px 0;
  border-top: 1px solid var(--line);
}

body[data-view="home"] .activity-mark { display: block; width: 16px; height: 16px; color: var(--muted); }

body[data-view="home"] .activity-log .is-error .activity-mark,
body[data-view="home"] .activity-log .is-error span { color: var(--danger); }

body[data-view="home"] .activity-log time { font-size: 0.75rem; }

.activity-mark { display: none; }

body[data-view="home"] #phoneCodeBtn {
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  border-color: transparent;
  padding: 6px 12px;
  font-weight: 700;
}

body[data-view="home"] .home-rail .phone-link .hint { margin: 6px 0 0; font-size: 0.82rem; }

body[data-view="home"] .home-rail .phone-code { font-size: 1.35rem; letter-spacing: 0.16em; margin: 8px 0 0; }

body[data-view="home"] .home-shortcut {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-2);
  color: var(--text);
  padding: 10px 12px;
  font-weight: 650;
}

body[data-view="home"] .home-shortcut svg { width: 18px; height: 18px; flex: none; color: var(--accent); }

[data-theme="contrast"] [data-view="home"] .home-shortcut svg { color: var(--text); }

@media (max-width: 1100px) {
  body[data-view="home"] .home-layout { grid-template-columns: 1fr; }
  body[data-view="home"] .home-rail { position: static; }
}

.search { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }

#query { flex: 1; min-width: 0; }

.search select { flex: 0 1 11rem; min-width: 9rem; }

#pageTitle { margin: 8px 0 12px; }

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

.group h3 { margin: 14px 0 8px; font-size: 0.95rem; color: var(--muted); }

.row {
  display: grid;
  grid-template-columns: 52px 1fr auto;
  gap: 12px;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 8px;
}

button.artist-row {
  width: 100%;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  grid-template-columns: 52px 1fr;
}

.row img, .row-art, #nowImage, .now-art {
  width: 52px;
  height: 52px;
  object-fit: cover;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
}

.row-art, .now-art { display: block; }

.row-art-wrap { width: 52px; height: 52px; flex: none; }

.row-glyph {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  color: #fff;
  background: var(--tint, var(--accent));
}

.row-glyph svg { width: 22px; height: 22px; }

.row-art-wrap:has(img) .row-glyph { display: none; }

#nowImage[hidden], #nowFallback[hidden] { display: none; }

.note { color: var(--muted); }

.now[hidden] { display: none !important; }

.now {
  position: sticky;
  top: 8px;
  z-index: 2;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: center;
  margin: 14px 0 0;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.now-copy { flex: 1; min-width: 0; }

.now-actions {
  display: flex;
  gap: 4px;
  margin-top: 4px;
}

.now-actions[hidden] { display: none; }

.now-actions .text-btn {
  padding: 2px 0;
  color: var(--muted);
  font-size: 13px;
}

#nowTitle, .row strong, .explore-card strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.transport {
  grid-column: 1 / -1;
  display: flex;
  gap: 8px;
}

.transport button {
  flex: 1;
  border: 1px solid var(--line);
  background: var(--surface-2);
  border-radius: 12px;
  padding: 10px 8px;
  font-weight: 600;
}

.transport button.symbol {
  flex: 0 0 46px;
  display: grid;
  place-items: center;
  font-size: 18px;
  line-height: 1;
  padding: 10px 0;
}

.transport button.symbol svg { width: 18px; height: 18px; }

.transport [data-action="shuffle"][aria-pressed="true"] {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: transparent;
}

.transport [data-action="stop"] {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: transparent;
}

body[data-playback="paused"] .transport [data-action="resume"] {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: transparent;
}

body[data-playback="playing"] .transport [data-action="pause"] {
  outline: 2px solid var(--accent);
}

.now-queue { grid-column: 1 / -1; }

.now-queue[hidden],
.now-queue-list[hidden] { display: none; }

.now-queue-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  text-align: left;
}

.now-queue-toggle svg { width: 18px; height: 18px; flex: none; }

.now-queue-count { margin-left: auto; color: var(--muted); font-weight: 600; font-size: 0.85rem; }

.now-queue-list {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  max-height: 240px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

.now-queue-list button {
  display: grid;
  grid-template-columns: 1.6rem 36px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  width: 100%;
  min-height: 48px;
  padding: 6px 10px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  font: inherit;
  text-align: left;
}

.now-queue-list li:last-child button { border-bottom: 0; }

.now-queue-list button[aria-current="true"] {
  background: var(--surface-2);
  box-shadow: inset 3px 0 0 var(--accent);
}

.now-queue-list img,
.now-queue-art {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  object-fit: cover;
  background: var(--line);
}

.now-queue-copy { min-width: 0; display: flex; flex-direction: column; }

.now-queue-copy strong,
.now-queue-copy span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.now-queue-pos,
.now-queue-copy span,
.now-queue-state { color: var(--muted); font-size: 0.82rem; }

.now-queue-state { font-weight: 700; }

[data-theme="contrast"] .now-queue-list button[aria-current="true"] {
  outline: 2px solid var(--text);
  outline-offset: -2px;
  box-shadow: none;
}

@media (max-width: 640px) {
  .now-queue-list { max-height: 200px; }
  .now-queue-list button { grid-template-columns: 1.4rem 36px minmax(0, 1fr); }
  .now-queue-state { grid-column: 2 / -1; }
}

.dock { display: none; }

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

@media (max-width: 1100px) {
  .app { grid-template-columns: 220px 1fr; }
  .side { padding: 16px 12px; }
  .topbar { padding: 16px 18px 0; }
  .content { padding: 14px 18px 24px; }
  .player-card { grid-template-columns: auto 1fr; }
  .player-controls { grid-column: 1 / -1; min-width: 0; }
}

@media (max-width: 640px) {
  .app { grid-template-columns: 1fr; }
  .side { display: none; }
  .brand-compact { display: flex; }
  .greet { display: none; }
  .topbar { align-items: center; padding: 14px 16px 0; }
  .now { position: sticky; top: 8px; margin: 12px 0 0; }
  .dock {
    display: flex;
    flex-direction: column;
    gap: 4px;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--surface);
    border-top: 1px solid var(--line);
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
  }
  .dock-views { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
  .dock-apps { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 4px; }
  .dock button { justify-content: center; }
  .dock-apps .side-app {
    flex-direction: column;
    gap: 2px;
    padding: 4px 2px;
    font-size: 0.62rem;
    line-height: 1.1;
  }
  .dock-apps .side-app-name {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }
  .content { padding: 14px 16px calc(112px + env(safe-area-inset-bottom)); }
  .legal-mobile { display: block; }
  .keys { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .sc-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
}

@media (max-width: 640px) {
  .sc-toolbar { align-items: stretch; flex-direction: column; }
  .sc-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sc-tracks { grid-template-columns: 1fr; }
  .sc-track { grid-template-columns: 56px minmax(0, 1fr); }
  .sc-cover, .sc-cover-fallback { width: 56px; height: 56px; }
  .sc-track .sc-play { grid-column: 2; justify-self: start; }
  .sc-dock-bar { align-items: stretch; flex-direction: column; }
  #soundcloudPlayer.soundcloud-player { bottom: calc(104px + env(safe-area-inset-bottom)); }
}

@media (max-width: 380px) {
  .sc-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .search { flex-wrap: wrap; }
  #query { flex-basis: 100%; }
  .search select { flex: 1 1 9rem; }
  .row { grid-template-columns: 44px 1fr; }
  .row .btn { grid-column: 2; justify-self: start; }
}

.admin-body { min-height: 100vh; background: var(--bg); color: var(--text); }
.admin-shell { min-height: 100vh; }
.admin-side .sidenav { min-height: 0; }
.admin-badge { margin-left: auto; color: var(--muted); font-size: 0.68rem; font-weight: 700; letter-spacing: 0.02em; }
.admin-content { padding: 8px 28px 48px; }
.admin-tools { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; align-items: center; }
.admin-tools .themes { display: flex; flex-wrap: wrap; gap: 6px; }
.admin-tools .themes button { border: 1px solid var(--line); background: var(--surface); color: var(--text); border-radius: 999px; padding: 6px 10px; }
.admin-tools .themes button[aria-pressed="true"] { background: var(--brand); color: var(--accent-ink); border-color: transparent; }
.admin-profile { position: relative; }
.admin-menu { position: absolute; right: 0; top: calc(100% + 8px); z-index: 2; display: flex; flex-direction: column; gap: 8px; min-width: 220px; padding: 12px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); box-shadow: var(--shadow); }
.admin-menu a { color: var(--accent); font-weight: 650; }
.admin-empty { margin: 12px 0 0; padding: 16px; border: 1px dashed var(--line); border-radius: 16px; color: var(--muted); background: var(--surface-2); }
.admin-theme { display: flex; align-items: center; gap: 8px; font-weight: 650; }
.admin-theme select { width: 9.5rem; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--text); padding: 8px 12px; font: inherit; }
.admin-section-head, .admin-pager, .admin-filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; }
.admin-section-head { justify-content: space-between; align-items: center; }
.admin-filters label { flex: 1 1 160px; margin: 0; }
.admin-filters .btn { margin-bottom: 2px; }
.admin-block { margin-top: 22px; }
.admin-block h3 { margin: 0 0 8px; }
.admin-url { display: block; min-width: 0; overflow-wrap: anywhere; word-break: break-word; color: var(--muted); font-size: 0.85rem; }
.admin-candidate { align-items: start; padding: 10px 12px; }
.admin-candidate p { margin: 0; }
.admin-candidate-main { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; min-width: 0; }
.admin-kv { display: grid; grid-template-columns: minmax(10rem, 16rem) minmax(0, 1fr); gap: 8px 16px; margin: 12px 0 0; }
.admin-kv dt { margin: 0; color: var(--muted); font-weight: 650; }
.admin-kv dd { margin: 0; overflow-wrap: anywhere; }
.admin-warning { margin: 12px 0; padding: 12px 14px; border: 1px solid color-mix(in srgb, #b42318 42%, var(--line)); border-radius: 14px; background: color-mix(in srgb, #b42318 10%, var(--surface)); }
.admin-pager { margin-top: 12px; align-items: center; }
.admin-bars { display: grid; gap: 8px; margin: 8px 0 18px; }
.admin-bar { display: grid; grid-template-columns: minmax(7rem, 10rem) 1fr auto; gap: 10px; align-items: center; }
.admin-bar-track { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.admin-bar-track span { display: block; height: 100%; background: linear-gradient(90deg, var(--brand), var(--brand-2, var(--accent))); }
.admin-directory-row, .admin-table article { display: flex; gap: 12px; align-items: center; width: 100%; text-align: left; margin-top: 8px; padding: 12px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); color: inherit; font: inherit; }
.admin-directory-row > span { display: grid; min-width: 0; }
.admin-directory-row div, .admin-table article { display: grid; }
.admin-art { width: 42px; height: 42px; object-fit: cover; border-radius: 10px; }
.admin-art-large { width: 120px; height: 120px; object-fit: cover; border-radius: 16px; }
.admin-panel select, .admin-panel input[type="text"], .admin-panel input[type="number"] { width: 100%; box-sizing: border-box; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); color: var(--text); padding: 12px 14px; font: inherit; }
.admin-theme select { width: 9.5rem; border-radius: 999px; padding: 8px 12px; }
.admin-content h2 { margin: 0 0 8px; }
@media (max-width: 800px) {
  .admin-shell { grid-template-columns: 1fr; }
  .admin-shell .side { display: flex; border-right: 0; border-bottom: 1px solid var(--line); }
  .admin-side .sidenav { flex-direction: row; flex-wrap: nowrap; overflow-x: auto; }
  .admin-side .sidenav button { width: auto; white-space: nowrap; }
  .admin-content, .admin-top { padding-left: 16px; padding-right: 16px; }
  .admin-tools { justify-content: flex-start; }
  .admin-bar { grid-template-columns: 1fr; }
}
.admin-wrap { width: min(920px, calc(100% - 32px)); margin: 0 auto; padding: 28px 0 48px; }
.admin-card, .admin-panel {
  background: var(--surface); border: 1px solid var(--line); border-radius: 18px;
  box-shadow: var(--shadow); padding: 22px;
}
.admin-login { width: min(420px, 100%); margin: 12vh auto 0; }
.admin-login h1, .admin-top h1 { font-size: 1.6rem; margin: 12px 0 4px; }
.admin-card label, .admin-panel label { display: block; font-weight: 600; margin: 14px 0 6px; }
.admin-card input, .admin-panel textarea, .admin-panel input[type="file"], .admin-panel input[type="search"] {
  width: 100%; box-sizing: border-box; border: 1px solid var(--line); border-radius: 12px;
  background: var(--surface-2); color: var(--text); padding: 12px 14px; font: inherit;
}
.admin-drop {
  border: 1px dashed var(--line); border-radius: 14px; background: var(--surface-2);
  padding: 16px; text-align: center;
}
.admin-drop p { margin: 0; }
.admin-drop input[type="file"] { margin-top: 10px; }
.admin-drop.is-over { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 14%, var(--surface-2)); }
.import-progress-list { display: grid; gap: 10px; margin-top: 16px; }
.import-progress { display: grid; grid-template-columns: 2rem minmax(0, 1fr) 3.5rem; gap: 8px; align-items: center; }
.import-progress progress { width: 100%; height: 10px; border: 0; border-radius: 999px; overflow: hidden; background: var(--surface-2); }
.import-progress progress::-webkit-progress-bar { background: var(--surface-2); border-radius: 999px; }
.import-progress progress::-webkit-progress-value { background: var(--brand); border-radius: 999px; }
.import-progress progress::-moz-progress-bar { background: var(--brand); border-radius: 999px; }
.admin-actions, .admin-nav { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.admin-nav button[aria-current="page"] { background: var(--brand); color: var(--accent-ink); }
.admin-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-top: 16px; }
.admin-stats article, .admin-stats .admin-stat { background: var(--surface-2); border: 1px solid transparent; border-radius: 14px; padding: 14px; min-width: 0; overflow: hidden; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.admin-stats .admin-stat:hover, .admin-stats .admin-stat:focus-visible { border-color: var(--brand); }
.admin-stats strong { display: block; font-size: 1.35rem; line-height: 1.25; overflow-wrap: anywhere; white-space: pre-line; }
.admin-dialog { border: 0; border-radius: 18px; background: var(--surface); color: var(--text); padding: 22px; max-width: 28rem; box-shadow: var(--shadow); }
.admin-dialog::backdrop { background: rgba(12, 16, 32, 0.45); }
.admin-status { display: inline-flex; align-items: center; border-radius: 999px; padding: 2px 8px; font-size: 0.75rem; font-weight: 700; background: var(--surface-2); color: var(--text); }
.admin-status-approved, .admin-status-completed { background: color-mix(in srgb, var(--brand) 18%, var(--surface)); }
.admin-status-pending, .admin-status-valid, .admin-status-processing { background: color-mix(in srgb, var(--accent) 18%, var(--surface)); }
.admin-status-failed, .admin-status-rejected, .admin-status-unavailable { background: color-mix(in srgb, #b42318 16%, var(--surface)); }
.admin-job-counts { display: flex; flex-wrap: wrap; gap: 8px; padding: 0; list-style: none; }
.admin-job-counts li { border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px; }
details.admin-directory-row { display: block; }
details.admin-directory-row summary { cursor: pointer; display: flex; justify-content: space-between; gap: 12px; }
@media (max-width: 800px) {
  .admin-stats { grid-template-columns: 1fr 1fr; }
}
.admin-note { color: var(--muted); }
.admin-error { color: var(--danger); }
.admin-top { display: flex; justify-content: space-between; gap: 16px; align-items: center; margin-bottom: 16px; }
.admin-row { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px 0; border-top: 1px solid var(--line); }
.admin-row.can-select { grid-template-columns: auto 56px minmax(0, 1fr) auto; }
.admin-import-row { grid-template-columns: minmax(0, 1fr) auto; }
.admin-import-row.can-select { grid-template-columns: auto minmax(0, 1fr) auto; }
.admin-import-row strong, .admin-import-row .admin-note { display: block; overflow-wrap: anywhere; }
.admin-import-row .admin-actions { margin-top: 0; }
.admin-import-job { margin-top: 8px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); overflow: hidden; }
.admin-import-head { display: flex; align-items: stretch; gap: 8px; background: var(--surface-2); }
.admin-import-toggle { display: flex; align-items: center; gap: 10px; flex: 1; width: auto; min-width: 0; min-height: 48px; padding: 10px 14px; border: 0; background: transparent; color: var(--text); font: inherit; font-weight: 650; text-align: left; cursor: pointer; }
.admin-import-job-actions { display: flex; align-items: center; gap: 8px; padding-right: 12px; flex: none; position: relative; z-index: 1; }
.admin-import-caret { width: 18px; height: 18px; flex: none; }
.admin-import-toggle[aria-expanded="true"] .admin-import-caret { transform: rotate(90deg); }
.admin-import-panel { padding: 0 14px 12px; background: var(--surface); }
#adminImportTabs { margin-bottom: 4px; }
.admin-panel label.admin-check { display: flex; align-items: center; gap: 8px; width: auto; margin: 0; font-weight: 600; cursor: pointer; }
.admin-check input { width: 18px; height: 18px; margin: 0; flex: none; accent-color: var(--brand); }
.admin-cover, .admin-cover-fallback { width: 56px; height: 56px; border-radius: 10px; object-fit: cover; background: var(--surface-2); }
.admin-cover-fallback { display: grid; place-items: center; color: var(--muted); }
@media (max-width: 640px) {
  .admin-top, .admin-row { display: block; }
  .admin-row .admin-actions { margin-top: 8px; }
  .admin-kv { grid-template-columns: 1fr; }
  .admin-nav { flex-wrap: nowrap; overflow-x: auto; }
}
