/* The components of the design system. One block per component, named as in design-system/components/. */

.icon { width: 1rem; height: 1rem; flex: none; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }

/* Button */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2); min-height: var(--w-target); padding: 0 var(--s-3);
  border: 1px solid var(--c-line-strong); border-radius: var(--radius-m); background: var(--c-surface); color: var(--c-ink);
  font-weight: 600; text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--c-sunken); color: var(--c-ink); }
.btn-primary { background: var(--c-primary); border-color: var(--c-primary); color: var(--c-on-primary); }
.btn-primary:hover { background: var(--c-primary-hover); border-color: var(--c-primary-hover); color: var(--c-on-primary); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-danger { color: var(--c-danger); border-color: var(--c-danger); }
.btn-danger:hover { background: var(--c-danger-tint); color: var(--c-danger); }
.btn-small { min-height: 1.75rem; padding: 0 var(--s-2); font-size: var(--fs-s); }
.btn-icon { padding: 0; width: var(--w-target); flex: none; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn.busy { cursor: progress; }
.form-actions { display: flex; flex-wrap: wrap; gap: var(--s-2); justify-content: flex-end; align-items: center; margin-top: var(--s-3); }
.top-actions { margin: 0 0 var(--s-3); }

/* Card */
.card { background: var(--c-surface); border: 1px solid var(--c-line); border-radius: var(--radius-l); padding: var(--s-4); }
.card-title { margin-bottom: var(--s-3); }
.cards { display: grid; gap: var(--s-3); }
.cards-grid { grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr)); }
.muted-card { opacity: 0.75; }
.empty { text-align: center; padding: var(--s-6) var(--s-4); color: var(--c-muted); border: 1px dashed var(--c-line-strong); border-radius: var(--radius-l); }
.loading { display: grid; place-items: center; padding: var(--s-6); }
.spinner { width: 1.5rem; height: 1.5rem; border: 2px solid var(--c-line); border-top-color: var(--c-primary); border-radius: 50%; }

/* StatusPill */
.pill { display: inline-flex; align-items: center; gap: var(--s-1); padding: 0.05rem 0.5rem; border-radius: var(--radius-pill); font-size: var(--fs-xs); font-weight: 600; line-height: 1.5; white-space: nowrap; border: 1px solid transparent; background: var(--c-sunken); color: var(--c-text); }
.pill-neutral { border-color: var(--c-line); }
.pill-info { background: var(--c-info-tint); color: var(--c-info); }
.pill-accent { background: var(--c-accent-tint); color: var(--c-accent-text); }
.pill-success { background: var(--c-success-tint); color: var(--c-success); }
.pill-done { background: var(--c-success); color: var(--c-surface); }
.pill-warning { background: var(--c-warning-tint); color: var(--c-warning); }
.pill-danger { background: var(--c-danger-tint); color: var(--c-danger); }
.pill-gate { background: var(--c-surface); color: var(--c-accent-text); border: 1px dashed var(--c-accent-text); }
.pill-muted { color: var(--c-muted); border-color: var(--c-line); text-decoration: line-through; }
.pills { display: flex; flex-wrap: wrap; gap: var(--s-2); align-items: center; margin-bottom: var(--s-3); }
.count { font-family: var(--font-text); font-size: var(--fs-xs); font-weight: 600; color: var(--c-muted); background: var(--c-sunken); border-radius: var(--radius-pill); padding: 0 0.45rem; }
.key { font-family: var(--font-mono); font-size: var(--fs-s); font-weight: 600; color: var(--c-muted); text-decoration: none; white-space: nowrap; }
a.key:hover { color: var(--c-ink); text-decoration: underline; }
.key-large { font-size: var(--fs-m); }
.tag { display: inline-flex; align-items: center; gap: 0.2rem; font-size: var(--fs-xs); color: var(--c-muted); }
.tag .icon { width: 0.8rem; height: 0.8rem; }
.dot { width: 0.6rem; height: 0.6rem; border-radius: 50%; background: var(--c-line-strong); flex: none; display: inline-block; }
.dot-success { background: var(--c-success); } .dot-danger { background: var(--c-danger); } .dot-warning { background: var(--c-warning); } .dot-accent { background: var(--c-primary); }
.chip { display: inline-flex; padding: 0.15rem 0.7rem; border: 1px solid var(--c-line-strong); border-radius: var(--radius-pill); text-decoration: none; color: var(--c-text); font-size: var(--fs-s); }
.chip[aria-current] { background: var(--c-accent-tint); border-color: var(--c-primary); color: var(--c-ink); font-weight: 600; }
.avatar { display: inline-grid; place-items: center; width: 1.75rem; height: 1.75rem; border-radius: 50%; font-size: var(--fs-xs); font-weight: 700; background: var(--c-sunken); color: var(--c-text); border: 1px solid var(--c-line); flex: none; }
.avatar-team { border-radius: var(--radius-m); background: var(--c-info-tint); color: var(--c-info); border-color: transparent; }
.avatar-small { width: 1.5rem; height: 1.5rem; font-size: var(--fs-xs); font-weight: 600; letter-spacing: -0.03em; margin-left: auto; }
.avatar-button { cursor: pointer; width: var(--w-target); height: var(--w-target); }

/* InlineAlert */
.alert { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-3); padding: var(--s-3) var(--s-4); border-radius: var(--radius-m); border: 1px solid var(--c-line); border-left-width: 4px; background: var(--c-surface); margin-bottom: var(--s-3); }
.alert-text { flex: 1 1 16rem; min-width: 0; color: var(--c-ink); }
.alert-text > :last-child { margin-bottom: 0; }
.alert-actions { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.alert-info { border-left-color: var(--c-info); background: var(--c-info-tint); }
.alert-success { border-left-color: var(--c-success); background: var(--c-success-tint); }
.alert-warning { border-left-color: var(--c-warning); background: var(--c-warning-tint); }
.alert-danger { border-left-color: var(--c-danger); background: var(--c-danger-tint); }
.alert-gate { border-left-color: var(--c-primary); background: var(--c-accent-tint); }

/* FormField */
.form { display: grid; gap: var(--s-3); }
.field { display: grid; gap: var(--s-1); min-width: 0; }
.field-label { font-weight: 600; color: var(--c-ink); font-size: var(--fs-s); }
.field-hint { font-size: var(--fs-xs); color: var(--c-muted); margin: 0; }
.field-static { margin: 0; }
.input { width: 100%; min-height: var(--w-target); padding: 0.35rem var(--s-2); border: 1px solid var(--c-line-strong); border-radius: var(--radius-m); background: var(--c-surface); color: var(--c-ink); }
textarea.input { resize: vertical; line-height: var(--lh-text); }
.input::placeholder { color: var(--c-muted); opacity: 0.8; }
.input:disabled { background: var(--c-sunken); }
.input-prefix { display: flex; align-items: stretch; }
.input-prefix span { display: flex; align-items: center; padding: 0 var(--s-2); background: var(--c-sunken); border: 1px solid var(--c-line-strong); border-right: 0; border-radius: var(--radius-m) 0 0 var(--radius-m); color: var(--c-muted); white-space: nowrap; }
.input-prefix .input { border-radius: 0 var(--radius-m) var(--radius-m) 0; }
.check { display: flex; gap: var(--s-2); align-items: flex-start; cursor: pointer; }
.check input { margin-top: 0.2rem; accent-color: var(--c-primary); width: 1rem; height: 1rem; flex: none; }
/* A tick without words beside it (a card, a row of a table): the label around it is what is pressed. */
.pick { display: inline-flex; align-items: center; justify-content: center; flex: none; cursor: pointer; }
.pick input { accent-color: var(--c-primary); margin: 0; }
.checks { display: grid; gap: var(--s-1); max-height: 14rem; overflow-y: auto; }
.form-card { margin-bottom: var(--s-4); max-width: 44rem; }

/* SegmentedControl */
.segmented { justify-self: start; display: inline-flex; flex-wrap: wrap; border: 1px solid var(--c-line-strong); border-radius: var(--radius-m); background: var(--c-surface); padding: 2px; gap: 2px; max-width: 100%; }
.segment { position: relative; display: flex; }
.segment input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.segment label { display: flex; flex-direction: column; justify-content: center; padding: 0.25rem var(--s-3); border-radius: 6px; font-weight: 600; font-size: var(--fs-s); min-height: 1.75rem; }
.segment label small { font-weight: 400; color: var(--c-muted); max-width: 16rem; }
.segment input:checked + label { background: var(--c-accent-tint); color: var(--c-ink); box-shadow: inset 0 0 0 1px var(--c-primary); }
.segment input:focus-visible + label { outline: 2px solid var(--c-focus); outline-offset: 1px; }
.segment input:disabled + label { color: var(--c-muted); opacity: 0.7; }

/* Dialog */
/* The head and the foot stay; what is between them scrolls. --vvh is what the
   on-screen keyboard leaves of the screen where the browser does not say so itself (sheet.js). */
.dialog { border: 1px solid var(--c-line); border-radius: var(--radius-l); padding: 0; background: var(--c-surface); color: var(--c-text); width: min(32rem, calc(100vw - 2rem)); max-height: calc(min(100dvh, var(--vvh, 100dvh)) - 2rem); box-shadow: var(--c-shadow); overflow: hidden; }
.dialog[open] { display: flex; flex-direction: column; }
.dialog-wide { width: min(44rem, calc(100vw - 2rem)); }
.dialog::backdrop { background: var(--c-overlay); }
.dialog-head { flex: none; display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); padding: var(--s-3) var(--s-3) var(--s-3) var(--s-4); border-bottom: 1px solid var(--c-line); }
.dialog-head h2 { min-width: 0; }
.dialog-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: var(--s-4); }
.dialog-foot { flex: none; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--s-2); padding: var(--s-3) var(--s-4); border-top: 1px solid var(--c-line); }
/* The buttons of a form in a dialog are part of the form (Enter sends it), so
   they cannot stand in the foot. They stay in sight all the same, however long the form. */
.dialog-body > form > .form-actions { position: sticky; bottom: calc(-1 * var(--s-4)); z-index: 1; margin: var(--s-3) calc(-1 * var(--s-4)) calc(-1 * var(--s-4)); padding: var(--s-3) var(--s-4); background: var(--c-surface); border-top: 1px solid var(--c-line); }
.consequences { padding-left: var(--s-4); }
.once { background: var(--c-warning-tint); border-radius: var(--radius-m); padding: var(--s-3); margin-bottom: var(--s-3); }
.once-note { color: var(--c-warning); font-weight: 600; }
.once-row { display: flex; gap: var(--s-2); align-items: center; flex-wrap: wrap; margin: var(--s-1) 0; }
.once-value { flex: 1 1 12rem; padding: var(--s-2); background: var(--c-surface); border: 1px solid var(--c-line); word-break: break-all; }
.code { background: var(--c-sunken); padding: var(--s-3); border-radius: var(--radius-m); overflow-x: auto; white-space: pre; }

/* Tabs */
.tabs { display: flex; gap: var(--s-1); border-bottom: 1px solid var(--c-line); margin-bottom: var(--s-4); overflow-x: auto; scrollbar-width: thin; }
.tab { display: inline-flex; align-items: center; gap: var(--s-1); padding: var(--s-2) var(--s-3); color: var(--c-muted); text-decoration: none; font-weight: 600; border-bottom: 2px solid transparent; white-space: nowrap; margin-bottom: -1px; flex: none; }
.tab:hover { color: var(--c-ink); }
.tab[aria-current] { color: var(--c-ink); border-bottom-color: var(--c-primary); }
.tab-count { font-size: var(--fs-xs); background: var(--c-sunken); border-radius: var(--radius-pill); padding: 0 0.4rem; color: var(--c-muted); }

/* Steps */
.steps { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: var(--s-2) var(--s-4); margin-bottom: var(--s-4); }
.step { display: flex; align-items: center; gap: var(--s-2); color: var(--c-muted); }
.step-mark { display: inline-grid; place-items: center; width: 1.5rem; height: 1.5rem; border-radius: 50%; border: 1px solid var(--c-line-strong); font-size: var(--fs-xs); font-weight: 700; flex: none; background: var(--c-surface); }
.step-done .step-mark { background: var(--c-success); border-color: var(--c-success); color: var(--c-surface); }
.step-current { color: var(--c-ink); font-weight: 600; }
.step-current .step-mark { border-color: var(--c-primary); background: var(--c-primary); color: var(--c-on-primary); }
.step-skipped .step-label { text-decoration: line-through; }
.step-skipped .step-mark, .step-blocked .step-mark { border-style: dashed; }
.step-note { color: var(--c-muted); }

/* ResourceRow, ConnectionRow, SecretSetting */
.rows { padding: 0; }
.card.rows > * + * { border-top: 1px solid var(--c-line); }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2) var(--s-3); padding: var(--s-3) var(--s-4); }
.rows:not(.card) .row { padding: var(--s-2) 0; }
.row-main { flex: 1 1 14rem; min-width: 0; }
.row-title { font-weight: 600; color: var(--c-ink); display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2); }
.row-meta { display: inline-flex; gap: var(--s-1); flex-wrap: wrap; font-weight: 400; }
.row-detail { color: var(--c-muted); font-size: var(--fs-s); }
.row-checked { display: block; }
.row-actions { display: flex; flex-wrap: wrap; gap: var(--s-2); margin-left: auto; }
.row-form { display: block; }
.secret-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s-2); }
.secret-value { display: inline-flex; gap: var(--s-2); align-items: baseline; flex-wrap: wrap; font-size: var(--fs-s); }

/* PlanCard */
.plan { display: grid; gap: var(--s-2); align-content: start; }
.plan-head { display: flex; flex-wrap: wrap; gap: var(--s-2); align-items: center; }
.plan-current { border-color: var(--c-primary); box-shadow: inset 0 0 0 1px var(--c-primary); }
.plan-price { font-size: var(--fs-xl); font-weight: 700; color: var(--c-ink); margin: 0; font-family: var(--font-title); }
.plan-price .muted { font-size: var(--fs-s); font-weight: 400; font-family: var(--font-text); }
.plan-limits { margin: 0; padding-left: var(--s-4); }
.plan-grid { display: grid; gap: var(--s-3); grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr)); margin: var(--s-3) 0; }
.plan-choice { cursor: pointer; }
.plan-choice:focus-within { outline: 2px solid var(--c-focus); outline-offset: 2px; }
.meter-head { display: flex; justify-content: space-between; font-size: var(--fs-s); }
.meter progress { width: 100%; height: 0.5rem; accent-color: var(--c-primary); }
.billing-now { max-width: 28rem; margin-bottom: var(--s-4); }

/* Menu */
.menu-wrap { position: relative; display: inline-block; }
.menu { position: absolute; top: calc(100% + 4px); z-index: 30; min-width: 13rem; max-width: min(22rem, calc(100vw - 1.5rem)); max-height: min(28rem, 70vh); overflow-y: auto; background: var(--c-surface); border: 1px solid var(--c-line); border-radius: var(--radius-m); box-shadow: var(--c-shadow); padding: var(--s-1); }
.menu-left { left: 0; } .menu-right { right: 0; }
.menu-item { display: flex; align-items: center; gap: var(--s-2); width: 100%; padding: 0.4rem var(--s-2); border: 0; background: none; text-align: left; border-radius: 6px; color: var(--c-text); text-decoration: none; cursor: pointer; flex-wrap: wrap; }
.menu-item:hover, .menu-item:focus-visible { background: var(--c-sunken); color: var(--c-ink); }
.menu-item.current { font-weight: 600; color: var(--c-ink); box-shadow: inset 3px 0 0 var(--c-primary); }
.menu-item.danger { color: var(--c-danger); }
.menu-item:disabled { color: var(--c-muted); cursor: default; }
.menu-item small { color: var(--c-muted); margin-left: auto; }
.menu-heading { padding: var(--s-1) var(--s-2); font-size: var(--fs-xs); color: var(--c-muted); font-weight: 600; }
.menu-sep { margin: var(--s-1) 0; }
.menu-scrim { display: none; }

/* NotificationBell */
.bell { position: relative; }
.bell-count { position: absolute; top: 2px; right: 0; background: var(--c-primary); color: var(--c-on-primary); border-radius: var(--radius-pill); font-size: var(--fs-xs); font-weight: 700; min-width: 1.125rem; height: 1.125rem; line-height: 1.125rem; padding: 0 3px; }
.lang { padding: 0 var(--s-2); font-size: var(--fs-s); }

/* Table */
.table-wrap { overflow-x: auto; border: 1px solid var(--c-line); border-radius: var(--radius-l); background: var(--c-surface); margin-bottom: var(--s-3); }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: var(--fs-xs); color: var(--c-muted); font-weight: 600; padding: var(--s-2) var(--s-3); border-bottom: 1px solid var(--c-line); white-space: nowrap; background: var(--c-sunken); }
.table td { padding: var(--s-2) var(--s-3); border-bottom: 1px solid var(--c-line); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table tr.clickable:hover td { background: var(--c-sunken); }
.table tr.selected td, .table tr:has(.cell-check input:checked) td { background: var(--c-accent-tint); }
.cell-wide { width: 50%; min-width: 12rem; }
.cell-num { text-align: right; font-variant-numeric: tabular-nums; }
.cell-check { width: 2rem; }
.cell-actions { display: inline-flex; gap: var(--s-1); flex-wrap: wrap; }
.row-link { color: inherit; text-decoration: none; }
.table td .pill + .pill { margin-left: var(--s-1); }

/* Toolbar */
.toolbar { display: flex; flex-wrap: wrap; gap: var(--s-2) var(--s-3); align-items: flex-end; margin-bottom: var(--s-3); }
.toolbar .toolbar { margin: 0; }
.search { position: relative; flex: 1 1 12rem; max-width: 18rem; }
.search .icon { position: absolute; left: 0.6rem; top: 50%; transform: translateY(-50%); color: var(--c-muted); }
.search .input { padding-left: 2rem; }
.filter { display: grid; gap: 2px; }
.filter-label { font-size: var(--fs-xs); color: var(--c-muted); }
.filter .input { min-width: 7.5rem; max-width: 12rem; min-height: 2rem; padding-block: 0.2rem; }
/* Beside a mouse the filters stand in the row; on a phone they fold behind one button. */
.filters { display: contents; }
.filters-toggle { display: none; }
.toolbar-right { margin-left: auto; align-self: center; }

/* Side panel */
.split { display: grid; gap: var(--s-4); grid-template-columns: minmax(0, 1fr); align-items: start; }
.split-open { grid-template-columns: minmax(0, 1fr) var(--w-panel); }
.panel { background: var(--c-surface); border: 1px solid var(--c-line); border-radius: var(--radius-l); position: sticky; top: 4.25rem; max-height: calc(100dvh - 5.25rem); display: flex; flex-direction: column; }
.panel-head { display: flex; justify-content: space-between; gap: var(--s-2); padding: var(--s-3) var(--s-3) var(--s-3) var(--s-4); border-bottom: 1px solid var(--c-line); }
.panel-sub { font-family: var(--font-mono); font-size: var(--fs-s); color: var(--c-muted); }
.panel-body { padding: var(--s-4); overflow-y: auto; }
.panel-foot { display: flex; flex-wrap: wrap; gap: var(--s-2); justify-content: flex-end; padding: var(--s-3) var(--s-4); border-top: 1px solid var(--c-line); }
.facts { display: grid; grid-template-columns: minmax(6rem, auto) 1fr; gap: var(--s-1) var(--s-3); }
.facts dt { color: var(--c-muted); font-size: var(--fs-s); }
.facts dd { margin: 0; color: var(--c-ink); min-width: 0; display: flex; flex-wrap: wrap; gap: var(--s-1); align-items: center; }
.facts dd .pill { white-space: normal; max-width: 100%; }

@media (max-width: 56rem) {
  /* Touch. A finger needs 2.75rem (--w-target-touch) to press, and iOS zooms
     the page in on any field whose text is under 16px. tests/mobile.test.js
     holds both. */
  .btn { min-height: var(--w-target-touch); }
  .btn-icon { width: var(--w-target-touch); }
  .input, .filter .input, input[type=file] { min-height: var(--w-target-touch); font-size: var(--fs-l); }
  input[type=file] { width: 100%; min-width: 0; }
  .input-prefix span { font-size: var(--fs-l); }
  .check { min-height: var(--w-target-touch); align-items: center; }
  .check input, .pick input { margin-top: 0; width: 1.25rem; height: 1.25rem; }
  .pick { width: var(--w-target-touch); height: var(--w-target-touch); }
  .table td .pick { justify-content: flex-start; }
  .segment label { min-height: var(--w-target-touch); min-width: var(--w-target-touch); }
  .tab { min-height: var(--w-target-touch); min-width: var(--w-target-touch); justify-content: center; }
  .menu-item { min-height: var(--w-target-touch); padding-block: var(--s-2); }
  .avatar-button, .lang { width: var(--w-target-touch); min-width: var(--w-target-touch); height: var(--w-target-touch); }
  .lang { padding: 0; }
  /* Small controls keep their size, or a card would be all buttons: the
     pressable area around them is made up to the same 2.75rem instead. */
  /* A width given here replaces the floor a flex row keeps by itself (its
     content), so the row may not squeeze them: the label would touch the border. */
  .btn-small, .chip, .status-button { position: relative; min-height: 2.25rem; min-width: var(--w-target-touch); flex-shrink: 0; }
  .chip { align-items: center; justify-content: center; }
  /* inset counts from inside the 1px border: 2.25rem - 2px + 2 × 0.3125rem = 2.75rem */
  .btn-small::after, .chip::after, .status-button::after { content: ''; position: absolute; inset: -0.3125rem 0; }
  .key, .row-link, .table td > a, .facts dd > a { display: inline-flex; align-items: center; min-height: var(--w-target-touch); min-width: var(--w-target-touch); }
  span.key { min-height: 0; min-width: 0; }
  /* A link that carries a pill (a release and its state) breaks between the two,
     and a long name of a fact does not take the room of what it says. */
  .facts dd > a { flex-wrap: wrap; max-width: 100%; column-gap: var(--s-1); }
  .facts { grid-template-columns: fit-content(40%) minmax(0, 1fr); }

  .split-open { grid-template-columns: minmax(0, 1fr); }
  .split-open .split-main { display: none; }
  .panel { position: static; max-height: none; }

  /* A table becomes a list of cards: each cell says what it is, and wraps
     rather than run out of the card. */
  .table-wrap { overflow-x: clip; }
  .table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .table, .table tbody, .table tr, .table td { display: block; width: auto; }
  .table tr { padding: var(--s-2) var(--s-3); border-bottom: 1px solid var(--c-line); }
  .table tr:last-child { border-bottom: 0; }
  .table td { border: 0; padding: 2px 0; display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-1) var(--s-2); text-align: left; min-width: 0; overflow-wrap: anywhere; }
  .table td::before { content: attr(data-label); flex: 0 0 6.5rem; color: var(--c-muted); font-size: var(--fs-xs); overflow-wrap: break-word; }
  .table td .pill, .row-meta .pill { white-space: normal; }
  .table td .pill + .pill { margin-left: 0; }
  .cell-wide { min-width: 0; }

  /* Toolbar: the search and one button; the selects open under them. */
  .search { max-width: none; flex: 1 1 8rem; }
  .filters-toggle { display: inline-flex; }
  .filters { display: none; flex: 1 1 100%; flex-wrap: wrap; gap: var(--s-2) var(--s-3); align-items: flex-end; }
  .filters.filters-open { display: flex; }
  .filter .input { max-width: none; }
  .filter { flex: 1 1 8rem; }
  .toolbar-right { margin-left: 0; }

  /* Menu: a sheet at the bottom of the screen, over a dimmed page (ui.js puts both on the body). */
  .menu { position: fixed; left: max(var(--s-3), var(--safe-left)); right: max(var(--s-3), var(--safe-right)); top: auto; bottom: calc(var(--s-3) + var(--safe-bottom) + var(--kb, 0px)); z-index: 61; max-width: none; max-height: calc(min(100dvh, var(--vvh, 100dvh)) * 0.7); overscroll-behavior: contain; border-radius: var(--radius-l); padding: var(--s-2); }
  .menu-scrim { display: block; position: fixed; inset: 0; z-index: 60; width: 100%; height: 100%; padding: 0; border: 0; background: var(--c-overlay); }

  /* Dialog: a sheet too, as wide as the screen, that stops above the keyboard. */
  .dialog, .dialog-wide { width: 100%; max-width: 100%; margin: auto 0 var(--kb, 0px); border-width: 1px 0 0; border-radius: var(--radius-l) var(--radius-l) 0 0; max-height: calc(min(100dvh, var(--vvh, 100dvh)) - var(--s-5) - var(--safe-top)); }
  .dialog-body { padding-bottom: calc(var(--s-4) + var(--safe-bottom)); }
  .dialog-body:not(:last-child) { padding-bottom: var(--s-4); }
  .dialog-foot { padding-bottom: calc(var(--s-3) + var(--safe-bottom)); }
  .dialog-body > form > .form-actions { bottom: calc(-1 * var(--s-4) - var(--safe-bottom)); margin-bottom: calc(-1 * var(--s-4) - var(--safe-bottom)); padding-bottom: calc(var(--s-3) + var(--safe-bottom)); }
  .dialog-foot .btn, .dialog-body > form > .form-actions .btn { flex: 1 1 auto; }
}

/* New activity: an offer to draw the page again, never a redraw by itself.
   It stands in the main column (main.js), under the drawer and its shade,
   and the page keeps room under its last control so the chip never hides it. */
.pulse-chip { position: fixed; left: 50%; bottom: calc(var(--s-4) + var(--safe-bottom)); transform: translateX(-50%); z-index: 10; display: flex; align-items: center; gap: var(--s-3); width: max-content; max-width: calc(100vw - 2rem); padding: var(--s-2) var(--s-2) var(--s-2) var(--s-4); background: var(--c-surface); color: var(--c-ink); border: 1px solid var(--c-line-strong); border-radius: var(--radius-m); box-shadow: var(--c-shadow); }
.main-col:has(.pulse-chip) main { padding-bottom: calc(var(--s-7) + 5rem + var(--safe-bottom)); }
