/**
 * Settings Panel Redesign
 * Visual cohesion pass — consistent spacing, typography, 
 * polished toggles, voice sub-grouping.
 * 
 * CONSTRAINTS: No JS logic changes. All IDs/classes JS touches are preserved.
 * This file layers on top of app.css settings styles.
 */

/* ==========================================================================
   PANEL HEADER — Richer identity
   ========================================================================== */

.settings-panel-header {
  padding: var(--space-4) var(--space-5);
  gap: var(--space-3);
  min-height: 56px;
}

.settings-panel-title {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--accent);
  letter-spacing: 1px;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.settings-panel-title::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 6px var(--accent-30);
  flex-shrink: 0;
}

.settings-panel-close {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  font-size: var(--text-lg);
  color: var(--text-dim);
  transition: color 0.15s, background 0.15s;
}

.settings-panel-close:hover {
  color: var(--text);
  background: var(--accent-10);
}

/* ==========================================================================
   SECTION HEADERS — Elevated, card-like feel
   ========================================================================== */

.settings-section {
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  overflow: hidden;
}

.settings-section:last-child {
  border-bottom: none;
}

.settings-section-header {
  padding: var(--space-4) var(--space-3);
  min-height: 52px;
  gap: var(--space-3);
  border-radius: 0;
  transition: background 0.15s, color 0.15s;
  position: relative;
}

.settings-section-header:hover {
  background: var(--accent-05);
  color: var(--text);
}

.settings-section-header[aria-expanded="true"] {
  color: var(--accent);
}

.settings-section-header[aria-expanded="true"] .settings-section-icon {
  color: var(--accent);
}

.settings-section-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  background: var(--accent-10);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--accent);
  transition: background 0.15s;
}

.settings-section-header:hover .settings-section-icon {
  background: var(--accent-15);
}

.settings-section-icon svg {
  width: 16px;
  height: 16px;
}

.settings-section-title {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.settings-section-chevron {
  color: var(--text-dim);
  transition: transform 0.2s ease, color 0.15s;
}

.settings-section-header:hover .settings-section-chevron {
  color: var(--accent);
}

.settings-section-header[aria-expanded="true"] .settings-section-chevron {
  color: var(--accent);
  transform: rotate(90deg);
}

.settings-section-chevron svg {
  width: 14px;
  height: 14px;
}

/* Danger zone overrides */
.settings-section-danger .settings-section-icon {
  background: rgba(220, 38, 38, 0.1);
  color: var(--warning);
}

.settings-section-danger .settings-section-header {
  color: var(--text-dim);
}

.settings-section-danger .settings-section-header:hover {
  background: rgba(220, 38, 38, 0.05);
  color: var(--error);
}

.settings-section-danger .settings-section-header:hover .settings-section-icon {
  background: rgba(220, 38, 38, 0.15);
  color: var(--error);
}

/* ==========================================================================
   SECTION BODY & ROWS — Tight, iOS-style list
   ========================================================================== */

.settings-section-body {
  transition: max-height 0.28s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.2s ease;
  max-height: 2400px; /* Voice section is huge */
  opacity: 1;
  padding: 0 var(--space-3) var(--space-2);
}

.settings-section-body.collapsed {
  max-height: 0;
  opacity: 0;
  pointer-events: none;
  padding-bottom: 0;
}

.setting-row {
  padding: var(--space-4) var(--space-2);
  gap: var(--space-3);
  min-height: 52px;
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
  border-radius: var(--radius-sm);
}

.setting-row:hover {
  background: var(--white-05, rgba(255,255,255,0.03));
}

.setting-row:last-child {
  border-bottom: none;
}

.setting-label {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text);
  line-height: 1.3;
}

.setting-desc {
  font-size: var(--text-xs);
  color: var(--text-dim);
  margin-top: 3px;
  line-height: 1.4;
}

/* ==========================================================================
   INPUTS & SELECTS — Consistent, polished
   ========================================================================== */

.setting-input {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-2) var(--space-3);
  color: var(--text);
  font-size: var(--text-sm);
  width: 130px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  height: 36px;
}

.setting-input:hover {
  border-color: var(--accent-30);
}

.setting-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-10);
}

.setting-select {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-2) var(--space-3);
  color: var(--text);
  font-size: var(--text-sm);
  outline: none;
  cursor: pointer;
  height: 36px;
  transition: border-color 0.15s, box-shadow 0.15s;
  flex-shrink: 0;
  /* Custom arrow */
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 32px;
}

.setting-select:hover {
  border-color: var(--accent-30);
}

.setting-select:focus,
.setting-select:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-10);
  outline: none;
}

.setting-input-group {
  display: flex;
  gap: var(--space-2);
  margin-top: var(--space-3);
  min-width: 0;
  max-width: 100%;
}

.setting-input-mono {
  flex: 1;
  min-width: 0;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 0;
}

.setting-input-wide {
  max-width: 200px;
  width: 100%;
}

/* ==========================================================================
   BUTTONS — Refined sizing, better hover feedback
   ========================================================================== */

.setting-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 var(--space-4);
  border-radius: var(--radius-md);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.2px;
  cursor: pointer;
  border: none;
  transition: background 0.15s, opacity 0.15s, box-shadow 0.15s, transform 0.1s;
  white-space: nowrap;
  height: 34px;
  flex-shrink: 0;
}

.setting-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.setting-btn:active {
  transform: scale(0.96);
}

.setting-btn-primary {
  background: var(--accent);
  color: var(--text-inverse, white);
  box-shadow: 0 1px 3px var(--accent-30);
}

.setting-btn-primary:hover {
  opacity: 0.88;
  box-shadow: 0 2px 6px var(--accent-40);
}

.setting-btn-secondary {
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.setting-btn-secondary:hover {
  background: var(--accent-10);
  border-color: var(--accent-20);
  color: var(--text);
}

.setting-btn-danger {
  background: var(--error);
  color: white;
}

.setting-btn-danger:hover {
  opacity: 0.85;
  box-shadow: 0 2px 6px rgba(220, 38, 38, 0.35);
}

/* ==========================================================================
   TOGGLES — Unified style (both .toggle and .toggle-switch labels)
   ========================================================================== */

/* Existing .toggle (div-based, JS-controlled) */
.toggle {
  width: 44px;
  height: 24px;
  background: var(--border);
  border-radius: var(--radius-full);
  position: relative;
  cursor: pointer;
  transition: background 0.2s;
  flex-shrink: 0;
  border: 2px solid transparent;
}

.toggle:hover {
  border-color: var(--accent-20);
}

.toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.toggle.on {
  background: var(--accent);
  border-color: transparent;
}

.toggle::after {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  background: white;
  border-radius: var(--radius-full);
  top: 1px;
  left: 1px;
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 1px 3px rgba(0,0,0,0.25);
}

.toggle.on::after {
  transform: translateX(20px);
}

.toggle.disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Input checkbox-based toggles (.toggle-switch label + .toggle-slider) */
.toggle-switch {
  position: relative;
  display: inline-flex;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
  cursor: pointer;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: var(--radius-full);
  transition: background 0.2s;
  border: 2px solid transparent;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  background: white;
  border-radius: var(--radius-full);
  top: 1px;
  left: 1px;
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 1px 3px rgba(0,0,0,0.25);
}

.toggle-switch input:checked + .toggle-slider {
  background: var(--accent);
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(20px);
}

.toggle-switch:hover .toggle-slider {
  border-color: var(--accent-20);
}

.toggle-switch input:focus-visible + .toggle-slider {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-full);
}

/* ==========================================================================
   VOICE SECTION — Sub-group visual hierarchy
   ========================================================================== */

/* Sub-group container */
.voice-subgroup {
  margin: var(--space-3) 0 var(--space-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--accent-05);
}

.voice-subgroup-header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  background: var(--accent-10);
  border-bottom: 1px solid var(--border);
}

.voice-subgroup-icon {
  font-size: 13px;
  line-height: 1;
  flex-shrink: 0;
}

.voice-subgroup-title {
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--accent);
}

.voice-subgroup .setting-row {
  border-radius: 0;
  padding-left: var(--space-4);
  padding-right: var(--space-4);
}

.voice-subgroup .setting-row:last-child {
  border-bottom: none;
}

/* Voice mode selector cards — more compact, horizontal on desktop */
.voice-mode-cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-2);
  margin-top: var(--space-3);
}

@media (min-width: 480px) {
  .voice-mode-cards {
    grid-template-columns: repeat(3, 1fr);
  }
}

.voice-mode-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--space-2);
  padding: var(--space-4) var(--space-3);
  background: var(--bg-input);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}

@media (max-width: 479px) {
  .voice-mode-card {
    flex-direction: row;
    text-align: left;
    padding: var(--space-3) var(--space-4);
  }
}

.voice-mode-card:hover {
  border-color: var(--accent-40);
  background: var(--accent-05);
}

.voice-mode-card.selected {
  border-color: var(--accent);
  background: var(--accent-10);
  box-shadow: 0 0 0 1px var(--accent-20);
}

.voice-mode-icon {
  font-size: 24px;
  line-height: 1;
  flex-shrink: 0;
}

.voice-mode-content {
  flex: 1;
}

.voice-mode-title {
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.1px;
  margin-bottom: 2px;
}

.voice-mode-desc {
  font-size: var(--text-xs);
  color: var(--text-dim);
  line-height: 1.35;
}

.voice-mode-card.selected .voice-mode-title {
  color: var(--accent);
}

.voice-mode-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ==========================================================================
   PROGRESSIVE DISCLOSURE — Voice context panels
   ========================================================================== */

/* Inline mode panels (inside the Voice Mode subgroup) */
.voice-context-panel {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition: max-height 0.32s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.22s ease;
}

.voice-context-panel--visible {
  max-height: 600px;
  opacity: 1;
}

/* For the legacy setting-hidden approach — keep it working */
#pushToTalkSettings,
#liveVoiceSettings,
#agentVoiceSettings {
  margin-top: 0;
}

/* ── Context panels wrapper (Voice Output + Voice Input subgroups) ── */

.voice-context-panels {
  /* Container — no special styles needed; children animate themselves */
}

/* Individual subgroups that are context-aware */
[data-voice-context] {
  max-height: 800px;  /* generous upper bound */
  opacity: 1;
  overflow: hidden;
  transition: max-height 0.32s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.22s ease,
              margin 0.22s ease;
}

[data-voice-context].voice-context-hidden {
  max-height: 0;
  opacity: 0;
  pointer-events: none;
  margin-top: 0 !important;
  margin-bottom: 0 !important;
}

/* ── Advanced Voice Settings Expander ── */

.voice-advanced-expander {
  /* Hidden until a mode is selected */
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition: max-height 0.25s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.2s ease,
              margin 0.2s ease;
}

.voice-advanced-expander--visible {
  max-height: 200px;
  opacity: 1;
  margin-top: var(--space-2);
}

.voice-advanced-expander-btn {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  padding: var(--space-3) var(--space-4);
  background: transparent;
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  color: var(--text-dim);
  font-size: var(--text-xs);
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.voice-advanced-expander-btn:hover {
  border-color: var(--accent-30);
  color: var(--text);
  background: var(--accent-05);
}

.voice-advanced-expander--open .voice-advanced-expander-btn {
  border-color: var(--accent-40);
  border-style: solid;
  color: var(--accent);
  background: var(--accent-05);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  border-bottom-color: transparent;
}

.voice-advanced-expander-icon {
  font-size: 14px;
  flex-shrink: 0;
  opacity: 0.8;
}

.voice-advanced-expander-label {
  font-weight: 600;
  font-size: var(--text-xs);
  letter-spacing: 0.1px;
  flex-shrink: 0;
}

.voice-advanced-expander-hint {
  font-size: var(--text-xs);
  color: var(--text-dim);
  flex: 1;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.voice-advanced-expander-chevron {
  flex-shrink: 0;
  transition: transform 0.2s ease;
  color: var(--text-dim);
}

.voice-advanced-expander--open .voice-advanced-expander-chevron {
  transform: rotate(90deg);
  color: var(--accent);
}

/* ── Agent Voice: inline STT Advanced row ── */

.voice-advanced-row {
  border-top: 1px solid var(--border);
}

.voice-advanced-toggle {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  padding: var(--space-3) var(--space-4);
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-dim);
  font-size: var(--text-xs);
  transition: color 0.15s, background 0.15s;
  text-align: left;
}

.voice-advanced-toggle:hover {
  color: var(--text);
  background: var(--white-05, rgba(255,255,255,0.03));
}

.voice-advanced-toggle[aria-expanded="true"] {
  color: var(--accent);
}

.voice-advanced-toggle-label {
  font-weight: 600;
  flex-shrink: 0;
}

.voice-advanced-toggle-hint {
  flex: 1;
  color: var(--text-dim);
  font-size: var(--text-xs);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.voice-advanced-chevron {
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.voice-advanced-toggle[aria-expanded="true"] .voice-advanced-chevron {
  transform: rotate(90deg);
}

.voice-advanced-panel {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.voice-advanced-panel--open {
  max-height: 300px;
}

/* ==========================================================================
   REDUCED MOTION addendum
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  .voice-context-panel,
  [data-voice-context],
  .voice-advanced-expander,
  .voice-advanced-panel {
    transition: opacity 0.15s, max-height 0s;
  }
}

/* TTS provider sub-panel */
.tts-provider-config {
  background: var(--accent-05);
  border-top: 1px solid var(--border);
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  padding: var(--space-1) 0 0;
}

.tts-provider-config .setting-row {
  padding-left: var(--space-4);
  padding-right: var(--space-4);
}

.tts-provider-config .setting-row:last-child {
  border-bottom: none;
}

/* VAD slider polish */
#vadSensitivitySlider {
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  border-radius: 2px;
  background: var(--border);
  outline: none;
  cursor: pointer;
  flex: 1;
}

#vadSensitivitySlider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  box-shadow: 0 0 0 3px var(--accent-20);
  transition: box-shadow 0.15s;
}

#vadSensitivitySlider::-webkit-slider-thumb:hover {
  box-shadow: 0 0 0 5px var(--accent-20);
}

#vadSensitivitySlider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: none;
  box-shadow: 0 0 0 3px var(--accent-20);
}

#vadSensitivitySlider:focus-visible {
  box-shadow: 0 0 0 2px var(--accent);
}

/* ==========================================================================
   STATUS INDICATOR — More distinctive
   ========================================================================== */

.status-indicator {
  width: 10px;
  height: 10px;
  border-radius: var(--radius-full);
  background: var(--text-dim);
  flex-shrink: 0;
  position: relative;
}

.status-indicator.connected::after {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  background: var(--success);
  opacity: 0.25;
}

.status-indicator.connected {
  background: var(--success);
}

.status-indicator.disconnected {
  background: var(--error);
}

/* ==========================================================================
   PREMIUM SECTION — Keep the marketing feel
   ========================================================================== */

.premium-badge {
  font-size: var(--text-xs);
  font-weight: 700;
  background: var(--accent);
  color: var(--text-inverse, white);
  padding: 2px var(--space-2);
  border-radius: var(--radius-full);
  letter-spacing: 0.3px;
  margin-left: auto;
  margin-right: var(--space-2);
}

/* ==========================================================================
   SECTION PANEL — Content padding consistency
   ========================================================================== */

.settings-panel-content {
  padding: var(--space-2) var(--space-4);
}

/* ==========================================================================
   MOBILE ADJUSTMENTS
   ========================================================================== */

@media (max-width: 768px) {
  .settings-panel-content {
    padding: var(--space-2) var(--space-3);
  }

  .setting-row {
    padding: var(--space-3) var(--space-2);
    min-height: 56px;
  }

  .setting-input {
    width: 110px;
  }

  .setting-select {
    max-width: 140px;
  }

  .setting-btn {
    padding: 0 var(--space-3);
    height: 36px;
  }

  /* Voice mode cards stack vertically on small screens */
  .voice-mode-cards {
    grid-template-columns: 1fr;
  }

  .voice-mode-card {
    flex-direction: row;
    text-align: left;
  }
}

/* ==========================================================================
   REDUCED MOTION
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  .settings-section-body {
    transition: opacity 0.15s;
  }

  .settings-section-chevron {
    transition: color 0.15s;
  }

  .toggle,
  .toggle::after,
  .toggle-slider,
  .toggle-slider::before {
    transition: none;
  }

  .voice-mode-card {
    transition: none;
  }
}

/* ==========================================================================
   VOICE SETTINGS V2 — Quick Setup Card + Accordions
   ========================================================================== */

/* ── Setup Card ── */

.v2-setup-card {
  margin: var(--space-3) var(--space-2) var(--space-2);
  border: 1px solid var(--accent-30, rgba(232, 132, 26, 0.3));
  border-radius: var(--radius-md);
  background: var(--accent-05, rgba(232, 132, 26, 0.05));
  overflow: hidden;
}

.v2-setup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--accent-15, rgba(232, 132, 26, 0.15));
}

.v2-setup-title {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--accent);
  font-weight: 600;
}

.v2-setup-banner {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: var(--text-xs);
  font-weight: 600;
  color: #22c55e;
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.25);
  border-radius: var(--radius-sm);
  padding: 2px 8px;
}

.v2-setup-rows {
  display: flex;
  flex-direction: column;
}

.v2-setup-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-3);
  cursor: pointer;
  transition: background 0.12s;
  border-bottom: 1px solid var(--border);
}

.v2-setup-row:last-child {
  border-bottom: none;
}

.v2-setup-row:hover {
  background: var(--accent-08, rgba(232, 132, 26, 0.08));
}

.v2-setup-row:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.v2-setup-row[data-muted="true"] {
  opacity: 0.45;
  cursor: default;
  pointer-events: none;
}

.v2-setup-row[data-muted="true"]:hover {
  background: transparent;
}

/* Status dot */
.v2-setup-dot {
  flex-shrink: 0;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  transition: background 0.2s, box-shadow 0.2s;
  background: var(--text-dim);
}

.v2-setup-dot[data-state="done"] {
  background: #22c55e;
  box-shadow: 0 0 6px rgba(34, 197, 94, 0.5);
}

.v2-setup-dot[data-state="todo"] {
  background: var(--accent);
  box-shadow: 0 0 6px var(--accent-30, rgba(232, 132, 26, 0.4));
}

.v2-setup-dot[data-state="empty"] {
  background: transparent;
  border: 1.5px solid var(--text-dim);
  box-shadow: none;
}

.v2-setup-dot[data-state="off"] {
  background: transparent;
  border: 1.5px dashed var(--text-dim);
  box-shadow: none;
  opacity: 0.5;
}

.v2-setup-row-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.v2-setup-row-label {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text);
  line-height: 1.3;
}

.v2-setup-row-sub {
  font-size: var(--text-xs);
  color: var(--text-muted);
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.v2-setup-row-arrow {
  flex-shrink: 0;
  color: var(--text-dim);
  opacity: 0.6;
  transition: opacity 0.12s, transform 0.12s;
}

.v2-setup-row:hover .v2-setup-row-arrow {
  opacity: 1;
  transform: translateX(2px);
}

/* ── Accordions ── */

.v2-accordion {
  border-bottom: 1px solid var(--border);
}

.v2-accordion:last-of-type {
  border-bottom: none;
}

.v2-accordion-header {
  width: 100%;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-3);
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text);
  text-align: left;
  min-height: 48px;
  transition: background 0.12s;
  border-radius: 0;
}

.v2-accordion-header:hover {
  background: var(--white-05, rgba(255,255,255,0.03));
}

.v2-accordion-header:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.v2-accordion-icon {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  background: var(--accent-10, rgba(232, 132, 26, 0.1));
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  transition: background 0.12s;
}

.v2-accordion-header:hover .v2-accordion-icon {
  background: var(--accent-15, rgba(232, 132, 26, 0.15));
}

.v2-accordion--open .v2-accordion-icon {
  background: var(--accent-15, rgba(232, 132, 26, 0.15));
}

.v2-accordion-header-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.v2-accordion-title {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text);
  line-height: 1.3;
  transition: color 0.12s;
}

.v2-accordion--open .v2-accordion-title {
  color: var(--accent);
}

.v2-accordion-summary {
  font-size: var(--text-xs);
  color: var(--text-muted);
  line-height: 1.3;
}

.v2-accordion-chevron {
  flex-shrink: 0;
  color: var(--text-dim);
  transition: transform 0.2s ease, color 0.12s;
}

.v2-accordion--open .v2-accordion-chevron {
  transform: rotate(90deg);
  color: var(--accent);
}

/* Accordion body — grid-rows animation */
.v2-accordion-body {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

.v2-accordion--open .v2-accordion-body {
  grid-template-rows: 1fr;
}

.v2-accordion-body > * {
  min-height: 0;
  overflow: hidden;
}

/* Inner wrapper so children overflow correctly */
.v2-accordion-body-inner {
  overflow: hidden;
}

/* ── TTS disabled state ── */
.v2-accordion--tts-disabled .v2-accordion-header {
  opacity: 0.5;
}

.v2-accordion--tts-disabled .v2-accordion-header::after {
  content: 'Off';
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-dim);
  background: var(--bg-elevated, #141C2B);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1px 6px;
  margin-left: auto;
  flex-shrink: 0;
}

.v2-accordion--tts-disabled .v2-accordion-body {
  opacity: 0.5;
  pointer-events: none;
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  .v2-accordion-body {
    transition: none;
  }
  .v2-accordion-chevron {
    transition: color 0.12s;
  }
}

/* ==========================================================================
   VOICE SETTINGS V2 — Mobile fixes
   ========================================================================== */

/* Prevent setup card rows from wrapping on narrow screens */
.v2-setup-row {
  flex-wrap: nowrap;
}

.v2-setup-row-arrow {
  flex-shrink: 0;
}

/* Accordions fill full width, no inherited padding cutting them */
.v2-accordion {
  width: 100%;
  box-sizing: border-box;
  margin-left: 0;
  margin-right: 0;
}

.v2-accordion-header {
  width: 100%;
  box-sizing: border-box;
}

/* Tighter accordion header padding on mobile */
@media (max-width: 480px) {
  .v2-accordion-header {
    padding: var(--space-3) var(--space-2);
  }

  .v2-setup-card {
    margin: var(--space-3) var(--space-1) var(--space-2);
  }

  .v2-setup-row {
    padding: var(--space-3) var(--space-2);
  }

  .v2-setup-row-sub {
    max-width: 180px;
  }
}

/* iOS button reset for accordion headers */
.v2-accordion-header {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
}
