:root {
  color-scheme: light;
  --bg: #eef2f6;
  --surface: #ffffff;
  --surface-soft: #f6f8fb;
  --ink: #17202f;
  --muted: #657286;
  --line: #dce3eb;
  --brand: #0b6f7d;
  --brand-deep: #084f5f;
  --accent: #e0a526;
  --good: #1d9a6c;
  --warn: #b87517;
  --shadow: 0 18px 44px rgba(23, 32, 47, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  overflow-x: hidden;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.login-screen {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(120deg, rgba(8, 79, 95, 0.92), rgba(18, 26, 37, 0.86)),
    url("https://images.unsplash.com/photo-1598488035139-bdbb2231ce04?auto=format&fit=crop&w=1400&q=80");
  background-position: center;
  background-size: cover;
}

.login-screen[hidden] {
  display: none;
}

.login-panel {
  display: grid;
  width: min(420px, 100%);
  gap: 14px;
  padding: 28px;
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.login-panel h1 {
  font-size: 1.8rem;
}

.login-panel p {
  margin-bottom: 0;
}

.login-panel label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-weight: 700;
}

button,
input,
select {
  max-width: 100%;
  font: inherit;
}

button {
  cursor: pointer;
  white-space: nowrap;
}

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 28px;
  height: 100vh;
  overflow-y: auto;
  padding: 24px 18px;
  background: #121a25;
  color: #edf5fb;
}

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

.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  aspect-ratio: 1;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--brand), #22a294);
  color: #fff;
  font-weight: 800;
}

.brand strong,
.brand span {
  display: block;
}

.brand span {
  color: #a8b5c5;
  font-size: 0.86rem;
}

.nav-list {
  display: grid;
  gap: 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #c7d3df;
  text-align: left;
}

.nav-item:hover,
.nav-item.active {
  background: #203044;
  color: #fff;
}

.icon {
  display: grid;
  place-items: center;
  width: 24px;
  color: #7fd3ca;
}

.sidebar-footer {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: auto;
  padding: 14px 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: #cbd7e3;
  font-size: 0.92rem;
}

.status-dot {
  width: 10px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--good);
  box-shadow: 0 0 0 5px rgba(29, 154, 108, 0.18);
}

.main {
  width: 100%;
  min-width: 0;
  padding: 28px;
}

.topbar,
.section-title,
.panel-header,
.toolbar,
.card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(260px, 440px) auto;
  margin-bottom: 24px;
}

.topbar > * {
  min-width: 0;
}

.active-station-context {
  display: grid;
  min-width: min(420px, 100%);
  gap: 6px;
}

.active-station-context label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.active-station-context span {
  color: var(--muted);
  font-size: 0.86rem;
  overflow-wrap: anywhere;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--brand);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.76rem;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(1.7rem, 3vw, 2.5rem);
}

h2 {
  margin-bottom: 8px;
  font-size: 1.45rem;
}

h3 {
  margin-bottom: 4px;
  font-size: 1.02rem;
}

p {
  color: var(--muted);
}

.topbar-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.context-bound-field {
  display: none !important;
}

.primary-button,
.secondary-button,
.danger-button,
.copy-button,
.icon-button,
.toolbar button,
.mount-list button,
.file-drop {
  min-height: 40px;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}

.primary-button {
  padding: 0 16px;
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
  font-weight: 700;
}

.primary-button:hover {
  background: var(--brand-deep);
}

.primary-button.is-busy,
.secondary-button.is-busy {
  opacity: 0.72;
  cursor: progress;
}

.primary-button.is-saved {
  border-color: var(--good);
  background: var(--good);
}

.secondary-button,
.danger-button {
  padding: 0 14px;
  font-weight: 700;
}

.secondary-button {
  background: #fff;
}

.copy-button {
  padding: 0 10px;
  background: #fff;
  font-size: 0.82rem;
  font-weight: 800;
}

.danger-button {
  border-color: rgba(181, 59, 59, 0.28);
  background: rgba(181, 59, 59, 0.08);
  color: #9d2f2f;
}

.icon-button {
  width: 42px;
  font-size: 1.1rem;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.station-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(280px, 0.9fr);
  gap: 18px;
  margin-bottom: 18px;
}

.dashboard-station-picker {
  display: none;
  grid-template-columns: minmax(260px, 0.8fr) minmax(0, 1fr);
  gap: 14px;
  align-items: end;
  margin-bottom: 18px;
}

.dashboard-station-picker label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.selected-station-summary {
  min-height: 40px;
  display: flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fff;
  color: var(--muted);
  font-size: 0.92rem;
  overflow-wrap: anywhere;
}

.station-live {
  min-height: 260px;
  padding: 28px;
  border-radius: 8px;
  background:
    linear-gradient(120deg, rgba(8, 79, 95, 0.94), rgba(18, 26, 37, 0.78)),
    url("https://images.unsplash.com/photo-1598488035139-bdbb2231ce04?auto=format&fit=crop&w=1400&q=80");
  background-position: center;
  background-size: cover;
  color: #fff;
  box-shadow: var(--shadow);
}

.station-live h2 {
  margin-top: 48px;
  font-size: clamp(2rem, 5vw, 4rem);
}

.station-live p {
  max-width: 620px;
  color: #dcecf2;
  font-size: 1.08rem;
}

.live-pill,
.idle-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.live-pill {
  background: rgba(29, 154, 108, 0.16);
  color: #08764e;
}

.station-live .live-pill {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}

.idle-pill {
  background: rgba(184, 117, 23, 0.16);
  color: var(--warn);
}

.player-row {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-top: 26px;
}

.play-button {
  display: grid;
  place-items: center;
  width: 58px;
  aspect-ratio: 1;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
  color: #1d170a;
  font-weight: 900;
}

.stream-meter,
.chart {
  display: flex;
  align-items: end;
  gap: 8px;
}

.stream-meter {
  height: 58px;
}

.stream-meter span {
  width: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.75);
}

.quick-stats {
  display: grid;
  gap: 14px;
}

.quick-stats article,
.panel,
.station-card,
.playlist-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.quick-stats article {
  display: grid;
  align-content: center;
  min-height: 76px;
  padding: 18px;
}

.quick-stats span,
.quick-stats small {
  color: var(--muted);
}

.quick-stats strong {
  font-size: 1.85rem;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(220px, 1fr));
  gap: 18px;
}

.panel {
  min-width: 0;
  padding: 20px;
  overflow: hidden;
}

.span-2 {
  grid-column: span 2;
}

.panel-header {
  margin-bottom: 18px;
}

.panel-header p {
  margin-bottom: 0;
  font-size: 0.92rem;
}

select,
input {
  width: 100%;
  min-width: 0;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 0 12px;
  color: var(--ink);
}

.chart {
  height: 220px;
  padding-top: 24px;
  border-bottom: 1px solid var(--line);
}

.compact-chart {
  height: 150px;
  margin-top: 18px;
}

.chart span {
  flex: 1;
  min-width: 14px;
  border-radius: 8px 8px 0 0;
  background: linear-gradient(180deg, #15a39c, #0b6f7d);
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.stat-grid article {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7fbfb;
}

.stat-grid span {
  color: var(--muted);
  font-size: 0.86rem;
}

.stat-grid strong {
  font-size: 1.55rem;
}

.settings-action-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7fbfb;
}

.settings-action-row div {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.settings-action-row span {
  color: var(--muted);
  font-size: 0.9rem;
  overflow-wrap: anywhere;
}

.station-profile-block,
.admin-limits-block,
.server-admin-block {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  min-width: 0;
  margin: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7fbfb;
}

.station-profile-block legend,
.admin-limits-block legend,
.server-admin-block legend {
  padding: 0 8px;
  color: var(--ink);
  font-weight: 800;
}

.station-profile-block p,
.admin-limits-block p,
.server-admin-block p {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.listener-map {
  position: relative;
  min-height: 260px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(0deg, rgba(255, 255, 255, 0.62), rgba(255, 255, 255, 0.62)),
    linear-gradient(135deg, #d8eef0, #f6faf8);
}

.listener-map::before {
  content: "";
  position: absolute;
  inset: 18px;
  border-radius: 45% 55% 52% 48%;
  background:
    radial-gradient(circle at 24% 42%, rgba(11, 111, 125, 0.2) 0 9%, transparent 10%),
    radial-gradient(circle at 49% 36%, rgba(11, 111, 125, 0.18) 0 14%, transparent 15%),
    radial-gradient(circle at 72% 53%, rgba(11, 111, 125, 0.16) 0 12%, transparent 13%),
    radial-gradient(circle at 82% 74%, rgba(11, 111, 125, 0.14) 0 8%, transparent 9%);
}

.map-dot {
  position: absolute;
  width: 12px;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border: 2px solid #fff;
  border-radius: 50%;
  background: #e0a526;
  box-shadow: 0 0 0 6px rgba(224, 165, 38, 0.22);
}

.map-empty {
  position: absolute;
  inset: auto 18px 18px;
  color: var(--muted);
}

.queue-list,
.rank-list,
.mount-list {
  display: grid;
  gap: 10px;
}

.queue-list div,
.rank-list span {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border-radius: 8px;
  background: var(--surface-soft);
}

.queue-list span,
.card-meta,
.playlist-card span {
  color: var(--muted);
  font-size: 0.9rem;
}

.stream-url {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 14px;
  overflow-wrap: anywhere;
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 10px;
  color: var(--brand-deep);
  font-size: 0.86rem;
  font-weight: 700;
}

.stream-url span {
  min-width: 0;
}

.data-table {
  min-width: 680px;
  width: 100%;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  padding: 14px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.data-table th {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
}

.mount-list button {
  display: flex;
  justify-content: space-between;
  padding: 0 12px;
}

.section-title {
  margin-bottom: 18px;
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px;
}

.station-card,
.playlist-card {
  padding: 20px;
}

.active-station-card {
  border-color: rgba(11, 111, 125, 0.5);
  box-shadow: 0 18px 44px rgba(11, 111, 125, 0.14);
}

.station-actions,
.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.form-message {
  min-height: 22px;
  margin: 12px 0 0;
  font-weight: 700;
}

.form-message[data-type="error"] {
  color: #9d2f2f;
}

.form-message[data-type="success"] {
  color: var(--good);
}

.settings-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 80;
  display: grid;
  gap: 8px;
  width: min(420px, calc(100vw - 32px));
  padding: 18px;
  border: 1px solid rgba(11, 111, 125, 0.24);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 44px rgba(23, 32, 47, 0.18);
}

.toast[hidden] {
  display: none;
}

.toast[data-type="error"] {
  border-color: rgba(157, 47, 47, 0.34);
}

.toast strong {
  font-size: 1rem;
}

.toast p {
  margin: 0;
  color: var(--muted);
}

.toast button {
  justify-self: start;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font-weight: 700;
}

.api-online .status-dot {
  background: #2fbf8f;
}

.station-builder,
.widget-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr);
  gap: 18px;
  margin-top: 18px;
}

.media-layout {
  display: grid;
  grid-template-columns: minmax(240px, 340px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.playlist-layout {
  display: grid;
  grid-template-columns: minmax(240px, 340px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.dj-layout {
  display: grid;
  grid-template-columns: minmax(240px, 360px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.mountpoint-layout {
  display: grid;
  grid-template-columns: minmax(240px, 360px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.media-uploader,
.playlist-form,
.dj-form,
.mountpoint-form {
  display: grid;
  gap: 16px;
}

.media-uploader label,
.playlist-form label,
.dj-form label,
.mountpoint-form label,
.playlist-toolbar label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 700;
}

.file-drop {
  height: auto;
  padding: 16px;
  border-style: dashed;
  border-color: rgba(18, 117, 137, 0.36);
  background: rgba(18, 117, 137, 0.06);
}

.file-drop span {
  display: block;
  margin-bottom: 10px;
  color: var(--ink);
}

.file-drop input {
  width: 100%;
  min-height: 0;
  padding: 0;
  border: 0;
}

.folder-create {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
}

.media-folder-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.folder-chip {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-weight: 700;
  overflow-wrap: anywhere;
  white-space: normal;
}

.folder-chip strong {
  min-width: 22px;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(18, 117, 137, 0.1);
  color: var(--brand-deep);
  font-size: 0.76rem;
}

.folder-chip.active-folder {
  border-color: var(--brand);
  background: rgba(18, 117, 137, 0.08);
}

.schedule-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.upload-progress {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.upload-progress[hidden] {
  display: none;
}

.upload-progress div {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(18, 117, 137, 0.14);
}

.upload-progress span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--brand);
  transition: width 0.18s ease;
}

.upload-progress strong {
  color: var(--ink);
  font-size: 0.85rem;
}

.service-panel {
  margin-top: 18px;
}

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

.service-panel pre {
  min-height: 160px;
  margin: 0;
  overflow-x: auto;
  white-space: pre-wrap;
  border-radius: 8px;
  background: #121a25;
  color: #d9f4ee;
  padding: 16px;
  font-size: 0.88rem;
  line-height: 1.55;
}

.builder-form,
.config-preview {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.form-grid,
.link-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.form-grid label,
.link-grid label,
.autodj-box label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-weight: 700;
}

.autodj-box {
  display: grid;
  gap: 14px;
  margin: 18px 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.autodj-box legend {
  padding: 0 8px;
  color: var(--ink);
  font-weight: 800;
}

input[type="range"] {
  padding: 0;
  accent-color: var(--brand);
}

.config-preview pre {
  min-height: 240px;
  margin: 12px 0 0;
  overflow-x: auto;
  white-space: pre-wrap;
  border-radius: 8px;
  background: #121a25;
  color: #d9f4ee;
  padding: 16px;
  font-size: 0.88rem;
  line-height: 1.55;
}

.link-grid input,
.link-grid textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 10px 12px;
  color: var(--ink);
}

.link-grid textarea {
  min-height: 118px;
  resize: vertical;
  font: inherit;
}

.span-all {
  grid-column: 1 / -1;
}

.player-widget {
  display: grid;
  grid-template-columns: minmax(120px, 180px) minmax(0, 1fr);
  gap: 22px;
  align-items: center;
  min-height: 260px;
  padding: 24px;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(18, 26, 37, 0.9), rgba(11, 111, 125, 0.82)),
    url("https://images.unsplash.com/photo-1516280440614-37939bbacd81?auto=format&fit=crop&w=1200&q=80");
  background-position: center;
  background-size: cover;
  color: #fff;
  box-shadow: var(--shadow);
}

.player-widget.theme-dark {
  background:
    linear-gradient(135deg, rgba(10, 14, 22, 0.94), rgba(32, 48, 68, 0.86)),
    url("https://images.unsplash.com/photo-1516280440614-37939bbacd81?auto=format&fit=crop&w=1200&q=80");
  color: #fff;
}

.player-widget.theme-light {
  border: 1px solid var(--line);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.92), rgba(238, 242, 246, 0.86)),
    url("https://images.unsplash.com/photo-1516280440614-37939bbacd81?auto=format&fit=crop&w=1200&q=80");
  color: var(--ink);
}

.player-widget.theme-light .player-copy p {
  color: var(--muted);
}

.player-widget.theme-light .live-pill {
  color: #08764e;
}

.player-widget.custom-background {
  background-position: center;
  background-size: cover;
}

.cover-art {
  position: relative;
  overflow: hidden;
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 1;
  border-radius: 8px;
  background: linear-gradient(135deg, #f2c14e, #22a294);
  color: #17202f;
  font-size: 2.6rem;
  font-weight: 900;
}

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

.cover-art.has-image {
  background: #17202f;
}

.cover-art.has-image span {
  display: none;
}

.player-copy h3 {
  margin-top: 16px;
  font-size: 2rem;
}

.player-copy p {
  color: #dcecf2;
}

.widget-controls {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 18px;
}

.widget-controls input {
  flex: 1;
  min-width: 90px;
}

.track-widget-options {
  display: grid;
  grid-template-columns: minmax(180px, 260px) minmax(120px, 180px);
  gap: 14px;
  margin-bottom: 16px;
}

.track-widget-options label,
.track-widget-embed {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-weight: 700;
}

.widget-background-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.widget-background-actions span {
  color: var(--muted);
  font-weight: 800;
}

.track-widget-preview {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
}

.track-widget-row {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.track-widget-row.no-artwork {
  grid-template-columns: minmax(0, 1fr);
}

.track-widget-thumb {
  position: relative;
  overflow: hidden;
  display: grid;
  place-items: center;
  width: 52px;
  aspect-ratio: 1;
  border-radius: 8px;
  background: linear-gradient(135deg, #f2c14e, #22a294);
  color: #17202f;
  font-weight: 900;
}

.track-widget-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.track-widget-title {
  min-width: 0;
}

.track-widget-title strong,
.track-widget-title span {
  display: block;
  overflow-wrap: anywhere;
}

.track-widget-title span {
  color: var(--muted);
  font-size: 0.9rem;
}

.station-card p,
.playlist-card p {
  min-height: 48px;
}

meter {
  width: 100%;
  height: 12px;
  margin: 14px 0 10px;
}

.toolbar {
  margin-bottom: 16px;
}

.toolbar input,
.toolbar label {
  min-width: 160px;
  flex: 1;
}

.toolbar button {
  padding: 0 14px;
}

.media-artwork-control {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) auto;
  gap: 8px;
  align-items: center;
  min-width: 260px;
}

.media-artwork-control input {
  min-width: 0;
  height: 36px;
}

.empty-state {
  margin: 14px 0 0;
  color: var(--muted);
  font-weight: 700;
}

.empty-state[hidden] {
  display: none;
}

.compact-button {
  min-height: 34px;
  padding: 0 10px;
}

.compact-button:disabled {
  cursor: default;
  opacity: 0.64;
}

.playlist-toolbar {
  align-items: flex-end;
  margin-bottom: 18px;
}

.data-table select {
  min-height: 34px;
  width: 100%;
  min-width: 150px;
  padding: 6px 8px;
}

.encoder-settings {
  display: grid;
  gap: 8px;
  margin: 14px 0;
}

.encoder-settings div {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--surface-soft);
}

.encoder-settings span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.encoder-settings strong {
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--ink);
  font-size: 0.88rem;
}

.settings-form {
  display: grid;
  width: min(760px, 100%);
  gap: 14px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.settings-form label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-weight: 700;
}

.settings-form input,
.settings-form select {
  color: var(--ink);
  font-weight: 500;
}

.switch-row {
  grid-template-columns: 1fr auto;
  align-items: center;
  min-height: 46px;
}

.switch-row input {
  width: 20px;
  min-height: 20px;
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 240px minmax(0, 1fr);
  }

  .topbar {
    grid-template-columns: minmax(0, 1fr) minmax(240px, 380px);
  }

  .topbar-actions {
    grid-column: 1 / -1;
  }

  .dashboard-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .cards-grid {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  }
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    gap: 16px;
    height: auto;
    padding: 16px;
  }

  .nav-list {
    grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  }

  .sidebar-footer {
    margin-top: 0;
  }

  .topbar {
    grid-template-columns: 1fr;
  }

  .station-hero,
  .dashboard-station-picker,
  .dashboard-grid,
  .cards-grid,
  .station-builder,
  .media-layout,
  .playlist-layout,
  .dj-layout,
  .mountpoint-layout,
  .widget-layout {
    grid-template-columns: 1fr;
  }

  .dashboard-grid {
    gap: 14px;
  }

  .span-2 {
    grid-column: auto;
  }

  .station-live h2 {
    margin-top: 34px;
  }
}

@media (max-width: 640px) {
  .login-panel {
    padding: 20px;
  }

  .sidebar {
    padding: 12px;
  }

  .brand {
    padding-inline: 4px;
  }

  .brand-mark {
    width: 38px;
  }

  .main {
    padding: 14px;
  }

  .topbar,
  .section-title,
  .toolbar,
  .panel-header,
  .card-meta {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar {
    gap: 14px;
  }

  .active-station-context {
    width: 100%;
  }

  .topbar-actions {
    width: 100%;
    justify-content: stretch;
  }

  .topbar-actions button,
  .form-actions button,
  .station-actions button,
  .primary-button {
    flex: 1;
  }

  .nav-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }

  .nav-item {
    min-height: 40px;
    padding: 8px 10px;
    font-size: 0.9rem;
  }

  .station-live {
    min-height: 230px;
    padding: 18px;
  }

  .station-live h2 {
    margin-top: 26px;
  }

  .station-live p,
  .player-copy p {
    font-size: 0.96rem;
  }

  .panel,
  .builder-form,
  .config-preview,
  .settings-form {
    padding: 16px;
    overflow-x: auto;
  }

  .data-table {
    min-width: 620px;
  }

  .data-table th,
  .data-table td {
    padding: 10px 8px;
  }

  .form-grid,
  .link-grid,
  .folder-create,
  .schedule-grid,
  .stat-grid,
    .station-profile-block,
    .admin-limits-block,
    .server-admin-block,
    .track-widget-options,
    .player-widget {
      grid-template-columns: 1fr;
    }

  .settings-action-row {
    align-items: stretch;
    flex-direction: column;
  }

  .player-row,
  .widget-controls {
    flex-wrap: wrap;
  }

  .cover-art {
    max-width: 180px;
  }

  .player-copy h3 {
    font-size: 1.5rem;
  }
}

@media (max-width: 420px) {
  .main {
    padding: 10px;
  }

  .nav-list {
    grid-template-columns: 1fr;
  }

  .section-title h2,
  h2 {
    font-size: 1.24rem;
  }

  .topbar-actions,
  .form-actions,
  .station-actions {
    flex-direction: column;
  }

  .topbar-actions button,
  .form-actions button,
  .station-actions button,
  .toolbar button {
    width: 100%;
  }

  .stream-url,
  .queue-list div,
  .rank-list span {
    align-items: flex-start;
    flex-direction: column;
  }
}
