/* Tenant colors extend to controls and panels outside the shared UI components.
   Playback canvases, waveforms and video controls deliberately retain their
   high-contrast dark work area. No rules apply without an explicit page theme. */
body.tenant-themed {
  color-scheme: dark light;
  --line:color-mix(in srgb,var(--text) 22%,var(--surface));
  --accent2:var(--accent);
}
body.tenant-themed .explorer-content,
body.tenant-themed .explorer .admin-tree-row>a.selected,
body.tenant-themed .player-time,
body.tenant-themed .mixpad .source-panel {
  background:var(--surface);
  color:var(--text);
  border-color:var(--line);
}
body.tenant-themed .explorer .admin-tree-row>a.selected { background:color-mix(in srgb,var(--accent) 22%,var(--surface)); }
body.tenant-themed .player-time [data-total-time] { color:var(--muted); }
body.tenant-themed .player-time-separator { color:var(--accent); }
body.tenant-themed dialog,
body.tenant-themed dialog.edit-dialog,
body.tenant-themed .floating-menu {
  background:var(--surface);
  color:var(--text);
  border-color:var(--line);
}
body.tenant-themed dialog input,
body.tenant-themed dialog select,
body.tenant-themed dialog textarea,
body.tenant-themed .sync-offset input {
  background:var(--bg);
  color:var(--text);
  border-color:var(--line);
}
body.tenant-themed .mixpad {
  color:var(--text);
  --mp-line:var(--line);
  --mp-red:var(--accent);
}
body.tenant-themed .mixpad p { color:var(--muted); }
body.tenant-themed .mixpad button,
body.tenant-themed .mixpad select,
body.tenant-themed .mixpad input,
body.tenant-themed .mixpad textarea {
  background:var(--surface);
  color:var(--text);
  border-color:var(--line);
}
body.tenant-themed .mixpad button.primary,
body.tenant-themed .mixpad .primary {
  background:var(--accent);
  border-color:var(--accent);
}
body.tenant-themed .mixpad .timeline-panel { border-color:var(--line); }
/* Waveform/timeline backgrounds and interactive clip colors stay distinct. */

/* Shared tenant palette for native form controls on watch, settings, admin,
   branding and Mini-Mixpad screens. Controls not listed here (e.g. waveform
   canvas, transport sliders and media playback) retain their own styling. */
body.tenant-themed input:is([type="text"],[type="search"],[type="number"],[type="password"],[type="email"],[type="url"],[type="tel"],[type="time"]),
body.tenant-themed select,
body.tenant-themed textarea {
  background:var(--surface);
  color:var(--text);
  border:1px solid var(--line);
  border-radius:7px;
  color-scheme:normal;
}
body.tenant-themed :is(input,textarea)::placeholder {
  color:var(--muted);
  opacity:.82;
}
body.tenant-themed select option {
  color:var(--text);
  background:var(--surface);
}
body.tenant-themed :is(input,textarea,select):focus-visible {
  outline:2px solid var(--accent);
  outline-offset:2px;
  border-color:var(--accent);
}
body.tenant-themed input[type="file"] {
  color:var(--text);
}
body.tenant-themed input[type="file"]::file-selector-button {
  background:var(--surface);
  color:var(--text);
  border:1px solid var(--line);
  border-radius:7px;
  padding:.4rem .65rem;
  margin-right:.65rem;
  cursor:pointer;
}
body.tenant-themed :is(input[type="checkbox"],input[type="radio"],input[type="range"]) {
  accent-color:var(--accent);
}
/* Legacy watch widgets use dark fixed inputs that should follow the club palette. */
body.tenant-themed .sync-offset input,
body.tenant-themed .training-panel :is(input,select,textarea),
body.tenant-themed .sync-panel :is(input,select,textarea) {
  background:var(--surface);
  color:var(--text);
  border-color:var(--line);
}

/* Tenant selector uses the same card and text colors as other club pages. */
body.tenant-themed .login-card {
  background:var(--surface);
  color:var(--text);
  border-color:var(--line);
}
body.tenant-themed .login-card p { color:var(--muted); }
body.tenant-themed .login-card :is(input,select,textarea) {
  background:var(--bg);
  color:var(--text);
  border-color:var(--line);
}
/* Primary actions use black or white text selected by the server for WCAG contrast. */
body.tenant-themed .button.primary,
body.tenant-themed .mixpad button.primary,
body.tenant-themed .mixpad .primary {
  color:var(--on-accent);
}

/* Mini-Mixpad working area: keep the grid and all track controls aligned with
   the tenant palette while preserving strong waveform/clip identity colors. */
body.tenant-themed .mixpad .timeline-panel,
body.tenant-themed .mixpad .timeline,
body.tenant-themed .mixpad .timeline-scroll {
  background:var(--bg);
  color:var(--text);
  border-color:var(--line);
}
body.tenant-themed .mixpad .ruler {
  background-color:var(--surface);
  border-color:var(--line);
  background-image:repeating-linear-gradient(
    90deg,transparent 0,transparent calc(var(--px-sec)*30 - 1px),
    var(--line) calc(var(--px-sec)*30 - 1px),var(--line) calc(var(--px-sec)*30)
  );
}
body.tenant-themed .mixpad .ruler span,
body.tenant-themed .mixpad .track-name,
body.tenant-themed .mixpad .track-ruler-label,
body.tenant-themed .mixpad .track-volume-row span {
  color:var(--text);
}
body.tenant-themed .mixpad .track-row {
  border-color:var(--line);
  background-color:var(--bg);
  background-image:linear-gradient(
    90deg,transparent calc(var(--px-sec)*30 - 1px),
    var(--line) calc(var(--px-sec)*30 - 1px)
  );
}
body.tenant-themed .mixpad .track-ruler-label,
body.tenant-themed .mixpad .track-controls {
  background:var(--surface);
  border-color:var(--line);
  color:var(--text);
  box-shadow:2px 0 8px #0002;
}
body.tenant-themed .mixpad .track-row.is-muted {
  background-color:color-mix(in srgb,var(--muted) 12%,var(--bg));
}
body.tenant-themed .mixpad .track-row.is-muted .track-controls {
  background:color-mix(in srgb,var(--muted) 13%,var(--surface));
  color:var(--text);
}
body.tenant-themed .mixpad .transport,
body.tenant-themed .mixpad .export-panel {
  background:var(--bg);
  color:var(--text);
  border-color:var(--line);
}
body.tenant-themed .mixpad #export-status,
body.tenant-themed .mixpad #preview-time { color:var(--text); }
/* Clips deliberately retain separate saturated colors so edits remain visible. */

/* Music library navigation must remain readable in light and dark tenant themes. */
body.tenant-themed .mixpad .music-folder {
  border-left-color:var(--line);
}
body.tenant-themed .mixpad .music-folder summary {
  color:var(--text);
}
body.tenant-themed .mixpad .music-folder summary:is(:hover,:focus-visible),
body.tenant-themed .mixpad .music-item:is(:hover,:focus-visible):not([aria-pressed="true"]) {
  background:color-mix(in srgb,var(--accent) 15%,var(--surface));
  color:var(--text);
  outline-color:var(--accent);
}
body.tenant-themed .mixpad .music-item small {
  color:var(--muted);
}
body.tenant-themed .mixpad .music-item[aria-pressed="true"] {
  background:var(--accent);
  border-color:var(--accent);
  color:var(--on-accent);
  box-shadow:inset 3px 0 var(--on-accent);
}
body.tenant-themed .mixpad .music-item[aria-pressed="true"] small {
  color:var(--on-accent);
}

/* Folder destination picker: avoid dark legacy dropdowns inside light tenant dialogs. */
body.tenant-themed .folder-picker .picker-button,
body.tenant-themed .folder-picker .picker-panel {
  background:var(--surface);
  color:var(--text);
  border-color:var(--line);
}
body.tenant-themed .folder-picker .picker-row,
body.tenant-themed .folder-picker .picker-row label,
body.tenant-themed .folder-picker .tree-toggle {
  color:var(--text);
}
body.tenant-themed .folder-picker .picker-row:is(:hover,:focus-within) {
  background:color-mix(in srgb,var(--accent) 14%,var(--surface));
  color:var(--text);
}
body.tenant-themed .folder-picker .picker-tree ul {
  border-left-color:var(--line);
}

/* Explorer three-dot actions must remain visible in both normal and hover states. */
body.tenant-themed .entry-menu-trigger {
  background:var(--accent);
  color:var(--on-accent);
  border:1px solid var(--accent);
  font-weight:800;
}
body.tenant-themed .entry-menu-trigger:is(:hover,:focus-visible,[aria-expanded="true"]) {
  background:var(--accent);
  color:var(--on-accent);
  border-color:var(--accent);
  box-shadow:0 0 0 3px color-mix(in srgb,var(--accent) 25%,transparent);
  filter:brightness(.93);
}

/* Explorer folder tiles and action menus follow the active club palette. */
body.tenant-themed .explorer-icon.folder {
  background:color-mix(in srgb,var(--accent) 11%,var(--surface));
  border:1px solid var(--line);
}
body.tenant-themed .explorer-menu {
  background:var(--surface);
  color:var(--text);
  border-color:var(--line);
}
body.tenant-themed .explorer-menu :is(button,a) {
  color:var(--text);
}
body.tenant-themed .explorer-menu :is(button,a):is(:hover,:focus-visible) {
  background:color-mix(in srgb,var(--accent) 16%,var(--surface));
  color:var(--text);
}
body.tenant-themed .explorer-menu .danger {
  color:var(--text);
  border-left:3px solid var(--accent);
}

/* Library media actions share the explorer's accessible club colors. */
body.tenant-themed .media-menu-trigger {
  background:var(--accent);
  border:1px solid var(--accent);
  color:var(--on-accent);
  font-weight:800;
}
body.tenant-themed .media-menu-trigger:is(:hover,:focus-visible,[aria-expanded="true"]) {
  background:var(--accent);
  border-color:var(--accent);
  color:var(--on-accent);
  filter:brightness(.93);
  box-shadow:0 0 0 3px color-mix(in srgb,var(--accent) 25%,transparent);
}
body.tenant-themed .floating-menu :is(button,a) {
  color:var(--text);
}
body.tenant-themed .floating-menu :is(button,a):is(:hover,:focus-visible) {
  background:color-mix(in srgb,var(--accent) 16%,var(--surface));
  color:var(--text);
}
body.tenant-themed .floating-menu form button {
  color:var(--text);
  border-left:3px solid var(--accent);
}

/* Watch-page descriptions must not use the legacy pale text on light cards. */
body.tenant-themed .description-panel .description-content {
  color:var(--text);
}
body.tenant-themed .description-panel .description-content[data-empty="true"] {
  color:var(--muted);
}
body.tenant-themed .description-panel .description-edit {
  color:var(--accent);
}
body.tenant-themed .description-panel .description-edit:is(:hover,:focus-visible) {
  color:var(--text);
  text-decoration-thickness:2px;
}
