/* CertaRounds — Settings screen styles (src/screens/settings.js). Semantic tokens only
   (COMPONENTS.md §2). Shared pickers (pf-days, pf-rest, pf-sheet) live in profile.css. */

.st-head { margin-bottom: 0; }
.st { display: flex; flex-direction: column; gap: var(--sp-6); }
.st-groups { display: flex; flex-direction: column; gap: var(--sp-7); min-width: 0; }

/* ---------- Section ---------- */
.st-sec { display: flex; flex-direction: column; gap: var(--sp-3); scroll-margin-top: calc(var(--topbar-h) + var(--sp-4)); }
.st-sec__title {
  font-size: var(--fs-17);
  font-weight: var(--fw-bold);
  letter-spacing: var(--tracking-snug, -0.01em);
  color: var(--text-strong);
  outline: none;
}
.st-sec__head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--sp-3); }
.st-sec__head .link-more { flex-shrink: 0; }
.st-sec__intro { font-size: var(--fs-13); color: var(--text-2); line-height: 1.45; margin-top: calc(-1 * var(--sp-1)); max-width: 60ch; text-wrap: balance; }
.st-card { overflow: hidden; }
.st-card > * + * { border-top: 1px solid var(--divider); }

/* ---------- Row ---------- */
.st-row {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  grid-template-areas: "icon text control" ". below below";
  align-items: center;
  column-gap: var(--sp-3);
  padding: 14px var(--sp-4);
  min-height: 64px;
  color: var(--text);
}
.st-row__icon {
  grid-area: icon; align-self: start;
  width: 36px; height: 36px; border-radius: 10px;
  display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent-soft-fg);
}
.st-row__icon--danger { background: var(--danger-bg); color: var(--danger); }
.st-row__text { grid-area: text; min-width: 0; display: flex; flex-direction: column; gap: 2px; align-self: center; }
.st-row__title { font-size: var(--fs-15); font-weight: var(--fw-semibold); color: var(--text-strong); line-height: 1.35; }
.st-row__title label { cursor: inherit; }
.st-row__hint { font-size: var(--fs-13); color: var(--text-2); line-height: 1.45; }
.st-row__hint.is-warning { color: var(--warning); }
.st-row__control { grid-area: control; min-width: 0; display: flex; align-items: center; justify-content: flex-end; }
.st-row__below { grid-area: below; margin-top: var(--sp-2); }
.st-row.is-disabled .st-row__title { color: var(--text-3); }
/* Quiet "Saved" confirmation after an instant change (R4). */
.st-saved {
  display: inline-flex; align-items: center; gap: 3px; margin-left: var(--sp-2);
  font-size: var(--fs-12); font-weight: var(--fw-semibold); color: var(--success);
  vertical-align: 1px; transition: opacity var(--dur-3) var(--ease-out);
}
.st-saved.is-out { opacity: 0; }

/* Control under the text (segmented controls, pickers, editors). */
.st-row--stack, .st-row--wide { grid-template-areas: "icon text text" "control control control" "below below below"; }
.st-row--stack .st-row__control, .st-row--wide .st-row__control { margin-top: var(--sp-3); justify-content: stretch; display: block; }
.st-row--stack .segmented { display: grid; width: 100%; }
/* Text-like editors keep the text column's left edge on phones too (R2: rest days). Only the
   week widget and segmented controls use the full row width. */
.st-row--wide.st-row--indent, .st-row--stack.st-row--indent { grid-template-areas: "icon text text" ". control control" ". below below"; }

/* Switch rows toggle from anywhere on the row. */
.st-row--switch { cursor: pointer; transition: background var(--dur-1) var(--ease-out); }
.st-row--switch:hover { background: var(--surface-hover); }

/* Link rows (Account, Privacy). */
.st-row--link { text-decoration: none; cursor: pointer; transition: background var(--dur-1) var(--ease-out); }
.st-row--link .st-row__chev { grid-area: control; color: var(--text-3); }
.st-row--link:hover { background: var(--surface-hover); text-decoration: none; }
.st-row--link:hover .st-row__chev { color: var(--link); }
.st-row--link:active { background: var(--surface-pressed); }
.st-row--link:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--focus); }
/* Phone disclosure row (pace for timed rounds) and the rows it opens. */
.st-row--disclose { width: 100%; text-align: left; background: none; border: 0; font: inherit; }
.st-pace > * + * { border-top: 1px solid var(--divider); }

/* Compact native select on the label row (weekly goal). */
/* Sized to its longest option ("Goal: 6 of your 7 study days") so the text never runs under the chevron. */
.st-select { min-width: 176px; }
/* R4 P1: every select here reserves room for the chevron (right 14px + 18px icon + gap) —
   the generic .input padding had won and let an auto-width select run text under it. */
.st .st-select .select__input { min-height: 44px; padding-right: 44px; }
@container stg (min-width: 600px) {
  .st-row .st-select { width: max-content; max-width: 100%; }
  .st-row .st-select .select__input { width: auto; min-width: 176px; }
}

/* Below 1200: jump chips that stick under the top bar (top set from the bar's real height in JS).
   Chips never ellipsize; the row scrolls sideways with a fade at the edge while there is more. */
.st-jump {
  position: sticky; top: var(--shell-sticky-top, 0px); z-index: calc(var(--z-sticky) - 1);
  margin: calc(-1 * var(--sp-3)) calc(-1 * var(--gutter)) 0;
  background: var(--bg);
  box-shadow: 0 1px 0 var(--divider);
}
.st-jump__row {
  display: flex; gap: var(--sp-2);
  overflow-x: auto; scrollbar-width: none;
  padding: 10px var(--gutter);
}
.st-jump__row::after { content: ""; flex: 0 0 56px; }        /* end room: the last chip scrolls clear of the fade */
.st-jump__row::-webkit-scrollbar { display: none; }
/* R3: a chip cut at the edge read as a word — while the row has more, the edge fades to the page. */
.st-jump::after {
  content: ""; position: absolute; top: 0; right: 0; bottom: 1px; width: 56px;
  background: linear-gradient(to right, transparent, var(--bg) 70%);
  pointer-events: none; opacity: 0; transition: opacity var(--dur-1) var(--ease-out);
}
.st-jump.is-more::after { opacity: 1; }
/* The "more" button sits on the fade: a round chevron that scrolls the row to the rest. */
.st-jump__more {
  position: absolute; z-index: 1; top: 50%; right: max(6px, calc(var(--gutter) - 10px)); transform: translateY(-50%);
  width: 32px; height: 32px; border-radius: 50%;
  display: none; place-items: center;
  background: var(--surface); color: var(--text-2);
  box-shadow: 0 0 0 1px var(--border-strong), var(--shadow-xs);
  cursor: pointer;
}
.st-jump__more::after { content: ""; position: absolute; inset: -6px; }
.st-jump__more:hover { color: var(--link); background: var(--surface-hover); }
.st-jump.is-more .st-jump__more { display: grid; }
.st-jump__chip { flex: 0 0 auto; }
.st-jump__chip[aria-current="true"] { color: var(--accent-soft-fg); background: var(--selected-bg); box-shadow: inset 0 0 0 1.5px var(--selected-border); font-weight: var(--fw-semibold); }
.st-sec { scroll-margin-top: calc(var(--st-stick, var(--topbar-h)) + var(--sp-3)); }

/* Text size sample — rem-based, so it previews the chosen size live. */
.st-sample {
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-md);
  background: var(--surface-2);
  color: var(--text);
  font-size: var(--fs-stem);
  line-height: var(--lh-stem);
}

/* em-based width, so the field grows with the chosen text size and never clips "PM". */
/* The reminder time is a select of half-hour times ("8:00 PM"): compact on the label row. */
.st-time-sel { min-width: 150px; }

.st-honest {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 14px var(--sp-4);
  background: var(--surface-2);
  font-size: var(--fs-13); line-height: 1.5; color: var(--text-2);
}
.st-honest .icon { flex-shrink: 0; color: var(--accent); margin-top: 1px; }

.st-error { display: flex; gap: 6px; align-items: flex-start; font-size: var(--fs-13); color: var(--danger); line-height: 1.45; }
.st-error .icon { flex-shrink: 0; margin-top: 1px; }

.st-about { font-size: var(--fs-13); color: var(--text-3); line-height: 1.5; text-align: center; padding: 0 var(--sp-2); }

/* ---------- Reset sheet ---------- */
.st-danger-note {
  display: flex; gap: var(--sp-3); align-items: flex-start;
  padding: var(--sp-4);
  border-radius: var(--r-md);
  background: var(--danger-bg);
  color: var(--danger-strong);
}
.st-danger-note .icon { flex-shrink: 0; }
.st-danger-note__title { font-weight: var(--fw-bold); font-size: var(--fs-15); }
.st-danger-list { margin: var(--sp-1) 0 0; padding-left: 1.1em; font-size: var(--fs-15); line-height: 1.6; }
.st-keep { display: flex; gap: var(--sp-2); align-items: flex-start; font-size: var(--fs-15); color: var(--text); font-weight: var(--fw-medium); }
.st-keep .icon { flex-shrink: 0; color: var(--success); margin-top: 1px; }
.st-keep[hidden] { display: none; }
.st-reset-scope { gap: var(--sp-2); }
/* "Erase everything" wears the danger colour of the Reset row it came from (R4). */
.st-choice--danger .icon-tile { background: var(--danger-bg); color: var(--danger); }

/* ---------- Rows follow the width of the settings column, not the viewport (R3) ----------
   Under 600px of column (phones, and 1024–1179 beside the index) controls sit under their text;
   from 600px compact controls sit on the label row, right-aligned, and wide ones go below at the
   full width of the text column — one right edge per card. */
.st-groups { container: stg / inline-size; }
@container stg (min-width: 600px) {
  .st-row { padding: 16px var(--sp-5); column-gap: var(--sp-4); }
  .st-row--wide { grid-template-areas: "icon text text" ". control control" ". below below"; }
  .st-row--stack, .st-row--stack.st-row--indent { grid-template-areas: "icon text control" ". below below"; }
  .st-row--stack .st-row__control { margin-top: 0; display: flex; justify-content: flex-end; }
  .st-row--stack .segmented { display: inline-grid; width: auto; }
  .st-row--stack .st-row__below { margin-top: var(--sp-3); }
  .st-row--wide .st-row__control { max-width: none; }
  .st-row--wide .segmented { max-width: 440px; }
  .st-honest { padding: 14px var(--sp-5); }
  .st .pf-rest__form { max-width: 520px; }
}
@media (min-width: 768px) {
  .st-about { text-align: left; padding: 0; }
}

/* ---------- ≥ 1024: section index beside the groups (R3: also at 1024) ---------- */
@media (min-width: 1024px) {
  .st-layout { display: grid; grid-template-columns: 184px minmax(0, 1fr); gap: var(--sp-6); align-items: start; }
  .st-groups { gap: var(--sp-8); }
  .st-sec__title { font-size: var(--fs-20); }
  .st-sec__intro { font-size: var(--fs-15); }
  .st-row__hint { max-width: 62ch; }
  .st-index { position: sticky; top: calc(var(--shell-sticky-top, 0px) + var(--sp-5)); }
  .st-index ul { display: flex; flex-direction: column; gap: 2px; }
  .st-index__link {
    display: flex; align-items: center; gap: var(--sp-3);
    min-height: 44px; padding: 0 var(--sp-3);
    border-radius: 12px;
    font-size: var(--fs-15); font-weight: var(--fw-medium);
    color: var(--text-2);
    text-decoration: none;
    transition: background var(--dur-1) var(--ease-out), color var(--dur-1) var(--ease-out);
  }
  .st-index__link .icon { color: var(--text-3); flex-shrink: 0; }
  .st-index__link:hover { background: var(--surface-hover); color: var(--text); text-decoration: none; }
  .st-index__link:focus-visible { outline: none; box-shadow: var(--focus-ring); }
  .st-index__link[aria-current="true"] { background: var(--selected-bg); color: var(--accent-soft-fg); font-weight: var(--fw-semibold); }
  .st-index__link[aria-current="true"] .icon { color: var(--accent); }
}
.st-index__link span { white-space: nowrap; }
@media (min-width: 1024px) and (max-width: 1199px) {
  .st-index__link { font-size: var(--fs-13); padding: 0 var(--sp-2); gap: var(--sp-2); }
}
/* ≥ 1200: the settings column is capped at 760px (R4: at 880 a control sat ~700px from its title). */
@media (min-width: 1200px) {
  .st-layout { grid-template-columns: 208px minmax(0, 760px); gap: var(--sp-8); }
}
