/* jhacal-settings-modal.css — 052026.5.019 [Batch 52 g229 V5.2 Phase A+C+D column-fit fix]  Two-column per-role voice grid sized to fit any modal width — flex-basis 320px → 0 with min-width 0, so columns split available space 50/50 instead of wrapping. ≤480px media query unchanged. */
/* =====================================================
   jhacal-settings-modal.css
   Unified settings modal for all 10 JHACAL programs.
   Entry point: JHACALSettingsModal.open(appConfig)

   Compliance citations in comments:
     [A1]  One property, one location. No duplicate selectors.
     [A2]  Exactly one :root block. Extends jhacal-settings-panel.css tokens.
     [A12] jhacal-ios-compat.css sets min-height:44px on ALL buttons.
           Every compact button here carries min-height: 0 !important.
     [D4]  Modal overlay z-index: exactly 20000.

   Class prefix: .jsm-* (JHACAL Settings Modal)
   Three-tier modifiers: .sp-control--greyed / .sp-control--soon / etc.
   (modifier names are fixed — referenced by Phase 2 JS)
   ===================================================== */


/* ── [A2] Design tokens — single :root block ──────────────────────────────
   Values sourced from jhacal-settings-panel.css. Never replace those — only
   extend with new tokens required by this modal. No second :root may be added.
   ───────────────────────────────────────────────────────────────────────── */
:root {
  /* Sourced from jhacal-settings-panel.css (same values — :root scope) */
  --sp-bg1:     #1a1d21;
  --sp-bg2:     #1e2128;
  --sp-bg3:     #272b33;
  --sp-bg4:     #2a2d35;
  --sp-border:  #333740;
  --sp-border2: #3a3d45;
  --sp-text1:   #e8eaf0;
  --sp-text2:   #9099b0;
  --sp-text3:   #666;
  --sp-accent:  #ffb74d;              /* JHACAL brand gold — replaces indigo */
  --sp-green:   #4ade80;
  --sp-gold:    #f6c177;
  --sp-red:     #f87171;
  --sp-radius:  12px;
  --sp-shadow:  0 8px 40px rgba(0, 0, 0, 0.65);

  /* Extended tokens — new to this file */
  --sp-amber:            #d97706;                     /* caution — Reset Level 1   */
  --sp-amber-bg:         rgba(217, 119, 6, 0.12);
  --sp-amber-border:     rgba(217, 119, 6, 0.30);
  --sp-red-bg:           rgba(248, 113, 113, 0.12);   /* danger — Reset Level 2    */
  --sp-red-border:       rgba(248, 113, 113, 0.30);
  --sp-maxdanger:        #dc2626;                     /* max-danger — Reset Level 3*/
  --sp-maxdanger-bg:     rgba(220, 38, 38, 0.15);
  --sp-maxdanger-border: rgba(220, 38, 38, 0.40);
  --sp-accent-bg:        rgba(255, 183, 77, 0.12);    /* coming-soon badge bg      */
  --sp-accent-border:    rgba(255, 183, 77, 0.30);
  --sp-section-gap:      20px;
}


/* ═══════════════════════════════════════════════════════
   1. OVERLAY BACKDROP
   [D4] z-index must be exactly 20000
   ═══════════════════════════════════════════════════════ */

.jsm-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.78);
  z-index: 20000; /* [D4] */
  display: flex;
  align-items: flex-start;
  justify-content: center;
  overflow-y: auto;
  padding: 20px 0 60px;
  -webkit-overflow-scrolling: touch;
}

.jsm-overlay.jsm-hidden {
  display: none;
}


/* ═══════════════════════════════════════════════════════
   2. PANEL CONTAINER
   ═══════════════════════════════════════════════════════ */

.jsm-panel {
  background: var(--sp-bg2);
  color: var(--sp-text1);
  border-radius: var(--sp-radius);
  width: min(560px, 96vw);
  overflow: hidden;
  box-shadow: var(--sp-shadow);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 80px);
  position: relative;
}


/* ═══════════════════════════════════════════════════════
   3. HEADER
   ═══════════════════════════════════════════════════════ */

.jsm-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 20px;
  background: var(--sp-bg3);
  border-bottom: 1px solid var(--sp-border);
  flex-shrink: 0;
  gap: 12px;
}

.jsm-title {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  color: var(--sp-text1);
  flex: 1;
  min-width: 0;
}

.jsm-app-name {
  font-size: 12px;
  font-weight: normal;
  color: var(--sp-text2);
  background: rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 2px 8px;
  margin-left: 4px;
  white-space: nowrap;
}

/* [A12] Close button is compact — min-height: 0 !important overrides ios-compat */
.jsm-close {
  background: none;
  border: none;
  color: var(--sp-text2);
  font-size: 20px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  line-height: 1;
  min-height: 0 !important; /* [A12] compact button — ios-compat override */
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.jsm-close:hover  { background: rgba(255, 255, 255, 0.08); color: var(--sp-text1); }
.jsm-close:active { background: rgba(255, 255, 255, 0.15); }


/* ═══════════════════════════════════════════════════════
   4. TAB STRIP
   ═══════════════════════════════════════════════════════ */

/* Tab strip wrapper — holds arrow buttons + scrollable nav */
.jsm-tab-wrap {
  position: relative;
  display: flex;
  align-items: stretch;
  background: var(--sp-bg3);
  border-bottom: 1px solid var(--sp-border);
  flex-shrink: 0;
}

.jsm-tab-arrow {
  flex-shrink: 0;
  width: 32px;
  background: var(--sp-bg3);
  border: none;
  border-bottom: 1px solid var(--sp-border);
  color: var(--sp-text2);
  font-size: 11px;
  cursor: pointer;
  padding: 0;
  transition: color 0.15s, background 0.15s;
  touch-action: manipulation;
  z-index: 1;
  margin-bottom: -1px; /* sit on top of border */
}
.jsm-tab-arrow:hover { color: var(--sp-accent); background: var(--sp-bg2); }
.jsm-tab-arrow--hidden { visibility: hidden; pointer-events: none; }

.jsm-tabs {
  display: flex;
  background: var(--sp-bg3);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  flex-shrink: 0;
  flex: 1;
  min-width: 0;
}

.jsm-tabs::-webkit-scrollbar { display: none; }

/* [A12] Tab buttons are compact — min-height: 0 !important */
.jsm-tab {
  flex-shrink: 0;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--sp-text2);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  min-height: 0 !important; /* [A12] */
  transition: color 0.15s, border-color 0.15s;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  position: relative;
}

.jsm-tab:hover             { color: var(--sp-text1); }
.jsm-tab.active            { color: var(--sp-accent); border-bottom-color: var(--sp-accent); }


/* ═══════════════════════════════════════════════════════
   5. THREE-TIER STATE CLASSES
   Exact class names are the contract — Phase 2 JS references these.
   Never rename them.
   ═══════════════════════════════════════════════════════ */

/* ── GREYED — does not apply to this program ── */
.sp-control--greyed {
  opacity: 0.4;
  pointer-events: none;
}

.sp-tab--greyed {
  opacity: 0.5;
  cursor: default;
}

.sp-greyed-label {
  font-size: 12px;
  color: var(--sp-text3);
  font-style: italic;
  margin-top: 6px;
  display: block;
}

/* ── COMING SOON — planned, not yet wired ── */
.sp-control--soon {
  opacity: 0.65;
  pointer-events: none;
}

.sp-soon-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--sp-accent);
  background: var(--sp-accent-bg);
  border: 1px solid var(--sp-accent-border);
  border-radius: 10px;
  padding: 2px 8px;
  margin-top: 6px;
}

.sp-tab--soon {
  /* visually between active and greyed — muted with accent dot indicator */
  opacity: 0.75;
  position: relative;
}

.sp-tab--soon::after {
  content: '';
  position: absolute;
  top: 6px;
  right: 6px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--sp-accent);
}

/* Never hidden — greyed and coming-soon controls always render in the DOM */


/* ═══════════════════════════════════════════════════════
   6. SCROLLABLE BODY & TAB CONTENT PANELS
   ═══════════════════════════════════════════════════════ */

.jsm-body {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  flex: 1;
}

.jsm-content {
  display: none;
  padding: 20px;
}

.jsm-content.active {
  display: block;
}


/* ═══════════════════════════════════════════════════════
   7. SECTION GROUPINGS
   ═══════════════════════════════════════════════════════ */

.jsm-section {
  padding-bottom: var(--sp-section-gap);
  margin-bottom: var(--sp-section-gap);
  border-bottom: 1px solid var(--sp-border);
}

.jsm-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.jsm-section-title {
  margin: 0 0 4px;
  font-size: 15px;
  color: #c8cfe8;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.jsm-section-desc {
  margin: 0 0 12px;
  font-size: 12px;
  color: var(--sp-text3);
  line-height: 1.5;
}

.jsm-section-subtitle {
  margin: 16px 0 8px;
  font-size: 13px;
  color: var(--sp-text2);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}


/* ═══════════════════════════════════════════════════════
   8. ROW LAYOUTS
   ═══════════════════════════════════════════════════════ */

/* Standard setting row: label left, control right */
.jsm-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--sp-border);
}

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

.jsm-row-label {
  flex: 1;
  font-size: 14px;
  color: var(--sp-text1);
  cursor: pointer;
}

.jsm-row-desc {
  display: block;
  font-size: 12px;
  color: var(--sp-text3);
  margin-top: 2px;
  font-weight: normal;
  cursor: default;
}

.jsm-row-ctrl { flex-shrink: 0; }

/* Field row: label + input inline */
.jsm-field {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.jsm-field-label {
  font-size: 13px;
  color: var(--sp-text2);
  min-width: 90px;
  flex-shrink: 0;
}

.jsm-field select,
.jsm-field input[type="text"],
.jsm-field input[type="password"] {
  flex: 1;
  background: var(--sp-bg4);
  color: var(--sp-text1);
  border: 1px solid var(--sp-border2);
  border-radius: 7px;
  padding: 8px 10px;
  font-size: 13px;
  min-width: 0;
}

.jsm-field input[type="range"] {
  flex: 1;
  accent-color: var(--sp-accent);
  min-width: 80px;
  cursor: pointer;
}

/* Slider value readout */
.jsm-slider-val {
  font-size: 12px;
  color: var(--sp-gold);
  font-weight: 600;
  min-width: 40px;
  text-align: right;
  flex-shrink: 0;
}


/* ═══════════════════════════════════════════════════════
   9. TOGGLE SWITCH
   ═══════════════════════════════════════════════════════ */

.jsm-toggle {
  position: relative;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.jsm-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.jsm-toggle-track {
  position: absolute;
  inset: 0;
  background: var(--sp-border2);
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.2s;
}

.jsm-toggle input:checked + .jsm-toggle-track { background: var(--sp-accent); }

.jsm-toggle-track::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  background: #fff;
  border-radius: 50%;
  transition: left 0.2s;
}

.jsm-toggle input:checked + .jsm-toggle-track::after { left: 23px; }


/* ═══════════════════════════════════════════════════════
   10. BUTTONS
   [A12] Compact variants carry min-height: 0 !important
   ═══════════════════════════════════════════════════════ */

.jsm-btn {
  border: none;
  border-radius: 8px;
  padding: 9px 16px;
  font-size: 14px;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s, opacity 0.15s;
  white-space: nowrap;
}

/* Primary — standard action */
.jsm-btn--primary             { background: var(--sp-accent); color: #1a1400; }
.jsm-btn--primary:hover       { background: #f59e0b; }
.jsm-btn--primary:active      { background: var(--sp-amber); }

/* Ghost — secondary action */
.jsm-btn--ghost               { background: var(--sp-bg4); color: var(--sp-text1); border: 1px solid var(--sp-border2); }
.jsm-btn--ghost:hover         { background: var(--sp-bg3); }
.jsm-btn--ghost:active        { background: #333; }

/* Caution (amber) — Reset Level 1: restores defaults, no data loss */
.jsm-btn--caution             { background: var(--sp-amber-bg); color: var(--sp-amber); border: 1px solid var(--sp-amber-border); }
.jsm-btn--caution:hover       { background: rgba(217, 119, 6, 0.22); }
.jsm-btn--caution:active      { background: rgba(217, 119, 6, 0.35); }

/* Danger (red) — Reset Level 2: wipes this program */
.jsm-btn--danger              { background: var(--sp-red-bg); color: var(--sp-red); border: 1px solid var(--sp-red-border); }
.jsm-btn--danger:hover        { background: rgba(248, 113, 113, 0.22); }
.jsm-btn--danger:active       { background: rgba(248, 113, 113, 0.35); }

/* Max-danger — Reset Level 3: factory reset, entire suite */
.jsm-btn--maxdanger           { background: var(--sp-maxdanger-bg); color: var(--sp-maxdanger); border: 2px solid var(--sp-maxdanger-border); font-weight: 600; letter-spacing: 0.02em; }
.jsm-btn--maxdanger:hover     { background: rgba(220, 38, 38, 0.25); }
.jsm-btn--maxdanger:active    { background: rgba(220, 38, 38, 0.40); }

/* Full-width — save / import actions */
.jsm-btn--fullwidth           { width: 100%; font-size: 15px; padding: 11px 20px; text-align: center; }

/* Small / compact — preview, test, clear actions */
/* [A12] min-height: 0 !important — ios-compat.css sets 44px on all buttons */
.jsm-btn--sm                  { padding: 6px 10px; font-size: 12px; min-height: 0 !important; }

/* [g488 2026-05-29] Profile / toggle pills (.jsm-profile-tile) — OFF and ON were
   visually identical (only base .jsm-btn applied; the referenced .jsm-btn-secondary
   + .active were never defined), so toggles "stayed white" with no on/off cue.
   OFF = ghost outline; ON / selected = filled accent. Applies suite-wide to every
   pill toggle + the profile/mode selector trios. */
.jsm-profile-tile {
  background: var(--sp-bg4);
  color: var(--sp-text1);
  border: 1px solid var(--sp-border2);
  font-weight: 600;
}
.jsm-profile-tile:hover { background: var(--sp-bg3); }
.jsm-profile-tile.active {
  background: var(--sp-accent);
  color: #1a1400;
  border-color: var(--sp-accent);
  font-weight: 700;
}

.jsm-btn-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.jsm-btn-row .jsm-btn { flex: 1; min-width: 120px; }

/* Voice selector — stretches to fill available width in .jsm-field */
.jsm-voice-sel {
  flex: 1;
  background: var(--sp-bg4);
  border: 1px solid var(--sp-border2);
  border-radius: 8px;
  padding: 8px 10px;
  color: var(--sp-text1);
  font-size: 13px;
  min-width: 0;
}

/* Role badge — "optional — speaker role", "Launcher only", etc. */
.sp-role-tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 500;
  color: var(--sp-text2);
  background: var(--sp-bg4);
  border: 1px solid var(--sp-border2);
  border-radius: 10px;
  padding: 2px 8px;
  margin-left: 6px;
  vertical-align: middle;
  white-space: nowrap;
}

/* Browse cache library panel */
.jsm-cache-browse {
  margin-top: 12px;
  background: var(--sp-bg4);
  border: 1px solid var(--sp-border2);
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 13px;
  max-height: 220px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}


/* ═══════════════════════════════════════════════════════
   11. STATUS BOXES & NOTICES
   ═══════════════════════════════════════════════════════ */

.jsm-status-box {
  background: var(--sp-bg4);
  border: 1px solid var(--sp-border2);
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 13px;
  color: var(--sp-text2);
  margin-bottom: 14px;
  line-height: 1.5;
}

.jsm-status-box strong    { color: var(--sp-text1); }
.jsm-status-box .jsm-ok   { color: var(--sp-green); }
.jsm-status-box .jsm-warn { color: var(--sp-amber); }
.jsm-status-box .jsm-hl   { color: var(--sp-gold); font-weight: 600; }

/* Accent-bordered notice — e.g. "configured from launcher" */
.jsm-notice {
  background: rgba(255, 183, 77, 0.08);
  border: 1px solid rgba(255, 183, 77, 0.30);
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 14px;
  font-size: 13px;
  color: var(--sp-text2);
  line-height: 1.5;
}

.jsm-notice strong         { display: block; color: var(--sp-accent); margin-bottom: 6px; }

/* Green success variant */
.jsm-notice--success       { background: rgba(74, 222, 128, 0.08); border-color: rgba(74, 222, 128, 0.30); }
.jsm-notice--success strong { color: var(--sp-green); }

/* Gold / JHACAL brand variant */
.jsm-notice--brand         { background: rgba(246, 193, 119, 0.08); border-color: rgba(246, 193, 119, 0.30); }
.jsm-notice--brand strong  { color: var(--sp-gold); }


/* ═══════════════════════════════════════════════════════
   12. VOICE TAB SPECIFIC
   ═══════════════════════════════════════════════════════ */

/* Role container (Tutor / Speaker) */
.jsm-voice-role {
  background: rgba(255, 183, 77, 0.06);
  border: 1px solid rgba(255, 183, 77, 0.15);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 16px;
}

.jsm-voice-role-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--sp-text2);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 12px;
}

/* Live voice status line */
.jsm-voice-status {
  font-size: 12px;
  color: #6bca7c;
  margin: 6px 0 0;
  min-height: 18px;
}

.jsm-voice-status.error { color: #f97; }

/* ═══════════════════════════════════════════════════════
   13. ACCESSIBILITY TAB — card grid
   Uses .jsm-ac-* prefix to avoid conflict with .sp-ac-*
   in jhacal-settings-panel.css during transition period.
   Same pattern as Path V6.0 accessibility panel.
   ═══════════════════════════════════════════════════════ */

.jsm-ac-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 10px;
}

/* Cards: red border = OFF, green border = ON */
.jsm-ac-card {
  background: rgba(248, 113, 113, 0.10);
  border: 2px solid rgba(248, 113, 113, 0.28);
  border-radius: 10px;
  padding: 12px;
  transition: background 0.25s, border-color 0.25s;
}

.jsm-ac-card--on   { background: rgba(74, 222, 128, 0.10); border-color: rgba(74, 222, 128, 0.35); }
.jsm-ac-card--wide { margin-bottom: 10px; }

.jsm-ac-card-header { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 8px; }
.jsm-ac-icon        { font-size: 1.4rem; line-height: 1; flex-shrink: 0; }
.jsm-ac-card-title  { font-size: 0.92rem; font-weight: 600; color: var(--sp-text1); }
.jsm-ac-card-desc   { font-size: 0.70rem; color: var(--sp-text2); margin-top: 2px; line-height: 1.3; }

/* Toggle button inside card */
/* [A12] Card toggles are compact */
.jsm-ac-toggle-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 2px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  color: var(--sp-text1);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  min-height: 0 !important; /* [A12] */
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.2s, border-color 0.2s;
}

.jsm-ac-toggle-btn--on   { background: rgba(74, 222, 128, 0.12); border-color: rgba(74, 222, 128, 0.50); }
.jsm-ac-toggle-btn:active { background: rgba(255, 255, 255, 0.12); }

/* Pill track inside toggle button */
.jsm-ac-toggle-track {
  display: inline-block;
  width: 38px;
  height: 20px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  position: relative;
  flex-shrink: 0;
  transition: background 0.25s;
}

.jsm-ac-toggle-btn--on .jsm-ac-toggle-track { background: rgba(74, 222, 128, 0.50); }

.jsm-ac-toggle-thumb {
  position: absolute;
  left: 2px;
  top: 2px;
  width: 16px;
  height: 16px;
  background: #aaa;
  border-radius: 50%;
  transition: left 0.25s, background 0.25s;
}

.jsm-ac-toggle-btn--on .jsm-ac-toggle-thumb { left: 20px; background: #fff; }

/* Sub-controls (slider, hint — shown when card is ON) */
.jsm-ac-sub {
  display: none;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.jsm-ac-sub-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
  font-size: 0.78rem;
  color: var(--sp-text2);
}

.jsm-ac-val { color: var(--sp-gold); font-weight: 700; font-size: 0.82rem; }

.jsm-ac-sub input[type="range"] {
  width: 100%;
  height: 22px;
  cursor: pointer;
  accent-color: var(--sp-gold);
}

.jsm-ac-hint {
  font-size: 0.70rem;
  color: var(--sp-text3);
  background: rgba(0, 0, 0, 0.25);
  border-radius: 4px;
  padding: 4px 6px;
  margin-top: 5px;
}

.jsm-ac-hint strong { color: var(--sp-gold); }


/* ═══════════════════════════════════════════════════════
   14. DATA & BACKUP TAB
   ═══════════════════════════════════════════════════════ */

/* Named section block (BACK-UP / SAVE EDITS / etc.) */
.jsm-db-block {
  background: var(--sp-bg4);
  border: 1px solid var(--sp-border2);
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 14px;
}

.jsm-db-block-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--sp-text2);
  margin-bottom: 10px;
}

/* ── Batch 40 Item C — Data-tab blocks are <details> collapsibles ──
   Preserves existing .jsm-db-block styling; replaces default caret with a
   right-aligned ▾/▴ that rotates when expanded. Respects prefers-reduced-
   motion (no transition when the user prefers reduced motion). */
.jsm-db-block > summary {
  cursor: pointer;
  list-style: none;
  position: relative;
  padding-right: 22px;
  outline: none;
}
.jsm-db-block > summary::-webkit-details-marker { display: none; }
.jsm-db-block > summary::after {
  content: '▾';
  position: absolute;
  right: 0;
  top: 0;
  font-size: 14px;
  color: var(--sp-text2);
  transition: transform 180ms ease;
}
.jsm-db-block[open] > summary::after { transform: rotate(180deg); }
@media (prefers-reduced-motion: reduce) {
  .jsm-db-block > summary::after { transition: none; }
}
.jsm-db-block > summary .jsm-db-block-label { margin-bottom: 0; }
.jsm-db-block[open] > summary { margin-bottom: 10px; }
.jsm-db-block > summary:focus-visible {
  outline: 2px solid var(--sp-focus, currentColor);
  outline-offset: 2px;
  border-radius: 4px;
}
/* L1–L3 reset blocks, when promoted to top-level <details>, also collapse */
.jsm-reset-block--l1,
.jsm-reset-block--l2,
.jsm-reset-block--l3 { /* promoted to top-level <details> in Item A; summary styling shared above via .jsm-db-block */ }

/* Backup tier status (Today / Week / Month) */
.jsm-backup-tiers {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.jsm-backup-tier {
  flex: 1;
  min-width: 72px;
  background: var(--sp-bg3);
  border: 1px solid var(--sp-border);
  border-radius: 8px;
  padding: 8px 10px;
  text-align: center;
}

.jsm-backup-tier-label { font-size: 10px; color: var(--sp-text2); text-transform: uppercase; letter-spacing: 0.05em; }
.jsm-backup-tier-date  { font-size: 12px; color: var(--sp-gold); font-weight: 600; margin-top: 3px; }
.jsm-backup-tier-date--never { color: var(--sp-text3); font-weight: normal; }


/* ── RESET SECTION — three escalating severity levels ── */

.jsm-reset-block {
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 10px;
}

.jsm-reset-block--l1 { background: var(--sp-amber-bg);     border: 1px solid var(--sp-amber-border); }
.jsm-reset-block--l2 { background: var(--sp-red-bg);        border: 1px solid var(--sp-red-border); }
.jsm-reset-block--l3 { background: var(--sp-maxdanger-bg);  border: 2px solid var(--sp-maxdanger-border); }

.jsm-reset-title { font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.jsm-reset-block--l1 .jsm-reset-title { color: var(--sp-amber); }
.jsm-reset-block--l2 .jsm-reset-title { color: var(--sp-red); }
.jsm-reset-block--l3 .jsm-reset-title { color: var(--sp-maxdanger); }

.jsm-reset-desc {
  font-size: 12px;
  color: var(--sp-text2);
  margin-bottom: 12px;
  line-height: 1.5;
}

/* Confirmation input (Level 2 and 3 only) */
.jsm-reset-confirm-wrap           { display: none; margin-top: 10px; }
.jsm-reset-confirm-wrap.visible   { display: block; }

.jsm-reset-confirm-label {
  font-size: 12px;
  color: var(--sp-text2);
  margin-bottom: 6px;
  display: block;
}

.jsm-reset-confirm-input {
  width: 100%;
  background: var(--sp-bg1);
  border: 1px solid var(--sp-border2);
  border-radius: 6px;
  color: var(--sp-text1);
  font-size: 13px;
  padding: 8px 10px;
  font-family: 'SF Mono', 'Consolas', monospace;
  margin-bottom: 10px;
  letter-spacing: 0.04em;
}

.jsm-reset-confirm-input:focus     { outline: none; border-color: var(--sp-red); }
.jsm-reset-block--l3 .jsm-reset-confirm-input:focus { border-color: var(--sp-maxdanger); }


/* ═══════════════════════════════════════════════════════
   15. APP-SPECIFIC INJECT CONTAINER
   appConfig injects these sections per program.
   Phase 2 JS shows/hides .jsm-inject-* sections.
   ═══════════════════════════════════════════════════════ */

.jsm-inject {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--sp-border);
}

.jsm-inject-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--sp-text2);
  margin-bottom: 12px;
}


/* ═══════════════════════════════════════════════════════
   16. ABOUT TAB
   ═══════════════════════════════════════════════════════ */

.jsm-about-logo {
  text-align: center;
  padding: 10px 0 20px;
  border-bottom: 1px solid var(--sp-border);
  margin-bottom: 20px;
}

.jsm-about-suite   { font-size: 22px; font-weight: 700; color: var(--sp-text1); letter-spacing: -0.02em; }
.jsm-about-version { font-size: 13px; color: var(--sp-text2); margin-top: 4px; }

/* App version table */
.jsm-version-tbl { width: 100%; border-collapse: collapse; font-size: 13px; margin-bottom: 16px; }

.jsm-version-tbl th {
  font-size: 11px;
  color: var(--sp-text2);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 6px 0;
  border-bottom: 1px solid var(--sp-border);
  text-align: left;
  font-weight: 600;
}

.jsm-version-tbl td {
  padding: 8px 0;
  border-bottom: 1px solid var(--sp-border2);
  color: var(--sp-text1);
  font-size: 13px;
}

.jsm-version-tbl td:last-child { color: var(--sp-text2); font-size: 12px; }


/* ═══════════════════════════════════════════════════════
   17. PANEL FOOTER
   ═══════════════════════════════════════════════════════ */

.jsm-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--sp-border);
  background: var(--sp-bg3);
  flex-shrink: 0;
}


/* ═══════════════════════════════════════════════════════
   18. MOBILE OVERRIDES
   ═══════════════════════════════════════════════════════ */

@media (max-width: 480px) {
  .jsm-panel           { max-height: calc(100vh - 40px); }
  .jsm-tab             { padding: 10px 12px; font-size: 12px; }
  .jsm-field-label     { min-width: 72px; }
  .jsm-btn-row .jsm-btn { min-width: 100px; }
  .jsm-ac-grid         { grid-template-columns: 1fr; }
}

/* Very small screens — full-width sheet */
@media (max-width: 360px) {
  .jsm-overlay { padding: 0; align-items: flex-end; }
  .jsm-panel   { width: 100vw; border-radius: var(--sp-radius) var(--sp-radius) 0 0; max-height: 92vh; }
}


/* ═══════════════════════════════════════════════════════
   19. REDUCED MOTION
   ═══════════════════════════════════════════════════════ */

@media (prefers-reduced-motion: reduce) {
  .jsm-toggle-track,
  .jsm-toggle-track::after,
  .jsm-btn,
  .jsm-ac-card,
  .jsm-ac-toggle-btn,
  .jsm-ac-toggle-track,
  .jsm-ac-toggle-thumb { transition: none; }
}


/* =============================================================================
   ── ADDITIONS REQUIRED IN OTHER SHARED FILES ──────────────────────────────────
   These changes must be made manually to existing files — they cannot live here.

   1. deploy/shared/js/jhacal-master-save.js — APP_REGISTRY Shared section:
      Add entry for the new global settings key:
        { key: "jhacal.global.settings", label: "Global accessibility & display settings", type: "json" }

   2. deploy/sw.js — Add this file and the upcoming JS to the PRECACHE_URLS list:
        '/shared/css/jhacal-settings-modal.css',
        '/shared/js/jhacal-settings-modal.js',
      Then bump CACHE_NAME: 'jhacal-shared-2026-05b9' → 'jhacal-shared-2026-05c1'
      (Minor letter bump — new shared CSS asset added to precache)

   3. All deploy/*/index.html files — add link tag AFTER jhacal-settings-panel.css:
        <link rel="stylesheet" href="/shared/css/jhacal-settings-modal.css">
      This is done per-program via the Phase 3 integration guide.

   4. deploy/shared/css/jhacal-shared-ui.css — no new class needed.
      .jhacal-icon-btn covers all settings trigger buttons as of this build.
   ============================================================================= */


/* ── [Batch 40 Item G] Settings → Display → Zone order UI (Mobile only) ── */
.jsm-zo-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}
.jsm-zo-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--sp-bg3);
  border: 1px solid var(--sp-border);
  border-radius: 8px;
}
.jsm-zo-label {
  flex: 1;
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}
.jsm-zo-pos {
  font-size: 11px;
  font-weight: 700;
  color: var(--sp-text2);
  letter-spacing: 0.05em;
  opacity: 0.75;
  min-width: 22px;
}
.jsm-zo-name {
  font-size: 14px;
  color: var(--sp-text1);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.jsm-zo-arrows {
  display: flex;
  gap: 6px;
}
.jsm-btn.jsm-zo-arrow {
  width: 40px;
  height: 36px;
  padding: 0;
  font-size: 14px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.jsm-btn.jsm-zo-arrow[disabled] {
  opacity: 0.35;
  cursor: not-allowed;
}

/* ── [Batch 41 g183] Diagnostics section in About tab ───────────────────── */
.jsm-diag-section { margin-top: 18px; }
.jsm-diag-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin: 10px 0;
}
.jsm-diag-btn {
  background: rgba(255,255,255,0.05);
  color: inherit;
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 8px;
  padding: 9px 14px;
  font: inherit;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease;
  min-width: 220px;
  text-align: left;
}
.jsm-diag-btn:hover:not([disabled]) {
  background: rgba(255,255,255,0.10);
  border-color: rgba(255,255,255,0.32);
}
.jsm-diag-btn[disabled] { opacity: 0.55; cursor: not-allowed; }
.jsm-diag-btn--primary {
  border-color: rgba(110,162,255,0.55);
  background: rgba(110,162,255,0.10);
  color: #6ea2ff;
}
.jsm-diag-btn--primary:hover:not([disabled]) {
  background: rgba(110,162,255,0.18);
  border-color: rgba(110,162,255,0.85);
  color: #fff;
}
.jsm-diag-status {
  font-size: 13px;
  color: rgba(255,255,255,0.55);
  flex: 1 1 200px;
  min-width: 0;
}
.jsm-diag-status--ok  { color: #6ee7b7; }
.jsm-diag-status--err { color: #fca5a5; }
.jsm-diag-status--info { color: #6ea2ff; }
.jsm-diag-detail {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11.5px;
  background: rgba(0,0,0,0.30);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 6px;
  padding: 10px 12px;
  margin: 8px 0 0;
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 320px;
  overflow: auto;
  color: rgba(255,255,255,0.85);
}
.jsm-diag-detail:empty { display: none; }
@media (prefers-reduced-motion: reduce) {
  .jsm-diag-btn { transition: none; }
}


/* [Track 4 sub-batch (a) Phase 1] Section deep-link spotlight.
   Applied by JHACALSettingsModal.openTab(tabId, sectionId) for ~2.5s to give
   visual confirmation that the deep-link landed on the right section. Pulse
   matches the deploy-handover ribbon's .jh-spotlight pattern (gold). */
.jsm-section-spotlight {
  animation: jsm-section-pulse 1.4s ease-in-out 2;
  position: relative;
}
@keyframes jsm-section-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(246, 193, 119, 0.55); }
  50% { box-shadow: 0 0 0 12px rgba(246, 193, 119, 0); }
}
@media (prefers-reduced-motion: reduce) {
  .jsm-section-spotlight {
    animation: none;
    box-shadow: 0 0 0 3px rgba(246, 193, 119, 0.55);
  }
}


/* [Track 4 sub-batch (b) Phase 3a] Voice chip-picker styles.
   5-chip role picker for Speaker / Tutor in the Voice tab. Active chip
   gets gold border + glow matching the existing JHACAL accent. Coming-soon
   chips (Tutor AI cells until Phase 4 lifts the g164 gate) render at 0.55
   opacity with diagonal stripes pattern + cursor:not-allowed.
   Reuses --bg-2/--text-1/--accent design tokens. */

.jsm-voice-role-section {
  margin-bottom: 18px;
}

/* [V5.2 Phase A+C+D — Pete-locked 2026-05-04 late evening] Two-column per-role layout.
   Speaker LEFT, Tutor RIGHT, side-by-side on tablet/desktop. Mobile (≤480px) collapses
   to stacked single column for narrow viewports. */
.jsm-voice-roles-grid {
  display: flex;
  gap: 14px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.jsm-voice-roles-grid .jsm-voice-role-col {
  /* [g229 column-fit fix — Pete-locked 2026-05-04 late evening] flex-basis was 320px,
     which forced wrap inside the ~450px settings modal (2×320 + gap > 450). With basis
     0, columns share whatever width is available 50/50 — chips inside still wrap to
     multiple rows naturally if the column is narrow. min-width 0 lets the inner select
     shrink below its content width without forcing horizontal scroll. */
  flex: 1 1 0;
  min-width: 0;
}
@media (max-width: 480px) {
  .jsm-voice-roles-grid { flex-direction: column; }
  .jsm-voice-roles-grid .jsm-voice-role-col { flex: 1 1 100%; }
}
.jsm-ai-voice-dropdown-wrap {
  margin: 8px 0 6px;
  padding: 6px 8px;
  background: rgba(0,0,0,0.04);
  border-radius: 6px;
}
.jsm-ai-voice-dropdown-label {
  display: block;
  font-size: 11px;
  opacity: 0.7;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.jsm-ai-voice-dropdown {
  width: 100%;
  font-size: 13px;
  padding: 4px 6px;
}

.jsm-voice-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
  margin-bottom: 8px;
}

.jsm-voice-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--bg-2, #272b31);
  color: var(--text-1, #e0e0e0);
  border: 1.5px solid rgba(255, 255, 255, 0.10);
  border-radius: 20px;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s ease-out;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.jsm-voice-chip:hover:not(.jsm-voice-chip--coming-soon) {
  border-color: rgba(246, 193, 119, 0.55);
  background: rgba(246, 193, 119, 0.08);
}

.jsm-voice-chip:focus-visible {
  outline: 2px solid #f6c177;
  outline-offset: 2px;
}

.jsm-voice-chip--active {
  background: rgba(246, 193, 119, 0.14);
  border-color: #f6c177;
  color: #f6c177;
  box-shadow: 0 0 0 3px rgba(246, 193, 119, 0.20);
}

.jsm-voice-chip--coming-soon {
  opacity: 0.45;
  cursor: not-allowed;
  background-image: repeating-linear-gradient(
    45deg,
    transparent,
    transparent 6px,
    rgba(255, 255, 255, 0.04) 6px,
    rgba(255, 255, 255, 0.04) 12px
  );
}

.jsm-voice-chip-icon {
  font-size: 16px;
  line-height: 1;
}

.jsm-voice-chip-label {
  font-weight: 500;
  white-space: nowrap;
}

.jsm-voice-preview-btn {
  margin-top: 4px;
}

@media (prefers-reduced-motion: reduce) {
  .jsm-voice-chip {
    transition: none;
  }
}

/* Tighten chip sizing on narrow viewports */
@media (max-width: 480px) {
  .jsm-voice-chip {
    padding: 6px 10px;
    font-size: 12px;
  }
  .jsm-voice-chip-icon {
    font-size: 14px;
  }
}


/* [Track 4 sub-batch (b) Phase 3c] Voice tab collapsibles
   ("Voice library" + "Advanced" — JHACAL-themed <details>/<summary> styling).
   Suppresses native disclosure marker; uses custom rotating ▾ indicator.
   Smooth open/close; reduced-motion fallback. */

.jsm-collapsible {
  margin-top: 16px;
  margin-bottom: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.02);
  overflow: hidden;
}

.jsm-collapsible[open] {
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(246, 193, 119, 0.18);
}

.jsm-collapsible-summary {
  cursor: pointer;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-1, #e0e0e0);
  user-select: none;
  list-style: none;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s ease-out;
}

.jsm-collapsible-summary::-webkit-details-marker { display: none; }
.jsm-collapsible-summary::marker { display: none; content: ''; }

.jsm-collapsible-summary:hover {
  background: rgba(246, 193, 119, 0.06);
}

.jsm-collapsible-summary:focus-visible {
  outline: 2px solid #f6c177;
  outline-offset: -2px;
}

.jsm-collapsible-marker {
  display: inline-block;
  font-size: 12px;
  color: #f6c177;
  transform: rotate(-90deg);
  transition: transform 0.18s ease-out;
}

.jsm-collapsible[open] .jsm-collapsible-marker {
  transform: rotate(0deg);
}

.jsm-collapsible-title {
  flex: 1;
}

/* Sections inside the collapsibles get a slim left rail to visually anchor them.
   Existing .jsm-section margin-top is preserved so spacing inside doesn't collapse. */
.jsm-collapsible > .jsm-section {
  margin-left: 10px;
  margin-right: 10px;
  padding-left: 8px;
  border-left: 2px solid rgba(246, 193, 119, 0.10);
}

@media (prefers-reduced-motion: reduce) {
  .jsm-collapsible-marker,
  .jsm-collapsible-summary {
    transition: none;
  }
}

@media (max-width: 480px) {
  .jsm-collapsible-summary {
    padding: 10px 12px;
    font-size: 13px;
  }
  .jsm-collapsible > .jsm-section {
    margin-left: 6px;
    margin-right: 6px;
    padding-left: 6px;
  }
}


/* ── [g328 2026-05-13] Cache management row-highlight states ──
   Two-column source grid: per-row checkbox state drives accent tinting
   so user sees at-a-glance which categories are queued for which voice. */
.jsm-cache-row { transition: background 120ms ease; }
.jsm-cache-row--tutor-on {
  background: linear-gradient(to right, rgba(165,180,252,0.14), rgba(165,180,252,0.04) 50%, transparent);
}
.jsm-cache-row--tutor-on .jsm-cache-row-label {
  font-weight: 600;
  color: #dbe4ff;
}
.jsm-cache-row--speaker-on {
  background: linear-gradient(to right, transparent, rgba(246,193,119,0.04) 50%, rgba(246,193,119,0.14));
}
.jsm-cache-row--speaker-on .jsm-cache-row-label {
  font-weight: 600;
  color: #fff1d6;
}
.jsm-cache-row--both-on {
  background: linear-gradient(to right, rgba(165,180,252,0.14), rgba(196,181,253,0.10) 50%, rgba(246,193,119,0.14));
}
.jsm-cache-row--both-on .jsm-cache-row-label {
  font-weight: 600;
  color: #ffffff;
}

/* ── [g503 2026-05-31] Camera Phase C — hub IA + carer setup overlay ──────── */
.jsm-cam-hub { display: flex; flex-direction: column; gap: 10px; }
.jsm-cam-setup-btn { width: 100%; margin-bottom: 6px; }
.jsm-cam-hub-card {
  display: flex; flex-direction: column; align-items: flex-start; gap: 3px;
  width: 100%; text-align: left; padding: 14px 16px; cursor: pointer;
  background: var(--bg-3, #313740); border: 1px solid var(--border, #3d444d);
  border-radius: 12px; color: var(--text-1, #f6f7f9);
}
.jsm-cam-hub-card:hover, .jsm-cam-hub-card:focus-visible {
  border-color: var(--jhacal-gold, #f6c177); background: var(--bg-2, #272b31);
}
.jsm-cam-hub-card-title { font-size: 16px; font-weight: 700; }
.jsm-cam-hub-card-desc { font-size: 13px; color: var(--text-2, #b9c0c7); line-height: 1.3; }
.jsm-cam-back { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.jsm-cam-back-title { font-size: 17px; font-weight: 700; color: var(--text-1, #f6f7f9); }

/* Carer setup overlay */
/* [g504 2026-05-31] Docked to the bottom with a transparent, click-through backdrop so the
   head-cursor stays visible during setup (esp. the "try the feel" step) — Pete UAT. */
.jsm-cam-setup-ov {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 100001; padding: 0 16px 16px;
  background: transparent; pointer-events: none;
  display: flex; align-items: flex-end; justify-content: center;
}
.jsm-cam-setup-card {
  width: 100%; max-width: 34em; pointer-events: auto;
  background: var(--bg-2, #272b31); border: 1px solid var(--border, #3d444d);
  border-radius: 16px 16px 0 0; box-shadow: 0 -8px 30px rgba(0,0,0,0.45);
  padding: 18px 22px; color: var(--text-1, #f6f7f9); text-align: center;
}
.jsm-cam-setup-h { font-size: clamp(20px, 4vw, 28px); font-weight: 800; margin-bottom: 12px; }
.jsm-cam-setup-body { font-size: clamp(14px, 2.4vw, 18px); color: var(--text-2, #b9c0c7); line-height: 1.45; }
.jsm-cam-setup-feels { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 16px; }
.jsm-cam-setup-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 22px; }

