/* =========================================================================
   Settings: a section index on the reading-start side, the sections beside it.
   Class prefix set- (st- is taken by booth status pills).
   ========================================================================= */
.set-layout { display: grid; grid-template-columns: 210px minmax(0, 860px); gap: 28px; align-items: start; }
.set-nav { position: sticky; top: 84px; display: flex; flex-direction: column; gap: 2px; }
.set-nav button { text-align: start; border: 0; background: none; padding: 9px 12px; border-radius: 10px; font-weight: 500; font-size: 14px; color: var(--ink-3); cursor: pointer; border-inline-start: 2px solid transparent; border-start-start-radius: 0; border-end-start-radius: 0; transition: color .15s, background .15s, border-color .15s; }
.set-nav button:hover { color: var(--ink); background: var(--line-2); }
.set-nav button[aria-current="true"] { color: var(--ink); font-weight: 600; border-inline-start-color: var(--accent); }
.set-body { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.set-sec { scroll-margin-top: 84px; padding: 22px 24px; }
.set-head { margin-bottom: 14px; }
.set-head h2 { outline: none; }
.set-head p { color: var(--ink-3); font-size: 14px; margin: 4px 0 0; max-width: 62ch; }
.set-saved { display: inline-flex; align-items: center; gap: 6px; color: var(--ok); font-size: 13.5px; font-weight: 600; min-height: 20px; }
.set-saved svg { width: 16px; height: 16px; }

/* a labelled control on one line */
.set-line { display: flex; align-items: center; justify-content: space-between; gap: 12px 24px; padding: 14px 0; border-top: 1px solid var(--line-2); flex-wrap: wrap; }
.set-head + .set-line { border-top: 0; padding-top: 4px; }
.set-line b { display: block; font-weight: 600; font-size: 14.5px; }
.set-line small { display: block; color: var(--ink-3); font-size: 13px; margin-top: 2px; max-width: 54ch; }
.set-line > div:first-child { flex: 1 1 260px; }

/* profile */
.set-me { display: flex; gap: 12px; align-items: center; padding-bottom: 16px; margin-bottom: 4px; border-bottom: 1px solid var(--line-2); }
.set-me .avatar { width: 46px; height: 46px; font-size: 16px; }
.set-me b { display: block; font-size: 15.5px; } .set-me small { color: var(--ink-3); font-size: 13px; }
.set-rows { display: flex; flex-direction: column; }
.set-row { display: grid; grid-template-columns: 116px minmax(0, 1fr) auto auto; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line-2); }
.set-row .chan { justify-self: start; font-size: 12.5px; }
.set-row .field { gap: 4px; }
.set-row input[readonly] { background: var(--surface-2); color: var(--ink-2); }
.set-row .field-error { grid-column: 1 / -1; }
.set-actions { margin-top: 14px; }

/* alert matrix */
.set-scroll { overflow-x: auto; margin: 0 -4px; }
.set-matrix { width: 100%; border-collapse: collapse; font-size: 14px; }
.set-matrix th, .set-matrix td { padding: 12px 8px; border-bottom: 1px solid var(--line-2); text-align: center; vertical-align: middle; }
.set-matrix thead th { font-size: 12.5px; font-weight: 600; color: var(--ink-3); padding-top: 4px; white-space: nowrap; }
.set-matrix :is(thead th, tbody th):first-child { text-align: start; width: 100%; min-width: 220px; }
.set-matrix tbody th b { display: block; font-weight: 600; }
.set-matrix tbody th small { display: block; color: var(--ink-3); font-size: 12.5px; font-weight: 400; margin-top: 2px; }
.set-matrix tbody tr:last-child :is(th, td) { border-bottom: 0; }
.set-tick { width: 20px; height: 20px; margin: 0; accent-color: var(--accent); cursor: pointer; }
.set-tick:disabled { cursor: not-allowed; opacity: .4; }
.set-always { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 7px; color: var(--ink-3); background: var(--surface-2); }
.set-always svg { width: 14px; height: 14px; }
.set-off th b { color: var(--ink-3); }
.set-quiet { margin-top: 6px; }

/* digest */
.set-digest { border: 0; padding: 4px 0 0; margin: 0; min-width: 0; display: grid; grid-template-columns: 140px 1fr; gap: 16px 20px; align-items: start; }
.set-digest > .field:nth-child(n + 2) { grid-column: 1 / -1; }
.set-digest:disabled { opacity: .5; }
.set-days { display: flex; flex-wrap: wrap; gap: 6px; }
.set-days label { position: relative; }
.set-days input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; }
.set-days span { display: inline-flex; align-items: center; justify-content: center; min-width: 56px; height: 36px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-solid); font-weight: 600; font-size: 13.5px; color: var(--ink-2); transition: background .15s, color .15s, border-color .15s; }
.set-days input:checked + span { background: var(--accent-soft); border-color: color-mix(in oklab, var(--accent) 40%, transparent); color: var(--accent); }
:root[data-theme="dark"] .set-days input:checked + span { color: #fff; }
.set-days input:focus-visible + span { outline: 2.5px solid var(--accent); outline-offset: 2px; }
.set-digest .seg { align-self: start; }
.set-digest .seg button:disabled { opacity: .4; cursor: not-allowed; }
.set-next { display: flex; align-items: center; gap: 8px; margin: 18px 0 0; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); color: var(--ink-2); font-size: 14px; }
.set-next svg { width: 17px; height: 17px; flex: none; color: var(--accent); }

/* organisation links */
.set-links { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.set-links a { display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface-solid); color: inherit; text-decoration: none; transition: border-color .15s, transform .15s var(--spring); }
.set-links a:hover { border-color: color-mix(in oklab, var(--accent) 45%, transparent); }
.set-links a > svg:first-child { width: 20px; height: 20px; flex: none; color: var(--accent); }
.set-links span { flex: 1; min-width: 0; }
.set-links b { display: block; font-weight: 600; font-size: 14.5px; }
.set-links small { display: block; color: var(--ink-3); font-size: 12.5px; margin-top: 1px; }
.set-go { width: 16px; height: 16px; flex: none; color: var(--ink-4); }
[dir="rtl"] .set-go { transform: scaleX(-1); }

@media (max-width: 980px) {
  .set-layout { grid-template-columns: 1fr; }
  .set-nav { display: none; }
}
@media (max-width: 640px) {
  .set-sec { padding: 18px 16px; }
  .set-row { grid-template-columns: 1fr auto; }
  .set-row .field { grid-column: 1 / -1; grid-row: 2; }
  .set-row .btn { grid-column: 2; grid-row: 1; }
  .set-row .pill { display: none; }
  .set-links { grid-template-columns: 1fr; }
  .set-digest { grid-template-columns: 1fr; }
  /* in-app is always on and the lede says so; dropping the column lets the matrix fit a phone */
  .set-matrix :is(th, td):nth-child(2) { display: none; }
  .set-matrix :is(thead th, tbody th):first-child { min-width: 120px; }
  .set-matrix th, .set-matrix td { padding-inline: 5px; }
  .set-matrix thead .chan { padding: 0; background: none; font-size: 11.5px; gap: 4px; }
}
