/*
 * GRIB Mail admin — Monolith design system.
 * Spec: DESIGN.md (repo root).
 * No icons, no cards, no shadows, no uppercase shouting. One accent.
 */

:root {
  --bone:        #fafaf7;
  --bone-raised: #f1f0eb;
  --bone-sunken: #ebeae3;
  --ink:         #0e0e0e;
  --ink-soft:    #2a2a2a;  /* one-tier-lighter ink for button hover */
  --ink-muted:   #666661;
  --ink-faint:   #a8a7a1;
  --accent:      #2c4ffe;
  --hairline:    #e3e2dd;

  --font-sans: 'Geist', -apple-system, system-ui, sans-serif;
  --font-mono: 'Geist Mono', ui-monospace, 'JetBrains Mono', Menlo, monospace;

  /* Semantic type scale. Fixed rem sizes (per typeset/product register —
   * fluid clamp() undermines spatial predictability in dense UI). One
   * family carries the chrome; mono carries the data; same scale ratios
   * for both. Step ratio: ~1.2 in the small range, ~1.5 in the display
   * range — strong hierarchy without a flat ramp. */
  --type-caption-size:    0.6875rem;  /* 11px — footer, gutter footnotes      */
  --type-caption-lh:      1.4;
  --type-mono-size:       0.8125rem;  /* 13px — mono data: timestamps, IDs    */
  --type-mono-lh:         1.4;
  --type-label-size:      0.75rem;    /* 12px — input labels, stat captions   */
  --type-label-lh:        1.35;
  --type-body-size:       0.9375rem;  /* 15px — nav, sub-lines, table prose   */
  --type-body-lh:         1.5;
  --type-subhead-size:    1.125rem;   /* 18px — section subheaders            */
  --type-subhead-lh:      1.3;
  --type-heading-size:    2rem;       /* 32px — mid-page headings ("mail-01") */
  --type-heading-lh:      1.05;
  --type-display-size:    2.5rem;     /* 40px — stat numbers                  */
  --type-display-lh:      1.0;
  --type-banner-size:     4rem;       /* 64px — page title ("сегодня.")       */
  --type-banner-lh:       0.95;

  --gutter: 7vw;
  --rhythm-major: 96px;
  --rhythm-minor: 32px;

  /* The asymmetric gutter column that footnotes hang in. Used by .header,
   * .lane, .stats, .storage so every section's main content starts at the
   * same x-coordinate. Changing one number here re-aligns the whole page. */
  --col-gutter: 192px;
  --col-gap: 32px;

  /* Motion tokens. Per product register: 200-320ms is the productive band —
   * faster reads as jank, slower stalls the operator in their task. */
  --motion-fast: 120ms;  /* hover feedback */
  --motion-base: 200ms;  /* state changes, page crossfade */
  --motion-slow: 320ms;  /* layout shifts (accordion, disclosure) */
  --ease-out-quart: cubic-bezier(0.25, 1, 0.5, 1);
  --ease-out-quint: cubic-bezier(0.22, 1, 0.36, 1);
}

/* ─── motion: cross-document view transitions ────────────────────────── */
/* Native browser-driven crossfade between pages. Chrome/Edge 129+ and
 * Safari 18+ honour the @view-transition rule on cross-document navigation;
 * Firefox and older browsers ignore it — no JS, no choreography, no jank.
 * .topbar / .footer get named so the persistent chrome stays planted while
 * everything else fades. .header gets a name so the headline pixels morph
 * in place rather than being lumped into the page-wide crossfade. The
 * active nav link gets a name so its underline indicator slides between
 * items as the operator clicks through nav. */
@view-transition {
  navigation: auto;
}

::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: var(--motion-base);
  animation-timing-function: var(--ease-out-quart);
}

.topbar              { view-transition-name: topbar; }
.footer              { view-transition-name: footer; }
.header              { view-transition-name: page-header; }
.topbar__nav a.is-active { view-transition-name: nav-active; }

/* ─── motion: <details> disclosure (form-section) ─────────────────────── */
/* Animate every direct child except <summary> on each [open] flip. Does NOT
 * require interpolate-size or ::details-content — works in any browser with
 * CSS animations. Form snaps to its natural height (no layout transition)
 * but content fades + slides in over the disclosure, which reads as a
 * deliberate reveal rather than a snap. Close is intentionally instant. */
details.form-section[open] > *:not(summary) {
  animation: form-disclose var(--motion-slow) var(--ease-out-quart);
}
@keyframes form-disclose {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ─── motion: page fade-in ────────────────────────────────────────────── */
/* Broad-compat fallback for browsers without cross-document view
 * transitions. Body fades in on every fresh page — login, dashboard,
 * sub-routes, redirects after form POST. Browsers that DO honour
 * @view-transition above get the nicer crossfade with persistent chrome
 * (topbar/footer/nav-active/page-header stay planted). The two animations
 * compose without visible glitch — both are ~200ms ease-out. */
body {
  animation: page-in var(--motion-base) var(--ease-out-quart);
}
@keyframes page-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0ms !important;
    animation-duration: 0ms !important;
  }
  /* The * selector doesn't reach view-transition pseudo-elements. Glue them
   * down explicitly so motion-sensitive users actually get instant page
   * swaps. The body and details disclosure use @keyframes named
   * page-in/form-disclose — `*` already kills those via animation-duration.
   */
  ::view-transition-old(*),
  ::view-transition-new(*),
  ::view-transition-group(*) {
    animation-duration: 0.01ms !important;
  }
}

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

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  border-radius: 0;
}

/* Keep the rem base at the user-agent default (typically 16px) so user
 * font-size preferences and the type-token scale agree. Body inherits
 * the body token; everything else uses tokens by class. */
html, body {
  background: var(--bone);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: var(--type-body-size);
  line-height: var(--type-body-lh);
  font-feature-settings: 'ss01', 'cv11';
  font-variant-numeric: tabular-nums;
  font-kerning: normal;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: inherit;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  text-decoration-color: var(--ink-faint);
  transition: text-decoration-color 100ms linear, color 100ms linear;
}
a:hover {
  text-decoration-color: var(--ink);
}

code, pre, .mono {
  font-family: var(--font-mono);
}

button {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
}

/* ─── chrome ─────────────────────────────────────────────────────────── */

.topbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 32px;
  height: 64px;
  padding: 0 var(--gutter);
  border-bottom: 1px solid var(--hairline);
  background: var(--bone);
}
.topbar__brand {
  font-size: var(--type-body-size);
  font-weight: 500;
  letter-spacing: -0.01em;
}
.topbar__brand-suffix {
  color: var(--ink-muted);
  font-weight: 400;
}
.topbar__nav {
  display: flex;
  gap: 12px;
  font-size: var(--type-body-size);
  color: var(--ink-muted);
  white-space: nowrap;
}
.topbar__nav a {
  color: var(--ink-muted);
  text-decoration: none;
  padding: 4px 0;
  border-bottom: 2px solid transparent;
  transition: color 100ms linear, border-color 100ms linear;
}
.topbar__nav a:hover {
  color: var(--ink);
}
.topbar__nav a.is-active {
  color: var(--ink);
  border-bottom-color: var(--accent);
}
.topbar__sep {
  color: var(--ink-faint);
}
.topbar__user {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: var(--type-mono-size);
  color: var(--ink-muted);
}
.topbar__user .mono {
  font-size: var(--type-mono-size);
}
.topbar__logout {
  background: none;
  border: 0;
  padding: 0;
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--ink-faint);
  cursor: pointer;
  font: inherit;
}
.topbar__logout:hover {
  text-decoration-color: var(--ink);
}

/* ─── page shell ─────────────────────────────────────────────────────── */

main {
  padding: 48px var(--gutter) 0;
}

.page {
  max-width: 1280px;
  margin: 0 auto;
}

.section {
  margin-top: var(--rhythm-major);
}
.section:first-child {
  margin-top: 0;
}

.section-label {
  font-size: var(--type-label-size);
  color: var(--ink-muted);
  margin-bottom: 24px;
}

/* ─── page header (asymmetric, with footnote gutter) ─────────────────── */

.header {
  display: grid;
  grid-template-columns: var(--col-gutter) 1fr auto;
  gap: var(--col-gap);
  align-items: end;
  margin-bottom: var(--rhythm-major);
}
.header__gutter {
  font-family: var(--font-mono);
  font-size: var(--type-caption-size);
  line-height: var(--type-caption-lh);
  color: var(--ink-muted);
  padding-bottom: 12px;
}
.header__gutter > div + div {
  margin-top: 4px;
}
.header__main {
  min-width: 0;
}
.headline {
  font-family: var(--font-sans);
  font-size: var(--type-banner-size);
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: var(--type-banner-lh);
  color: var(--ink);
}
.headline__sub {
  margin-top: 20px;
  font-size: var(--type-subhead-size);
  line-height: var(--type-subhead-lh);
  color: var(--ink-muted);
  max-width: 60ch;
}
.header__actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
  font-size: var(--type-body-size);
  padding-bottom: 12px;
}
.action-link {
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  font: inherit;
  font-size: var(--type-body-size);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.action-link--primary {
  color: var(--accent);
  font-weight: 500;
  text-decoration-color: var(--accent);
}
.action-link--primary:hover {
  text-underline-offset: 5px;
}
.action-link--secondary {
  color: var(--ink-muted);
  text-decoration-color: var(--ink-faint);
}
.action-link--secondary:hover {
  color: var(--ink);
  text-decoration-color: var(--ink);
}

/* ─── stat strip ─────────────────────────────────────────────────────── */

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 48px;
  margin-bottom: var(--rhythm-major);
  /* align stats under .header__main: gutter + gap = 224px from page edge */
  padding-left: calc(var(--col-gutter) + var(--col-gap));
}
.stat__num {
  font-family: var(--font-sans);
  font-size: var(--type-display-size);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: var(--type-display-lh);
  color: var(--ink);
}
.stat__num--mono {
  font-family: var(--font-mono);
  font-weight: 500;
  letter-spacing: -0.01em;
}
.stat__num--accent {
  color: var(--accent);
}
.stat__label {
  margin-top: 12px;
  font-size: var(--type-label-size);
  color: var(--ink-muted);
}
.stat__sub {
  margin-top: 4px;
  font-family: var(--font-mono);
  font-size: var(--type-caption-size);
  color: var(--ink-faint);
}

/* ─── tables (ledger style) ──────────────────────────────────────────── */

.ledger {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--type-body-size);
}
.ledger thead th {
  text-align: left;
  font-weight: 400;
  font-size: var(--type-label-size);
  color: var(--ink-muted);
  padding: 0 16px 12px 0;
  border-bottom: 1px solid var(--hairline);
}
.ledger thead th.num {
  text-align: right;
}
.ledger tbody td {
  padding: 14px 16px 14px 0;
  vertical-align: top;
  color: var(--ink);
}
.ledger tbody td.num {
  text-align: right;
  font-family: var(--font-mono);
  font-size: var(--type-mono-size);
}
.ledger tbody td.mono {
  font-family: var(--font-mono);
  font-size: var(--type-mono-size);
}
.ledger tbody tr:hover {
  background: var(--bone-raised);
}
/* Actions column — pushes the inline-flex .row-actions span to the right
 * edge so destructive buttons line up vertically across rows regardless of
 * how many siblings each row has. */
.ledger thead th.actions,
.ledger tbody td.actions {
  text-align: right;
}

/* ─── status dots & DNS ──────────────────────────────────────────────── */

.status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: var(--type-mono-size);
  color: var(--ink);
}
.status::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ink);
}
.status--disabled {
  color: var(--ink-muted);
}
.status--disabled::before {
  background: transparent;
  box-shadow: inset 0 0 0 1px var(--ink-faint);
}
.status--attention {
  color: var(--ink);
}
.status--attention::before {
  background: var(--accent);
}

.dns {
  display: inline-flex;
  gap: 6px;
}
.dns__dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ink);
}
.dns__dot--off {
  background: transparent;
  box-shadow: inset 0 0 0 1px var(--ink-faint);
}
.dns__dot--bad {
  background: var(--accent);
}
/* Honest "no DNS check has run" cell. A single faint em-dash beats four
 * ghost dots that read ambiguously as "all-passes" or "all-checks". The
 * column header itself ("dns") provides the meaning, so no tooltip needed. */
.dns--unknown {
  font-family: var(--font-mono);
  font-size: var(--type-mono-size);
  color: var(--ink-faint);
}

/* Inline marker on the primary domain row. Sans (chrome, not data) and
 * --ink-faint so it sits politely next to the mono domain name without
 * competing for attention. */
.tag-primary {
  margin-left: 12px;
  font-size: var(--type-caption-size);
  color: var(--ink-faint);
  font-family: var(--font-sans);
}

/* ─── activity ──────────────────────────────────────────────────────── */

.activity {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.activity__day {
  margin-top: 28px;
  padding-bottom: 6px;
  font-family: var(--font-mono);
  font-size: var(--type-label-size);
  color: var(--ink-muted);
  border-bottom: 1px solid var(--hairline);
}
.activity__day:first-child {
  margin-top: 0;
}
.activity__row {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 20px;
  font-size: var(--type-body-size);
  align-items: baseline;
}
.activity__time {
  font-family: var(--font-mono);
  font-size: var(--type-mono-size);
  color: var(--ink-muted);
}
.activity__msg {
  color: var(--ink);
  line-height: var(--type-body-lh);
  max-width: 65ch;
}
.activity__msg .mono {
  font-size: var(--type-mono-size);
}
.activity__empty {
  color: var(--ink-faint);
  font-size: var(--type-body-size);
}

/* ─── node block ─────────────────────────────────────────────────────── */

.node {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.node__name {
  font-family: var(--font-sans);
  font-size: var(--type-heading-size);
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: var(--type-heading-lh);
  color: var(--ink);
}
.node__lines {
  display: grid;
  grid-template-columns: auto auto;
  column-gap: 14px;
  row-gap: 6px;
  font-size: var(--type-mono-size);
  color: var(--ink-muted);
  width: max-content;
}
.node__lines dt {
  color: var(--ink-muted);
}
.node__lines dd {
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: var(--type-mono-size);
}
.node__caption {
  margin-top: 8px;
  font-size: var(--type-mono-size);
  color: var(--ink-muted);
}

/* ─── lane (gutter label + main content) ─────────────────────────────── */

.lane {
  display: grid;
  grid-template-columns: var(--col-gutter) 1fr;
  gap: var(--col-gap);
  align-items: start;
  margin-bottom: var(--rhythm-major);
}
.lane__gutter {
  /* sans, not mono: per DESIGN.md "tiny lower-case sans label in the gutter"
   * — mono is reserved for technical data (timestamps, IDs), not section
   * labels which are chrome */
  font-family: var(--font-sans);
  font-size: var(--type-label-size);
  color: var(--ink-muted);
  padding-top: 12px;
}
.lane__body {
  min-width: 0;
}
.lane__note {
  margin-top: 14px;
  font-size: var(--type-label-size);
  color: var(--ink-faint);
}
.lane__empty {
  color: var(--ink-faint);
}
.lane__empty a {
  color: var(--ink);
}

/* ─── storage ────────────────────────────────────────────────────────── */

.storage {
  display: grid;
  gap: 18px;
  margin-bottom: var(--rhythm-major);
  padding-left: calc(var(--col-gutter) + var(--col-gap));
}
.storage__row {
  display: grid;
  grid-template-columns: 280px 1fr 120px;
  gap: 24px;
  align-items: center;
  font-size: var(--type-mono-size);
}
.storage__email {
  font-family: var(--font-mono);
  font-size: var(--type-mono-size);
  color: var(--ink);
}
.storage__bar {
  position: relative;
  height: 1px;
  background: var(--hairline);
}
.storage__bar::after {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  width: var(--w, 0%);
  background: var(--ink);
}
.storage__bar--over::after {
  background: var(--accent);
}
.storage__size {
  text-align: right;
  font-family: var(--font-mono);
  font-size: var(--type-mono-size);
  color: var(--ink);
}
.storage__size--over {
  color: var(--accent);
}

/* ─── footer ─────────────────────────────────────────────────────────── */

.footer {
  margin-top: var(--rhythm-major);
  padding: 24px var(--gutter);
  border-top: 1px solid var(--hairline);
  text-align: center;
  font-family: var(--font-mono);
  font-size: var(--type-caption-size);
  color: var(--ink-muted);
}
.footer .sep {
  color: var(--ink-faint);
  margin: 0 8px;
}

/* ─── login screen ───────────────────────────────────────────────────── */
/* Echoes the dashboard's gutter+main asymmetry: a small mono wordmark
 * hangs in the left "footnote" gutter, the form sits in a narrow right-
 * leaning column, and the rest of the viewport is intentionally empty.
 * The page should feel like the title page of a printed manual, not a
 * SaaS sign-in modal centered in a void.
 */

.auth {
  max-width: 1280px;
  margin: 0 auto;
  padding: 96px var(--gutter) 96px;
  display: grid;
  grid-template-columns: 192px minmax(280px, 380px);
  gap: 32px;
  align-items: start;
}
.auth__gutter {
  font-family: var(--font-mono);
  font-size: var(--type-caption-size);
  color: var(--ink-muted);
  line-height: var(--type-caption-lh);
  padding-top: 22px; /* optical baseline-align with the headline */
}
.auth__gutter > div + div { margin-top: 4px; }

.auth__main {
  min-width: 0;
}

.auth h1 {
  font-size: var(--type-banner-size);
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: var(--type-banner-lh);
  margin: 0 0 16px;
}
.auth__sub {
  font-size: var(--type-subhead-size);
  line-height: var(--type-subhead-lh);
  color: var(--ink-muted);
  margin: 0 0 48px;
  max-width: 50ch;
}

.auth__field {
  margin-bottom: 28px;
}
.auth__field label {
  display: block;
  font-size: var(--type-label-size);
  color: var(--ink-muted);
  margin-bottom: 10px;
}
/* Default: hairline. Hover: ink. Focus: accent (per DESIGN.md). */
.auth__field input {
  width: 100%;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--ink-faint);
  padding: 10px 0 9px;
  font: inherit;
  font-family: var(--font-mono);
  font-size: var(--type-body-size);
  color: var(--ink);
  outline: none;
  transition: border-color 100ms linear;
}
.auth__field input:hover {
  border-bottom-color: var(--ink);
}
.auth__field input:focus {
  border-bottom: 2px solid var(--accent);
  padding-bottom: 8px; /* preserve baseline as border thickens */
}

.auth__actions {
  margin-top: 40px;
}
.auth__btn {
  background: var(--ink);
  color: var(--bone);
  padding: 12px 24px;
  font: inherit;
  font-size: var(--type-body-size);
  font-weight: 500;
  cursor: pointer;
  transition: background-color 100ms linear;
  -webkit-appearance: none;
}
.auth__btn:hover {
  background: var(--ink-soft);
}
.auth__btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

/* Inline notice with a single 6px leading dot. Color of the dot is the
 * signal; the message itself stays in --ink so we don't burn the accent
 * budget on body text. Mirrors the .status pattern in tables.
 */
.auth__notice {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: var(--type-body-size);
  color: var(--ink);
  line-height: var(--type-body-lh);
  margin: 0 0 28px;
}
.auth__notice::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}
.auth__notice--muted {
  color: var(--ink-muted);
}
.auth__notice--muted::before {
  background: var(--ink-faint);
}

@media (max-width: 720px) {
  .auth {
    grid-template-columns: 1fr;
    padding: 48px var(--gutter) 64px;
  }
  .auth__gutter { padding-top: 0; }
  .auth h1 { font-size: 2.75rem; /* 44px — slightly tighter on phones */ }
}

/* ─── forms (CRUD pages, account, edit screens) ───────────────────────── */
/* Mirror of .auth__field but composable into a grid. Underline-only inputs,
 * sans labels above, no boxes anywhere — same visual vocabulary as login. */

.form {
  display: grid;
  grid-template-columns: minmax(240px, 420px);
  gap: 28px;
  max-width: 540px;
}
.form__field {
  display: grid;
  gap: 10px;
  min-width: 0;
}
.form__field > label {
  font-size: var(--type-label-size);
  color: var(--ink-muted);
}
.form__field input,
.form__field select,
.form__field textarea {
  width: 100%;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--ink-faint);
  padding: 8px 0 7px;
  font: inherit;
  font-family: var(--font-mono);
  font-size: var(--type-body-size);
  color: var(--ink);
  outline: none;
  transition: border-color 100ms linear;
  -webkit-appearance: none;
  appearance: none;
}
.form__field select {
  /* native chevron is platform-inconsistent; render a small mono caret */
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-muted) 50%),
                    linear-gradient(-45deg, transparent 50%, var(--ink-muted) 50%);
  background-position: calc(100% - 8px) center, calc(100% - 4px) center;
  background-size: 4px 4px;
  background-repeat: no-repeat;
  padding-right: 18px;
}
.form__field textarea {
  resize: vertical;
  min-height: 90px;
  font-family: var(--font-mono);
  line-height: 1.5;
}
.form__field input:hover,
.form__field select:hover,
.form__field textarea:hover {
  border-bottom-color: var(--ink);
}
.form__field input:focus,
.form__field select:focus,
.form__field textarea:focus {
  border-bottom: 2px solid var(--accent);
  padding-bottom: 6px;
}
.form__field--checkbox {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 12px;
  grid-template-columns: none;
}
.form__field--checkbox input[type="checkbox"] {
  width: 16px;
  height: 16px;
  border-bottom: 0;
  padding: 0;
  accent-color: var(--accent);
  margin: 0;
  flex-shrink: 0;
}
.form__field--checkbox > label {
  margin: 0;
  font-size: var(--type-body-size);
  color: var(--ink);
}
.form__hint {
  font-size: var(--type-caption-size);
  color: var(--ink-faint);
  font-family: var(--font-sans);
}
.form__actions {
  display: flex;
  align-items: center;
  gap: 24px;
  margin-top: 12px;
  flex-wrap: wrap;
}
.form__cancel {
  color: var(--ink-muted);
  text-decoration: underline;
  text-decoration-color: var(--ink-faint);
  text-underline-offset: 3px;
  font-size: var(--type-body-size);
  transition: color 100ms linear, text-decoration-color 100ms linear;
}
.form__cancel:hover {
  color: var(--ink);
  text-decoration-color: var(--ink);
}

/* Inline disclosure for "new X" forms — avoids modal-dialog ceremony. The
 * summary is the action-link itself, styled like .action-link--primary. */
.form-section > summary {
  cursor: pointer;
  display: inline-block;
  font-size: var(--type-body-size);
  color: var(--accent);
  font-weight: 500;
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-underline-offset: 3px;
  list-style: none;
  margin-bottom: 0;
  transition: text-underline-offset 100ms linear;
}
.form-section > summary::-webkit-details-marker { display: none; }
.form-section > summary::marker { content: ""; }
.form-section > summary:hover {
  text-underline-offset: 5px;
}
.form-section[open] > summary {
  color: var(--ink-muted);
  text-decoration-color: var(--ink-faint);
  margin-bottom: 28px;
}
.form-section[open] > summary:hover {
  color: var(--ink);
}

/* Solid-fill primary submit. Same as .auth__btn but a touch denser. */
.btn {
  background: var(--ink);
  color: var(--bone);
  padding: 10px 22px;
  font: inherit;
  font-size: var(--type-body-size);
  font-weight: 500;
  cursor: pointer;
  border: 0;
  transition: background-color 100ms linear;
  -webkit-appearance: none;
}
.btn:hover { background: var(--ink-soft); }
.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}
.btn--ghost {
  background: none;
  color: var(--ink-muted);
  padding: 0;
  text-decoration: underline;
  text-decoration-color: var(--ink-faint);
  text-underline-offset: 3px;
  font-weight: 400;
}
.btn--ghost:hover {
  background: none;
  color: var(--ink);
  text-decoration-color: var(--ink);
}

/* Row of action links in a table cell. Each child reads as an underlined
 * text link in lower case — destructive ones use .is-destructive to bump
 * to --ink (the spec way to flag danger without burning color). */
.row-actions {
  display: inline-flex;
  gap: 16px;
  align-items: center;
  font-size: var(--type-body-size);
  /* Keep all actions on one line — wrap pushed destructive buttons to a new
   * row when the neighbouring data column was wide (e.g. alias destinations
   * list). The data column is what should wrap, not the action labels. */
  white-space: nowrap;
}
.row-actions form { display: inline; margin: 0; }
.row-actions a,
.row-actions button {
  background: none;
  border: 0;
  padding: 0;
  color: var(--ink-muted);
  font: inherit;
  font-size: var(--type-body-size);
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: var(--ink-faint);
  text-underline-offset: 3px;
  white-space: nowrap;
  transition: color 100ms linear, text-decoration-color 100ms linear;
}
.row-actions a:hover,
.row-actions button:hover {
  color: var(--ink);
  text-decoration-color: var(--ink);
}
.row-actions .is-destructive {
  color: var(--ink);
}

/* dl-style key/value list — used on /account profile and edit screens for
 * displaying immutable identity data. */
.kv {
  display: grid;
  grid-template-columns: auto auto;
  column-gap: 28px;
  row-gap: 10px;
  align-items: baseline;
  width: max-content;
  margin: 0;
}
.kv dt {
  font-size: var(--type-label-size);
  color: var(--ink-muted);
}
.kv dd {
  font-family: var(--font-mono);
  font-size: var(--type-mono-size);
  color: var(--ink);
  margin: 0;
}

/* Inline notice line — same dot-prefix vocabulary as .auth__notice. */
.notice {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: var(--type-body-size);
  color: var(--ink);
  margin-bottom: 28px;
  line-height: var(--type-body-lh);
}
.notice::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ink);
  flex-shrink: 0;
}
.notice--accent::before { background: var(--accent); }
.notice--muted { color: var(--ink-muted); }
.notice--muted::before { background: var(--ink-faint); }

/* Plain prose lists used on /setup. No bullets — let the bold lead-in carry
 * the structure. */
.hints {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 18px;
  max-width: 70ch;
}
.hints li {
  font-size: var(--type-body-size);
  line-height: var(--type-body-lh);
  color: var(--ink);
}
.hints li strong {
  font-weight: 600;
}
.hints li .mono {
  font-family: var(--font-mono);
  font-size: var(--type-mono-size);
}

/* ─── narrow viewports (~laptop, tablet) ────────────────────────────── */
/* The operator works on desktop per PRODUCT.md, but a narrow-viewport
 * pass keeps the page readable on a 13" laptop or a glance from a phone.
 * We collapse the gutter into the main column rather than redesign for
 * mobile — the goal is "still legible", not "mobile-first". */
@media (max-width: 960px) {
  .header {
    grid-template-columns: 1fr;
    gap: 16px;
    align-items: start;
  }
  .header__gutter {
    padding-bottom: 0;
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
  }
  .header__gutter > div + div { margin-top: 0; }
  .header__actions {
    flex-direction: row;
    align-items: flex-start;
    gap: 20px;
    padding-bottom: 0;
  }
  .stats {
    padding-left: 0;
    grid-template-columns: 1fr 1fr;
    gap: 32px;
  }
  .lane {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .lane__gutter { padding-top: 0; }
  .storage { padding-left: 0; }
  .ledger {
    /* prevent horizontal overflow on narrow tables */
    font-size: var(--type-label-size);
  }
  .activity__row {
    grid-template-columns: 80px 1fr;
    gap: 14px;
  }
  .form { grid-template-columns: 1fr; max-width: none; }
  .row-actions { gap: 12px; font-size: var(--type-label-size); }
}

