/* =============================================================================
   SETTINGS REDESIGN — two-column section pattern (D-002 / D-007).
   Reference: design/laquest-settings-redesign.html (approved mockup).
   Prefixed .s2* classes so untouched panels are unaffected; theme-aware
   (light + dark) via the app's own design tokens. Pattern: each section shows
   its title + description on the LEFT, controls on the RIGHT, grouped in cards
   with consistent hairlines and generous whitespace.
   ============================================================================= */

/* page head (active sub-tab name + description) */
.s2head { margin: 2px 0 20px; }
.s2head h2 { font-size: var(--lq-text-h2, 26px); font-weight: var(--lq-weight-bold, 700); color: var(--lq-ink-primary); letter-spacing: -.02em; }
.s2head p { font-size: var(--lq-text-small, 14px); color: var(--lq-ink-muted); margin-top: 4px; }

/* card + two-column section */
.s2card { background: var(--lq-surface-card); border: 1px solid var(--lq-border); border-radius: var(--lq-radius-lg, 14px); padding: 0 26px; margin-bottom: 20px; box-shadow: 0 1px 2px rgba(20, 22, 28, .03); }
.s2sec { display: grid; grid-template-columns: 270px 1fr; gap: 36px; padding: 24px 0; border-bottom: 1px solid var(--lq-border); align-items: start; }
.s2sec:last-child { border-bottom: none; }
.s2st { font-size: 14.5px; font-weight: var(--lq-weight-semibold, 600); color: var(--lq-ink-primary); }
.s2sd { font-size: 13px; color: var(--lq-ink-muted); margin-top: 4px; max-width: 34ch; }
.s2ctl { min-width: 0; }

/* card header for CRUD / table cards (title + description left, actions right),
   used where a section holds a functional table rather than a two-column form. */
.s2ch { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 22px 0 0; flex-wrap: wrap; }
/* FIXED 2026-08-19: the title block had no flex basis and .s2ch__r was flex:none, so a crowded
   header (Pay types carries six controls) crushed the title column to a few characters and pushed
   the card wider than its grid track, giving the whole settings page horizontal overflow. The
   title now flexes and may shrink; the action group keeps its intrinsic width but WRAPS to the
   next line instead of squeezing the title. */
.s2ch > :first-child { flex: 1 1 280px; min-width: 0; }
.s2ch__t { font-size: 15px; font-weight: var(--lq-weight-semibold, 600); color: var(--lq-ink-primary); }
.s2ch__d { font-size: 12.5px; color: var(--lq-ink-muted); margin-top: 3px; max-width: 64ch; }
.s2ch__r { display: flex; align-items: center; gap: 10px; flex: 0 1 auto; min-width: 0; flex-wrap: wrap; justify-content: flex-end; }
/* FIXED 2026-08-19: flex:none pinned the action group to its single-line max-content width, so its
   own flex-wrap could never fire and a six-control header still pushed the card past its grid
   track below ~1100px. It may now shrink and wrap internally. Measured at 1024px: settings panel
   scrollWidth 904 -> 764 (= clientWidth, no overflow). */
.s2cb { padding: 16px 0 22px; }
.s2cb:last-child { padding-bottom: 22px; }
/* a full-width section (no left rail) inside an .s2card — for a form that owns the whole row */
.s2secfull { padding: 22px 0; border-bottom: 1px solid var(--lq-border); }
.s2secfull:last-child { border-bottom: none; }

/* fields */
.s2grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.s2grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.s2grid3 + .s2grid2, .s2grid2 + .s2grid3, .s2grid3 + .s2grid3 { margin-top: 16px; }
@media (max-width: 920px) { .s2grid3 { grid-template-columns: 1fr; } }
.s2grid2 + .s2grid2 { margin-top: 16px; }
.s2f { display: flex; flex-direction: column; gap: 6px; }
.s2f > label { font-size: 12.5px; font-weight: var(--lq-weight-semibold, 600); color: var(--lq-ink-primary); }
.s2f > label em, .s2f .req { color: var(--lq-accent); font-style: normal; }
.s2f input, .s2f select { font: inherit; font-size: 14px; color: var(--lq-ink-primary); background: var(--lq-surface-card); border: 1px solid var(--lq-border); border-radius: 10px; padding: 11px 13px; width: 100%; transition: border-color .12s, box-shadow .12s; }
.s2f input:focus, .s2f select:focus { outline: none; border-color: var(--lq-accent); box-shadow: 0 0 0 3px var(--lq-accent-tint); }
.s2f input:disabled, .s2f input[readonly] { background: var(--lq-surface-subtle); color: var(--lq-ink-muted); cursor: not-allowed; }
.s2hint { font-size: 11.5px; color: var(--lq-ink-muted); }

/* buttons */
.s2btn { font: inherit; font-size: 14px; font-weight: var(--lq-weight-semibold, 600); border-radius: 10px; padding: 10px 18px; cursor: pointer; border: 1px solid transparent; display: inline-flex; align-items: center; gap: 8px; transition: background .12s, border-color .12s, transform .08s; }
.s2btn:active { transform: translateY(1px); }
.s2btn .btn__icon, .s2btn svg { width: 15px; height: 15px; }
.s2btn.pri { background: var(--lq-accent); color: var(--lq-ink-inverse, #fff); }
.s2btn.pri:hover { background: var(--lq-accent-hover, var(--lq-accent)); }
.s2btn.pri:disabled { opacity: .5; cursor: not-allowed; }
.s2btn.ghost { background: var(--lq-surface-card); border-color: var(--lq-border); color: var(--lq-ink-primary); }
.s2btn.ghost:hover { border-color: var(--lq-border-strong); }
.s2btn.sm { padding: 7px 13px; font-size: 13px; }
.s2actions { display: flex; justify-content: flex-end; gap: 10px; padding-top: 4px; }
.s2foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.s2foot .s2note { font-size: 12.5px; color: var(--lq-ink-muted); }
.s2linkbtn { font: inherit; font-size: 13px; font-weight: var(--lq-weight-semibold, 600); color: var(--lq-accent); background: none; border: none; cursor: pointer; padding: 0; }

/* avatar row */
.s2avarow { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }

/* toggles */
.s2tog { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 13px 0; border-bottom: 1px solid var(--lq-border); }
.s2tog:last-child { border-bottom: none; }
.s2tt { font-size: 14px; font-weight: var(--lq-weight-semibold, 600); color: var(--lq-ink-primary); }
.s2td { font-size: 12.5px; color: var(--lq-ink-muted); margin-top: 2px; }
.s2sw { width: 40px; height: 23px; border-radius: 999px; background: var(--lq-border-strong); position: relative; flex: none; cursor: pointer; transition: background .16s; border: none; padding: 0; }
.s2sw::after { content: ""; position: absolute; top: 2.5px; left: 2.5px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .2); transition: left .16s; }
.s2sw.on { background: var(--lq-accent); }
.s2sw.on::after { left: 19.5px; }

/* password checklist — reuses the existing #pwRules .pw-rule markup (pwCheck toggles .is-pass) */
.s2ctl .pw-rules { list-style: none; display: grid; grid-template-columns: 1fr 1fr; gap: 9px 22px; margin: 14px 0 0; padding: 0; }
.s2ctl .pw-rule { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--lq-ink-muted); }
.s2ctl .pw-rule.is-pass { color: var(--lq-ink-primary); }
.s2ctl .pw-rule .pw-rule__ic { width: 15px; height: 15px; color: var(--lq-ink-muted); flex: none; }
.s2ctl .pw-rule.is-pass .pw-rule__ic { color: var(--lq-success-text); }

/* bounded active-sessions list (D-002 fix, styled to the mockup) */
.s2sess { border: 1px solid var(--lq-border); border-radius: 12px; overflow: hidden; }
.s2srow { display: flex; align-items: center; gap: 14px; padding: 13px 16px; border-bottom: 1px solid var(--lq-border); }
.s2srow:last-child { border-bottom: none; }
.s2sic { width: 34px; height: 34px; border-radius: 9px; background: var(--lq-accent-tint); color: var(--lq-accent); display: flex; align-items: center; justify-content: center; flex: none; }
.s2sic svg { width: 17px; height: 17px; }
.s2smeta { flex: 1; min-width: 0; }
.s2smeta .d1 { font-size: 13.5px; font-weight: var(--lq-weight-semibold, 600); color: var(--lq-ink-primary); }
.s2smeta .d2 { font-size: 12px; color: var(--lq-ink-muted); margin-top: 1px; }
.s2tag { font-size: 10.5px; font-weight: var(--lq-weight-bold, 700); padding: 3px 9px; border-radius: 999px; background: var(--lq-accent-tint); color: var(--lq-accent); }
.s2tag.grey { background: var(--lq-surface-subtle); color: var(--lq-ink-muted); }
.s2lnk { font: inherit; font-size: 13px; font-weight: var(--lq-weight-semibold, 600); color: var(--lq-accent); cursor: pointer; background: none; border: none; }
.s2sessfoot { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px; background: var(--lq-surface-subtle); border-top: 1px solid var(--lq-border); }
.s2more { font: inherit; font-size: 13px; font-weight: var(--lq-weight-semibold, 600); color: var(--lq-accent); cursor: pointer; background: none; border: none; }

@media (max-width: 920px) {
  .s2sec { grid-template-columns: 1fr; gap: 14px; }
  .s2grid2, .s2ctl .pw-rules { grid-template-columns: 1fr; }
  .s2card { padding: 0 18px; }
}

/* Payslip Settings live preview wrapper */
.pspv{max-width:640px;margin-top:var(--lq-space-2,8px)}
.pspv .slip{margin:0}

/* Payroll Readiness Score — run-detail breakdown panel (display only). */
.rdy-panel{display:flex;gap:var(--lq-space-5,20px);align-items:flex-start;flex-wrap:wrap;margin-top:var(--lq-space-3,12px)}
.rdy-score{flex:0 0 auto;text-align:center;min-width:96px;padding:var(--lq-space-3,12px) var(--lq-space-4,16px);border:1px solid var(--lq-border);border-radius:var(--lq-radius-lg,14px);background:var(--lq-surface-subtle)}
.rdy-score__n{font-size:40px;font-weight:700;line-height:1;color:var(--lq-accent);font-variant-numeric:tabular-nums}
.rdy-score__l{font-size:var(--lq-text-xs,12px);color:var(--lq-ink-muted);margin-top:4px}
.rdy-list{flex:1;min-width:240px;display:flex;flex-direction:column;gap:6px}
.rdy-chk{display:flex;align-items:center;gap:10px;padding:8px 12px;border:1px solid var(--lq-border);border-radius:var(--lq-radius-md,10px)}
.rdy-chk.is-bad{border-color:#F0C36D;background:#FFFBEB}
.rdy-chk__ic{flex:0 0 auto;display:inline-flex}.rdy-chk__ic svg{width:16px;height:16px}
.rdy-chk.is-ok .rdy-chk__ic{color:#15803D}.rdy-chk.is-bad .rdy-chk__ic{color:#B45309}
.rdy-chk__t{flex:1;min-width:0;display:flex;flex-direction:column;line-height:1.35}
.rdy-chk__t b{font-size:var(--lq-text-small);color:var(--lq-ink-primary)}
.rdy-chk__t span{font-size:var(--lq-text-xs,12px);color:var(--lq-ink-secondary)}
.rdy-chk__ok{color:#15803D;font-size:12px;font-weight:700}
