/* Shiur Reader app components (from docs/design/app.css). Uses only tokens from tokens.css,
   which base.html loads first. The additions for the live Service are at the end of the file. */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html {
  background: var(--color-paper);
  color: var(--color-text);
  font-family: var(--font-sans);
  font-feature-settings: var(--font-sans-features);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  color-scheme: light;
}
body { font-size: var(--text-base); line-height: var(--text-base-lh); min-height: 100dvh; }
@media (min-width: 40rem) { body { font-size: var(--text-sm); line-height: var(--text-sm-lh); } }
img, svg { display: block; max-width: 100%; }
a { color: var(--color-pine-700); text-decoration: underline; text-decoration-color: rgb(47 93 80 / 0.35); text-underline-offset: 3px; }
a:hover { text-decoration-color: currentColor; }
button, input, select, textarea { font: inherit; color: inherit; }
ul[role="list"], ol[role="list"] { list-style: none; }
:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }
.he { font-family: var(--font-hebrew); font-size: 1.125em; }
code, .mono { font-family: var(--font-mono); font-size: 0.8125rem; }

/* ---------- Top nav ---------- */
.nav { border-bottom: 1px solid var(--color-line); background: var(--color-paper); position: relative; z-index: 10; }
.nav__inner { max-width: var(--container-wide); margin: 0 auto; padding: 0 var(--gutter); height: var(--nav-height); display: flex; align-items: center; gap: var(--space-4); }
.wordmark { font-family: var(--font-display); font-size: 1.375rem; color: var(--color-ink); text-decoration: none; white-space: nowrap; }
.nav__sep { width: 1px; height: 1.25rem; background: var(--color-line-strong); }
.org-switch { display: inline-flex; align-items: center; gap: var(--space-2); min-width: 0; padding: var(--space-1) var(--space-2) var(--space-1) var(--space-1); border: 0; border-radius: var(--radius-md); background: transparent; cursor: pointer; font-weight: var(--weight-medium); color: var(--color-ink); }
.org-switch:hover { background: rgb(28 25 23 / 0.05); }
.org-switch__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 14rem; }
.org-mark { flex: none; display: grid; place-items: center; width: 1.5rem; height: 1.5rem; border-radius: var(--radius-sm); background: var(--color-pine-700); color: #fff; font-size: 0.75rem; font-weight: var(--weight-semibold); }
.org-mark--lg { width: 2.5rem; height: 2.5rem; font-size: 1rem; border-radius: var(--radius-md); }
.chev { width: 0.875rem; height: 0.875rem; flex: none; color: var(--color-subtle); }
.nav__links { display: flex; gap: var(--space-1); margin-left: var(--space-2); }
.nav__links a { padding: var(--space-1) var(--space-3); border-radius: var(--radius-md); color: var(--color-muted); text-decoration: none; font-size: var(--text-sm); white-space: nowrap; }
.nav__links a:hover { color: var(--color-ink); background: rgb(28 25 23 / 0.04); }
.nav__links a[aria-current="page"] { color: var(--color-ink); background: rgb(28 25 23 / 0.06); }
.nav__end { margin-left: auto; display: flex; align-items: center; gap: var(--space-2); }
.avatar { display: grid; place-items: center; width: 2rem; height: 2rem; border-radius: var(--radius-full); background: var(--color-paper-deep); color: var(--color-muted); font-size: 0.75rem; font-weight: var(--weight-semibold); box-shadow: var(--ring); }
.menu-btn { display: none; }
.mobile-menu { display: none; }
@media (max-width: 63.99rem) {
  .nav__links, .nav .avatar { display: none; }
  .menu-btn { display: grid; place-items: center; width: 2.75rem; height: 2.75rem; border: 0; background: none; border-radius: var(--radius-md); color: var(--color-ink); }
  .nav__sep { display: none; }
  .wordmark--app { display: none; }
  .mobile-menu[open] { display: block; }
}
.mobile-menu { border-top: 1px solid var(--color-line); padding: var(--space-2) var(--gutter) var(--space-4); background: var(--color-paper); }
.mobile-menu a { display: block; padding: var(--space-3) 0; color: var(--color-text); text-decoration: none; font-size: var(--text-base); }

/* ---------- Page shell ---------- */
.page { max-width: var(--container); margin: 0 auto; padding: var(--space-8) var(--gutter) var(--space-16); }
.page--narrow { max-width: calc(var(--container-narrow) + 2 * var(--gutter)); }
.page--wide { max-width: var(--container-wide); }
@media (min-width: 40rem) { .page { padding-top: var(--space-12); } }

.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--space-4) var(--space-6); margin-bottom: var(--space-8); }
.page-head__text { min-width: 0; flex: 1 1 20rem; }
.eyebrow { font-size: var(--text-sm); color: var(--color-muted); margin-bottom: var(--space-2); }
.eyebrow a { color: inherit; text-decoration: none; }
.eyebrow a:hover { color: var(--color-ink); }
h1, .h1 { font-family: var(--font-display); font-weight: var(--weight-normal); font-size: var(--text-3xl); line-height: var(--text-3xl-lh); letter-spacing: var(--tracking-tight); color: var(--color-ink); text-wrap: balance; }
h1.he { font-family: var(--font-hebrew); font-size: var(--text-3xl); letter-spacing: 0; }
h2, .h2 { font-size: var(--text-lg); line-height: var(--text-lg-lh); font-weight: var(--weight-semibold); color: var(--color-ink); text-wrap: balance; }
@media (min-width: 40rem) { h2, .h2 { font-size: var(--text-base); line-height: var(--text-base-lh); } }
.lede { margin-top: var(--space-2); color: var(--color-muted); max-width: 60ch; text-wrap: pretty; }
p { text-wrap: pretty; }
.muted { color: var(--color-muted); }
.subtle { color: var(--color-subtle); }
.stack > * + * { margin-top: var(--space-4); }
.stack-sm > * + * { margin-top: var(--space-2); }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); }

/* Settings-style section: heading+description left, controls right. Collapses to one column on phone. */
.section { display: grid; gap: var(--space-4) var(--space-10); padding: var(--space-8) 0; border-top: 1px solid var(--color-line); }
.section:first-of-type { border-top: 0; padding-top: 0; }
@media (min-width: 48rem) { .section { grid-template-columns: 2fr 5fr; } }
.section__desc { margin-top: var(--space-1); color: var(--color-muted); }
.section--danger h2 { color: var(--color-danger); }

/* ---------- Buttons (two sizes only: --control-h and --control-h-sm) ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2); height: var(--control-h); padding: 0 var(--space-3); border: 0; border-radius: var(--radius-md); font-size: var(--text-base); font-weight: var(--weight-medium); white-space: nowrap; text-decoration: none; cursor: pointer; transition: background var(--duration) var(--ease); }
@media (min-width: 40rem) { .btn { font-size: var(--text-sm); } }
.btn svg { width: 1rem; height: 1rem; flex: none; }
.btn--primary { background: var(--color-pine-700); color: #fff; box-shadow: var(--shadow-xs); }
.btn--primary:hover { background: var(--color-pine-800); }
.btn--secondary { background: var(--color-surface); color: var(--color-ink); box-shadow: 0 0 0 1px var(--color-line-strong), var(--shadow-xs); }
.btn--secondary:hover { background: var(--color-surface-hover); }
.btn--ghost { background: transparent; color: var(--color-ink); }
.btn--ghost:hover { background: rgb(28 25 23 / 0.05); }
.btn--danger { background: var(--color-surface); color: var(--color-danger); box-shadow: 0 0 0 1px var(--color-danger-line), var(--shadow-xs); }
.btn--danger:hover { background: var(--color-danger-soft); }
.btn--danger-solid { background: var(--color-danger); color: #fff; }  /* only inside a confirm dialog */
.btn--google { width: 100%; background: var(--color-surface); color: var(--color-ink); box-shadow: 0 0 0 1px var(--color-line-strong), var(--shadow-xs); }
.btn--sm { height: var(--control-h-sm); padding: 0 var(--space-3); font-size: var(--text-sm); border-radius: var(--radius-sm); }
.btn--block { width: 100%; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }

/* ---------- Forms ---------- */
.field + .field { margin-top: var(--space-6); }
.label { display: block; font-weight: var(--weight-medium); color: var(--color-ink); margin-bottom: var(--space-2); }
.hint { margin-top: var(--space-2); color: var(--color-subtle); font-size: var(--text-sm); }
.field-error { margin-top: var(--space-2); color: var(--color-danger); font-size: var(--text-sm); }
.input, .textarea, .select { display: block; width: 100%; height: var(--control-h); padding: 0 var(--space-3); border: 0; border-radius: var(--radius-md); background: var(--color-surface); box-shadow: 0 0 0 1px var(--color-line-strong), var(--shadow-xs); font-size: var(--text-base); color: var(--color-ink); }
@media (min-width: 40rem) { .input, .textarea, .select { font-size: var(--text-sm); } }
.input:focus, .textarea:focus { outline: 2px solid var(--color-focus); outline-offset: -1px; }
.input[aria-invalid="true"] { box-shadow: 0 0 0 1px var(--color-danger), var(--shadow-xs); }
.textarea { height: auto; padding: var(--space-3); line-height: 1.5; }
.input-row { display: flex; gap: var(--space-2); }
.input-row .input { flex: 1; min-width: 0; }

.check { display: flex; gap: var(--space-3); align-items: flex-start; }
.check input { flex: none; width: 1.25rem; height: 1.25rem; margin-top: 0.25rem; accent-color: var(--color-pine-700); }
@media (min-width: 40rem) { .check input { width: 1rem; height: 1rem; } }

/* Choice cards (Visibility, Role) — radio list in one bordered group */
.choices { border-radius: var(--radius-lg); background: var(--color-surface); box-shadow: 0 0 0 1px var(--color-line-strong); }
.choice { display: flex; gap: var(--space-3); padding: var(--space-4); cursor: pointer; }
.choice + .choice { border-top: 1px solid var(--color-line); }
.choice input { flex: none; width: 1.125rem; height: 1.125rem; margin-top: 0.3rem; accent-color: var(--color-pine-700); }
.choice:has(input:checked) { background: var(--color-pine-50); }
.choice:first-child { border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
.choice:last-child { border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.choice__title { font-weight: var(--weight-medium); color: var(--color-ink); display: flex; align-items: center; gap: var(--space-2); }
.choice__desc { color: var(--color-muted); }

/* File picker: a drop zone with a real <input type=file> inside the label */
.file { position: relative; display: flex; align-items: center; gap: var(--space-4); padding: var(--space-4); border-radius: var(--radius-lg); background: var(--color-surface); border: 1px dashed var(--color-line-strong); cursor: pointer; }
.file:hover { background: var(--color-surface-hover); border-color: var(--color-pine-600); }
.file input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.file__icon { flex: none; display: grid; place-items: center; width: 2.5rem; height: 2.5rem; border-radius: var(--radius-md); background: var(--color-paper-deep); color: var(--color-muted); }
.file__icon svg { width: 1.25rem; height: 1.25rem; }
.file__text { min-width: 0; flex: 1; }
.file__name, .file__meta { display: block; }
.file__name { font-weight: var(--weight-medium); color: var(--color-ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file__meta { color: var(--color-subtle); font-size: var(--text-sm); }
.file--chosen { border-style: solid; border-color: var(--color-line-strong); }
.file--chosen .file__icon { background: var(--color-pine-50); color: var(--color-pine-700); }
.file--error { border-style: solid; border-color: var(--color-danger); background: var(--color-danger-soft); }
.file--error .file__icon { background: #fff; color: var(--color-danger); }

/* ---------- Progress ---------- */
.progress { height: 0.5rem; border-radius: var(--radius-full); background: var(--color-paper-deep); overflow: hidden; }
.progress__bar { height: 100%; width: var(--value, 0%); background: var(--color-pine-700); border-radius: inherit; transition: width 300ms var(--ease); }
.progress--lg { height: 0.625rem; }
.progress-label { display: flex; justify-content: space-between; gap: var(--space-4); margin-bottom: var(--space-2); font-size: var(--text-sm); }
.progress-label strong { font-weight: var(--weight-medium); color: var(--color-ink); }

/* Build steps */
.steps { display: grid; gap: var(--space-3); margin-top: var(--space-6); }
.step { display: flex; align-items: center; gap: var(--space-3); color: var(--color-subtle); }
.step__dot { flex: none; display: grid; place-items: center; width: 1.25rem; height: 1.25rem; border-radius: var(--radius-full); box-shadow: inset 0 0 0 1.5px var(--color-line-strong); }
.step--done { color: var(--color-muted); }
.step--done .step__dot { background: var(--color-pine-700); box-shadow: none; color: #fff; }
.step--done .step__dot svg { width: 0.75rem; height: 0.75rem; }
.step--now { color: var(--color-ink); font-weight: var(--weight-medium); }
.step--now .step__dot { box-shadow: inset 0 0 0 1.5px var(--color-pine-700); }
.step--now .step__dot::after { content: ""; width: 0.5rem; height: 0.5rem; border-radius: 50%; background: var(--color-pine-700); }

/* ---------- Panels / cards ---------- */
.panel { background: var(--color-surface); border-radius: var(--radius-lg); box-shadow: 0 0 0 1px var(--color-line), var(--shadow-xs); padding: var(--space-6); }
.panel--well { background: var(--color-paper-deep); box-shadow: none; }
.card-auth { background: var(--color-surface); border-radius: var(--radius-xl); box-shadow: 0 0 0 1px var(--color-line), var(--shadow-lg); padding: var(--space-8) var(--space-6); }
@media (min-width: 40rem) { .card-auth { padding: var(--space-10); } }

/* ---------- Stats (divider-separated, no icons, no cards) ---------- */
.stats { container-type: inline-size; }
.stats__grid { display: grid; grid-template-columns: 1fr 1fr; }
.stat { padding: var(--space-4) var(--space-4) var(--space-4) 0; }
.stat:nth-child(2n) { padding-left: var(--space-4); border-left: 1px solid var(--color-line); }
.stat:nth-child(n+3) { border-top: 1px solid var(--color-line); }
@container (min-width: 36rem) {
  .stats__grid { grid-template-columns: repeat(4, 1fr); }
  .stat { padding: 0 var(--space-6); border-left: 1px solid var(--color-line); border-top: 0 !important; }
  .stat:first-child { padding-left: 0; border-left: 0; }
  .stat:last-child { padding-right: 0; }
}
.stat__label { font-size: var(--text-sm); color: var(--color-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat__value { margin-top: var(--space-1); font-size: var(--text-2xl); line-height: var(--text-2xl-lh); font-weight: var(--weight-medium); color: var(--color-ink); font-variant-numeric: tabular-nums; letter-spacing: var(--tracking-tight); }
.stat__value small { font-size: var(--text-sm); font-weight: var(--weight-normal); color: var(--color-subtle); letter-spacing: 0; }

/* ---------- Tables (directly on the canvas, row dividers only) ---------- */
.table-wrap { margin: calc(-1 * var(--space-2)) calc(-1 * var(--gutter)); overflow-x: auto; }
.table-wrap__inner { display: inline-block; min-width: 100%; padding: var(--space-2) var(--gutter); vertical-align: middle; }
.table { width: 100%; border-collapse: collapse; text-align: left; }
.table th { padding: 0 var(--space-3) var(--space-3); font-size: var(--text-sm); font-weight: var(--weight-medium); color: var(--color-muted); white-space: nowrap; border-bottom: 1px solid var(--color-line-strong); }
.table td { padding: var(--space-4) var(--space-3); border-bottom: 1px solid var(--color-line); vertical-align: middle; }
.table th:first-child, .table td:first-child { padding-left: 0; }
.table th:last-child, .table td:last-child { padding-right: 0; }
.table .r { text-align: right; }
.table tbody tr:hover { background: rgb(28 25 23 / 0.02); }
.table__title { font-weight: var(--weight-medium); color: var(--color-ink); text-decoration: none; }
.table__title:hover { color: var(--color-pine-700); }
.table--compact td { padding-top: var(--space-2); padding-bottom: var(--space-2); }
.table--compact { font-size: var(--text-sm); }

/* Phone: the Reader list becomes a stacked list instead of a scrolling table */
@media (max-width: 39.99rem) {
  .table--stack thead { display: none; }
  .table--stack, .table--stack tbody, .table--stack tr { display: block; }
  .table--stack tr { padding: var(--space-4) 0; border-bottom: 1px solid var(--color-line); }
  .table--stack td { display: inline; padding: 0; border: 0; color: var(--color-muted); font-size: var(--text-sm); }
  .table--stack td:first-child { display: block; margin-bottom: var(--space-1); color: var(--color-ink); font-size: var(--text-base); }
  .table--stack td + td:not(:nth-child(2))::before { content: " · "; color: var(--color-subtle); }
  .table--stack td.stack-hide { display: none; }
  .table--stack td.plays::after { content: " Plays"; }
}

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: var(--space-1); height: 1.375rem; padding: 0 var(--space-2); border-radius: var(--radius-sm); font-size: 0.8125rem; font-weight: var(--weight-medium); white-space: nowrap; background: rgb(28 25 23 / 0.06); color: var(--color-muted); }
.badge svg { width: 0.75rem; height: 0.75rem; }
.badge--icon { padding-left: var(--space-1); }
.badge--public { background: var(--color-pine-50); color: var(--color-pine-700); box-shadow: inset 0 0 0 1px rgb(47 93 80 / 0.15); }
.badge--restricted { background: var(--color-paper-deep); color: var(--color-text); box-shadow: inset 0 0 0 1px var(--color-line); }
.badge--ready { background: var(--color-pine-50); color: var(--color-pine-700); }
.badge--building { background: var(--color-gold-100); color: var(--color-gold-800); }
.badge--waiting { background: var(--color-gold-100); color: var(--color-warn); }
.badge--failed { background: var(--color-danger-soft); color: var(--color-danger); }
.badge--dot::before { content: ""; width: 0.375rem; height: 0.375rem; border-radius: 50%; background: currentColor; }

/* ---------- Alerts ---------- */
.alert { display: flex; gap: var(--space-3); padding: var(--space-4); border-radius: var(--radius-lg); background: var(--color-surface); box-shadow: inset 0 0 0 1px var(--color-line); }
.alert svg { flex: none; width: 1.25rem; height: 1.25rem; margin-top: 0.1875rem; }
.alert__title { font-weight: var(--weight-semibold); color: var(--color-ink); }
.alert__body { color: var(--color-text); }
.alert__actions { margin-top: var(--space-3); display: flex; flex-wrap: wrap; gap: var(--space-3); }
.alert--danger { background: var(--color-danger-soft); box-shadow: inset 0 0 0 1px var(--color-danger-line); }
.alert--danger svg { color: var(--color-danger); }
.alert--danger .alert__title { color: var(--color-danger); }
.alert--warn { background: var(--color-warn-soft); box-shadow: inset 0 0 0 1px var(--color-warn-line); }
.alert--warn svg { color: var(--color-warn); }
.alert--info { background: var(--color-pine-50); box-shadow: inset 0 0 0 1px rgb(47 93 80 / 0.15); }
.alert--info svg { color: var(--color-pine-700); }

/* ---------- Code / Embed Code ---------- */
.code { position: relative; border-radius: var(--radius-lg); background: var(--color-paper-deep); padding: var(--space-4); padding-right: 6rem; font-family: var(--font-mono); font-size: 0.8125rem; line-height: 1.6; color: var(--color-ink); word-break: break-all; }
.code .btn { position: absolute; top: var(--space-3); right: var(--space-3); }

/* ---------- Description list ---------- */
.dl { display: grid; grid-template-columns: auto 1fr; gap: var(--space-2) var(--space-6); }
.dl dt { color: var(--color-muted); }
.dl dd { color: var(--color-ink); font-variant-numeric: tabular-nums; }

/* ---------- Empty state ---------- */
.empty { text-align: center; padding: var(--space-16) var(--space-6); border-radius: var(--radius-xl); border: 1px dashed var(--color-line-strong); }
.empty__title { font-family: var(--font-display); font-size: var(--text-2xl); color: var(--color-ink); }
.empty p { margin: var(--space-2) auto var(--space-6); max-width: 40ch; color: var(--color-muted); }

/* ---------- Usage meter ---------- */
.meter-legend { display: flex; justify-content: space-between; margin-top: var(--space-2); font-size: var(--text-sm); color: var(--color-muted); font-variant-numeric: tabular-nums; }

/* ---------- Member / key list ---------- */
.list > li { display: flex; align-items: center; gap: var(--space-4); padding: var(--space-4) 0; border-bottom: 1px solid var(--color-line); }
.list > li:first-child { padding-top: 0; }
.list__main { flex: 1; min-width: 0; }
.list__title { font-weight: var(--weight-medium); color: var(--color-ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list__meta { font-size: var(--text-sm); color: var(--color-subtle); }
.list__actions { display: flex; align-items: center; gap: var(--space-2); flex: none; }
@media (max-width: 39.99rem) {
  .list > li { flex-wrap: wrap; }
  .list__actions { width: 100%; }
}

/* ---------- Auth layout ---------- */
.auth { min-height: 100dvh; display: grid; place-items: center; padding: var(--space-8) var(--gutter); }
.auth__box { width: 100%; max-width: 25rem; }
.auth__brand { text-align: center; margin-bottom: var(--space-8); }
.auth h1 { text-align: center; font-size: var(--text-3xl); }
.auth .lede { text-align: center; margin-left: auto; margin-right: auto; }
.divider-text { display: flex; align-items: center; gap: var(--space-3); margin: var(--space-6) 0; color: var(--color-subtle); font-size: var(--text-sm); }
.divider-text::before, .divider-text::after { content: ""; flex: 1; height: 1px; background: var(--color-line); }
.auth__foot { margin-top: var(--space-6); text-align: center; font-size: var(--text-sm); color: var(--color-subtle); }

/* ---------- Footer ---------- */
.foot { max-width: var(--container-wide); margin: 0 auto; padding: var(--space-6) var(--gutter) var(--space-10); display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-6); font-size: var(--text-sm); color: var(--color-subtle); border-top: 1px solid var(--color-line); }
.foot a { color: inherit; text-decoration: none; }

/* Phone: input + action rows wrap so the input gets the full width */
@media (max-width: 39.99rem) {
  .input-row { flex-wrap: wrap; }
  .input-row .input { flex-basis: 100%; }
  .input-row .select { flex: 1; }
}

/* =====================================================================
   Additions for the live Service (templates in service/templates/)
   ===================================================================== */

[hidden] { display: none !important; }
body { display: flex; flex-direction: column; }
body > main, .page { flex: 1 0 auto; width: 100%; }
::selection { background: var(--color-gold-200); color: var(--color-ink); }
.skip-link { position: absolute; left: var(--space-4); top: -4rem; z-index: 50; padding: var(--space-2) var(--space-3); border-radius: var(--radius-md); background: var(--color-ink); color: #fff; text-decoration: none; }
.skip-link:focus { top: var(--space-3); }
h1 { overflow-wrap: anywhere; }
h1.he, .h1.he { font-size: calc(var(--text-3xl) * 1.06); line-height: 1.3; }
.he { line-height: 1.4; }
.mono { font-family: var(--font-mono); }
.input.mono { font-size: 0.8125rem; }
@media (max-width: 39.99rem) { .input.mono { font-size: var(--text-base); } }
code { padding: 0.0625rem 0.3125rem; border-radius: var(--radius-sm); background: rgb(28 25 23 / 0.06); color: var(--color-ink); overflow-wrap: anywhere; }
pre { margin: 0; overflow-x: auto; }
pre code { padding: 0; background: none; }
.mt-2 { margin-top: var(--space-2); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mt-8 { margin-top: var(--space-8); }
.mb-6 { margin-bottom: var(--space-6); }
.mb-8 { margin-bottom: var(--space-8); }
.icon { width: 1rem; height: 1rem; flex: none; }

/* ---------- Nav: the menus are <details>, so they work without JavaScript ---------- */
.nav__inner { position: relative; }
.org-static { display: inline-flex; align-items: center; gap: var(--space-2); min-width: 0; padding: var(--space-1) var(--space-2) var(--space-1) var(--space-1); font-weight: var(--weight-medium); color: var(--color-ink); }
.org-mark { overflow: hidden; }
.org-mark--logo { background: #fff; box-shadow: var(--ring); }
.org-mark--logo img { width: 100%; height: 100%; object-fit: contain; }
.menu { position: relative; min-width: 0; }
.menu > summary { list-style: none; }
.menu > summary::-webkit-details-marker, .nav-mobile > summary::-webkit-details-marker { display: none; }
.nav-mobile > summary { list-style: none; }
.menu[open] > summary .chev { transform: rotate(180deg); }
.menu__panel { position: absolute; z-index: 30; top: calc(100% + var(--space-2)); left: 0; min-width: 16rem; max-width: min(22rem, calc(100vw - 2 * var(--gutter))); padding: var(--space-2); border-radius: var(--radius-lg); background: var(--color-surface); box-shadow: 0 0 0 1px var(--color-line), var(--shadow-lg); animation: menu-in 120ms var(--ease); }
.menu__panel--end { left: auto; right: 0; }
@keyframes menu-in { from { opacity: 0; transform: translateY(-4px); } }
.menu__label { padding: var(--space-2) var(--space-3) var(--space-1); font-size: var(--text-sm); color: var(--color-subtle); }
.menu__list { list-style: none; }
.menu__item { position: relative; display: flex; align-items: center; gap: var(--space-3); width: 100%; min-height: 2.75rem; padding: var(--space-2) var(--space-3); border: 0; border-radius: var(--radius-md); background: none; color: var(--color-ink); text-align: left; text-decoration: none; cursor: pointer; }
@media (min-width: 40rem) { .menu__item { min-height: 2.5rem; } }
.menu__item:hover { background: rgb(28 25 23 / 0.05); }
.menu__item form { flex: 1; min-width: 0; }
.menu__item form button { width: 100%; border: 0; background: none; padding: 0; text-align: left; font-weight: var(--weight-medium); color: var(--color-ink); cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu__item form button::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius-md); }
.menu__item form button:focus-visible { outline: none; }
.menu__item:has(button:focus-visible) { outline: 2px solid var(--color-focus); outline-offset: -2px; }
.menu__item--current { background: var(--color-pine-50); }
.menu__item--current:hover { background: var(--color-pine-50); }
.menu__item .check-icon { margin-left: auto; color: var(--color-pine-700); }
.menu__item-name { flex: 1; min-width: 0; font-weight: var(--weight-medium); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu__sep { height: 1px; margin: var(--space-2) 0; background: var(--color-line); }
.menu__email { padding: var(--space-2) var(--space-3); color: var(--color-muted); font-size: var(--text-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu__panel form .btn { width: 100%; justify-content: flex-start; }
summary.avatar { cursor: pointer; list-style: none; }
summary.avatar::-webkit-details-marker { display: none; }
summary.avatar:hover { background: var(--color-pine-50); color: var(--color-pine-700); }
.nav__end .menu__panel { top: calc(100% + var(--space-3)); }

.nav-mobile { display: none; }
@media (max-width: 63.99rem) {
  .nav-mobile { display: block; margin-left: auto; }
  .nav-mobile > summary { display: grid; place-items: center; width: 2.75rem; height: 2.75rem; margin-right: calc(-1 * var(--space-2)); border-radius: var(--radius-md); color: var(--color-ink); cursor: pointer; }
  .nav-mobile > summary:hover { background: rgb(28 25 23 / 0.05); }
  .nav-mobile > summary svg { width: 1.5rem; height: 1.5rem; }
  .nav-mobile .icon-close { display: none; }
  .nav-mobile[open] .icon-close { display: block; }
  .nav-mobile[open] .icon-open { display: none; }
  .nav-mobile__panel { position: absolute; z-index: 30; left: 0; right: 0; top: 100%; padding: var(--space-2) var(--gutter) var(--space-6); background: var(--color-paper); border-bottom: 1px solid var(--color-line); box-shadow: 0 16px 24px -16px rgb(28 25 23 / 0.18); animation: menu-in 120ms var(--ease); }
  .nav-mobile__panel a { display: flex; align-items: center; min-height: 2.75rem; padding: 0 var(--space-3); margin: 0 calc(-1 * var(--space-3)); border-radius: var(--radius-md); color: var(--color-text); text-decoration: none; font-size: var(--text-base); }
  .nav-mobile__panel a:hover { background: rgb(28 25 23 / 0.04); }
  .nav-mobile__panel a[aria-current="page"] { background: rgb(28 25 23 / 0.06); color: var(--color-ink); }
  .nav-mobile__foot { margin-top: var(--space-3); padding-top: var(--space-3); border-top: 1px solid var(--color-line); }
  .nav-mobile__foot .menu__email { padding: var(--space-2) 0; }
  .nav__account { display: none; }
}
.nav--simple .wordmark--app { display: inline; }

/* ---------- Buttons: pressed, busy and confirmed states ---------- */
.btn { position: relative; transition: background var(--duration) var(--ease), transform 80ms var(--ease), box-shadow var(--duration) var(--ease); -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
.btn:active:not([disabled]):not([aria-busy="true"]) { transform: translateY(1px); }
.btn--primary:active:not([disabled]) { background: var(--color-pine-800); box-shadow: none; }
.btn--secondary:active:not([disabled]), .btn--danger:active:not([disabled]) { box-shadow: 0 0 0 1px var(--color-line-strong); }
.btn--danger-solid:hover { background: #82241a; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.btn[aria-busy="true"] { cursor: progress; opacity: 1; color: transparent; }
.btn[aria-busy="true"] > * { visibility: hidden; }
.btn[aria-busy="true"]::after { content: ""; position: absolute; inset: 0; margin: auto; width: 1rem; height: 1rem; border-radius: 50%; border: 2px solid var(--spinner, var(--color-ink)); border-right-color: transparent; animation: spin 0.7s linear infinite; }
.btn--primary[aria-busy="true"], .btn--danger-solid[aria-busy="true"] { --spinner: #fff; }
.btn--danger[aria-busy="true"] { --spinner: var(--color-danger); }
@keyframes spin { to { transform: rotate(360deg); } }
.btn.is-done { color: var(--color-pine-700); background: var(--color-pine-50); box-shadow: 0 0 0 1px rgb(47 93 80 / 0.3), var(--shadow-xs); }
.btn--link { height: auto; padding: 0; background: none; color: var(--color-pine-700); }
.btn--link:hover { text-decoration: underline; text-underline-offset: 3px; }

/* The small inline actions still get a 44px target on touch screens. */
@media (pointer: coarse) {
  .btn--sm::before { content: ""; position: absolute; left: 50%; top: 50%; width: max(100%, 2.75rem); height: max(100%, 2.75rem); transform: translate(-50%, -50%); }
}

/* ---------- Forms ---------- */
.form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); margin-top: var(--space-6); }
.input::placeholder, .textarea::placeholder { color: var(--color-subtle); opacity: 0.8; }
.textarea { min-height: 6rem; resize: vertical; }
.textarea:focus { outline: 2px solid var(--color-focus); outline-offset: -1px; }
.select { appearance: none; -webkit-appearance: none; width: auto; padding-right: var(--space-8); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%2378716c' stroke-width='1.5'%3E%3Cpath d='M5 6.5 8 9.5l3-3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 0.625rem center; background-size: 1rem; cursor: pointer; }
.select:focus { outline: 2px solid var(--color-focus); outline-offset: -1px; }
.fieldset { border: 0; min-width: 0; }
.check { cursor: pointer; }
.check input:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 2px; }
.choice__title, .choice__desc { display: block; }
.choice:hover:not(:has(input:checked)) { background: var(--color-surface-hover); }
.choice:has(input:focus-visible) { position: relative; z-index: 1; outline: 2px solid var(--color-focus); outline-offset: -2px; }
.choice input:focus-visible { outline: none; }
.choice__title { display: flex; }

/* File picker: with JavaScript the label is a drop zone; without it the native input shows. */
.file__cta { flex: none; }
.no-js .file { cursor: default; }
.no-js .file input { position: static; opacity: 1; width: 100%; cursor: pointer; }
.no-js .file .file__icon, .no-js .file .file__text, .no-js .file .file__cta { display: none; }
.file.is-dragging { border-color: var(--color-pine-700); background: var(--color-pine-50); }
.file:has(input:focus-visible) { outline: 2px solid var(--color-focus); outline-offset: 2px; }
.file__meta .skeleton { display: inline-block; vertical-align: -0.0625rem; width: 5rem; height: 0.625rem; margin: 0; }
.file--error .field-error { margin: 0; }
@media (max-width: 39.99rem) { .file { padding: var(--space-3); } .file__cta { display: none; } }

/* ---------- Progress (<progress> elements and .progress divs look the same) ---------- */
progress.progress { -webkit-appearance: none; appearance: none; display: block; width: 100%; height: 0.625rem; border: 0; border-radius: var(--radius-full); background: var(--color-paper-deep); color: var(--color-pine-700); overflow: hidden; }
progress.progress::-webkit-progress-bar { background: var(--color-paper-deep); border-radius: var(--radius-full); }
progress.progress::-webkit-progress-value { background: var(--color-pine-700); border-radius: var(--radius-full); transition: width 300ms var(--ease); }
progress.progress::-moz-progress-bar { background: var(--color-pine-700); border-radius: var(--radius-full); }
progress.progress:indeterminate, .progress.is-indeterminate { background: var(--color-paper-deep) linear-gradient(90deg, transparent, rgb(47 93 80 / 0.45), transparent) no-repeat; background-size: 40% 100%; animation: progress-slide 1.3s var(--ease) infinite; }
progress.progress:indeterminate::-webkit-progress-bar { background: transparent; }
progress.progress:indeterminate::-moz-progress-bar { background: transparent; }
@keyframes progress-slide { from { background-position: -60% 0; } to { background-position: 160% 0; } }
.progress-label { align-items: baseline; }
.progress-label > :first-child { min-width: 0; }
.progress-label .num { flex: none; }
.progress-label .skeleton { display: inline-block; width: 6rem; height: 0.75rem; vertical-align: -0.0625rem; }

/* Build steps: the step in progress pulses softly */
.step--now .step__dot::after { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(0.6); opacity: 0.6; } }
.step--failed { color: var(--color-danger); font-weight: var(--weight-medium); }
.step--failed .step__dot { background: var(--color-danger); box-shadow: none; color: #fff; }
.step__dot svg { width: 0.75rem; height: 0.75rem; }

/* Panels */
.panel__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-2) var(--space-4); margin-bottom: var(--space-4); }
.panel__title { font-weight: var(--weight-semibold); color: var(--color-ink); }
.panel > * + .hint, .panel > * + p { margin-top: var(--space-3); }
@media (max-width: 39.99rem) { .panel { padding: var(--space-5) var(--space-4); } }

/* ---------- Skeletons (loading placeholders) ---------- */
.skeleton { position: relative; display: block; overflow: hidden; border-radius: var(--radius-sm); background: var(--color-paper-deep); color: transparent; user-select: none; }
.skeleton::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, rgb(255 253 248 / 0.8), transparent); animation: shimmer 1.4s ease-in-out infinite; }
@keyframes shimmer { to { transform: translateX(100%); } }
.skeleton--line { height: 0.75rem; margin: 0.375rem 0; width: var(--w, 100%); }
.skeleton--dot { width: 1.25rem; height: 1.25rem; border-radius: 50%; flex: none; }
.skeleton--bar { height: 0.625rem; border-radius: var(--radius-full); }
.skeleton-steps { display: grid; gap: var(--space-3); margin-top: var(--space-6); }
.skeleton-steps > div { display: flex; align-items: center; gap: var(--space-3); }
.skeleton-steps .skeleton--line { margin: 0; }
/* The Build panel until its first status answer arrives: the numbers are stale, the bar shimmers. */
.js .is-syncing .progress { background-image: linear-gradient(90deg, transparent, rgb(255 253 248 / 0.85), transparent); background-repeat: no-repeat; background-size: 40% 100%; animation: progress-slide 1.3s var(--ease) infinite; }
.js .is-syncing .progress-label .num { opacity: 0.6; }

/* ---------- Page head, sections ---------- */
.page-head__actions { display: flex; flex-wrap: wrap; gap: var(--space-3); }
.meta-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1) var(--space-3); margin-top: var(--space-3); color: var(--color-muted); }
.meta-row .sep { color: var(--color-subtle); }
.section > div { min-width: 0; }
.section__body > * + * { margin-top: var(--space-4); }
.section__body > .hint { margin-top: var(--space-2); }
@media (max-width: 39.99rem) { .page-head { margin-bottom: var(--space-6); } .section { padding: var(--space-6) 0; } }

/* ---------- Copyable code, Embed Code ---------- */
.code-block { position: relative; }
.code-block .textarea, .code-block pre { display: block; width: 100%; min-height: 0; padding: var(--space-4); padding-right: 6.5rem; border: 0; border-radius: var(--radius-lg); background: var(--color-paper-deep); box-shadow: none; font-family: var(--font-mono); font-size: 0.8125rem; line-height: 1.6; color: var(--color-ink); resize: none; overflow-wrap: anywhere; white-space: pre-wrap; }
.code-block pre { padding-right: var(--space-4); white-space: pre; overflow-x: auto; }
.code-block .textarea:focus { outline: 2px solid var(--color-focus); outline-offset: 0; }
.code-block > .btn { position: absolute; top: var(--space-3); right: var(--space-3); }
@media (max-width: 39.99rem) {
  .code-block .textarea { padding-right: var(--space-4); padding-bottom: 3.5rem; }
  .code-block > .btn { top: auto; bottom: var(--space-3); }
}
.secret { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-3); }
.secret > code { flex: 1 1 16rem; min-width: 0; display: block; padding: var(--space-2) var(--space-3); border-radius: var(--radius-md); background: var(--color-surface); box-shadow: 0 0 0 1px var(--color-line-strong); font-size: 0.8125rem; line-height: 1.25rem; word-break: break-all; }

/* ---------- Alerts ---------- */
.alert > div { min-width: 0; flex: 1; }
.alert p + p { margin-top: var(--space-1); }
.alert--warn .alert__title { color: var(--color-warn); }
.alert--info .alert__title { color: var(--color-pine-800); }
.alert--danger a { color: var(--color-danger); text-decoration-color: rgb(155 44 31 / 0.4); }
.alert--warn a:not(.btn) { color: var(--color-warn); text-decoration-color: rgb(122 84 16 / 0.4); }
.alert .btn svg { width: 1rem; height: 1rem; margin: 0; color: currentColor; }
.alerts:empty { display: none; }
.alerts > * + * { margin-top: var(--space-3); }

/* ---------- Badges ---------- */
.badge--owner { background: var(--color-pine-50); color: var(--color-pine-700); }

/* ---------- Tables and lists ---------- */
.table__title.he { font-size: 1.0625rem; }
.table td.num { white-space: nowrap; }
.table .plays { color: var(--color-muted); white-space: nowrap; }
@media (max-width: 39.99rem) {
  .table--stack td:first-child a { display: block; }
  .table--stack td { line-height: 1.75rem; }
}
.list > li { min-height: 3.5rem; }
.list__title code { font-weight: var(--weight-normal); }
.list .avatar { flex: none; }
.list form { display: inline-flex; }
.list--keys > li:first-child { padding-top: var(--space-4); }
.list--keys { border-top: 1px solid var(--color-line); }
.is-revoked .list__title { color: var(--color-subtle); }

/* ---------- Auth and message pages ---------- */
.auth { flex: 1 0 auto; }
.auth .wordmark { font-size: 1.625rem; }
.auth__box--wide { max-width: 28rem; }
.auth__box--message { max-width: 30rem; }
.card-auth form { margin-top: var(--space-6); }
.card-auth .alert { margin-top: var(--space-6); text-align: left; }
.message { text-align: center; }
.message__icon { display: grid; place-items: center; width: 3rem; height: 3rem; margin: 0 auto var(--space-6); border-radius: var(--radius-full); background: var(--color-pine-50); color: var(--color-pine-700); }
.message__icon svg { width: 1.5rem; height: 1.5rem; }
.message__icon--warn { background: var(--color-gold-100); color: var(--color-warn); }
.message__icon--danger { background: var(--color-danger-soft); color: var(--color-danger); }
.message__actions { margin-top: var(--space-8); display: flex; flex-wrap: wrap; justify-content: center; gap: var(--space-3); }
.message .org-mark--lg { margin: 0 auto var(--space-6); }
.message .org-logo { display: block; max-height: 3.5rem; max-width: 10rem; width: auto; margin: 0 auto var(--space-6); object-fit: contain; }
.made-with { margin-top: var(--space-10); font-size: var(--text-sm); color: var(--color-subtle); }
.made-with a { color: inherit; }

/* ---------- Confirm dialog ---------- */
.dialog { width: min(28rem, calc(100vw - 2rem)); margin: auto; padding: var(--space-6); border: 0; border-radius: var(--radius-xl); background: var(--color-surface); color: var(--color-text); box-shadow: 0 0 0 1px var(--color-line), var(--shadow-lg); }
.dialog::backdrop { background: rgb(28 25 23 / 0.35); }
.dialog[open] { animation: dialog-in 160ms var(--ease); }
@keyframes dialog-in { from { opacity: 0; transform: translateY(6px) scale(0.98); } }
.dialog__title { font-size: var(--text-lg); line-height: var(--text-lg-lh); font-weight: var(--weight-semibold); color: var(--color-ink); }
.dialog__body { margin-top: var(--space-2); color: var(--color-muted); }
.dialog__actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--space-3); margin-top: var(--space-6); }
@media (max-width: 39.99rem) { .dialog__actions { flex-direction: column-reverse; } .dialog__actions .btn { width: 100%; } }

/* ---------- Toast: "Copied" ---------- */
.toast { position: fixed; z-index: 60; left: 50%; bottom: var(--space-6); transform: translate(-50%, 0.75rem); padding: var(--space-2) var(--space-4); border-radius: var(--radius-full); background: var(--color-ink); color: #fff; font-size: var(--text-sm); opacity: 0; pointer-events: none; transition: opacity 160ms var(--ease), transform 160ms var(--ease); }
.toast.is-shown { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Operator (wide, dense tables) ---------- */
.table--compact td.num, .table--compact th.r { text-align: right; }
.table--compact td { vertical-align: middle; }
.table--compact .inline { display: flex; flex-wrap: nowrap; align-items: center; gap: var(--space-2); }
.table--compact .inline .input { height: var(--control-h-sm); width: 5rem; padding: 0 var(--space-2); }
.table--compact .inline .input--wide { width: 9rem; }
.table--compact td.plan-status, .table--compact td.status { font-weight: var(--weight-medium); white-space: nowrap; }
.table--compact td.status[data-status="failed"], .table--compact td.plan-status[data-status*="past"], .table--compact td.plan-status[data-status*="offline"] { color: var(--color-danger); }
.table--compact td.status[data-status="done"], .table--compact td.plan-status[data-status="plan"], .table--compact td.plan-status[data-status="active"] { color: var(--color-pine-700); }
.table--compact td.status[data-status="waiting"], .table--compact td.status[data-status="running"], .table--compact td.status[data-status="queued"] { color: var(--color-gold-800); }
.table--compact td.reason { color: var(--color-muted); white-space: normal; min-width: 16rem; }
.refunded { color: var(--color-subtle); }
.section-title { margin: var(--space-12) 0 var(--space-4); }

/* ---------- Motion preferences: no shimmer, no slides ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .skeleton::after { display: none; }
  progress.progress:indeterminate, .progress.is-indeterminate, .js .is-syncing .progress { background-image: none; }
  .btn[aria-busy="true"]::after { border-right-color: var(--spinner, var(--color-ink)); border-style: dotted; }
}

@media print { .nav, .foot, .btn, .skip-link { display: none !important; } }

/* ---------- Page-specific pieces ---------- */
.section--full { display: block; }
.input-row--short { max-width: 20rem; }
.input-row--medium { max-width: 32rem; }
.alert h2.alert__title { font-size: inherit; line-height: inherit; }
.code-block .textarea { field-sizing: content; }
.progress--full .progress__bar { background: var(--color-warn); }
.prose > * + * { margin-top: var(--space-4); }
.prose p { max-width: 70ch; }

/* Organization: logo, status line, the list of your Organizations */
.org-mark--xl { width: 4rem; height: 4rem; font-size: 1.375rem; border-radius: var(--radius-lg); }
img.logo { display: block; height: 4rem; width: auto; max-width: 10rem; object-fit: contain; border-radius: var(--radius-md); background: #fff; box-shadow: var(--ring); padding: var(--space-1); }
.logo-row { display: flex; align-items: center; gap: var(--space-4); }
.logo-row .file { flex: 1; min-width: 0; }
.status-line { display: flex; align-items: center; gap: var(--space-2); font-weight: var(--weight-medium); color: var(--color-ink); }
.status-line::before { content: ""; width: 0.5rem; height: 0.5rem; border-radius: 50%; background: var(--color-subtle); }
.status-line[data-on="true"]::before { background: var(--color-pine-700); }
.org-list > li { position: relative; }
.org-list form button { padding: 0; border: 0; background: none; font-weight: var(--weight-medium); color: var(--color-ink); cursor: pointer; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.org-list > li:not(.is-current) form button::after { content: ""; position: absolute; inset: 0; }
.org-list > li:not(.is-current):hover { background: rgb(28 25 23 / 0.02); }
.org-list > li:not(.is-current) .list__meta { color: var(--color-pine-700); font-weight: var(--weight-medium); }
.org-list > li.is-current form button { cursor: default; }
.org-list form button:focus-visible { outline: none; }
.org-list > li:has(button:focus-visible) { outline: 2px solid var(--color-focus); outline-offset: 2px; border-radius: var(--radius-md); }

/* Files: icon tile in list rows */
.list > li > .file__icon { width: 2.25rem; height: 2.25rem; }

.panel--message { padding: var(--space-12) var(--space-6); }

/* ---------- Fixes after the screenshot review ---------- */
.foot { width: 100%; }
.page-head h1[dir="auto"] { text-align: left; }
@media (max-width: 39.99rem) {
  .table--stack td.r { display: block; margin-top: var(--space-1); text-align: left; }
  .table--stack td.r::before { content: none !important; }
  .code-block .textarea { font-size: var(--text-base); }
}
.table--compact td.date, .table--compact td.name { white-space: nowrap; font-variant-numeric: tabular-nums; }
@media (max-width: 39.99rem) { .list > li > .avatar ~ .list__actions, .list > li > .file__icon ~ .list__actions { padding-left: calc(2rem + var(--space-4)); } .list > li:last-child { border-bottom: 0; } }
.table--compact td.stages { font-size: 0.8125rem; color: var(--color-muted); font-variant-numeric: tabular-nums; min-width: 12rem; }
.table--compact .inline .input { width: 4rem; } .table--compact .inline .input--wide { width: 6.5rem; }

/* ---------- Brand: the lockup in the nav, the mark on phones ---------- */
.wordmark { display: inline-flex; align-items: center; flex: none; border-radius: var(--radius-sm); }
.wordmark:focus-visible { outline: 2px solid var(--color-pine-700); outline-offset: 4px; }
.wordmark__lockup { display: block; height: 1.75rem; width: auto; }
.wordmark__lockup--lg { height: 2.25rem; }
.wordmark__mark { display: none; height: 1.75rem; width: auto; }
@media (max-width: 63.99rem) {
  .wordmark--app, .nav--simple .wordmark--app { display: inline-flex; }
  .wordmark--app .wordmark__lockup { display: none; }
  .wordmark--app .wordmark__mark { display: block; }
}

/* An Organization's logo keeps its shape: fixed height, width follows the aspect ratio up to a limit. */
.org-mark--logo { width: auto; min-width: 1.5rem; max-width: 4.5rem; padding: 0.125rem; }
.org-mark--logo img { display: block; height: 100%; width: auto; max-width: 100%; object-fit: contain; }
.org-mark--lg.org-mark--logo { min-width: 2.5rem; max-width: 7.5rem; }
.org-mark--xl.org-mark--logo { min-width: 4rem; max-width: 12rem; }
.menu__item .org-mark--logo { max-width: 3.5rem; }

/* The Reader page's "Matched:" line; a mismatch reads as a warning. */
.meta-row--warn { color: var(--color-warn); }
.meta-row--warn a { color: inherit; font-weight: var(--weight-medium); }

/* ---------- Upload in three steps (upload.html, upload.js) ----------
   Without JavaScript the steps stack as one form. With it (.wizard--live) only the current step shows. */
.page-head--tight { margin-bottom: var(--space-6); }
.wizard__step + .wizard__step { margin-top: var(--space-10); padding-top: var(--space-8); border-top: 1px solid var(--color-line); }
.wizard__title { display: flex; flex-direction: column; gap: var(--space-1); font-size: var(--text-lg); line-height: var(--text-lg-lh); scroll-margin-top: var(--space-6); }
.wizard__title:focus { outline: none; }
.wizard__title:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 4px; border-radius: var(--radius-sm); }
.wizard__count { font-size: var(--text-sm); font-weight: var(--weight-medium); color: var(--color-subtle); }
.wizard__lede { margin-top: var(--space-2); color: var(--color-muted); text-wrap: pretty; }
.wizard__step > .field { margin-top: var(--space-6); }
.wizard__nav { display: flex; flex-wrap: wrap; gap: var(--space-3); margin-top: var(--space-8); }
.wizard__nav .wizard__next, .wizard__nav .wizard__build { margin-left: auto; }
.btn .icon { width: 1rem; height: 1rem; }
.wizard-progress { display: none; }

.wizard--live .wizard__step { display: none; }
.wizard--live .wizard__step.is-current { display: block; }
.wizard--live .wizard__step + .wizard__step { margin-top: 0; padding-top: 0; border-top: 0; }
.wizard--live .wizard__count { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* The step indicator: 1 Files · 2 Title · 3 Build */
.wizard--live .wizard-progress { display: flex; align-items: center; gap: var(--space-2); margin-bottom: var(--space-8); font-size: var(--text-sm); color: var(--color-subtle); }
.wizard-progress__step { display: flex; align-items: center; gap: var(--space-2); white-space: nowrap; }
.wizard-progress__step + .wizard-progress__step::before { content: ""; width: clamp(1rem, 6vw, 3rem); height: 1px; margin-right: var(--space-1); background: var(--color-line-strong); }
.wizard-progress__num { display: grid; place-items: center; width: 1.5rem; height: 1.5rem; border-radius: var(--radius-full); box-shadow: inset 0 0 0 1px var(--color-line-strong); font-size: 0.75rem; font-weight: var(--weight-semibold); font-variant-numeric: tabular-nums; }
.wizard-progress__step[aria-current="step"] { color: var(--color-ink); font-weight: var(--weight-medium); }
.wizard-progress__step[aria-current="step"] .wizard-progress__num { background: var(--color-pine-700); color: #fff; box-shadow: none; }
.wizard-progress__step.is-done { color: var(--color-muted); }
.wizard-progress__step.is-done .wizard-progress__num { background: var(--color-pine-50); color: var(--color-pine-700); box-shadow: inset 0 0 0 1px rgb(47 93 80 / 0.2); }

/* "What PDF do I need?" */
.disclosure { margin-top: var(--space-3); }
.disclosure > summary { display: inline-flex; align-items: center; gap: var(--space-2); min-height: 2.75rem; color: var(--color-pine-700); font-weight: var(--weight-medium); cursor: pointer; list-style: none; border-radius: var(--radius-sm); }
.disclosure > summary::-webkit-details-marker { display: none; }
.disclosure > summary .icon { width: 1.125rem; height: 1.125rem; }
.disclosure > summary:hover { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: rgb(47 93 80 / 0.35); }
.disclosure__body { display: grid; gap: var(--space-2); margin-bottom: var(--space-2); padding: var(--space-4); border-radius: var(--radius-lg); background: var(--color-paper-deep); color: var(--color-text); text-wrap: pretty; }
.disclosure__body strong { font-weight: var(--weight-semibold); color: var(--color-ink); }
@media (min-width: 40rem) { .disclosure > summary { min-height: 2.25rem; } }

/* The one drop zone for both files */
.dropzone { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--space-1); margin-top: var(--space-4); padding: var(--space-10) var(--space-6); border: 1.5px dashed var(--color-line-strong); border-radius: var(--radius-lg); background: var(--color-surface); text-align: center; cursor: pointer; transition: background var(--duration) var(--ease), border-color var(--duration) var(--ease); }
.dropzone:hover { background: var(--color-surface-hover); border-color: var(--color-pine-600); }
.dropzone.is-dragging { border-color: var(--color-pine-700); background: var(--color-pine-50); }
.dropzone:has(input:focus-visible) { outline: 2px solid var(--color-focus); outline-offset: 2px; }
.dropzone input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.dropzone__icon { display: grid; place-items: center; width: 3rem; height: 3rem; margin-bottom: var(--space-2); border-radius: var(--radius-full); background: var(--color-pine-50); color: var(--color-pine-700); }
.dropzone__icon svg { width: 1.5rem; height: 1.5rem; }
.dropzone__title { font-weight: var(--weight-semibold); color: var(--color-ink); }
.dropzone__hint { color: var(--color-subtle); font-size: var(--text-sm); }
.dropzone--compact { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: var(--space-3); row-gap: 0; align-items: center; padding: var(--space-3) var(--space-4); text-align: left; }
.dropzone--compact .dropzone__icon { grid-row: span 2; width: 2.5rem; height: 2.5rem; margin: 0; }
.dropzone--compact .dropzone__icon svg { width: 1.25rem; height: 1.25rem; }
@media (max-width: 39.99rem) { .dropzone:not(.dropzone--compact) { padding: var(--space-8) var(--space-4); } }

/* A chosen file: what it is, its size, and Replace / Remove */
.file-cards { display: grid; gap: var(--space-3); margin-top: var(--space-4); }
.file-cards:empty { display: none; }
.file-card { display: flex; align-items: center; gap: var(--space-3); min-width: 0; padding: var(--space-3) var(--space-3) var(--space-3) var(--space-4); border-radius: var(--radius-lg); background: var(--color-surface); box-shadow: 0 0 0 1px var(--color-line-strong), var(--shadow-xs); }
.file-card__icon { flex: none; display: grid; place-items: center; width: 2.5rem; height: 2.5rem; border-radius: var(--radius-md); background: var(--color-pine-50); color: var(--color-pine-700); }
.file-card__icon svg { width: 1.25rem; height: 1.25rem; }
.file-card__text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.file-card__kind { font-size: 0.75rem; line-height: 1rem; font-weight: var(--weight-semibold); letter-spacing: 0.02em; text-transform: uppercase; color: var(--color-subtle); }
.file-card__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: var(--weight-medium); color: var(--color-ink); }
.file-card__meta { color: var(--color-muted); font-size: var(--text-sm); }
.file-card__meta .skeleton { display: inline-block; vertical-align: -0.0625rem; width: 4rem; height: 0.625rem; }
.file-card__actions { flex: none; display: flex; align-items: center; gap: var(--space-1); }
.file-card--error { background: var(--color-danger-soft); box-shadow: 0 0 0 1px var(--color-danger-line); }
.file-card--error .file-card__icon { background: #fff; color: var(--color-danger); }
.btn--icon { width: var(--control-h-sm); padding: 0; }
.btn--icon .icon { width: 1.125rem; height: 1.125rem; }
/* Small buttons keep a 44px tap target on touch screens. */
@media (max-width: 39.99rem) { .file-card__actions .btn::before, .review__change::before { content: ""; position: absolute; left: 50%; top: 50%; width: max(100%, 2.75rem); height: max(100%, 2.75rem); transform: translate(-50%, -50%); } }

.checking { display: flex; align-items: center; gap: var(--space-2); margin-top: var(--space-3); color: var(--color-muted); font-size: var(--text-sm); }
.spinner { width: 1rem; height: 1rem; flex: none; border-radius: 50%; border: 2px solid var(--color-pine-700); border-right-color: transparent; animation: spin 0.7s linear infinite; }
#files-errors:not(:empty) { margin-top: var(--space-4); }

/* One picker per file: the form without JavaScript; with it, two small fallback buttons. */
.pickers { margin-top: var(--space-6); }
.wizard--live .pickers { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); margin-top: var(--space-4); }
.wizard--live .pickers__label { flex-basis: 100%; color: var(--color-subtle); font-size: var(--text-sm); }
.wizard--live .picker, .wizard--live .field + .field.picker { margin: 0; }
.wizard--live .picker > .label, .wizard--live .picker > .hint { display: none; }
.wizard--live .picker .file { display: inline-flex; align-items: center; height: var(--control-h-sm); padding: 0 var(--space-3); border: 0; border-radius: var(--radius-sm); background: var(--color-surface); box-shadow: 0 0 0 1px var(--color-line-strong), var(--shadow-xs); font-size: var(--text-sm); font-weight: var(--weight-medium); color: var(--color-ink); }
.wizard--live .picker .file:hover { background: var(--color-surface-hover); }
.wizard--live .picker .file > :not(input):not(.picker__button) { display: none; }
.picker__button { display: none; }
.wizard--live .picker__button { display: inline; white-space: nowrap; }
@media (max-width: 39.99rem) { .wizard--live .picker .file { height: 2.75rem; } }

/* Step 3: review */
.review { margin-top: var(--space-6); border-top: 1px solid var(--color-line); }
.review__row { display: grid; grid-template-columns: 6.5rem minmax(0, 1fr); gap: 0 var(--space-4); padding: var(--space-3) 0; border-bottom: 1px solid var(--color-line); align-items: center; }
.review__row dt { color: var(--color-muted); }
.review__row dd { display: flex; align-items: center; gap: var(--space-2); min-width: 0; }
.review__value { flex: 1; min-width: 0; color: var(--color-ink); font-weight: var(--weight-medium); overflow-wrap: anywhere; }
.review__change { flex: none; margin-right: calc(-1 * var(--space-3)); }
@media (max-width: 39.99rem) { .review__row { grid-template-columns: minmax(0, 1fr); } .review__row dt { font-size: var(--text-sm); } }
.hours-line { margin-top: var(--space-6); }
.hours-line__uses { color: var(--color-ink); font-weight: var(--weight-medium); }
#hours { color: var(--color-muted); }
#build-errors:empty { display: none; }
@media (max-width: 39.99rem) {
  .wizard__nav { flex-wrap: nowrap; }
  .wizard__nav .wizard__next, .wizard__nav .wizard__build { flex: 1; }
  .wizard__nav--build { flex-direction: column-reverse; }
  .wizard__nav--build .btn { width: 100%; margin-left: 0; flex: none; }
}
.is-uploading .wizard__back, .is-uploading .review__change { visibility: hidden; }

/* ---------- Upload page: the way to bulk upload ---------- */
.bulk-link { margin: calc(-1 * var(--space-4)) 0 var(--space-6); color: var(--color-muted); font-size: var(--text-sm); }
.bulk-link a { font-weight: var(--weight-medium); }
