/* Reset, type, buttons, chips, cards and the shared states. Phone first: every control is at least 44px.
   Motion is only ever declared inside `prefers-reduced-motion: no-preference` (end of each file), so reduced
   motion needs no overrides. */
*, *::before, *::after { box-sizing: border-box; }
:root:root [hidden] { display: none; }   /* beats any one component's display */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html, body { max-width: 100%; overflow-x: hidden; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 16px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent-text); }
h1, h2, h3, p { margin: 0; }
ul, ol { margin: 0; padding: 0; }
bdi, .wrap { overflow-wrap: anywhere; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.icon { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.9;
  stroke-linecap: round; stroke-linejoin: round; }
[dir="rtl"] .icon--flip, [dir="rtl"] .setlink__chev, [dir="rtl"] .backlink .icon { transform: scaleX(-1); }

.skip-link { position: fixed; inset-inline-start: 8px; top: -80px; z-index: 50; background: var(--card); color: var(--ink);
  padding: 10px 14px; border-radius: var(--r-sm); box-shadow: var(--shadow); min-height: var(--tap); }
.skip-link:focus { top: 8px; }

.page-title { font-size: 22px; font-weight: 750; line-height: 1.3; }
.section-title { font-size: 19px; font-weight: 700; margin: 4px 0 14px; }
.section-title:focus, .sheet__title:focus { outline: none; }

/* ---------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tap); padding: 10px 18px; border-radius: var(--r-sm);
  border: 1px solid transparent; background: var(--soft); color: var(--ink);
  font-weight: 650; font-size: 16px; line-height: 1.25; cursor: pointer; text-decoration: none;
}
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn--primary { background: var(--accent); color: var(--accent-ink); }
.btn--soft { background: var(--accent-soft); color: var(--accent-text); }
.btn--quiet { background: transparent; border-color: var(--line); color: var(--ink); }
.btn--danger { background: var(--hot); color: var(--hot-ink); }
.btn--danger-quiet { background: transparent; border-color: var(--hot-soft); color: var(--hot-text); }
.btn--small { min-height: var(--tap); padding: 8px 14px; font-size: 15px; }
.btn--block { width: 100%; }
.btn[aria-busy="true"] { cursor: progress; }
@media (hover: hover) {
  .btn--primary:hover { box-shadow: inset 0 0 0 100px var(--press); }
  .btn--quiet:hover, .btn--soft:hover { box-shadow: inset 0 0 0 100px var(--press-soft); }
}
.iconbtn { display: inline-grid; place-items: center; width: var(--tap); height: var(--tap); border-radius: 50%;
  border: 0; background: var(--soft); color: var(--ink); cursor: pointer; flex: none; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }

/* ---------------------------------------------------------------- chips, badges, notes */
.chip { display: inline-flex; align-items: center; gap: 4px; min-height: 26px; padding: 2px 10px; border-radius: 99px;
  font-size: 13px; font-weight: 650; background: var(--soft); color: var(--muted-text); white-space: nowrap; }
.chip--ok { background: var(--ok-soft); color: var(--ok-text); }
.chip--warn { background: var(--warn-soft); color: var(--warn-text); }
.chip--bad { background: var(--hot-soft); color: var(--hot-text); }
.chip--info { background: var(--info-soft); color: var(--info-text); }
.chip--muted { background: var(--muted-soft); color: var(--muted-text); }
.badge { display: inline-block; padding: 2px 10px; border-radius: 99px; font-size: 13px; font-weight: 650; }
.badge--muted { background: var(--warn-soft); color: var(--warn-text); }
.note { padding: 10px 14px; border-radius: var(--r-sm); font-size: 15px; }
.note--warn { background: var(--warn-soft); color: var(--warn-text); }
.note--info { background: var(--info-soft); color: var(--info-text); }
.note--bad { background: var(--hot-soft); color: var(--hot-text); }
.note--ok { background: var(--ok-soft); color: var(--ok-text); }
.note--muted { background: var(--muted-soft); color: var(--muted-text); }

.card { background: var(--card); border-radius: var(--r); padding: var(--pad); box-shadow: var(--shadow); min-width: 0; }
.card + .card { margin-top: var(--gap); }

/* ---------------------------------------------------------------- states */
.state { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; padding: 28px 16px;
  color: var(--muted); }
.state--loading { flex-direction: row; justify-content: center; }
.state--empty { font-size: 15px; padding: 22px 12px; }
.state--error { background: var(--hot-soft); color: var(--hot-text); border-radius: var(--r); margin: 12px 0; }
.state__title { font-weight: 700; }
.spinner { width: 20px; height: 20px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--accent); }
.pending { display: grid; gap: 10px; }
.pending .badge { justify-self: start; }
.pending__what { font-size: 16px; font-weight: 600; }
.facts { padding-inline-start: 20px; display: grid; gap: 6px; }
.center { max-width: 520px; margin: 40px auto; padding: 0 16px; }

/* ---------------------------------------------------------------- toast */
.toasts { position: fixed; inset-inline: 12px; bottom: calc(var(--bar) + 12px + env(safe-area-inset-bottom)); z-index: 60;
  display: grid; justify-items: center; pointer-events: none; }
.toast { max-width: 520px; background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: var(--r);
  font-weight: 600; box-shadow: var(--shadow); text-align: center; }
.toast--bad { background: var(--hot); color: var(--hot-ink); }
@media (min-width: 768px) { .toasts { bottom: 24px; } }

@media (prefers-reduced-motion: no-preference) {
  .btn { transition: background-color .15s, box-shadow .15s; }
  .spinner { animation: spin .8s linear infinite; }
  @keyframes spin { to { transform: rotate(360deg); } }
}
.toast--warn { background: var(--warn-soft); color: var(--warn-text); }
