/* =====================================================
   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; }

.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;
}

/* 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.
   ============================================================================= */
