/* ==========================================================================
   إحراز — settings page (settings.html, assets/settings.js)
   A list of sections beside one panel; on phones the list becomes a row of pills above it.
   Gold marks where you are (the open section, the chosen value); red only for what can't be undone.
   ========================================================================== */
.st-layout { display: grid; grid-template-columns: 220px minmax(0, 720px); gap: 24px; align-items: start; }

/* ---- the section list ---- */
.st-nav { position: sticky; top: 24px; display: grid; gap: 4px; }
.st-nav a {
  display: flex; align-items: center; gap: 12px; min-height: 46px; padding: 0 14px; border-radius: 12px;
  border: 1px solid transparent; color: var(--ink-2); font-size: 15px; text-decoration: none;
  transition: background-color var(--dur-fast), border-color var(--dur-fast);
}
.st-nav a:hover { background: var(--lilac); color: var(--ink); }
.st-nav a.is-on { background: var(--highlight-soft); border-color: var(--highlight-line); color: var(--ink); font-weight: var(--w-semibold); }
.st-nav .icon { width: 20px; height: 20px; flex: none; }
.st-nav a:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

/* ---- panels and cards ---- */
.st-panels { min-width: 0; }
.st-panel { display: grid; gap: 16px; }
.st-panel[hidden] { display: none; }
.st-card { display: grid; gap: 18px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r-panel); padding: 24px; container-type: inline-size; }
.st-card[hidden], .st-row[hidden], .field[hidden] { display: none; }
.st-card__title { font-size: 18px; line-height: 1.4; font-weight: var(--w-display); }
.st-card .field { margin-bottom: 0; }
.st-field { display: grid; gap: 10px; justify-items: start; }
.st-label { font-size: 13px; color: var(--muted); }
.st-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.st-actions .btn, .st-try, #activate-link { display: inline-flex; align-items: center; gap: 8px; }
.st-actions .icon, .st-try .icon { width: 18px; height: 18px; }
.st-try { justify-self: start; }
.st-note { font-size: 13px; line-height: 1.8; color: var(--muted); }
.st-note[hidden], .st-error[hidden], .st-pending[hidden] { display: none; }
.st-error { padding: 10px 14px; border-radius: 12px; background: var(--t-exam); color: var(--ink); font-size: var(--text-sm); line-height: 1.8; }

/* who is signed in */
.st-who { display: flex; align-items: center; gap: 14px; padding: 4px 4px 0; flex-wrap: wrap; }
.st-who__avatar { width: 56px; height: 56px; font-size: 22px; flex: none; background: var(--highlight); color: var(--ink); border: 0; }
.st-who > div { display: grid; gap: 2px; min-width: 0; }
.st-who b { font-size: 18px; font-weight: var(--w-display); }
.st-who__email, .st-who__since { font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.st-tag { padding: 3px 12px; border-radius: var(--r-pill); background: var(--highlight-soft); border: 1px solid var(--highlight-line); font-size: 12px; }
.st-tag[hidden] { display: none; }

/* segmented choices (the .seg look from reading.css, sized for fingers) */
.st-seg { flex-wrap: wrap; }
.st-seg button { min-height: 40px; padding: 8px 18px; font-size: var(--text-sm); }
.st-seg button:focus-visible, .st-band:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

/* every choice answers the pointer: a soft fill on hover, a firmer one while pressed (colour only, nothing moves) */
.st-seg button { transition: background-color 120ms ease, color 120ms ease; }
.st-seg button:not(.is-on):hover { background: var(--lilac); color: var(--ink); }
.st-seg button:not(.is-on):active { background: var(--border); }
.st-nav a:active { background: var(--border); }
.st-nav a.is-on:active { background: var(--highlight-soft); }

/* «✓ حُفظ»: a quiet sign beside what was just saved (settings.js flashSaved) */
.st-saved { display: inline-flex; align-items: center; gap: 4px; margin-inline-start: 10px; font-size: 12px; font-weight: var(--w-medium);
  color: var(--c-speaking); opacity: 0; transition: opacity 200ms ease; vertical-align: middle; pointer-events: none; }
.st-saved.is-on { opacity: 1; }
.st-saved .icon { width: 14px; height: 14px; }
.st-actions .st-saved { align-self: center; }

/* target band */
.st-bands { display: flex; flex-wrap: wrap; gap: 8px; }
.st-band {
  min-width: 56px; min-height: 44px; padding: 0 12px; border-radius: 12px; border: 1px solid var(--border-strong); background: var(--surface);
  font: inherit; font-size: 16px; font-weight: var(--w-semibold); color: var(--ink-2); font-variant-numeric: tabular-nums;
  transition: background-color var(--dur-fast), border-color var(--dur-fast);
}
.st-band:hover { border-color: var(--ink); }
.st-band:not(.is-on):active { background: var(--lilac); }
.st-band.is-on { background: var(--ink); border-color: var(--ink); color: var(--on-accent); }

/* test date */
.st-date { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.st-date input {
  height: 44px; padding: 0 12px; border: 1px solid var(--border-strong); border-radius: var(--r-input);
  background: var(--surface); font: inherit; font-size: var(--text-body); color: var(--ink);
}
.st-date input:focus { outline: 2px solid var(--ink); outline-offset: 1px; }
.st-date .link[hidden] { display: none; }
.st-count { font-size: var(--text-sm); font-weight: var(--w-semibold); color: var(--c-plan); }
.st-count.is-past { color: var(--c-exam); }

/* a card that is a link (the study plan) */
.st-link { display: flex; align-items: center; gap: 14px; padding: 16px 20px; color: var(--ink); text-decoration: none; transition: border-color var(--dur-fast); }
.st-link:hover { border-color: var(--ink); }
.st-link::after { content: "←"; margin-inline-start: auto; font-family: system-ui, sans-serif; color: var(--muted); }
.st-link > span:last-of-type { display: grid; gap: 2px; }
.st-link small { font-size: 13px; color: var(--muted); }
.st-link__icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--t-plan); color: var(--c-plan); flex: none; }
.st-link__icon .icon { width: 20px; height: 20px; }
.st-link[hidden] { display: none; }

/* rows: icon · name and value · action */
.st-rows { display: grid; }
.st-row { display: flex; align-items: center; gap: 14px; padding: 14px 0; }
.st-row + .st-row { border-top: 1px solid var(--border); }
.st-rows .st-row:first-child { padding-top: 0; }
.st-rows .st-row:last-child { padding-bottom: 0; }
.st-row__icon { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; background: var(--lilac); flex: none; }
.st-row__icon .icon { width: 19px; height: 19px; }
.st-row__body { display: grid; gap: 2px; min-width: 0; flex: 1; font-size: var(--text-sm); color: var(--muted); }
.st-row__body b { font-size: 15px; font-weight: var(--w-semibold); color: var(--ink); }
.st-row__body .ltr { overflow-wrap: anywhere; }
/* English bits (an email, IELTS) stay on the right edge like the Arabic around them */
.st-row__body > *, .st-who > div > * { justify-self: start; max-width: 100%; }
.st-row__body small { font-size: 12px; color: var(--muted); }
.st-row .btn { flex: none; }
/* a narrow card (a phone, or larger text): the button goes under the name instead of squeezing it */
@container (max-width: 300px) {
  .st-row { flex-wrap: wrap; }
  .st-row__body { flex-basis: calc(100% - 52px); }
  .st-row .btn { margin-inline-start: 52px; }
}
.st-pending { color: var(--c-plan) !important; }
.st-sub { font-weight: var(--w-medium); color: var(--muted); }
.st-sub.is-on { color: var(--c-speaking); }
.st-sub.is-off { color: var(--c-exam); }

/* what can't be undone */
.st-danger { border-color: var(--l-exam); }
.st-danger .st-card__title { color: var(--c-exam); }
.st-danger .st-row__icon { background: var(--t-exam); color: var(--c-exam); }
.btn.st-bad { color: var(--c-exam); border-color: var(--l-exam); }
.btn.st-bad:hover { border-color: var(--c-exam); }
.btn--danger { background: var(--c-exam); color: #fff; }
.btn--danger:hover { background: #b91c1c; }
.btn--danger:disabled, .btn--primary:disabled { opacity: .45; cursor: not-allowed; top: 0; }
.btn[aria-busy="true"] { cursor: progress; }

/* dialogs */
.st-dlg form { display: grid; gap: 14px; }
.st-dlg .field { margin-bottom: 0; }
.st-dlg .dlg__head, .st-dlg .dlg__actions { margin: 0; }
/* text buttons («بلا موعد», «إظهار») look like links */
.settings-page button.link { border: 0; background: none; padding: 0; font: inherit; font-size: 14px; color: var(--ink); cursor: pointer; }
.st-show { justify-self: start; font-size: 13px !important; }
.st-list { display: grid; gap: 8px; font-size: var(--text-sm); line-height: 1.8; }
.st-list li { position: relative; padding-inline-start: 22px; }
.st-list li[hidden] { display: none; }
.st-list li::before { position: absolute; inset-inline-start: 0; top: 0; font-weight: 700; }
.st-list .is-bad::before { content: "✕"; color: var(--c-exam); }
.st-list .is-ok::before { content: "✓"; color: var(--c-speaking); }

/* ---- phones and tablets: the list becomes a row of pills ---- */
@media (max-width: 960px) {
  .st-layout { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .st-nav {
    position: static; display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none;
    margin-inline: calc(-1 * var(--gutter)); padding: 2px var(--gutter);
  }
  .st-nav::-webkit-scrollbar { display: none; }
  .st-nav a { flex: none; min-height: 40px; padding: 0 14px; border-radius: var(--r-pill); border-color: var(--border-strong); background: var(--surface); font-size: 14px; }
  .st-nav .icon { width: 17px; height: 17px; }
}
@media (max-width: 560px) {
  .st-card { padding: 18px; }
  .st-dlg .dlg__actions { flex-direction: column-reverse; }
  .st-dlg .dlg__actions .btn { width: 100%; }
}
