/* Renovierungshelfer (next) — components.
 *
 * The whole visual language in one file. A screen's markup only combines
 * these; it never styles a one-off. Rules of the language:
 *
 *   • Read first. Values are text in rows; editing happens in a sheet.
 *   • One surface: grouped rows on a quiet ground. Borders, fills and shadows
 *     are spent by role — only board cards, sheets, the FAB and toasts float.
 *   • Amounts are ink with tabular figures. Colour only marks a deviation
 *     (overdue, over budget) or a lifecycle status (dot + word).
 *   • Every control is at least 44 px on its short side.
 */

/* ---------------------------------------------------------------- base --- */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--fs-md);
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
}

[hidden] { display: none !important; }

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent-ink); text-decoration: none; } /* every link is a styled component */

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.icon { width: 18px; height: 18px; flex: none; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

.num { font-variant-numeric: tabular-nums; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

/* -------------------------------------------------------------- screen --- */

.screen {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top, 0px) + var(--sp-3)) var(--gutter)
    calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px) + 88px);
  display: flex;
  flex-direction: column;
  gap: var(--sp-5);
}

.screen--no-tabbar {
  padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 96px);
}

.stack { display: flex; flex-direction: column; gap: var(--sp-2); }

/* ---------------------------------------------------------- page head --- */

.page-head { display: flex; flex-direction: column; gap: var(--sp-2); }

.page-head__bar {
  display: flex; align-items: center; justify-content: space-between;
  min-height: var(--touch); gap: var(--sp-2);
  color: var(--ink-2); font-size: var(--fs-sm);
}

.page-head__context {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.back-link {
  display: inline-flex; align-items: center; gap: 2px;
  min-height: var(--touch); margin-left: -8px; padding: 0 8px 0 2px;
  border: 0; background: none; color: var(--accent-ink);
  font-size: var(--fs-md); font-weight: 500; text-decoration: none;
}

.page-head__title {
  margin: 0;
  font-size: var(--fs-2xl); font-weight: 700; letter-spacing: -0.02em; line-height: 1.1;
  text-wrap: balance;
}

.page-head__title--sm { font-size: var(--fs-xl); }

.page-head__kicker { margin: 0; color: var(--ink-2); font-size: var(--fs-sm); }

/* ------------------------------------------------------- section head --- */

.section { display: flex; flex-direction: column; gap: var(--sp-2); }

.section__head {
  display: flex; align-items: baseline; justify-content: space-between; gap: var(--sp-2);
  padding: 0 var(--sp-1);
  color: var(--ink-2); font-size: var(--fs-sm); font-weight: 600;
}

.section__link {
  display: inline-flex; align-items: center; justify-content: flex-end; min-height: var(--touch); min-width: var(--touch); margin: -12px 0;
  border: 0; background: none; padding: 0;
  color: var(--accent-ink); font-size: var(--fs-sm); font-weight: 500;
}

/* --------------------------------------------------------- group + row --- */

.group {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
}

.row {
  display: flex; align-items: center; gap: var(--sp-3);
  width: 100%; min-height: 52px;
  padding: var(--sp-2) var(--sp-4);
  border: 0; background: none; color: inherit; text-align: left; text-decoration: none;
}

.row + .row { border-top: 1px solid var(--line); }

button.row:active, a.row:active { background: var(--surface-sunken); }

.row__main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }

.row__title {
  font-weight: 600; font-size: var(--fs-md);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.row__title--wrap { white-space: normal; }

.row__sub {
  color: var(--ink-2); font-size: var(--fs-sm);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.row__label { color: var(--ink-2); font-size: var(--fs-xs); }

.row__value { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }

.row__value--muted { color: var(--ink-3); font-weight: 500; }

.row__chevron { color: var(--ink-3); width: 16px; height: 16px; flex: none; }

.row__icon {
  width: 34px; height: 34px; border-radius: 10px; flex: none;
  display: grid; place-items: center;
  background: var(--accent-wash); color: var(--accent-ink);
}

.row__icon--offers { background: var(--info-wash); color: var(--status-offers); }
.row__icon--warn { background: var(--warning-wash); color: var(--warning); }
.row__icon--danger { background: var(--danger-wash); color: var(--danger); }

.row--danger .row__title { color: var(--danger); }

.tone-danger { color: var(--danger); }
.tone-warning { color: var(--warning); }
.tone-success { color: var(--success); }
.tone-muted { color: var(--ink-3); }

/* ------------------------------------------------------------ buttons --- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  min-height: var(--touch); padding: 0 var(--sp-4);
  border: 0; border-radius: var(--r-md);
  background: var(--surface-sunken); color: var(--ink);
  font-weight: 600; font-size: var(--fs-md); text-decoration: none;
  transition: transform 120ms var(--ease), opacity 120ms;
}

.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.45; pointer-events: none; }

.btn--primary { background: var(--primary-bg); color: var(--primary-ink); }
.btn--accent { background: var(--accent); color: #fff; }
.btn--danger { background: var(--danger-wash); color: var(--danger); }
.btn--plain { background: none; color: var(--accent-ink); padding: 0 var(--sp-2); }
.btn--block { width: 100%; }

.icon-btn {
  width: var(--touch); height: var(--touch); flex: none;
  display: grid; place-items: center;
  border: 0; border-radius: 50%; background: none; color: var(--ink-2);
}

.icon-btn--soft { background: var(--accent-wash); color: var(--accent-ink); }
.icon-btn--soft .icon { width: 17px; height: 17px; }

.cta-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: flex; gap: var(--sp-2);
  padding: var(--sp-3) var(--gutter) calc(env(safe-area-inset-bottom, 0px) + var(--sp-3));
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.cta-bar > .btn--primary { flex: 1; }

@media (min-width: 48rem) {
  .cta-bar { left: 50%; right: auto; width: min(var(--content-max), 100%); transform: translateX(-50%); border-radius: var(--r-lg) var(--r-lg) 0 0; }
}

/* ----------------------------------------------------- chips + segment --- */

.seg {
  display: flex; padding: 3px; gap: 2px;
  background: var(--surface-sunken); border-radius: var(--r-md);
}

.seg__btn {
  flex: 1; min-height: var(--touch); border: 0; border-radius: 9px;
  background: none; color: var(--ink-2); font-weight: 500; font-size: var(--fs-sm);
}

.seg__btn[aria-pressed="true"] {
  background: var(--surface-raised); color: var(--ink);
  box-shadow: var(--shadow-card);
}

.chips {
  display: flex; gap: var(--sp-2);
  overflow-x: auto; scrollbar-width: none;
  margin: 0 calc(-1 * var(--gutter)); padding: 0 var(--gutter);
  scroll-snap-type: x proximity;
}

.chips::-webkit-scrollbar { display: none; }

.chip {
  display: inline-flex; align-items: center; gap: 6px; flex: none;
  min-height: var(--touch); padding: 0 var(--sp-3);
  border: 0; border-radius: var(--r-pill);
  background: var(--surface-sunken); color: var(--ink-2);
  font-size: var(--fs-sm); font-weight: 500; white-space: nowrap;
  scroll-snap-align: start;
}

/* Wrapping variant for pickers inside sheets: every option stays visible. */
.chips--wrap {
  flex-wrap: wrap; overflow: visible;
  margin: 0; padding: 0;
}

.chips--wrap .chip { white-space: normal; text-align: start; padding-block: var(--sp-2); }

.chip b { font-weight: 700; font-variant-numeric: tabular-nums; }

.chip[aria-pressed="true"] { background: var(--primary-bg); color: var(--primary-ink); }

.status {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--ink-2); font-size: var(--fs-sm); font-weight: 500; white-space: nowrap;
}

.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--ink-3); }
.dot--idea { background: var(--status-idea); }
.dot--offers { background: var(--status-offers); }
.dot--planned { background: var(--status-planned); }
.dot--work { background: var(--status-work); }
.dot--done { background: var(--status-done); }

/* -------------------------------------------------------------- money --- */

.money { display: flex; flex-direction: column; gap: var(--sp-2); }

.money--link { padding-block: var(--sp-2); color: inherit; text-decoration: none; }

.money__big {
  font-size: 2.25rem; font-weight: 700; letter-spacing: -0.025em; line-height: 1;
  font-variant-numeric: tabular-nums;
}

.money__big small { font-size: var(--fs-sm); font-weight: 500; letter-spacing: 0; color: var(--ink-2); margin-left: 6px; }

.bar {
  display: flex; height: 8px; overflow: hidden;
  border-radius: var(--r-pill); background: var(--surface-sunken);
}

.bar__seg { height: 100%; }
.bar__seg--paid { background: var(--accent); }
.bar__seg--open { background: var(--accent-soft); }
.bar__seg--buffer {
  background: repeating-linear-gradient(135deg, var(--accent-soft) 0 3px, transparent 3px 6px);
}
.bar__seg--over { background: var(--danger); }

.legend {
  display: flex; flex-wrap: wrap; gap: var(--sp-1) var(--sp-4);
  color: var(--ink-2); font-size: var(--fs-xs); font-variant-numeric: tabular-nums;
}

.legend span { display: inline-flex; align-items: center; gap: 6px; }

.trio {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px; overflow: hidden;
  background: var(--line); border: 1px solid var(--line); border-radius: var(--r-md);
}

.trio__cell {
  display: flex; flex-direction: column; gap: 2px; min-width: 0;
  padding: var(--sp-2) var(--sp-3);
  border: 0; background: var(--surface); text-align: left;
}

button.trio__cell:active { background: var(--surface-sunken); }

.trio__label { color: var(--ink-2); font-size: var(--fs-xs); }

.trio__value {
  font-size: var(--fs-lg); font-weight: 700; letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ------------------------------------------------------------ stepper --- */

.stepper {
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px;
  width: 100%; min-height: var(--touch); padding: var(--sp-2) 0; border: 0; background: none; text-align: left;
  align-items: center;
}

.stepper__step {
  display: flex; flex-direction: column; gap: 6px; min-width: 0;
  color: var(--ink-3); font-size: 0.6875rem; font-weight: 500;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.stepper__step::before {
  content: ''; display: block; height: 4px; border-radius: 3px; background: var(--line);
}

.stepper__step--past::before { background: var(--accent); }
.stepper__step--now { color: var(--ink); font-weight: 600; }
.stepper__step--now::before { background: var(--step-color, var(--accent)); }

/* -------------------------------------------------------------- board --- */

.board {
  display: flex; gap: var(--sp-3);
  margin: 0 calc(-1 * var(--gutter)); padding: 0 var(--gutter) var(--sp-2);
  overflow-x: auto; scroll-snap-type: x mandatory; scroll-padding: 0 var(--gutter);
  scrollbar-width: none; overscroll-behavior-x: contain;
}

.board::-webkit-scrollbar { display: none; }

.board-col {
  flex: 0 0 min(84vw, 20rem);
  scroll-snap-align: start;
  display: flex; flex-direction: column; gap: var(--sp-2);
  padding: var(--sp-3);
  background: var(--surface-sunken); border-radius: var(--r-lg);
  align-self: flex-start;
}

.board-col__head {
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2);
  padding: var(--sp-1) var(--sp-1) var(--sp-1);
  font-size: var(--fs-sm); font-weight: 600;
}

.board-col__head span { display: inline-flex; align-items: center; gap: var(--sp-2); }

.board-col__sum { color: var(--ink-2); font-weight: 500; font-variant-numeric: tabular-nums; }

.board-col__empty {
  padding: var(--sp-4) var(--sp-2); color: var(--ink-3); font-size: var(--fs-sm); text-align: center;
}

@media (min-width: 60rem) {
  .board { overflow-x: auto; }
  .board-col { flex-basis: 17rem; }
}

.card {
  display: flex; flex-direction: column; gap: 6px;
  width: 100%; padding: var(--sp-3);
  border: 0; border-radius: var(--r-md);
  background: var(--surface-raised); color: inherit; text-align: left; text-decoration: none;
  box-shadow: var(--shadow-card);
}

.card:active { transform: scale(0.99); }

.card__title { font-weight: 600; font-size: var(--fs-md); line-height: 1.25; }

.card__hint { font-size: var(--fs-sm); font-weight: 500; color: var(--status-offers); }
.card__hint--muted { color: var(--ink-2); }
.card__hint--work { color: var(--warning); }

.card__meta {
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2);
  color: var(--ink-2); font-size: var(--fs-sm);
}

.card__meta > span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.card__amount { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }

.card--tentative { background: transparent; box-shadow: inset 0 0 0 1px var(--line-strong); }

/* ------------------------------------------------------- task check --- */

.check {
  width: var(--touch); height: var(--touch); margin: -8px -6px -8px -10px; flex: none;
  display: grid; place-items: center; border: 0; background: none;
}

.check__box {
  width: 22px; height: 22px; border-radius: 7px;
  border: 1.75px solid var(--line-strong);
  display: grid; place-items: center; color: transparent;
  transition: background 150ms, border-color 150ms;
}

.check[aria-checked="true"] .check__box { background: var(--accent); border-color: var(--accent); color: #fff; }
.check__box .icon { width: 14px; height: 14px; stroke-width: 3; }

.row--done .row__title { color: var(--ink-3); text-decoration: line-through; }

/* ------------------------------------------------------ tabbar + fab --- */

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(4, 1fr);
  padding: 6px 6px calc(env(safe-area-inset-bottom, 0px) + 6px);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.tabbar__tab {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: 52px; border-radius: var(--r-md);
  color: var(--ink-3); font-size: 0.6875rem; font-weight: 500; text-decoration: none;
}

.tabbar__tab .icon { width: 22px; height: 22px; }
.tabbar__tab[aria-current="page"] { color: var(--accent-ink); }

.fab {
  position: fixed; z-index: 31;
  right: max(var(--gutter), calc((100vw - var(--content-max)) / 2 + var(--gutter)));
  bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px) + var(--sp-4));
  width: 56px; height: 56px; border: 0; border-radius: 18px;
  display: grid; place-items: center;
  background: var(--primary-bg); color: var(--primary-ink);
  box-shadow: var(--shadow-float);
}

.fab .icon { width: 24px; height: 24px; stroke-width: 2.2; }

@media (min-width: 60rem) {
  .tabbar { left: 50%; right: auto; width: 30rem; transform: translateX(-50%); bottom: var(--sp-3); border: 1px solid var(--line); border-radius: var(--r-xl); padding-bottom: 6px; box-shadow: var(--shadow-float); }
}

/* -------------------------------------------------------------- sheet --- */

.sheet-host { position: fixed; inset: 0; z-index: 50; }

.sheet-scrim {
  position: absolute; inset: 0; background: var(--scrim);
  animation: fade-in 180ms var(--ease);
}

.sheet {
  position: absolute; left: 0; right: 0; bottom: 0;
  max-height: calc(100dvh - env(safe-area-inset-top, 0px) - 24px);
  display: flex; flex-direction: column;
  background: var(--surface); border-radius: var(--r-xl) var(--r-xl) 0 0;
  box-shadow: var(--shadow-float);
  animation: sheet-in 240ms var(--ease);
}

@media (min-width: 48rem) {
  .sheet { left: 50%; right: auto; bottom: auto; top: 50%; width: min(30rem, calc(100vw - 2rem)); transform: translate(-50%, -50%); border-radius: var(--r-xl); animation: fade-in 180ms var(--ease); }
}

.sheet__grab { width: 36px; height: 5px; border-radius: 3px; background: var(--line-strong); margin: 8px auto 0; flex: none; }

.sheet__head {
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-2) var(--sp-2) var(--gutter); flex: none;
}

.sheet__title { margin: 0; font-size: var(--fs-lg); font-weight: 700; }

.sheet__body {
  flex: 1; overflow-y: auto; overscroll-behavior: contain;
  display: flex; flex-direction: column; gap: var(--sp-4);
  padding: var(--sp-1) var(--gutter) calc(env(safe-area-inset-bottom, 0px) + var(--sp-5));
}

.sheet__foot {
  display: flex; gap: var(--sp-2); flex: none;
  padding: var(--sp-3) var(--gutter) calc(env(safe-area-inset-bottom, 0px) + var(--sp-3));
  border-top: 1px solid var(--line);
}

.sheet__foot > .btn { flex: 1; }

@keyframes sheet-in { from { transform: translateY(100%); } to { transform: none; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

/* -------------------------------------------------------------- field --- */

.field { display: flex; flex-direction: column; gap: 6px; }

.field__label { color: var(--ink-2); font-size: var(--fs-sm); font-weight: 600; }

.field__wrap {
  display: flex; align-items: center; gap: var(--sp-2);
  min-height: 48px; padding: 0 var(--sp-3);
  background: var(--surface-sunken); border: 1.5px solid transparent; border-radius: var(--r-md);
}

.field__wrap:focus-within { border-color: var(--accent); background: var(--surface); }

.field__control {
  flex: 1; min-width: 0; min-height: 44px;
  border: 0; outline: 0; background: none;
  font-size: var(--fs-base);
}

.field__control--amount { font-size: var(--fs-xl); font-weight: 700; font-variant-numeric: tabular-nums; }

textarea.field__control { min-height: 96px; padding: var(--sp-3) 0; resize: vertical; line-height: 1.45; }

.field__unit { color: var(--ink-2); font-weight: 500; }

.field__hint { color: var(--ink-2); font-size: var(--fs-sm); }

.options { display: flex; flex-direction: column; }

.option {
  display: flex; align-items: center; gap: var(--sp-3);
  min-height: 52px; padding: 0 var(--sp-1);
  border: 0; border-bottom: 1px solid var(--line); background: none; text-align: left;
}

.option:last-child { border-bottom: 0; }

.option__check { margin-left: auto; color: var(--accent-ink); }
.option[aria-checked="false"] .option__check { visibility: hidden; }

/* ----------------------------------------------------- banner + toast --- */

.banners {
  position: sticky; top: 0; z-index: 40;
  display: flex; flex-direction: column; gap: 1px;
  padding-top: env(safe-area-inset-top, 0px);
}

.banner {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2) var(--sp-3);
  padding: var(--sp-3) var(--gutter);
  background: var(--warning-wash); color: var(--ink);
  font-size: var(--fs-sm); font-weight: 500;
}

.banner p { margin: 0; flex: 1 1 14rem; }
.banner--danger { background: var(--danger-wash); }
.banner--info { background: var(--info-wash); }


.toast {
  position: fixed; left: 50%; z-index: 60;
  bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px) + 88px);
  transform: translateX(-50%);
  max-width: calc(100vw - 2 * var(--gutter));
  padding: var(--sp-3) var(--sp-4); border-radius: var(--r-md);
  background: var(--primary-bg); color: var(--primary-ink);
  font-size: var(--fs-sm); font-weight: 500; box-shadow: var(--shadow-float);
  animation: fade-in 160ms var(--ease);
  pointer-events: none; /* a message must never swallow a tap on what is under it */
}

/* ---------------------------------------------------- empty + lock --- */

.empty {
  display: flex; flex-direction: column; align-items: center; gap: var(--sp-3);
  padding: var(--sp-8) var(--sp-4); text-align: center; color: var(--ink-2);
}

.empty__title { margin: 0; color: var(--ink); font-size: var(--fs-lg); font-weight: 700; }
.empty p { margin: 0; max-width: 28rem; }

.note {
  margin: 0; padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-md); background: var(--surface-sunken);
  color: var(--ink-2); font-size: var(--fs-sm);
}

/* The editing lock (offline, no session, outdated build). Controls that
   change data carry [data-edit]; everything else stays usable. */
.is-readonly [data-edit] { opacity: 0.45; pointer-events: none; }

/* ------------------------------------------------------------- switch --- */

.row--toggle { cursor: pointer; }
.row__sub--wrap { white-space: normal; }

.switch { position: relative; flex: none; width: 52px; height: var(--touch); display: grid; place-items: center; }

.switch__input {
  position: absolute; inset: 0; width: 100%; height: 100%;
  margin: 0; opacity: 0; cursor: pointer;
}

.switch__track {
  width: 46px; height: 28px; border-radius: 999px;
  background: var(--line-strong); position: relative;
  transition: background 160ms var(--ease);
}

.switch__track::after {
  content: ''; position: absolute; top: 3px; left: 3px;
  width: 22px; height: 22px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgb(0 0 0 / 0.25);
  transition: transform 160ms var(--ease);
}

.switch__input:checked + .switch__track { background: var(--accent); }
.switch__input:checked + .switch__track::after { transform: translateX(18px); }
.switch__input:focus-visible + .switch__track { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ------------------------------------------------------------- viewer --- */

.viewer {
  position: fixed; inset: 0; z-index: 70;
  display: flex; flex-direction: column;
  background: var(--bg);
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.viewer__bar {
  display: flex; align-items: center; gap: var(--sp-2);
  padding: var(--sp-1) var(--sp-2); border-bottom: 1px solid var(--line);
}

.viewer__name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }

.viewer__body { flex: 1; min-height: 0; overflow: auto; display: grid; place-items: center; }
.viewer__image { max-width: 100%; max-height: 100%; object-fit: contain; }
.viewer__frame { width: 100%; height: 100%; border: 0; background: #fff; }
.viewer__hint { margin: 0; padding: var(--sp-2) var(--gutter); color: var(--ink-2); font-size: var(--fs-xs); text-align: center; }

/* --------------------------------------------------------- list page --- */

.list-actions { display: flex; gap: var(--sp-2); flex-wrap: wrap; }
.list-actions > .btn { flex: 1 1 auto; }

/* -------------------------------------------------------- print sheet --- */

@media print {
  .tabbar, .fab, .cta-bar, .banners, #preview, .page-head__bar, .no-print { display: none !important; }
  body { background: #fff; color: #000; }
  .screen { padding: 0; max-width: none; }
}

/* ------------------------------------------------------ pull to refresh --- */

.ptr {
  position: fixed; top: calc(env(safe-area-inset-top, 0px) + 8px); left: 50%; z-index: 45;
  transform: translate(-50%, -60px);
  padding: 6px 12px; border-radius: 999px;
  background: var(--surface-raised); color: var(--ink-2); box-shadow: var(--shadow-float);
  font-size: var(--fs-xs); font-weight: 600; opacity: 0; pointer-events: none;
}
.ptr--visible { opacity: 1; }
.ptr--ready { color: var(--accent-ink); }

/* -------------------------------------------------------- print sheet --- */

.print-sheet__body { place-items: start center; padding: var(--sp-4) var(--gutter); background: var(--surface-sunken); }
.print-sheet__page { width: min(100%, 44rem); padding: var(--sp-5); background: #fff; border-radius: var(--r-sm); box-shadow: var(--shadow-card); }
.print-sheet__actions {
  display: flex; flex-wrap: wrap; gap: var(--sp-2);
  padding: var(--sp-3) var(--gutter); border-top: 1px solid var(--line); background: var(--surface);
}
.print-sheet__actions .btn { flex: 1 1 auto; }

/* ------------------------------------------------------------ board tools --- */

.board-tools { display: flex; align-items: center; gap: var(--sp-1); }
.board-tools__search { flex: 1; min-width: 0; min-height: var(--touch); color: var(--ink-3); }
.board-tools__search .field__control { min-height: var(--touch); }

.card--reorder { flex-direction: row; align-items: center; gap: var(--sp-2); padding-right: var(--sp-1); }
.card__reorder-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.card__reorder-actions { display: flex; flex-direction: column; }
.card__reorder-actions .icon-btn:disabled { opacity: 0.3; }

/* ------------------------------------------------------------- capture --- */

.capture-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-2); }

.capture-tile {
  display: flex; flex-direction: column; justify-content: space-between; gap: var(--sp-3);
  min-height: 96px; padding: var(--sp-3);
  border: 0; border-radius: var(--r-lg); background: var(--surface-sunken);
  color: var(--ink); text-align: left;
}

.capture-tile--hero {
  grid-column: 1 / -1; flex-direction: row-reverse; align-items: center; min-height: 76px;
  background: var(--primary-bg); color: var(--primary-ink);
}

.capture-tile__icon {
  width: 36px; height: 36px; border-radius: 11px; flex: none;
  display: grid; place-items: center; background: var(--surface); color: var(--ink);
}

.capture-tile--hero .capture-tile__icon { background: color-mix(in srgb, var(--primary-ink) 16%, transparent); color: var(--primary-ink); }
.capture-tile__text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.capture-tile--hero .capture-tile__text { flex: 1; }
.capture-tile__title { font-weight: 600; }
.capture-tile__sub { font-size: var(--fs-xs); color: var(--ink-2); }
.capture-tile--hero .capture-tile__sub { color: color-mix(in srgb, var(--primary-ink) 70%, transparent); }

/* A row whose link sits beside its own controls (see parts.js row()). */
.row--split { padding-block: 0; }
.row__target {
  flex: 1; min-width: 0; align-self: stretch;
  display: flex; align-items: center; gap: var(--sp-3);
  min-height: 52px; padding: var(--sp-2) 0;
  border: 0; background: none; color: inherit; text-align: left; text-decoration: none;
}
.row__target:active { background: var(--surface-sunken); }
