/* Settings: the setup checklist leads, then one card per connection, then the
   profile, the schedule and the feeds. Every class here starts with st. */

/* Narrow: one column, the checklist on top. Wide: the checklist stays in view on the left. */
.st { display: grid; gap: 20px; grid-template-columns: minmax(0, 1fr); align-items: start; }
.st .section { margin-top: 0; }
.st-cards { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; min-width: 0; }
@media (min-width: 1280px) {
  .st { grid-template-columns: 384px minmax(0, 1fr); gap: 24px; }
  .st-setup { position: sticky; top: 76px; max-height: calc(100vh - 96px); overflow-y: auto; overscroll-behavior: contain; }
}
@media (min-width: 1800px) { .st { grid-template-columns: 408px minmax(0, 1fr); } }

/* ---------- Sample copy notice ---------- */
.st-sample { display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 14px; align-items: start; padding: 18px 20px; margin-bottom: 20px; border-radius: var(--r-lg); background: var(--amber-wash); max-width: 900px; }
.st-sample-ic { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 11px; background: var(--surface); color: var(--amber-ink); }
.st-sample h2 { margin-bottom: 2px; }
.st-sample p { color: var(--ink); }

/* ---------- The hero: setup checklist ---------- */
.st-setup { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; min-width: 0; padding: 22px 22px 12px; background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--elev-1); container: stsetup / inline-size; }
.st-setup-head { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.st-score { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; color: var(--ink-2); }
.st-score-n { font: 600 32px/1 var(--font); letter-spacing: -0.03em; color: var(--ink); white-space: nowrap; }
.st-setup .bar { height: 6px; }
.st-next { color: var(--ink-2); max-width: 60ch; }

.st-steps { display: grid; gap: 4px; margin: 0 -12px; }
.st-step { display: grid; grid-template-columns: 36px minmax(0, 1fr); align-items: center; gap: 10px 12px; padding: 12px; border-radius: 12px; }
.st-step > .st-mark { grid-column: 1; grid-row: 1; align-self: start; }
.st-step-main { grid-column: 2; grid-row: 1; min-width: 0; }
.st-step-foot { grid-column: 2; grid-row: 2; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; min-width: 0; }
.st-step-act { margin-left: auto; }
.st-step.is-next { background: var(--sunken); box-shadow: inset 0 0 0 var(--hair) var(--line-strong); }
.st-step.is-next .st-mark { background: var(--surface); box-shadow: var(--ring); }
.st-step-top { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 8px; }
.st-step-name { font-weight: 600; }
.st-step-what { margin-top: 1px; font-size: 14px; color: var(--ink-2); }
.st-step-act .btn.quiet { margin-right: -6px; }
/* A wide checklist (above 1280px it is in the side column, so this is the narrow window case): 1 line a step. */
@container stsetup (min-width: 640px) {
  .st-setup .bar { max-width: 560px; }
  .st-steps { grid-template-columns: 48px minmax(0, 1fr) max-content max-content; column-gap: 16px; }
  .st-step { grid-column: 1 / -1; grid-template-columns: subgrid; }
  .st-step > .st-mark { align-self: center; }
  .st-step-foot { display: contents; }
  .st-step-state { grid-column: 3; grid-row: 1; }
  .st-step-act { grid-column: 4; grid-row: 1; justify-self: end; margin-left: 0; }
}

/* Brand marks: the only icons that lead a row, because they name the service. */
.st-mark { flex: none; width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px; background: var(--sunken); color: var(--ink); }
.st-need { font-size: 14px; color: var(--ink-3); }
.st-tag { flex: none; }

/* ---------- Connection cards ---------- */
.st-card { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; container: stcard / inline-size; scroll-margin-top: 76px; }
.st-card-head { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; align-items: center; gap: 10px 14px; }
.st-card-head .st-mark { width: 40px; height: 40px; border-radius: 11px; }
.st-card-id { display: grid; gap: 1px; min-width: 0; }
.st-card-state { justify-self: end; }
@container stcard (max-width: 460px) {
  .st-card-head { grid-template-columns: 40px minmax(0, 1fr); }
  .st-card-state { grid-column: 2; justify-self: start; }
}

/* Collapsed: 1 summary line under the name, the actions beside it. */
.st-people { display: grid; gap: 0; }
.st-people li { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 8px 16px; padding: 8px 0; border-top: var(--hair) solid var(--line-strong); }
.st-people li:first-child { border-top: 0; }
.st-person { display: flex; align-items: center; gap: 8px; min-width: 0; font-weight: 500; }
.st-person span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st-person-meta { font-size: 14px; color: var(--ink-2); }
@container stcard (max-width: 559px) { .st-people li { grid-template-columns: minmax(0, 1fr) auto; } .st-person-meta { grid-column: 1; grid-row: 2; } .st-people .btn { grid-row: 1 / span 2; grid-column: 2; } }
.st-sum { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 20px; }
.st-sum p { flex: 1 1 300px; color: var(--ink-2); max-width: 64ch; }
.st-sum .actions { flex: none; gap: 6px; }
@container stcard (min-width: 560px) { .st-sum { padding-left: 54px; } }

.st-body { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; min-width: 0; }
.st-body > p, .st-lede { max-width: 68ch; }
.st-lede { color: var(--ink-2); }
.st-body h3 { font-size: 16px; }
.st-sep { padding-top: 20px; margin-top: 4px; border-top: var(--hair) solid var(--line-strong); }
.st-foot { padding-top: 14px; border-top: var(--hair) solid var(--line-strong); }
.st-tight { margin-left: -10px; }

/* Notes: what happened, in words, with an icon for its kind. */
.st-note { display: flex; align-items: flex-start; gap: 9px; max-width: 72ch; padding: 10px 12px; border-radius: 10px; background: var(--sunken); color: var(--ink); }
.st-note > svg { margin-top: 3px; color: var(--ink-3); }
.st-note.good { background: var(--green-wash); }
.st-note.good > svg { color: var(--green-ink); }
.st-note.warn { background: var(--amber-wash); }
.st-note.warn > svg { color: var(--amber-ink); }
.st-note.bad { background: var(--red-wash); }
.st-note.bad > svg { color: var(--red-ink); }
.st-live:empty { display: none; }
.st-live { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }

/* A wait with a known ceiling: the bar fills over the whole wait. */
.st-wait { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; padding: 14px; border-radius: var(--r-md); background: var(--sunken); }
.st-wait-t { font-weight: 500; }
.st-wait-track { height: 4px; overflow: hidden; border-radius: 2px; background: var(--line-strong); }
.st-wait-track i { display: block; width: 100%; height: 100%; border-radius: 2px; background: var(--primary); transform-origin: left; animation: st-fill var(--st-dur, 25s) linear both; }
@keyframes st-fill { from { transform: scaleX(0); } }

/* Commands to copy, with where to type them. */
.st-cmd { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; min-width: 0; }
.st-cmd-where { font-size: 14px; color: var(--ink-2); }
.st-cmd-line { display: flex; align-items: center; gap: 8px; max-width: 560px; min-width: 0; padding: 4px 4px 4px 14px; border-radius: 10px; background: var(--sunken); box-shadow: inset 0 0 0 var(--hair) var(--line-strong); }
.st-cmd-line code { flex: 1 1 auto; min-width: 0; padding: 6px 0; background: none; box-shadow: none; color: var(--ink); white-space: pre-wrap; overflow-wrap: anywhere; }
.st-cmd-line .btn { flex: none; }

/* Plain numbered steps. The number is text, not a badge. */
.st-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; max-width: 68ch; counter-reset: st-step; }
.st-list > li { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 6px 8px; counter-increment: st-step; }
.st-list > li::before { content: counter(st-step) "."; grid-column: 1; grid-row: 1; font-weight: 600; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.st-list > li > * { grid-column: 2; min-width: 0; }
.st-list .out { justify-self: start; font-size: 14px; font-weight: 500; }
.st-fix { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; padding: 18px; border-radius: var(--r-md); background: var(--sunken); }
.st-fix .st-cmd-line { background: var(--surface); }

/* Telegram parts: a checklist inside the card. The icon and the word say the state. */
.st-parts { display: grid; grid-template-columns: minmax(0, 1fr); }
.st-part { display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: 0 12px; padding: 18px 0; border-top: var(--hair) solid var(--line-strong); }
.st-part:first-child { padding-top: 2px; border-top: 0; }
.st-part:last-child { padding-bottom: 0; }
.st-part-ic { padding-top: 2px; color: var(--ink-3); }
.st-part.is-now .st-part-ic { color: var(--ink); }
.st-part.is-done .st-part-ic { color: var(--green-ink); }
.st-part-body { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; min-width: 0; }
.st-part-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 2px 12px; }
.st-part-t { font: 600 16px/1.35 var(--font); }
.st-part.is-later .st-part-t { color: var(--ink-2); }
.st-part-done { font-size: 14px; color: var(--ink-2); }
.st-part-body > p { max-width: 64ch; }
.st-part-body .field { max-width: 560px; }

/* ---------- Switches: a real button with role switch, the whole row is the target ---------- */
.st-switches { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px; margin: 0 -12px; max-width: 640px; }
.st-switch {
  appearance: none; border: 0; background: transparent; font: inherit; color: inherit; text-align: left; cursor: pointer;
  width: 100%; min-height: 48px; display: grid; grid-template-columns: minmax(0, 1fr) auto 44px; align-items: center; gap: 12px;
  padding: 8px 12px; border-radius: 12px;
  transition: background-color var(--duration-quick) var(--ease-out);
}
.st-switch:hover { background: var(--sunken); }
.st-switch-text { display: grid; gap: 1px; min-width: 0; }
.st-switch-label { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; }
.st-switch-hint { font-size: 14px; color: var(--ink-3); }
.st-switch-state { min-width: 3.4em; text-align: right; font-size: 14px; font-weight: 500; color: var(--ink-2); }
.st-switch-track { position: relative; width: 44px; height: 26px; border-radius: 13px; background: var(--sunken); box-shadow: inset 0 0 0 1.5px var(--line-strong); transition: background-color var(--duration-quick) var(--ease-out), box-shadow var(--duration-quick) var(--ease-out); }
.st-switch-thumb { position: absolute; top: 5px; left: 5px; width: 16px; height: 16px; border-radius: 50%; background: var(--ink-3); transition: transform var(--duration-fast) var(--ease-smooth-out), background-color var(--duration-quick) var(--ease-out), width var(--duration-fast) var(--ease-smooth-out), height var(--duration-fast) var(--ease-smooth-out), top var(--duration-fast) var(--ease-smooth-out), left var(--duration-fast) var(--ease-smooth-out); }
.st-switch[aria-checked="true"] .st-switch-track { background: var(--ink); box-shadow: none; }
.st-switch[aria-checked="true"] .st-switch-thumb { top: 3px; left: 3px; width: 20px; height: 20px; background: var(--surface); transform: translateX(18px); }
.st-switch[aria-checked="true"] .st-switch-state { color: var(--ink); }
.st-switch[aria-busy="true"] { cursor: progress; }
.st-switch:disabled { cursor: default; }
.st-switch:disabled:hover { background: transparent; }
.st-switch:disabled .st-switch-label, .st-switch:disabled .st-switch-state { color: var(--ink-3); }
.st-switch:disabled .st-switch-track { opacity: 0.5; }

/* ---------- Secret boxes ---------- */
.st-secret-wrap { position: relative; }
.st-secret-wrap input { padding-right: 48px; font-family: var(--mono); font-size: 15px; letter-spacing: 0.01em; }
.st-secret-wrap input::placeholder { font-family: var(--font); letter-spacing: 0; }
.st-reveal { position: absolute; top: 0; right: 0; bottom: 0; width: 44px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 0 10px 10px 0; background: transparent; color: var(--ink-3); cursor: pointer; transition: color var(--duration-quick) var(--ease-out); }
.st-reveal:hover { color: var(--ink); }
.st-reveal[aria-pressed="true"] { color: var(--ink); }
.st-reveal:disabled { cursor: default; color: var(--ink-3); }
.st-narrow { max-width: 520px; }

/* @ in front of the X handle. It sits on the box, so clicking it still focuses the box. */
.st-at { position: relative; }
.st-at::before { content: "@"; position: absolute; left: 12px; top: 50%; transform: translateY(-52%); color: var(--ink-3); pointer-events: none; }
.st-at input { padding-left: 29px; }

/* ---------- Forms ---------- */
.st-form { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; min-width: 0; }
.st-form-head { display: grid; gap: 2px; }
.st-fields { grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); max-width: 900px; }
.st-hours { grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr)); max-width: 560px; }
.st-save { gap: 8px 14px; }
.st-dirty { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; font-size: 14px; color: var(--ink-2); }
.st-dirty[hidden] { display: none; }
.st-error { max-width: 72ch; }
.st input[aria-invalid="true"], .st select[aria-invalid="true"] { box-shadow: inset 0 0 0 1.5px var(--red-ink); }
.st input:disabled, .st select:disabled { cursor: not-allowed; color: var(--ink-2); background: var(--sunken); box-shadow: inset 0 0 0 1px var(--line); }
.st-group { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; min-width: 0; }
.st-group h3 { font-size: 16px; }
.st-group + .st-group { padding-top: 18px; border-top: var(--hair) solid var(--line-strong); }

/* Scout limits: 1 row per limit, 1 column per platform, so the 2 read side by side. */
.st-mx { display: grid; grid-template-columns: minmax(0, 1fr); max-width: 640px; }
.st-mx-row { display: grid; grid-template-columns: minmax(0, 1fr) 96px 96px; align-items: center; gap: 12px; padding: 10px 0; border-top: var(--hair) solid var(--line-strong); }
.st-mx-top { padding: 0 0 8px; border-top: 0; font-size: 14px; font-weight: 500; color: var(--ink-2); }
.st-mx-top > span { display: inline-flex; align-items: center; justify-content: flex-end; gap: 6px; padding-right: 2px; white-space: nowrap; }
.st-mx-k { display: grid; gap: 1px; min-width: 0; }
.st-mx-name { font-weight: 500; }
.st-mx-help { font-size: 14px; color: var(--ink-3); }
.st-mx-cell { display: block; min-width: 0; }
.st-n { text-align: right; }
@container stcard (max-width: 460px) { .st-mx-row { grid-template-columns: minmax(0, 1fr) 72px 72px; gap: 8px; } }

/* Today's scout use, per platform. */
.st-today-wrap { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.st-today { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); gap: 12px; max-width: 900px; }
.st-plat { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; align-content: start; padding: 14px 16px; border-radius: var(--r-md); background: var(--sunken); }
.st-plat-h { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.st-plat-on { margin-left: auto; font-size: 14px; font-weight: 500; color: var(--ink-2); }
.st-plat.is-off .st-plat-on { color: var(--ink-3); }
.st-plat-n { font-size: 14px; color: var(--ink-2); }
.st-plat-n .num { font: 600 20px/1.2 var(--font); letter-spacing: -0.015em; color: var(--ink); font-variant-numeric: tabular-nums lining-nums; }
.st-plat .bar { height: 6px; background: var(--surface); }
.st-plat-meta { display: flex; align-items: flex-start; gap: 6px; font-size: 14px; color: var(--ink-2); }
.st-plat-meta.is-bad { color: var(--ink); }
.st-plat-meta.is-bad svg { margin-top: 2px; color: var(--amber-ink); }

/* ---------- Profile, schedule, feeds ---------- */
.st-pref { container: stcard / inline-size; scroll-margin-top: 76px; }
.st-pref-head { display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px; margin-bottom: 18px; }

.st-feeds { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 0 28px; margin-bottom: 18px; }
.st-feed { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px; min-width: 0; padding: 6px 0; border-bottom: var(--hair) solid var(--line-strong); }
.st-feed-id { min-width: 0; }
.st-feed-name { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st-feed-url { font-size: 14px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st-feed-add { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) auto; align-items: end; gap: 12px 14px; max-width: 900px; padding: 16px; border-radius: var(--r-md); background: var(--sunken); }
.st-feed-add-btn { padding-bottom: 2px; }
@container stcard (max-width: 640px) { .st-feed-add { grid-template-columns: minmax(0, 1fr); } .st-feed-add-btn { padding: 0; } }
.st-feeds-card .st-error { margin-top: 12px; }
.st-feeds-card .st-save { margin-top: 16px; }

/* ---------- Loading and failure ---------- */
.st-loading, .st-fail { max-width: 760px; }

/* ---------- Touch and narrow windows: 44px targets ---------- */
@media (pointer: coarse), (max-width: 960px) {
  .st-switch { min-height: 52px; }
  .st-mx-row input { min-height: 44px; }
  .st-list .out { min-height: 44px; }
}
@media (max-width: 720px) {
  .st-setup { padding: 18px 18px 8px; }
  .st-score-n { font-size: 28px; }
  .st-steps { margin: 0 -10px; }
  .st-step { padding: 12px 10px; }
  .st-fix { padding: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  .st-wait-track i { animation: none; transform: none; opacity: 0.4; }
}
