/* Blinktax shared components (DESIGN.md, #64). Rendered by blinktax/ui.py.
   Depends on tokens.css. Page layout and the app shell live elsewhere. */

.ic { width: 20px; height: 20px; flex: none; }

/* ------------------------------------------------------------------ type */
.display { margin: 0; font: 800 var(--display-size)/var(--display-lh) var(--font-display); letter-spacing: -0.025em; text-wrap: balance; }
.headline { margin: 0; font: 800 var(--headline-size)/var(--headline-lh) var(--font-display); letter-spacing: -0.015em; }
.title { margin: 0; font: 800 var(--title-size)/var(--title-lh) var(--font-display); letter-spacing: -0.01em; }
.headline .count, .title .count { margin-left: 4px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.lede { margin: 10px 0 0; max-width: 72ch; color: var(--ink-2); font-size: 16px; line-height: 24px; }
.lede strong { color: var(--ink); font-weight: 600; }
.note { margin: 0; max-width: 70ch; color: var(--ink-3); font-size: var(--text-small); line-height: var(--lh-small); }
.figure-value { font: 800 var(--figure-size)/var(--figure-lh) var(--font-display); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; white-space: nowrap; }
/* Money and Unknown (#81): ui.money renders 1.234,56 € or the dashed Unknown, never 0 or blank. */
.money { white-space: nowrap; font-variant-numeric: tabular-nums; }
.money-original { margin-left: 4px; color: var(--ink-3); font-size: var(--text-small); font-weight: 400; }
.unknown-value { display: inline-flex; align-items: center; gap: 4px; padding: 0 8px; border: 1px dashed var(--unknown-line); border-radius: var(--radius-pill); color: var(--ink-2); font: 600 13px/22px var(--font-body); letter-spacing: 0; white-space: nowrap; vertical-align: middle; }
.unknown-value .ic { width: 14px; height: 14px; }
/* On a figure the edge is 2 px and the word stays in the figure's face, a step quieter. */
.figure-value .unknown-value { gap: 0.25em; padding: 0 0.5em; border-width: 2px; border-radius: 16px; font: inherit; font-size: 0.75em; line-height: 1.4; }
.figure-value .unknown-value .ic { width: 0.8em; height: 0.8em; }
.plus-unknown { display: inline-block; margin-left: 10px; padding: 2px 10px; border: 2px dashed var(--unknown-line); border-radius: 12px; color: var(--ink-2); font-size: max(14px, 0.5em); line-height: 1.2; vertical-align: 0.3em; cursor: help; }
.section-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 16px; }

/* ------------------------------------------------------------------ buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: var(--control-h); padding: 0 22px;
  border: 1px solid transparent; border-radius: var(--radius-pill);
  font: 600 15px/1 var(--font-body); white-space: nowrap;
  text-decoration: none; cursor: pointer;
  transition: background-color var(--dur) var(--ease);
}
.btn .ic { width: 18px; height: 18px; }
.btn-s { height: var(--control-h-s); padding: 0 16px; font-size: 14px; }
.btn-s .ic { width: 16px; height: 16px; }
.btn-primary { background: var(--primary-bg); color: var(--primary-fg); }
.btn-primary:hover { background: var(--primary-bg-hover); }
.btn-secondary { background: var(--secondary-bg); color: var(--secondary-fg); }
.btn-secondary:hover { background: var(--secondary-bg-hover); }
.btn-tertiary { padding: 0 12px; background: transparent; color: var(--forest); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.btn-tertiary:hover { background: var(--neutral); text-decoration-thickness: 2px; }
.btn-danger { background: var(--problem-bg); color: var(--problem-fg); }
.btn-danger:hover { background: color-mix(in srgb, var(--problem-bg) 82%, var(--problem-solid)); }
.btn:disabled, .btn[aria-disabled="true"] { background: var(--neutral); color: var(--ink-3); cursor: not-allowed; }
.btn[aria-busy="true"] { cursor: progress; }
.btn[aria-busy="true"] .ic { animation: bt-spin 900ms linear infinite; }
.btn-block { width: 100%; }
@keyframes bt-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .btn[aria-busy="true"] .ic { animation: none; } }
.icon-btn { display: inline-grid; place-items: center; width: 36px; height: 36px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--ink-2); cursor: pointer; }
.icon-btn:hover { background: var(--neutral); color: var(--ink); }
.icon-btn-filled { background: var(--neutral); color: var(--forest); }
.icon-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.panel-fill .btn-secondary, .banner .btn-secondary, .conflict .btn-secondary { background: var(--ground); }

/* ------------------------------------------------------------------ status */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 28px; padding: 0 12px 0 10px;
  border-radius: var(--radius-pill);
  font-size: 13px; font-weight: 600; line-height: 1; white-space: nowrap;
}
.chip .ic { width: 15px; height: 15px; stroke-width: 2.25; }
.chip-l { height: 32px; padding: 0 14px 0 12px; font-size: 14px; }
.chip-s { height: 22px; padding: 0 8px 0 6px; font-size: 12px; }
.chip-s .ic { width: 13px; height: 13px; }
.chip.is-problem { background: var(--problem-bg); color: var(--problem-fg); }
.chip.is-attention { background: var(--attention-bg); color: var(--attention-fg); }
.chip.is-progress { background: var(--progress-bg); color: var(--progress-fg); }
.chip.is-done { background: var(--done-bg); color: var(--done-fg); }
.chip.is-neutral { background: var(--neutral); color: var(--ink-2); }
.chip.is-unknown { background: transparent; color: var(--ink-2); border: 1px dashed var(--unknown-line); }
.panel-fill .chip.is-neutral, .panel-fill .chip.is-unknown { background: var(--ground); }
.inline-status { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); font-size: 13px; font-weight: 600; }
.inline-status .ic { width: 15px; height: 15px; }
.inline-status.is-problem { color: var(--problem-fg); }
.inline-status.is-attention { color: var(--attention-fg); }
.inline-status.is-progress { color: var(--progress-fg); }
.inline-status.is-done { color: var(--done-fg); }

/* Avatars with a status badge */
.avatar {
  position: relative; flex: none;
  display: inline-grid; place-items: center;
  width: var(--avatar); height: var(--avatar);
  border-radius: 50%;
  background: var(--neutral); color: var(--ink);
}
.avatar .ic { width: 22px; height: 22px; }
.avatar-s { width: var(--avatar-s); height: var(--avatar-s); }
.avatar-s .ic { width: 18px; height: 18px; }
.avatar-mono { font: 800 18px/1 var(--font-display); color: var(--forest); }
.avatar-s.avatar-mono { font-size: 14px; }
.avatar-unknown { background: var(--ground); border: 1px dashed var(--unknown-line); }
.panel-fill .avatar { background: var(--ground); }
.badge {
  position: absolute; right: -3px; bottom: -3px;
  display: grid; place-items: center;
  width: 20px; height: 20px; border-radius: 50%;
  border: 2px solid var(--badge-ring, var(--ground));
}
.avatar-s .badge { width: 16px; height: 16px; }
.badge .ic { width: 11px; height: 11px; stroke-width: 3; }
.avatar-s .badge .ic { width: 9px; height: 9px; }
.badge.is-problem { background: var(--problem-solid); color: #fff; }
.badge.is-attention { background: var(--attention-solid); color: var(--attention-ink); }
.badge.is-progress { background: var(--progress-solid); color: var(--progress-fg); }
.badge.is-done { background: var(--done-solid); color: var(--forest); }
.badge.is-neutral { background: var(--neutral-strong); color: var(--ink-2); }
.panel-fill { --badge-ring: var(--neutral); }

/* ------------------------------------------------------------------ rows and groups */
.rows { display: flex; flex-direction: column; margin: 0; padding: 0; list-style: none; }
.row {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 16px;
  margin: 0 -12px; padding: 12px;
  border-radius: var(--radius-row);
  transition: background-color var(--dur) var(--ease);
}
.row:hover { background: var(--neutral); }
.row-body { min-width: 0; }
.row-title { display: block; color: var(--ink); font-size: var(--text-row); line-height: var(--lh-row); font-weight: 600; text-decoration: none; }
a.row-title:hover { text-decoration: underline; }
.row-sub { margin: 2px 0 0; color: var(--ink-2); }
.row-end { display: flex; align-items: center; gap: 16px; }
.row-end-stack { flex-direction: column; align-items: flex-end; gap: 2px; }
.row-meta { color: var(--ink-3); font-size: var(--text-small); white-space: nowrap; }
.row-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.row-end .phone-only { display: none; }
.amount { font-size: var(--text-row); font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.group + .group { margin-top: 28px; }
.group-title { display: flex; align-items: center; gap: 8px; margin: 0 0 4px; color: var(--ink-2); font-size: 14px; font-weight: 600; }

/* Filled panel: for things that belong together (a month, its exceptions, the package) */
.panel-fill { padding: 24px; border-radius: var(--radius-panel); background: var(--neutral); }

/* ------------------------------------------------------------------ tracker */
.tracker { display: grid; grid-auto-columns: minmax(0, 1fr); grid-auto-flow: column; margin: 0; padding: 0; list-style: none; }
.tracker li { position: relative; display: flex; flex-direction: column; align-items: flex-start; }
.tracker li::before { content: ""; position: absolute; top: var(--tk-mid); left: var(--tk-dot); right: 0; height: 3px; margin-top: -1.5px; border-radius: var(--radius-pill); background: var(--neutral-strong); }
.tracker li:last-child::before { display: none; }
.tk-dot { position: relative; z-index: 1; display: grid; place-items: center; width: var(--tk-dot); height: var(--tk-dot); border-radius: 50%; background: var(--neutral); color: var(--ink-2); }
.tk-dot .ic { width: calc(var(--tk-dot) * 0.48); height: calc(var(--tk-dot) * 0.48); }
.tracker .is-problem .tk-dot { background: var(--problem-solid); color: #fff; }
.tracker .is-attention .tk-dot { background: var(--attention-solid); color: var(--attention-ink); }
.tracker .is-done .tk-dot { background: var(--bright-green); color: var(--forest); }
.tracker .is-done::before { background: var(--bright-green); }
.tracker .is-todo .tk-dot { background: var(--ground); box-shadow: inset 0 0 0 2px var(--neutral-strong); color: var(--ink-3); }
.tk-label { color: var(--ink-2); font-weight: 600; }
.tk-value { font: 800 20px/26px var(--font-display); letter-spacing: -0.01em; }
.tk-note { color: var(--ink-3); font-size: 13px; }
.tracker-full { --tk-dot: 44px; --tk-mid: 22px; padding: 28px 28px 24px; border-radius: var(--radius-panel); background: var(--neutral); }
.tracker-full .tk-label { margin-top: 14px; font-size: 13px; }
.tracker-full .tk-value { margin-top: 2px; }
.tracker-full .is-current .tk-dot { box-shadow: 0 0 0 5px var(--neutral), 0 0 0 7px var(--ring, var(--forest)); }
.tracker-full .is-current.is-problem { --ring: var(--problem-solid); }
.tracker-full .is-current.is-attention { --ring: var(--attention-solid); }
.tracker-full .is-current.is-problem .tk-note { color: var(--problem-fg); font-weight: 600; }
.tracker-compact { --tk-dot: 28px; --tk-mid: 14px; }
.tracker-compact .tk-label { margin-top: 8px; padding-right: 4px; font-size: 12px; line-height: 16px; }
@media (max-width: 860px) {
  .tracker-full { --tk-dot: 36px; grid-auto-columns: auto; grid-auto-flow: row; padding: 20px; }
  .tracker-full li { display: grid; grid-template-columns: var(--tk-dot) 1fr; column-gap: 14px; padding-bottom: 18px; }
  .tracker-full li:last-child { padding-bottom: 0; }
  .tracker-full li::before { top: var(--tk-dot); bottom: 0; left: calc(var(--tk-dot) / 2); right: auto; width: 3px; height: auto; margin: 0 0 0 -1.5px; }
  .tracker-full .tk-dot { grid-row: 1 / span 3; }
  .tracker-full .tk-label { margin-top: 0; }
}

/* ------------------------------------------------------------------ tabs and filters */
.tabs { display: flex; gap: 28px; margin: 0 0 28px; overflow-x: auto; border-bottom: 1px solid var(--line); }
.tabs a { position: relative; display: inline-flex; align-items: center; gap: 8px; padding: 12px 0 14px; color: var(--ink-2); font-size: 16px; font-weight: 600; text-decoration: none; white-space: nowrap; }
.tabs a:hover, .tabs a[aria-current="page"] { color: var(--ink); }
.tabs a[aria-current="page"]::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 3px; border-radius: var(--radius-pill) var(--radius-pill) 0 0; background: var(--forest); }
.tab-count { padding: 1px 8px; border-radius: var(--radius-pill); background: var(--attention-bg); color: var(--attention-fg); font-size: 12px; font-weight: 700; }
.tab-tag { padding: 1px 8px; border: 1px dashed var(--unknown-line); border-radius: var(--radius-pill); color: var(--ink-3); font-size: 12px; font-weight: 600; }
.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pill { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 16px; border: 0; border-radius: var(--radius-pill); background: var(--neutral); color: var(--ink); font: 600 14px/1 var(--font-body); text-decoration: none; cursor: pointer; }
.pill:hover { background: var(--neutral-hover); }
.pill .count { color: var(--ink-3); }
.pill[aria-current="true"], .pill[aria-selected="true"], .pill.is-active { background: var(--forest); color: #fff; }
.pill[aria-current="true"] .count, .pill[aria-selected="true"] .count, .pill.is-active .count { color: var(--bright-green); }
.pill-add { border: 1px dashed var(--line-strong); background: transparent; color: var(--ink-2); }
.pill .ic { width: 16px; height: 16px; }

/* Filter pills in the tone of the status they filter by; the active pill stays forest. */
.pill.is-attention .ic { color: var(--attention-fg); }
.pill.is-problem .ic { color: var(--problem-fg); }
.pill.is-done .ic { color: var(--done-fg); }
.pill.is-neutral .ic, .pill.is-unknown .ic { color: var(--ink-2); }
.pill.is-unknown { border: 1px dashed var(--unknown-line); background: transparent; }
.pill.is-unknown:hover { background: var(--neutral); }
.pill[aria-current="true"] .ic { color: var(--bright-green); }
.pill.is-unknown[aria-current="true"] { border-color: var(--forest); background: var(--forest); }

/* ------------------------------------------------------------------ money figures and accounts */
.figures { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 0 0 var(--section-gap); }
.figure { display: flex; flex-direction: column; gap: 6px; min-width: 0; padding: 4px 32px 4px 0; }
.figure + .figure { padding-left: 32px; border-left: 1px solid var(--line); }
.figure-label { display: inline-flex; align-items: center; gap: 8px; color: var(--ink-2); font-size: 15px; font-weight: 600; }
.figure-label .ic { box-sizing: content-box; width: 18px; height: 18px; padding: 3px; border-radius: 50%; background: var(--neutral); color: var(--forest); }
.figure-quiet .figure-value { color: var(--ink-2); font-size: calc(var(--figure-size) * 0.7); }
.figure-note { max-width: 40ch; color: var(--ink-3); font-size: 13px; line-height: 18px; }
.title-note { margin-left: 8px; color: var(--ink-3); font: 400 14px/20px var(--font-body); letter-spacing: 0; }
.account-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(232px, 1fr)); gap: 12px; margin: 14px 0 0; padding: 0; list-style: none; }
.account { display: flex; align-items: flex-start; gap: 14px; min-width: 0; padding: 16px; border: 1px solid transparent; border-radius: var(--radius-panel); background: var(--neutral); --badge-ring: var(--neutral); }
.account .avatar { background: var(--ground); }
.acct-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.acct-body strong { color: var(--ink-2); font-size: 14px; font-weight: 600; }
.acct-value { font: 800 var(--title-size)/var(--title-lh) var(--font-display); letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.acct-unknown { color: var(--ink-2); }
.account small { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; margin-top: 4px; color: var(--ink-3); font-size: 13px; line-height: 18px; }
.account .chip.is-neutral, .account .chip.is-unknown { background: var(--ground); }
.account.is-unknown { border: 1px dashed var(--unknown-line); background: transparent; --badge-ring: var(--ground); }
.account.is-unknown .avatar { background: var(--neutral); }
.account.is-unknown .chip.is-unknown { background: transparent; }

/* Bank entries grouped by booking day */
.day-head { margin: 22px 0 4px; color: var(--ink-2); font-size: 14px; font-weight: 600; }
.tx-end { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.amount.is-in, .qf-amount.is-in { color: var(--done-fg); }

/* ------------------------------------------------------------------ fields */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field label { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; }
.input {
  width: 100%; height: var(--control-h); padding: 0 16px;
  border: 1px solid var(--line-strong); border-radius: var(--radius-field);
  background: var(--ground); color: var(--ink); font: 400 15px/1.4 var(--font-body);
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.input:hover { border-color: var(--ink-2); }
.input:focus { outline: none; border-color: var(--forest); box-shadow: 0 0 0 3px color-mix(in srgb, var(--bright-green) 60%, transparent); }
textarea.input { height: auto; padding: 12px 16px; resize: vertical; }
.input-amount { text-align: right; font-variant-numeric: tabular-nums; }
.field-source { color: var(--ink-3); font-size: 13px; }
.field-flag { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: var(--radius-pill); background: var(--attention-bg); color: var(--attention-fg); font-size: 12px; font-weight: 600; }
.field.is-check .input { border-color: var(--check-line); background: var(--check-fill); }
.field-why { color: var(--attention-fg); font-size: 13px; line-height: 18px; }
.field.is-error .input { border-color: var(--problem-solid); box-shadow: 0 0 0 1px var(--problem-solid); }
.field-err { display: inline-flex; align-items: center; gap: 6px; color: var(--problem-fg); font-size: 13px; font-weight: 600; }
.field.is-locked .input { border-color: transparent; background: var(--neutral); color: var(--ink-2); }

/* ------------------------------------------------------------------ table */
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: var(--radius-panel); }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; }
.table th { position: sticky; top: 0; z-index: 1; height: 44px; padding: 0 16px; background: var(--neutral); color: var(--ink-2); font-size: 13px; font-weight: 600; text-align: left; white-space: nowrap; }
.table td { height: 60px; padding: 8px 16px; border-top: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:hover td { background: var(--row-hover); }
.table tr[aria-selected="true"] td { background: var(--row-selected); }
.table .t-num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table td.t-num { font-weight: 600; }
.table .t-unknown { color: var(--ink-3); font-weight: 400; }

/* ------------------------------------------------------------------ feedback */
.banner { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 14px; padding: 16px 16px 16px 20px; border-radius: var(--radius-overlay); }
.banner > .ic { width: 22px; height: 22px; }
.banner-title { display: block; font-weight: 600; }
.banner p { margin: 0; font-size: 14px; }
.banner.is-problem { background: var(--problem-bg); color: var(--problem-fg); }
.banner.is-attention { background: var(--attention-bg); color: var(--attention-fg); }
.banner.is-done { background: var(--done-bg); color: var(--done-fg); }
.banner.is-neutral { background: var(--neutral); color: var(--ink-2); }
.banner.is-neutral .banner-title { color: var(--ink); }
.banner.is-unknown { border: 2px dashed var(--unknown-line); background: transparent; color: var(--ink-2); }
.banner.is-unknown .banner-title { color: var(--ink); }
.toast { display: inline-flex; align-items: center; gap: 10px; padding: 8px 8px 8px 16px; border-radius: var(--radius-pill); background: var(--forest); color: #fff; box-shadow: var(--shadow-float); font-weight: 500; }
.toast > .ic { color: var(--bright-green); }
.toast .btn-tertiary { color: var(--bright-green); }
.toast :focus-visible { outline-color: var(--bright-green); }

/* ------------------------------------------------------------------ empty and loading */
.empty { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 24px 0; text-align: center; }
.empty-mark { display: grid; place-items: center; width: 56px; height: 56px; margin-bottom: 6px; border-radius: 50%; background: var(--bright-green); color: var(--forest); }
.empty-mark .ic { width: 28px; height: 28px; stroke-width: 2.5; }
.empty-mark.is-neutral { background: var(--neutral); color: var(--ink-2); }
.empty-mark.is-unknown { border: 2px dashed var(--unknown-line); background: var(--ground); color: var(--ink-2); }
.empty .note { max-width: 40ch; }
.sk { display: block; height: 12px; border-radius: var(--radius-pill); background: linear-gradient(90deg, var(--neutral) 0%, color-mix(in srgb, var(--neutral) 40%, var(--ground)) 50%, var(--neutral) 100%) 0 0 / 200% 100%; animation: bt-shimmer 1.4s ease-in-out infinite; }
@keyframes bt-shimmer { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .sk { animation: none; } }

/* ------------------------------------------------------------------ phone */
@media (max-width: 860px) {
  .row { grid-template-columns: auto minmax(0, 1fr); align-items: start; gap: 4px 14px; }
  .row-title { overflow-wrap: anywhere; }
  .row-end { grid-column: 2; flex-direction: column; align-items: flex-start; gap: 8px; margin-top: 8px; }
  .row-end .btn { min-height: 44px; }
  .row-end [data-desktop-only] { display: none; }
  .row-end .phone-only { display: inline; }
  .row:has(> .row-end-stack) { grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; }
  .row-end-stack { grid-column: auto; margin-top: 0; }
  .banner { grid-template-columns: auto minmax(0, 1fr); }
  .banner > .btn, .banner > .icon-btn { grid-column: 2; justify-self: start; }
  .figures { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .figure, .figure + .figure { padding: 0; border-left: 0; }
  .figure + .figure { padding-top: 20px; border-top: 1px solid var(--line); }
  .account-list { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; margin-right: calc(-1 * var(--page-gutter)); padding-right: var(--page-gutter); }
  .account { flex: 0 0 min(78%, 280px); scroll-snap-align: start; }
  .tx-end { align-items: flex-start; }
  .pills.bank-filters { flex-wrap: nowrap; overflow-x: auto; margin-right: calc(-1 * var(--page-gutter)); padding-right: var(--page-gutter); }
  .pills.bank-filters .pill { flex: none; }
}

/* ------------------------------------------------------------------ dialog (ui.dialog): irreversible steps only */
.dialog {
  width: min(600px, calc(100vw - 32px)); max-height: calc(100vh - 48px); padding: 24px; overflow: auto;
  border: 0; border-radius: var(--radius-panel); background: var(--ground); color: var(--ink);
  box-shadow: var(--shadow-float), 0 0 0 1px var(--line);
}
.dialog::backdrop { background: rgb(14 15 12 / 0.32); }
/* Opened by link without script: centred over the page like the modal it becomes. */
.dialog[open]:not(:modal) { position: fixed; inset: 0; z-index: 40; margin: auto; }
.dialog > .title { margin: 0 0 12px; text-wrap: balance; }

/* ------------------------------------------------------------------ keyboard shortcuts (static/keys.js) */
.kbd { display: inline-grid; place-items: center; min-width: 26px; height: 26px; padding: 0 7px; border: 1px solid var(--line-strong); border-radius: var(--radius-pill); background: var(--ground); color: var(--ink-2); font: 600 12px/1 var(--font-body); }
.shortcuts { width: min(420px, calc(100vw - 32px)); padding: 24px; border: 0; border-radius: var(--radius-panel); background: var(--ground); color: var(--ink); box-shadow: var(--shadow-float), 0 0 0 1px var(--line); }
.shortcuts::backdrop { background: rgb(14 15 12 / 0.32); }
.shortcuts-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
.shortcuts-head form { margin: 0; }
.shortcuts-keys { width: 100%; border-collapse: collapse; }
.shortcuts-keys td { padding: 8px 0; border-top: 1px solid var(--line); vertical-align: middle; }
.shortcuts-keys td:first-child { width: 96px; white-space: nowrap; }
.shortcuts .note { margin: 12px 0 0; color: var(--ink-3); font-size: var(--text-small); line-height: var(--lh-small); }
/* ------------------------------------------------------------------ search and quick-find (#89) */
/* DESIGN.md Inputs: the search is a Neutral pill with a leading icon and a "/" hint; white with the focus glow on focus. */
.search { position: relative; display: flex; align-items: center; min-width: 0; }
.search > .ic { position: absolute; left: 16px; width: 20px; height: 20px; color: var(--ink-2); pointer-events: none; }
.search .search-input {
  height: var(--control-h); padding: 0 44px 0 46px;
  border-color: transparent; border-radius: var(--radius-pill);
  background: var(--neutral);
}
.search .search-input::placeholder { color: var(--ink-3); }
.search .search-input:hover { border-color: transparent; background: var(--neutral-hover); }
.search .search-input:focus { border-color: var(--forest); background: var(--ground); }
.search .search-input::-webkit-search-cancel-button { display: none; }
.search > kbd { position: absolute; right: 14px; pointer-events: none; }
.search .search-input:focus ~ kbd { display: none; }
kbd { display: inline-block; min-width: 22px; padding: 1px 6px; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--ground); color: var(--ink-2); font: 600 12px/18px var(--font-body); text-align: center; }

/* The result list: grouped options in a floating menu (desktop) or a full-screen sheet (phone). */
.qf-list { display: flex; flex-direction: column; }
.qf-group { padding: 12px 12px 4px; color: var(--ink-3); font-size: 12px; font-weight: 600; line-height: 16px; }
/* Menu items use 14 px corners inside the 20 px menu (DESIGN.md Shapes). */
.qf-opt {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px;
  width: 100%; min-height: 52px; padding: 8px 12px;
  border: 0; border-radius: 14px; background: none;
  color: var(--ink); font: inherit; text-align: left; text-decoration: none; cursor: pointer;
}
.qf-opt:hover, .qf-opt[aria-selected="true"] { background: var(--neutral); }
.qf-opt > .ic { width: 20px; height: 20px; margin: 0 6px; color: var(--ink-2); }
.qf-main { display: flex; flex-direction: column; min-width: 0; }
.qf-main strong { overflow: hidden; font-size: var(--text-row); font-weight: 600; line-height: var(--lh-row); text-overflow: ellipsis; white-space: nowrap; }
.qf-main small { overflow: hidden; color: var(--ink-2); font-size: var(--text-small); line-height: var(--lh-small); text-overflow: ellipsis; white-space: nowrap; }
.qf-end { display: flex; align-items: center; gap: 12px; }
.qf-amount { min-width: 9ch; font-size: var(--text-body); font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.qf-recent, .qf-all { grid-template-columns: auto minmax(0, 1fr); min-height: 44px; }
.qf-all { margin-top: 4px; border-top: 1px solid var(--line); border-radius: 0 0 14px 14px; }
.qf-hint, .qf-empty { margin: 0; padding: 10px 12px; color: var(--ink-3); font-size: var(--text-small); line-height: var(--lh-small); }
.qf-empty { padding-top: 14px; color: var(--ink); font-size: var(--text-body); line-height: var(--lh-body); }

/* ------------------------------------------------------------------ side panel (#84, ui.side_panel) */
/* One item opened beside its list. It floats on desktop (the one soft shadow) and fills the phone
   screen with a back arrow. static/side_panel.js closes it on Esc and returns focus to the row. */
.side-panel { display: flex; flex-direction: column; gap: 24px; padding: 12px 24px 24px; border-radius: var(--radius-panel); background: var(--ground); box-shadow: var(--shadow-float); }
.side-panel:focus { outline: none; }
.side-panel:focus-visible { outline: none; } /* Focused on open so keys and screen readers start here; the panel itself is the cue. */
.panel-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 -12px; }
.panel-keys { display: inline-flex; align-items: center; gap: 6px; margin-left: 12px; color: var(--ink-3); font-size: 12px; }
.panel-back { display: none; }
.panel-close { margin-left: auto; }
.panel-heading { display: flex; align-items: flex-start; gap: 16px; }
.panel-heading-text { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; min-width: 0; }
.panel-heading-text .title { overflow-wrap: anywhere; }
.panel-meta { margin: 0; color: var(--ink-3); font-size: var(--text-small); line-height: var(--lh-small); }
.panel-section { display: flex; flex-direction: column; gap: 12px; }
.panel-label { margin: 0; color: var(--ink-2); font-size: 14px; font-weight: 600; line-height: 20px; }
.panel-text { margin: 0; font-size: var(--text-body); line-height: 22px; }
.panel-note { margin: 0; color: var(--ink-3); font-size: var(--text-small); line-height: var(--lh-small); }
.panel-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
/* A requested run (#87): its state or outcome takes a line of its own above the buttons. */
.panel-actions > .run-outcome, .panel-actions > .run-request { flex-basis: 100%; }
.panel-actions > .run-request { order: 1; } /* The reason sits under the disabled button. */
.panel-actions > .run-again { display: contents; }
.run-request { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin: 0; color: var(--ink-2); font-size: var(--text-small); line-height: var(--lh-small); }
.panel-banner .banner { grid-template-columns: auto minmax(0, 1fr); }
.panel-banner .banner > .btn { grid-column: 2; justify-self: start; }

/* Labelled facts: term in Ink 3 above its value. */
.facts { display: flex; flex-direction: column; gap: 12px; margin: 0; }
.facts > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.facts dt { color: var(--ink-3); font-size: 13px; font-weight: 600; line-height: 18px; }
.facts dd { margin: 0; font-size: var(--text-body); line-height: 22px; overflow-wrap: anywhere; }
.facts .id { color: var(--ink-2); font-variant-numeric: slashed-zero; }

/* A history, newest first: a dot in the entry's colour joined by a Line rule. The words carry the status too. */
.timeline { display: flex; flex-direction: column; margin: 0; padding: 0; list-style: none; }
.timeline > li { position: relative; display: grid; grid-template-columns: 14px minmax(0, 1fr); gap: 12px; padding-bottom: 16px; }
.timeline > li:not(:last-child)::before { content: ""; position: absolute; left: 6px; top: 18px; bottom: 0; width: 2px; background: var(--line); }
.tl-dot { width: 14px; height: 14px; margin-top: 4px; border-radius: 50%; background: var(--neutral-strong); }
.timeline .is-problem .tl-dot { background: var(--problem-solid); }
.timeline .is-attention .tl-dot { background: var(--attention-solid); }
.timeline .is-progress .tl-dot { background: var(--progress-solid); }
.timeline .is-done .tl-dot { background: var(--bright-green); box-shadow: inset 0 0 0 2px var(--forest); }
.tl-body { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 10px; min-width: 0; }
.tl-when { font-size: var(--text-body); font-weight: 600; font-variant-numeric: tabular-nums; }
.tl-note { flex-basis: 100%; margin: 0; color: var(--ink-2); font-size: var(--text-small); line-height: var(--lh-small); overflow-wrap: anywhere; }

/* Checks a step went through (ui.checklist): passed, failed, or not reached. The words say which too. */
.checklist { display: flex; flex-direction: column; gap: 6px; margin: 0; padding: 0; list-style: none; }
.checklist > li { display: flex; align-items: flex-start; gap: 8px; color: var(--ink); font-size: var(--text-small); line-height: var(--lh-small); }
.checklist .ic { flex: none; width: 18px; height: 18px; }
.checklist .is-done .ic { color: var(--done-fg); }
.checklist .is-problem { color: var(--problem-fg); font-weight: 600; }
.checklist .is-todo { color: var(--ink-3); }

@media (max-width: 860px) {
  .side-panel { padding: 8px var(--page-gutter) 32px; border-radius: 0; box-shadow: none; }
  .panel-bar { margin: 0 -8px; }
  .panel-back { display: inline-grid; width: 44px; height: 44px; }
  .panel-close, .panel-keys { display: none; }
}
