/* This Source Code Form is subject to the terms of the Mozilla Public
   License, v. 2.0. If a copy of the MPL was not distributed with this
   file, You can obtain one at https://mozilla.org/MPL/2.0/.

   contra.css: Contra's own page grammar, on the Oficina suite's look.

   Everything around the page is estilo's and is linked before this file:
   rastrillo's tokens, Calma with Contra's accent (theme.ForApp("contra"),
   hue 200), and estilo's base, menu, chrome (the bar and the account
   menu), side and, on the request page, desk (the segmented control).
   None of it is copied here. This file is only what is Contra's: the
   unlock panel, the vault's tiles and list, an item's fields, the grant
   decision, the kit, written in the same tokens so it changes with them.

   The approved screens are docs/mockups/estilo/; DESIGN.md is the record,
   including why Left Luggage was retired (Paul, 2026-11-18). */

:root {
  accent-color: var(--rst-accent);
  /* The bar is sticky: anything scrolled to (a link's target, a focused
     field) lands below it rather than under it, as in Mapa. */
  scroll-padding-block-start: calc(var(--estilo-bar-block-size, 56px) + 16px);
}
::selection { background: var(--rst-accent-soft); color: var(--rst-text); }

/* The icons are line drawings at one weight, the mockups' 1.75. */
.icon { stroke-width: 1.75; }
/* Inside the page they are drawn at 1rem, whatever the text beside them
   (a tile's label, a kind tile, a note), as in the mockups. Chips and the
   request's runner tile size their own, below. */
[contra-main] .icon { block-size: 1rem; flex: none; inline-size: 1rem; }

/* A hidden element inside the page stays hidden, whatever display a
   component rule gives it ([rst-btn] is inline-flex, a panel is a block).
   Scoped to <main>: estilo's side draws some [hidden] rows on purpose. */
[contra-main] [hidden] { display: none !important; }

/* ── The column ─────────────────────────────────────────────────────── */

[contra-main] > [rst-page] {
  margin-inline: auto;
  max-inline-size: 60rem;
  padding-block: var(--rst-sp-6);
}
[contra-main="door"] > [rst-page], [contra-main="door"] > [contra-foot] { max-inline-size: 44rem; }
body { background: var(--rst-surface); }
[contra-foot] {
  box-sizing: border-box;
  color: var(--rst-text-faint);
  font-size: var(--rst-fs-xs);
  margin-inline: auto;
  max-inline-size: 60rem;
  padding: 0 var(--rst-sp-4) var(--rst-sp-5);
}
[contra-foot] p { margin: 0; }
[contra-foot] code { background: none; padding: 0; }

[rst-page] h1 { font-size: 2rem; letter-spacing: -0.02em; line-height: 1.15; margin: 0 0 var(--rst-sp-4); }
[rst-page] h2 { font-size: 1.05rem; margin: var(--rst-sp-5) 0 var(--rst-sp-2); }
[rst-page] h3 { font-size: 1rem; margin: var(--rst-sp-4) 0 var(--rst-sp-2); }
[rst-page] p { line-height: 1.55; }
code {
  background: var(--rst-surface-2);
  border-radius: var(--rst-radius-sm);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9em;
  overflow-wrap: anywhere;
  padding: 0.05rem 0.3rem;
}
code.block { display: block; padding: 0.6rem 0.8rem; }
.code, [data-pair-code] {
  background: none;
  display: inline-block;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: clamp(1.75rem, 6vw, 2.5rem);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  letter-spacing: 0.08em;
  padding: 0;
}

.lede { color: var(--rst-text-muted); margin: 0 0 var(--rst-sp-5); max-inline-size: 68ch; }
.help { color: var(--rst-text-muted); font-size: var(--rst-fs-sm); margin: 0 0 var(--rst-sp-3); max-inline-size: 68ch; }
.line { color: var(--rst-text-muted); font-size: var(--rst-fs-sm); margin-block-start: var(--rst-sp-4); }
.kicker { color: var(--rst-text-muted); font-size: var(--rst-fs-sm); margin: 0 0 0.25rem; }
.foot { color: var(--rst-text-faint); font-size: var(--rst-fs-sm); margin-block-start: var(--rst-sp-6); }
.acts { align-items: center; display: flex; flex-wrap: wrap; gap: 0.6rem; }

/* ── Surfaces ───────────────────────────────────────────────────────── */

.panel {
  background: var(--rst-surface);
  border: 1px solid var(--rst-line);
  border-radius: var(--rst-radius);
  box-shadow: var(--rst-shadow-lift);
  padding: var(--rst-sp-5);
}
.panel > :first-child { margin-block-start: 0; }
.panel > :last-child { margin-block-end: 0; }

/* A note: something true about the page, said once, in the accent's tint. */
.note {
  align-items: flex-start;
  background: var(--rst-accent-soft);
  border-radius: var(--rst-radius);
  display: flex;
  gap: 0.7rem;
  margin: 0 0 var(--rst-sp-4);
  padding: 0.85rem 1rem;
}
.note > .icon { color: var(--rst-accent); flex: none; margin-block-start: 0.2rem; }
.note h2 { margin: 0 0 0.25rem; }
.note p { margin: 0.25rem 0 0; }

/* A warning: a condition worth reading twice. A tinted block, never a
   coloured edge. */
[data-kind="warning"], [data-notice] {
  background: var(--rst-tone-warning-bg);
  border-radius: var(--rst-radius);
  color: var(--rst-text);
  max-inline-size: 68ch;
  padding: 0.85rem 1rem;
}
[data-notice] { border: 1px solid color-mix(in oklab, var(--rst-tone-warning-fg) 25%, var(--rst-line)); box-shadow: none; max-inline-size: none; }
[data-notice] h2 { align-items: center; color: var(--rst-tone-warning-fg); display: flex; gap: 0.45rem; margin-block-start: 0; }
[data-notice] > :last-child, [data-kind="warning"] > :last-child { margin-block-end: 0; }
[data-kind="error"] { color: var(--rst-tone-negative-fg); }
[data-kind="ok"], [data-kind="notice"] { color: var(--rst-tone-positive-fg); }

/* Chips: state in a word or two. */
.chips { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0; }
.chip {
  align-items: center;
  background: var(--rst-surface-2);
  border-radius: var(--rst-radius-pill);
  color: var(--rst-text-muted);
  display: inline-flex;
  font-size: var(--rst-fs-xs);
  font-weight: 550;
  gap: 0.3rem;
  padding: 0.2rem 0.6rem;
}
.chip .icon { block-size: 0.85rem; inline-size: 0.85rem; }
.chip.ok { background: var(--rst-tone-positive-bg); color: var(--rst-tone-positive-fg); }
.chip.on { background: var(--rst-accent-soft); color: var(--rst-accent-strong); }
.chip.warn { background: var(--rst-tone-warning-bg); color: var(--rst-tone-warning-fg); }

/* The tile an item, a runner or a key sits behind. */
.kind {
  align-items: center;
  background: var(--rst-surface-2);
  border-radius: var(--rst-radius-sm);
  block-size: 2.25rem;
  color: var(--rst-text-muted);
  display: inline-flex;
  flex: none;
  inline-size: 2.25rem;
  justify-content: center;
}
.kind.key { background: var(--rst-accent-soft); color: var(--rst-accent); }

.check { align-items: flex-start; display: flex; gap: 0.5rem; max-inline-size: 68ch; }
.check input { margin-block-start: 0.3rem; }
textarea[rst-input] { min-block-size: 6rem; resize: vertical; }

/* ── Unlock: one task in the middle of the page ─────────────────────── */

.unlock, .door { margin: 6vh auto 0; max-inline-size: 26rem; text-align: center; }
.door { max-inline-size: 40rem; margin-block-start: 4vh; }
.unlock .panel, .door .panel, .unlock .lede, .door .lede { text-align: start; }
.unlock .lede { margin-block-end: var(--rst-sp-4); }
[contra-mark] { block-size: 3.25rem; display: block; inline-size: 3.25rem; margin: 0 auto var(--rst-sp-4); }
.unlock h1 { font-size: 1.75rem; margin-block-end: var(--rst-sp-4); }
.unlock .panel form > [rst-btn], .unlock .panel > form > [rst-btn] { inline-size: 100%; justify-content: center; }
.unlock .panel [rst-field]:first-child, .unlock .panel form > :first-child { margin-block-start: 0; }
.unlock .panel .chips { margin-block: 0.2rem var(--rst-sp-4); }
.unlock .panel .help { margin-block-end: var(--rst-sp-3); }
.unlock .panel .line { margin-block: var(--rst-sp-3) 0; text-align: center; }
.unlock [data-status]:empty, .unlock [data-unlock-status]:empty { display: none; }
.unlock [data-status], .unlock [data-unlock-status] { font-size: var(--rst-fs-sm); margin-block: var(--rst-sp-3) 0; }
/* Once the page has unlocked, the panel has done its work. */
.unlock:has(form[data-unlock][hidden]) { display: none; }

/* The boundary through the sign-in form: what goes to the server above
   the rule, what never leaves the page below it. */
.or {
  color: var(--rst-text-faint);
  display: grid;
  font-size: var(--rst-fs-xs);
  gap: 0.3rem;
  justify-items: center;
  margin-block: var(--rst-sp-3);
}
.or > :first-child { order: 1; }
.or::before { border-block-start: 1px dashed var(--rst-line-strong); content: ""; inline-size: 100%; order: 2; }
.or > :last-child { order: 3; }

.door h1 { font-size: clamp(1.75rem, 4.5vw, 2.4rem); }
.door .lede { margin-inline: auto; text-align: center; }
.door .acts { justify-content: center; margin-block: 0 var(--rst-sp-6); }
.door [data-notice] { text-align: start; }
.door.error { text-align: start; }

/* The bar's Lock: only once the page has been unlocked, and never below
   800px, where the bar has no room for a lead. */
[estilo-bar-lead]:has([contra-lock]) { display: none; }
@media (min-width: 800px) {
  body:has(form[data-unlock][hidden]) [estilo-bar-lead]:has([contra-lock]) { display: flex; }
}

/* ── A page's head: its title, its actions, its state ────────────────── */

.head { align-items: flex-end; display: flex; flex-wrap: wrap; gap: var(--rst-sp-3); margin-block-end: var(--rst-sp-5); }
.head h1 { margin: 0; flex: 1 1 16rem; min-inline-size: 0; overflow-wrap: anywhere; }
.head .acts { margin-inline-start: auto; }
.head .meta {
  flex: 0 0 100%;
  align-items: center;
  color: var(--rst-text-muted);
  display: flex;
  flex-wrap: wrap;
  font-size: var(--rst-fs-sm);
  gap: 0.35rem 0.6rem;
  margin: 0;
}
.head .meta select { inline-size: auto; }
.head .lede { flex: 0 0 100%; margin: 0; }
[data-vault-open] .head .acts { align-self: center; }

.section { align-items: baseline; display: flex; gap: 0.6rem; margin-block: var(--rst-sp-6) var(--rst-sp-3); }
.section h2 { margin: 0; }

/* ── The vault: tiles, then one list ────────────────────────────────── */

/* The tiles arrive one by one as their numbers do, so their row is
   reserved from the start: nothing below them moves when they land. */
.stats { display: grid; gap: var(--rst-sp-3); grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr)); margin-block-end: var(--rst-sp-5); min-block-size: 6.4rem; }
@media (max-width: 760px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); min-block-size: calc(12.8rem + var(--rst-sp-3)); } }
.stat {
  background: var(--rst-surface);
  border: 1px solid var(--rst-line);
  border-radius: var(--rst-radius);
  color: inherit;
  display: block;
  padding: 0.75rem 0.9rem;
  text-decoration: none;
}
.stat .k { align-items: center; color: var(--rst-text-muted); display: flex; font-size: var(--rst-fs-xs); gap: 0.35rem; }
.stat .v { display: block; font-size: 1.5rem; font-variant-numeric: tabular-nums; font-weight: 650; letter-spacing: -0.01em; margin-block-start: 0.15rem; }
.stat .v small { color: var(--rst-text-muted); font-size: var(--rst-fs-sm); font-weight: 500; margin-inline-start: 0.35rem; }
.stat.attn { background: var(--rst-accent-soft); border-color: color-mix(in oklab, var(--rst-accent) 35%, var(--rst-line)); }
.stat.attn .v { color: var(--rst-accent-strong); }
.stat.attn .go { color: var(--rst-accent); font-size: var(--rst-fs-xs); font-weight: 600; }
a.stat:hover { border-color: var(--rst-accent); }

.toolbar { align-items: center; display: flex; flex-wrap: wrap; gap: 0.6rem; margin-block: 0 var(--rst-sp-3); }
.toolbar input { flex: 1 1 16rem; }

/* One raised surface, ruled rows. */
.items {
  background: var(--rst-surface);
  border: 1px solid var(--rst-line);
  border-radius: var(--rst-radius);
  box-shadow: var(--rst-shadow-lift);
  list-style: none;
  margin: 0 0 var(--rst-sp-4);
  overflow: hidden;
  padding: 0;
}
.items:empty { display: none; }
.items > li { border-block-end: 1px solid var(--rst-line); padding: 0.7rem 1rem; }
.items > li:last-child { border-block-end: 0; }

/* A vault row: the kind tile, the name over the username, the row's two
   actions, and the item's fields when its name is opened. */
[data-items] > li { align-items: center; display: grid; gap: 0.25rem 0.9rem; grid-template-columns: 2.25rem minmax(0, 1fr) auto; }
[data-items] > li:hover { background: color-mix(in oklab, var(--rst-accent-soft) 45%, transparent); }
[data-items] .main { min-inline-size: 0; }
[data-items] .name {
  background: none;
  border: 0;
  color: var(--rst-text);
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  max-inline-size: 100%;
  overflow: hidden;
  padding: 0;
  text-align: start;
  text-overflow: ellipsis;
  white-space: nowrap;
}
[data-items] .name:hover { color: var(--rst-accent-strong); text-decoration: underline; }
[data-items] .sub { color: var(--rst-text-muted); font-size: var(--rst-fs-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-acts { display: flex; gap: 0.25rem; }
[data-items] .detail { grid-column: 1 / -1; padding-block: 0.4rem 0.2rem; }

/* An item's fields: ruled rows, a label column, the value, its actions. */
.fields { background: var(--rst-surface); border: 1px solid var(--rst-line); border-radius: var(--rst-radius); margin: 0; }
.fields > div { align-items: center; border-block-end: 1px solid var(--rst-line); display: grid; gap: 0.9rem; grid-template-columns: 8rem minmax(0, 1fr) auto; padding: 0.6rem 1rem; }
.fields > div:last-child { border-block-end: 0; }
.fields dt { color: var(--rst-text-muted); font-size: var(--rst-fs-sm); }
.fields dd { margin: 0; min-inline-size: 0; overflow-wrap: anywhere; white-space: pre-wrap; }
.fields dd.secret { letter-spacing: 0.15em; overflow: hidden; white-space: nowrap; }
.fa { display: flex; gap: 0.25rem; }
.residue { align-items: flex-start; color: var(--rst-text-faint); display: flex; font-size: var(--rst-fs-xs); gap: 0.4rem; line-height: 1.5; margin: var(--rst-sp-3) 0 0; }
.residue .icon { flex: none; margin-block-start: 0.15rem; }
@media (max-width: 600px) {
  .fields > div { grid-template-columns: minmax(0, 1fr) auto; }
  .fields dt { grid-column: 1 / -1; }
}

/* The form that adds and edits. */
.item-form { margin-block: var(--rst-sp-4); }
.item-form .grid { display: grid; gap: 0 var(--rst-sp-4); grid-template-columns: repeat(2, minmax(0, 1fr)); }
.item-form .grid > :last-child { grid-column: 1 / -1; }
.item-form [rst-field] { margin-block: 0 var(--rst-sp-3); }
@media (max-width: 600px) { .item-form .grid { grid-template-columns: minmax(0, 1fr); } }

[data-status], [data-share-status], [data-request-status], [data-audit-status], [data-pair-status] { color: var(--rst-text-muted); font-size: var(--rst-fs-sm); min-block-size: 1.4em; }
[data-status][data-endorsement] { color: var(--rst-tone-positive-fg); }
[data-request-status]:empty, [data-audit-status]:empty, [data-pair-status]:empty { margin: 0; min-block-size: 0; }

[data-sharing] .panel > p { max-inline-size: 68ch; }
.inline-form { align-items: flex-end; display: flex; flex-wrap: wrap; gap: 0 0.6rem; }
.inline-form [rst-field] { flex: 1 1 18rem; margin-block-end: var(--rst-sp-3); }
.inline-form > [rst-btn] { margin-block-end: var(--rst-sp-3); }

/* Plain ruled rows: members, and lists inside a panel. */
.rows { list-style: none; margin: 0 0 var(--rst-sp-4); padding: 0; }
.rows > li { align-items: center; border-block-end: 1px solid var(--rst-line); display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; justify-content: space-between; padding-block: 0.5rem; }

/* ── Runners and requests: rows of state, then one action ───────────── */

[data-request-row], [data-runner] { align-items: center; display: flex; flex-wrap: wrap; gap: 0.4rem 1.2rem; }
[data-request-row] > strong, [data-runner] > span { flex: 0 0 auto; font-size: var(--rst-fs-xs); font-weight: 600; }
[data-request-row] > strong { background: var(--rst-tone-warning-bg); border-radius: var(--rst-radius-pill); color: var(--rst-tone-warning-fg); padding: 0.15rem 0.55rem; }
[data-request-row] > span { color: var(--rst-text-muted); flex: 1 1 10rem; font-size: var(--rst-fs-sm); overflow-wrap: anywhere; }
[data-request-row] > span:first-of-type { color: var(--rst-text); flex-basis: 12rem; font-weight: 600; }
[data-request-row] > p { color: var(--rst-text-muted); font-size: var(--rst-fs-sm); margin: 0; }
[data-runner] > strong { flex: 1 1 12rem; overflow-wrap: anywhere; }
[data-runner] > span { background: var(--rst-tone-positive-bg); border-radius: var(--rst-radius-pill); color: var(--rst-tone-positive-fg); padding: 0.15rem 0.55rem; }
[data-revoke-review] { flex-basis: 100%; }
[data-revoke-review] p { color: var(--rst-text-muted); font-size: var(--rst-fs-sm); margin-block: 0 0.5rem; }
[data-revoke-review] button { margin-inline-end: 0.4rem; }
[data-request-toolbar] [data-request-count] { color: var(--rst-text-muted); font-size: var(--rst-fs-sm); margin: 0; }
.empty { color: var(--rst-text-muted); }

/* The request: the decision first. */
/* With a request open, the request is the page: its own head, Back. */
[data-requests]:has(> [data-request-detail]:not([hidden])) > .head { display: none; }
.ask { align-items: center; display: flex; gap: 0.9rem; margin-block: var(--rst-sp-4) var(--rst-sp-3); }
.ask .runner {
  align-items: center;
  background: var(--rst-surface-2);
  border-radius: var(--rst-radius-sm);
  block-size: 2.75rem;
  color: var(--rst-text-muted);
  display: inline-flex;
  flex: none;
  inline-size: 2.75rem;
  justify-content: center;
}
.ask .runner .icon { block-size: 1.3rem; inline-size: 1.3rem; }
.ask-title { min-inline-size: 0; }
.ask h2 { font-size: 1.75rem; letter-spacing: -0.02em; line-height: 1.15; margin: 0; overflow-wrap: anywhere; }
[data-request-summary].meta { align-items: center; display: flex; flex-wrap: wrap; gap: 0.4rem 1rem; margin-block-end: var(--rst-sp-4); }
.inline-facts { color: var(--rst-text-muted); display: flex; flex-wrap: wrap; font-size: var(--rst-fs-sm); gap: 0.2rem 0.4rem; margin: 0; }
.inline-facts dt::after { content: ":"; }
.inline-facts dd { margin: 0 0.8rem 0 0; }

/* Facts: label and value, ruled. */
.facts { font-size: var(--rst-fs-sm); margin: 0 0 var(--rst-sp-4); }
.facts:empty { display: none; }
.facts:not(:empty) { display: grid; grid-template-columns: minmax(8rem, max-content) minmax(0, 1fr); }
.facts dt, .facts dd { border-block-end: 1px solid var(--rst-line); padding-block: 0.5rem; }
.facts dt { padding-inline-end: 1rem; }
.facts dt { color: var(--rst-text-muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }
@media (max-width: 600px) {
  .facts:not(:empty) { grid-template-columns: minmax(0, 1fr); }
  .facts dt { border: 0; padding-block-end: 0; }
}

/* The agent's words: set apart, dashed, quoted, never styled as ours. */
.say { border: 1px dashed var(--rst-line-strong); border-radius: var(--rst-radius-sm); padding: 0.8rem 1rem; }
.say h3 { color: var(--rst-text-faint); font-size: var(--rst-fs-xs); font-weight: 600; margin: 0 0 0.2rem; }
.say > p { color: var(--rst-text-muted); font-size: var(--rst-fs-sm); margin: 0 0 0.5rem; }
.say h4 { color: var(--rst-text-faint); font-size: var(--rst-fs-xs); font-weight: 550; margin: 0.6rem 0 0.15rem; }
.say blockquote { line-height: 1.5; margin: 0; overflow-wrap: anywhere; unicode-bidi: plaintext; white-space: pre-wrap; }

.step { margin-block-start: var(--rst-sp-5); }
.step > h3:first-child { margin-block-start: 0; }
.pick { display: grid; gap: 0 var(--rst-sp-4); grid-template-columns: repeat(3, minmax(0, 1fr)); }
.pick [rst-field] { margin-block: 0 var(--rst-sp-3); }
@media (max-width: 760px) { .pick { grid-template-columns: minmax(0, 1fr); } }
.timing { display: flex; flex-wrap: wrap; gap: 0 var(--rst-sp-6); }
.timing fieldset { border: 0; margin: 0 0 var(--rst-sp-3); min-inline-size: 0; padding: 0; }
.timing legend { padding: 0; }
.timing [estilo-seg] { flex: none; }
.timing [estilo-seg-item] { block-size: 2.25rem; flex: none; font-size: var(--rst-fs-sm); min-block-size: 2.25rem; padding-inline: 0.9rem; }

/* One action bar, stuck to the bottom of the window while the request is
   on screen: the facts of the decision as chips, then its buttons. */
.decide {
  align-items: center;
  background: var(--rst-surface);
  border: 1px solid var(--rst-line);
  border-radius: var(--rst-radius);
  box-shadow: var(--rst-shadow-lift);
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  inset-block-end: var(--rst-sp-3);
  margin-block-start: var(--rst-sp-5);
  padding: 0.9rem 1rem;
  position: sticky;
  z-index: 2;
}
.decide .chips { flex: 1 1 16rem; }
.decide .acts { margin-inline-start: auto; }
.decide:not(:has(button:not([hidden]))) { display: none; }

/* Grants: one card per grant. */
.cards { display: grid; gap: var(--rst-sp-3); list-style: none; margin: 0 0 var(--rst-sp-4); padding: 0; }
.cards > li {
  background: var(--rst-surface);
  border: 1px solid var(--rst-line);
  border-radius: var(--rst-radius);
  overflow-wrap: anywhere;
  padding: 0.75rem 1rem;
}
.cards > li > p { color: var(--rst-text-muted); font-size: var(--rst-fs-sm); margin: 0.2rem 0; }
.cards > li > p:first-child { color: var(--rst-text-faint); font-size: var(--rst-fs-xs); }
.cards dl { display: grid; font-size: var(--rst-fs-sm); gap: 0.2rem 1rem; grid-template-columns: minmax(7rem, max-content) minmax(0, 1fr); margin: 0.4rem 0; }
.cards dt { color: var(--rst-text-muted); }
.cards dd { margin: 0; }
.cards summary { color: var(--rst-text-muted); cursor: pointer; font-size: var(--rst-fs-sm); padding-block: 0.4rem; }
[data-grant-revoke-actions] { display: flex; flex-wrap: wrap; gap: 0.5rem; }
@media (max-width: 480px) { .cards dl { grid-template-columns: minmax(0, 1fr); } }

/* ── This device: the ladder ────────────────────────────────────────── */

.rungs { counter-reset: rung; display: grid; gap: var(--rst-sp-3); list-style: none; margin: 0 0 var(--rst-sp-4); padding: 0; }
.rungs > li { counter-increment: rung; padding-inline-start: 4rem; position: relative; }
.rungs > li::before {
  align-items: center;
  background: var(--rst-accent-soft);
  border-radius: var(--rst-radius-pill);
  color: var(--rst-accent-strong);
  content: counter(rung);
  display: flex;
  font-weight: 650;
  block-size: 2rem;
  inline-size: 2rem;
  inset-block-start: var(--rst-sp-5);
  inset-inline-start: var(--rst-sp-4);
  justify-content: center;
  position: absolute;
}
.rungs h3 { margin-block-start: 0.2rem; }
.rungs video { border-radius: var(--rst-radius-sm); max-inline-size: 100%; }
.disclosure summary { cursor: pointer; font-weight: 600; }
.disclosure[open] summary { margin-block-end: var(--rst-sp-3); }
.disclosure { padding-block: var(--rst-sp-3); }

/* ── The kit ─────────────────────────────────────────────────────────── */

.kit { align-items: start; display: grid; gap: var(--rst-sp-4); grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr)); margin-block-end: var(--rst-sp-4); }
.titled { align-items: center; display: flex; flex-wrap: wrap; gap: 0.7rem; margin-block-end: var(--rst-sp-3); }
.titled h2 { margin: 0; }
.titled .chip { margin-inline-start: auto; }

/* The two printed values, on screen at signup and at a reissue: a clean,
   high-contrast card, the value large and monospaced, because a person
   copies it by hand. */
[data-kit] {
  background: var(--rst-surface);
  border: 1px solid var(--rst-line-strong);
  border-radius: var(--rst-radius);
  color: var(--rst-text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 1.05rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
  overflow-x: auto;
  padding: var(--rst-sp-4);
  white-space: pre-wrap;
  word-break: break-all;
}
.kit-screen [data-kit-body] { max-inline-size: 44rem; }
.kit-screen h2 { margin-block-start: var(--rst-sp-6); }
.progress { list-style: none; text-align: start; }
.progress li { color: var(--rst-text-faint); padding-block: 0.3rem; }
.progress li[data-state="doing"] { color: var(--rst-text); font-weight: 600; }
.progress li[data-state="done"] { color: var(--rst-tone-positive-fg); }
.progress li[data-state="done"]::before { content: "✓ "; }

/* ── Small screens ──────────────────────────────────────────────────── */

@media (max-width: 760px) {
  [contra-main] > [rst-page] { padding-block: var(--rst-sp-5); }
  .panel { padding: var(--rst-sp-4); }
  .head h1 { font-size: 1.75rem; }
  .ask .runner { display: none; }
  .ask h2 { font-size: 1.5rem; }
  [data-items] > li { grid-template-columns: 2.25rem minmax(0, 1fr); }
  .row-acts { grid-column: 2; }
  .unlock { margin-block-start: 2vh; }
}

/* ── Print ──────────────────────────────────────────────────────────── */
/* A printed screen, the kit above all, is black on white with no chrome:
   no bar, no side, no tints, every rule a plain line. The kit's PDFs are
   drawn in the browser by crypto/kit.js and do not come through here. */
@media print {
  /* Every token is light-dark(), so the scheme decides the ink. Paper is
     light whatever Appearance says: :root:root[data-theme] outranks
     estilo's :root[data-theme="dark"], and plain :root follows estilo's
     own :root, which would let a dark system choose. */
  :root, :root:root[data-theme] { color-scheme: light; }
  body { background: #fff; color: #000; }
  [estilo-bar], [estilo-side], [rst-skip], [contra-foot], [estilo-bar-lead],
  [data-onward], [data-save], [data-print-card], .decide, .row-acts { display: none !important; }
  [estilo-side-frame] { display: block; }
  [contra-main] > [rst-page] { max-inline-size: none; padding: 0; }
  .panel, .items, .fields, .stat, .cards > li, .note, [data-kind="warning"], [data-notice], .chip {
    background: #fff !important;
    border-color: #000 !important;
    box-shadow: none !important;
    color: #000 !important;
  }
  [data-kit] { background: #fff; border: 2px solid #000; color: #000; font-size: 14pt; }
  a { color: #000; }
}
