/* ── Audio as a standalone Bento widget ───────────────────────
   Audio moved out of the system side-panel into its own .panel,
   which has no base padding — restore a comfortable inset here. */
.audio-panel {
  padding: 12px;
}

/* ── Volume tab inside the System hub — fill the tile, distribute ── */
body:not([data-panel]) .system-audio-pane:not([hidden]) {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
}
.system-audio-pane .audio-block {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  min-height: 0;
}
.system-audio-pane .volume-wrap {
  flex: 1 1 auto;
  min-height: 0;
}
.system-audio-pane .speaker-apps {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding-right: 0;
}
.system-audio-pane .device-section {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.audio-block {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-flow: dense;
  gap: 10px 6px;
}

.audio-block[data-audio-hidden="true"] {
  display: none;
}

/* .audio-block is display:grid, so the plain [hidden] attribute (UA display:none)
   loses to the class rule — restate it explicitly for the unavailable toggle. */
.audio-block[hidden] {
  display: none;
}

/* ── "Audio unavailable" notice (SoundVolumeView blocked / missing) ──
   Shown in place of the audio controls when the server can't read the
   devices — usually the antivirus has quarantined SoundVolumeView.exe. */
.audio-unavailable {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 8px;
  min-height: 0;
  padding: 16px 18px;
  color: var(--text-muted, rgba(255, 255, 255, .62));
}
.audio-unavailable[hidden] { display: none; }
.audio-unavailable-icon {
  width: 34px;
  height: 34px;
  fill: currentColor;
  opacity: .7;
}
.audio-unavailable-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text, rgba(255, 255, 255, .92));
}
.audio-unavailable-sub {
  font-size: 12px;
  line-height: 1.45;
  max-width: 34ch;
}

.volume-wrap {
  position: relative;
  grid-column: span 2;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding: 10px 12px;
  border-radius: var(--radius);
  background: var(--panel-soft);
  border: 1px solid #222929;
}

.vol-header {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
}

.vol-title {
  color: var(--muted-text);
  font-size: 13.5px;
  font-weight: 850;
}

.vol-value {
  color: var(--text);
  font-size: 14.5px;
  font-weight: 850;
  font-variant-numeric: tabular-nums;
}

.vol-mute-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid #293030;
  background: var(--control-bg);
  color: var(--muted-text);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: transform 0.12s ease, color 0.18s ease, border-color 0.18s ease;
}

.vol-mute-btn:active { transform: scale(0.9); }
.vol-mute-btn svg { width: 16px; height: 16px; fill: currentColor; }
.vol-mute-btn.speaker-muted { color: var(--color-danger); border-color: rgba(var(--danger-rgb),0.36); }

.vol-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 8px;
  border-radius: 999px;
  outline: none;
  cursor: pointer;
  background: var(--control-bg);
}

.vol-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--text);
  box-shadow: 0 0 0 3px var(--surface), 0 3px 10px rgba(0,0,0,0.35);
  cursor: pointer;
}

.vol-slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--text);
  border: 3px solid var(--surface);
  box-shadow: 0 3px 10px rgba(0,0,0,0.35);
  cursor: pointer;
}

.vol-slider.speaker-muted { opacity: 0.4; }

/* ── App Mixer (speaker) ─────────────────────────────────── */
.speaker-apps {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding-top: 8px;
  /* Right gutter keeps the per-app mute buttons clear of the floating AI
     voice orb (.xenon-voice-fab), which is fixed to the bottom-right corner
     directly over this panel. */
  padding-right: 88px;
  border-top: 1px solid #1c2424;
  margin-top: 2px;
}

.app-mix-row {
  display: grid;
  grid-template-columns: 22px minmax(46px, 92px) 1fr auto 24px;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.app-mix-row.app-mix-muted .app-mix-slider { opacity: 0.38; }
.app-mix-row.app-mix-muted .app-mix-vol   { color: var(--dim-text); }

.app-mix-icon {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
}

.app-mix-icon-letter {
  display: grid;
  place-items: center;
  background: rgba(var(--accent-rgb), 0.16);
  color: rgba(var(--accent-rgb), 0.9);
  font-size: 11px;
  font-weight: 850;
  border: 1px solid rgba(var(--accent-rgb), 0.22);
}

.app-mix-name {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.app-mix-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  border-radius: 999px;
  background: var(--control-bg);
  outline: none;
  cursor: pointer;
}

.app-mix-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--text);
  box-shadow: 0 0 0 2px var(--surface), 0 2px 6px rgba(0,0,0,0.35);
  cursor: pointer;
}

.app-mix-slider::-moz-range-thumb {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--text);
  border: 2px solid var(--surface);
  box-shadow: 0 2px 6px rgba(0,0,0,0.35);
  cursor: pointer;
}

.app-mix-vol {
  font-size: 11px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--muted-text);
  text-align: right;
  min-width: 30px;
}

.app-mix-mute {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px solid #293030;
  background: var(--control-bg);
  color: var(--dim-text);
  display: grid;
  place-items: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: color 0.15s, border-color 0.15s;
}

.app-mix-mute svg { width: 12px; height: 12px; fill: currentColor; }
.app-mix-mute.active { color: var(--color-danger); border-color: rgba(var(--danger-rgb),0.36); }
