/*
 * Page layouts: the signed-in app shell (core/app.html), the sign-in layout (core/auth.html)
 * and error pages. Layout beats components in the cascade, so it can place and hide them.
 */
@layer layout {

  /* ---------- App shell ---------- */
  /* --topbar-h: the top bar's height. Page header bands slide up under it by this much. */
  .app { --topbar-h: 75px; min-height: 100dvh; }
  @media (min-width: 960px) {
    .app {
      display: grid; grid-template-columns: 272px minmax(0, 1fr);
      transition: grid-template-columns var(--bp-dur-tide) var(--bp-ease-tide);
    }
  }

  .bp-skip {
    position: absolute; left: var(--space-4); top: var(--space-4); z-index: 100;
    padding: var(--space-2) var(--space-4); border-radius: var(--radius-pill);
    background: var(--ink); color: var(--ink-inverse); font-weight: 600; text-decoration: none;
    transform: translateY(-200%);
  }
  .bp-skip:focus-visible { transform: none; }

  /* The sidebar column runs the full page height; the nav inside it sticks to the viewport.
     On small screens the column steps aside and the nav is a popover drawer. */
  .app-sidebar { display: contents; }
  .app-nav {
    display: flex; flex-direction: column; gap: var(--space-6);
    padding: var(--space-5);
    background: var(--paper-subtle);
  }
  .app-nav[popover] {
    inset: 0 auto 0 0; margin: 0; height: 100dvh; width: min(320px, 88vw);
    color: var(--ink); border: 0; border-right: 1px solid var(--line);
    box-shadow: var(--shadow-float);
  }
  .app-nav[popover]::backdrop { background: rgb(15 20 17 / .4); }
  @media (max-width: 959px) {
    .app-nav[popover]:not(:popover-open) { display: none; }
  }
  @media (min-width: 960px) {
    /* A low ridgeline along the foot of the sidebar column; the wordmark sits above it. */
    .app-sidebar {
      display: block; border-right: 1px solid var(--line);
      background: url("../brand/motifs/ridge-sidebar-light.a53b2789e58a.svg") bottom / 100% 64px no-repeat, var(--paper-subtle);
    }
    [data-theme="dark"] .app-sidebar { background-image: url("../brand/motifs/ridge-sidebar-dark.a1ee0ccff086.svg"); }
    .app-nav[popover] {
      display: flex; position: sticky; inset: auto; top: 0; width: auto; /* inset first: it resets top */
      height: 100dvh; box-shadow: none; overflow-y: auto;
      background: transparent; border-right: 0;
    }
    .app-nav-footer { padding-bottom: 52px; }
    .app-nav-close, .app-nav-open { display: none; }
  }
  @media (min-width: 960px) and (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .app-sidebar { background-image: url("../brand/motifs/ridge-sidebar-dark.a1ee0ccff086.svg"); }
  }

  .app-brand { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); }
  .app-brand a { display: block; color: inherit; }
  .app-nav-section { display: grid; gap: var(--space-1); }
  /* Section names: the brand's eyebrow with a hairline running to the edge. */
  .app-nav-section .bp-eyebrow { display: flex; align-items: center; gap: var(--space-3); padding: 0 var(--space-3) var(--space-2); }
  .app-nav-section .bp-eyebrow::after { content: ""; flex: 1; height: 1px; background: var(--line); }
  .app-nav-link {
    display: flex; align-items: center; gap: var(--space-3);
    padding: var(--space-2) var(--space-3); border-radius: var(--radius-pill);
    color: var(--ink); text-decoration: none; font-weight: 500; font-size: 15px;
    transition: background-color var(--bp-dur-quick) var(--bp-ease-tide), color var(--bp-dur-quick) var(--bp-ease-tide);
  }
  .app-nav-link:hover:not([aria-current="page"]) { background: var(--paper-raised); }
  .app-nav-link:hover:not([aria-current="page"]) .icon { transform: translateX(2px); }
  .app-nav-link:focus-visible { outline-offset: 2px; }
  /* The current page is a forest pill with faint contours: the surface a project tile turns
     into on hover, so "where you are" and "where you're going" look alike. */
  .app-nav-link[aria-current="page"] {
    background: var(--forest) url("../brand/motifs/contour-nav.f9771d6d8420.svg") right -40px center / 260px auto no-repeat;
    color: var(--on-forest); font-weight: 600;
  }
  .app-nav-link .icon { width: 18px; height: 18px; transition: transform var(--bp-dur-quick) var(--bp-ease-tide); }
  @media (prefers-reduced-motion: reduce) {
    .app-nav-link, .app-nav-link .icon { transition: none; }
    .app-nav-link:hover .icon { transform: none; }
  }
  .app-nav-count {
    margin-left: auto; min-width: 22px; padding: 1px 7px; border-radius: var(--radius-pill);
    background: var(--ink); color: var(--ink-inverse); font: 600 12px/18px var(--font-sans); text-align: center;
    font-variant-numeric: tabular-nums;
  }
  .app-nav-link[aria-current="page"] .app-nav-count { background: var(--on-forest); color: var(--forest); }
  .app-nav-footer { margin-top: auto; }
  .app-nav-wordmark { width: 72px; height: auto; margin: 0 auto; color: var(--ink-muted); }
  .app-nav-mark { display: none; width: 30px; height: auto; margin: 0 auto; color: var(--ink-muted); }

  /* Folded sidebar (static/js/sidebar.js): an 80px icon rail. Each label becomes the link's
     tooltip; it stays in the accessibility tree, so the link keeps its name. */
  .sidebar-toggle { display: none; }
  @media (min-width: 960px) {
    .sidebar-toggle { display: inline-grid; }
    .app.is-collapsed { grid-template-columns: 80px minmax(0, 1fr); }
    .is-collapsed .app-sidebar { position: relative; z-index: 20; background-image: none; }
    .is-collapsed .app-nav[popover] { padding: var(--space-5) var(--space-3); overflow: visible; }
    .is-collapsed .app-brand { justify-content: center; }
    .is-collapsed .connect-lockup-name, .is-collapsed .app-nav-wordmark { display: none; }
    .is-collapsed .app-nav-mark { display: block; }
    .is-collapsed .app-nav-footer { padding-bottom: 0; }
    /* Section names shrink to a rule; screen readers still hear them. */
    .is-collapsed .app-nav-section .bp-eyebrow {
      height: 1px; padding: 0; margin: var(--space-1) var(--space-3) var(--space-2);
      overflow: hidden; font-size: 0; line-height: 0; background: var(--line);
    }
    .is-collapsed .app-nav-section .bp-eyebrow::after { content: none; }
    /* Links become 48px circles; the current one is a forest circle. */
    .is-collapsed .app-nav-link { position: relative; justify-content: center; width: 48px; height: 48px; justify-self: center; padding: 0; }
    .is-collapsed .app-nav-link[aria-current="page"] { background-size: 140px auto; background-position: center; }
    .is-collapsed .app-nav-count {
      position: absolute; top: 0; right: 4px;
      min-width: 18px; padding: 0 5px; font-size: 10px; line-height: 16px;
    }
    .is-collapsed .app-nav-label {
      position: absolute; left: calc(100% + 14px); top: 50%; z-index: 30;
      padding: 7px 10px; border-radius: var(--radius-sm);
      background: var(--ink); color: var(--ink-inverse); font: 500 12px/1 var(--font-sans); white-space: nowrap;
      opacity: 0; pointer-events: none; transform: translate(-4px, -50%);
      transition: opacity var(--bp-dur-quick), transform var(--bp-dur-quick);
    }
    .is-collapsed .app-nav-link:is(:hover, :focus-visible) .app-nav-label { opacity: 1; transform: translate(0, -50%); }
  }

  /* A size container, so a full-bleed band can reach its right edge past .app-content's cap. */
  .app-main { display: flex; flex-direction: column; min-width: 0; container-type: inline-size; }
  .app-topbar {
    position: sticky; top: 0; z-index: 10;
    display: flex; align-items: center; justify-content: space-between; gap: var(--space-4);
    min-height: var(--topbar-h);
    padding: var(--space-3) var(--fluid-gutter);
    background: color-mix(in srgb, var(--paper) 88%, transparent);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--line);
    transition: background-color 240ms var(--bp-ease-tide), border-color 240ms var(--bp-ease-tide), box-shadow 240ms var(--bp-ease-tide);
  }
  .app-topbar-start { display: flex; align-items: center; gap: var(--space-3); min-width: 0; }

  /* Breadcrumbs in the top bar (core/_breadcrumbs.html). The current page truncates first. */
  .breadcrumbs { min-width: 0; font-size: 14px; color: var(--ink-muted); }
  .breadcrumbs ol { display: flex; align-items: center; margin: 0; padding: 0; list-style: none; white-space: nowrap; }
  .breadcrumbs li { display: flex; align-items: center; gap: var(--space-2); min-width: 0; }
  .breadcrumbs li + li { margin-left: var(--space-2); }
  .breadcrumbs a { color: inherit; text-decoration: none; }
  .breadcrumbs a:hover { color: var(--ink); text-decoration: underline; }
  .breadcrumbs [aria-current] { overflow: hidden; text-overflow: ellipsis; color: var(--ink); font-weight: 600; }
  .breadcrumbs-sep { width: 14px; height: 14px; opacity: .5; }
  @media (max-width: 599px) { .breadcrumbs { display: none; } }
  .app-content {
    flex: 1;
    width: min(100%, 88rem);
    padding: var(--space-7) var(--fluid-gutter) var(--space-9);
    display: grid; align-content: start; gap: var(--fluid-stack);
  }
  /* Grid children default to min-width: auto, so one long unbreakable string (a URL) would
     widen the whole page on phones. Let content shrink and wrap instead. */
  .app-content > * { min-width: 0; }

  /* ---------- Page header motifs (cotton/page_header.html) ----------
     Desktop: faint contour rings behind the title, top right, fading out. `band` (Home) and every
     page header on phones: a forest band with contours and a ridgeline, running up under the
     see-through top bar (js/hero.js). Contours are CSS masks over a flat colour, so they follow
     the theme. */
  .app-content > .page-header { position: relative; isolation: isolate; }
  .app-content > .page-header::before {
    content: ""; position: absolute; z-index: -1; pointer-events: none;
    right: calc(-1 * var(--fluid-gutter)); top: calc(-1 * var(--space-7));
    width: min(560px, 70%); height: 240px; background: var(--line);
    mask: url("../brand/motifs/contour-header.6bf72c10e36c.svg") center / cover no-repeat,
          radial-gradient(closest-side at 72% 40%, #000 30%, transparent);
    mask-composite: intersect;
  }
  .page-header-ridge { display: none; }

  /* The forest band. Components inside recolour themselves through the on-forest tokens. */
  .app-content > .page-header-band {
    --ink: #f4f5f1; --ink-muted: #a9c4b8; --ink-inverse: #0f1411;
    --line: rgb(244 245 241 / .16); --line-control: rgb(244 245 241 / .55); --line-strong: #f4f5f1;
    --focus: #f4f5f1; --paper-subtle: rgb(244 245 241 / .1); --paper-raised: rgb(244 245 241 / .08);
    overflow: hidden; background: var(--forest); color: var(--ink);
    margin: calc(-1 * (var(--topbar-h) + var(--space-7))) calc(-1 * var(--fluid-gutter)) 0;
    padding: calc(var(--topbar-h) + var(--space-7)) var(--fluid-gutter) calc(var(--space-7) + 72px);
    /* Full bleed on wide screens: .app-content stops at 88rem, so the band reaches on to the
       window's edge (100cqw is .app-main's width; 100% here is the content column's), and its
       contents spread with it: the actions line up with the account button above. */
    margin-right: calc(var(--fluid-gutter) + 100% - 100cqw);
  }
  .app-content > .page-header-band::before {
    top: 0; right: 0; width: 70%; height: 100%; background: rgb(244 245 241 / .14);
    mask: url("../brand/motifs/contour-band.c6679a4a6d78.svg") center / cover no-repeat,
          linear-gradient(to left, #000 40%, transparent);
    mask-composite: intersect;
  }
  .app-content > .page-header-band .page-header-ridge {
    display: block; position: absolute; z-index: -1; inset: auto 0 -1px 0; height: 104px;
    background: url("../brand/motifs/ridge-band.ca194f0fb38d.svg") bottom / 100% 100% no-repeat;
  }
  /* The band ends in the ridgeline: its front ridge is the page itself, rising into the band
     like a shoreline. It takes the page colour, so it works in both themes. */
  .app-content > .page-header-band .page-header-ridge::after {
    content: ""; position: absolute; inset: 0; background: var(--paper);
    mask: url("../brand/motifs/ridge-band-front.dd9ed53900fb.svg") bottom / 100% 100% no-repeat;
  }

  /* The top bar over a band: see-through while the band is behind it, then solid again. The
     on-forest colours go on the bar's own controls only, never the account menu that opens from it. */
  .app-main:has(> .app-content > .page-header-band) > .app-topbar.is-over-hero {
    background: transparent; border-bottom-color: transparent; backdrop-filter: none;
  }
  .app-main:has(> .app-content > .page-header-band) > .app-topbar.is-over-hero > :is(.app-topbar-start, .user-btn) {
    --ink: #f4f5f1; --ink-muted: #a9c4b8; --line-control: rgb(244 245 241 / .55); --line-strong: #f4f5f1;
    --focus: #f4f5f1; --paper-subtle: rgb(244 245 241 / .1);
  }
  .app-main:has(> .app-content > .page-header-band) > .app-topbar.is-over-hero .avatar { background: rgb(244 245 241 / .16); }
  /* While the bar is see-through, the header scrolls up underneath it: its buttons get a solid
     forest backing so the title never shows through them. */
  .app-main:has(> .app-content > .page-header-band) > .app-topbar.is-over-hero :is(.app-topbar-start .icon-btn, .user-btn) {
    background: var(--forest);
  }

  /* Phones: every page header is a band, and the page rises over it on a sheet whose rounded
     top edge is the band's ::after. The top bar is forest to match. */
  @media (max-width: 599px) {
    .app-content > .page-header {
      --ink: #f4f5f1; --ink-muted: #a9c4b8; --ink-inverse: #0f1411;
      --line: rgb(244 245 241 / .16); --line-control: rgb(244 245 241 / .55); --line-strong: #f4f5f1;
      --focus: #f4f5f1; --paper-subtle: rgb(244 245 241 / .1); --paper-raised: rgb(244 245 241 / .08);
      display: flex; flex-direction: column; gap: var(--space-3);
      overflow: hidden; background: var(--forest); color: var(--ink);
      margin: calc(-1 * (var(--topbar-h) + var(--space-7))) calc(-1 * var(--fluid-gutter)) 0;
      padding: calc(var(--topbar-h) + var(--space-4)) var(--fluid-gutter) calc(var(--space-7) + 28px);
      border-radius: 0;
    }
    .app-content > .page-header::before {
      top: 0; right: 0; width: 100%; height: 100%; background: rgb(244 245 241 / .13);
      mask: url("../brand/motifs/contour-header.6bf72c10e36c.svg") center / cover no-repeat,
            linear-gradient(to left, #000 30%, transparent 95%);
      mask-composite: intersect;
    }
    .app-content > .page-header .page-header-ridge {
      display: block; position: absolute; z-index: -1; inset: auto 0 18px 0; height: 64px;
      background: url("../brand/motifs/ridge-band.ca194f0fb38d.svg") bottom / 100% 100% no-repeat;
    }
    .app-content > .page-header .page-header-ridge::after { display: none; } /* the sheet is the shore here */
    .app-content > .page-header::after {
      content: ""; position: absolute; inset: auto 0 0 0; height: 28px;
      border-radius: 28px 28px 0 0; box-shadow: 0 -12px 30px -18px rgb(0 0 0 / .45);
      background: var(--paper);
    }
    .app-content > .page-header .page-header-row { display: contents; }
    .app-content > .page-header .page-title { font-size: clamp(1.75rem, 1.2rem + 3vw, 2.25rem); }
    .app-content > .page-header .page-lead { order: 2; }
    .app-content > .page-header .page-actions { order: 3; margin-top: var(--space-2); }

    .app-topbar {
      background: var(--forest); border-bottom-color: transparent; backdrop-filter: none;
      box-shadow: 0 8px 20px -14px rgb(0 0 0 / .55);
    }
    .app-topbar > :is(.app-topbar-start, .user-btn) {
      --ink: #f4f5f1; --ink-muted: #a9c4b8; --line-control: rgb(244 245 241 / .55); --line-strong: #f4f5f1;
      --focus: #f4f5f1; --paper-subtle: rgb(244 245 241 / .1);
    }
    .app-topbar .avatar { background: rgb(244 245 241 / .16); }
    .app-topbar.is-over-hero { background: transparent; box-shadow: none; }
    .app-topbar.is-over-hero :is(.app-topbar-start .icon-btn, .user-btn) {
      background: var(--forest);
    }
  }

  /* Account button in the top bar (opens the user menu). */
  .avatar {
    display: inline-grid; place-items: center; width: 40px; height: 40px;
    border-radius: var(--radius-pill); background: var(--forest); color: var(--on-forest);
    font: 600 14px/1 var(--font-sans); letter-spacing: .02em;
  }
  .user-btn {
    display: inline-flex; align-items: center; gap: var(--space-3);
    padding: 4px 12px 4px 4px; border-radius: var(--radius-pill);
    border: 1px solid var(--line-control); background: transparent; color: var(--ink);
    font-weight: 600; font-size: 14px; cursor: pointer;
  }
  .user-btn:hover { border-color: var(--line-strong); }
  @media (max-width: 599px) { .user-btn-name { display: none; } .user-btn { padding-right: 4px; } }

  /* ---------- Sign-in layout (core/auth.html) ----------
     One forest scene behind the page: contours (a CSS mask), a moon and a ridgeline. The brand
     on the left, the form on a card on the right. Night colours in dark mode, where the card is
     deep green rather than black. Below 960px the card rises over the band as a sheet. */
  .auth {
    --scene-top: #1d4d38; --scene-bottom: #133526; --scene-line: rgb(244 245 241 / .12);
    --moon: rgb(244 245 241 / .9); --moon-glow: rgb(244 245 241 / 0);
    --ridge-1: #1a4634; --ridge-2: #123425; --ridge-3: #0d281c;
    --card: var(--paper-raised); --card-line: transparent;
    --card-shadow: 0 30px 60px -30px rgb(4 12 8 / .65), 0 2px 6px rgb(4 12 8 / .12);
    position: relative; isolation: isolate; overflow: hidden;
    display: grid; gap: var(--space-7) var(--space-8); min-height: 100dvh;
    grid-template-columns: minmax(0, 1fr) minmax(360px, 440px);
    grid-template-areas: "brand card" "foot foot";
    padding: var(--space-7) clamp(var(--space-6), 5vw, var(--space-9)) var(--space-5);
    background: linear-gradient(180deg, var(--scene-top), var(--scene-bottom)); color: var(--on-forest);
  }
  [data-theme="dark"] .auth {
    --scene-top: #10291e; --scene-bottom: #08150f; --scene-line: rgb(169 196 184 / .1);
    --moon: #e9efe6; --moon-glow: rgb(233 239 230 / .12);
    --ridge-1: #10261c; --ridge-2: #0a1a13; --ridge-3: #06110c;
    --card: color-mix(in srgb, var(--forest) 22%, var(--paper)); --card-line: rgb(244 245 241 / .09);
    --card-shadow: 0 30px 70px -30px rgb(0 0 0 / .8);
    --paper-raised: color-mix(in srgb, var(--forest) 12%, var(--paper));
  }
  @media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .auth {
      --scene-top: #10291e; --scene-bottom: #08150f; --scene-line: rgb(169 196 184 / .1);
      --moon: #e9efe6; --moon-glow: rgb(233 239 230 / .12);
      --ridge-1: #10261c; --ridge-2: #0a1a13; --ridge-3: #06110c;
      --card: color-mix(in srgb, var(--forest) 22%, var(--paper)); --card-line: rgb(244 245 241 / .09);
      --card-shadow: 0 30px 70px -30px rgb(0 0 0 / .8);
      --paper-raised: color-mix(in srgb, var(--forest) 12%, var(--paper));
    }
  }

  .auth-scene { position: absolute; inset: 0; z-index: -1; pointer-events: none; }
  .auth-scene::before {
    content: ""; position: absolute; inset: 0; background: var(--scene-line);
    mask: url("../brand/motifs/contour-auth.aee9d3eb58db.svg") center / cover no-repeat,
          linear-gradient(180deg, #000 55%, transparent 92%);
    mask-composite: intersect;
  }
  .auth-scene-moon {
    position: absolute; left: 38%; bottom: 96px; width: 76px; aspect-ratio: 1; border-radius: 50%;
    background: var(--moon); box-shadow: 0 0 60px 24px var(--moon-glow);
    animation: moonrise-rise var(--bp-dur-moon) var(--bp-ease-tide) both;
  }
  .scene-ridge { position: absolute; inset: auto 0 0 0; width: 100%; height: 190px; }
  .scene-ridge-1 { fill: var(--ridge-1); }
  .scene-ridge-2 { fill: var(--ridge-2); }
  .scene-ridge-3 { fill: var(--ridge-3); }

  .auth-brand { grid-area: brand; display: flex; flex-direction: column; justify-content: space-between; gap: var(--space-7); padding-bottom: 200px; }
  .auth-brand .connect-lockup { color: var(--on-forest); }
  .auth-brand-copy { display: grid; gap: var(--space-4); }
  .auth-brand-title {
    max-width: 11ch; font: 700 clamp(2.5rem, 1.6rem + 3vw, 4.25rem)/1 var(--font-display);
    letter-spacing: -.04em; text-wrap: balance;
  }
  .auth-brand-lead { max-width: 38ch; font-size: var(--fluid-lead); font-weight: 300; line-height: 1.5; color: var(--on-forest-muted); }

  .auth-card {
    grid-area: card; align-self: center; display: grid; gap: var(--space-5);
    padding: var(--space-7) var(--space-6); border-radius: var(--radius-lg);
    background: var(--card); color: var(--ink); border: 1px solid var(--card-line); box-shadow: var(--card-shadow);
  }
  .auth-card-head { display: grid; gap: var(--space-2); }
  .auth-card-title { font-size: 2rem; line-height: 1.05; font-weight: 700; letter-spacing: -.035em; }
  .auth-card-sub { color: var(--ink-muted); font-size: 15px; }
  .auth-help { padding-top: var(--space-4); border-top: 1px solid var(--line); color: var(--ink-muted); font-size: 14px; line-height: 1.55; }

  .auth-foot { grid-area: foot; display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); font-size: 13px; color: var(--on-forest-muted); }
  /* Light / Dark / System, before signing in (static/js/theme.js, same cookie as the app). */
  .theme-switch { display: inline-flex; gap: 2px; padding: 3px; border-radius: var(--radius-pill); background: rgb(4 12 8 / .28); }
  .theme-switch .theme-switch-option { width: 34px; height: 34px; color: var(--on-forest-muted); }
  .theme-switch .theme-switch-option:hover { background: transparent; color: var(--on-forest); }
  .theme-switch .theme-switch-option[aria-pressed="true"] { background: rgb(244 245 241 / .16); color: var(--on-forest); }
  .theme-switch .theme-switch-option .icon { width: 16px; height: 16px; }

  @media (max-width: 959px) {
    .auth {
      grid-template-columns: minmax(0, 1fr); grid-template-areas: "brand" "card" "foot";
      gap: 0; min-height: 0; padding: 0;
    }
    .auth-scene { position: relative; inset: auto; grid-area: brand; }
    .auth-scene::before { mask: url("../brand/motifs/contour-auth.aee9d3eb58db.svg") center / cover no-repeat; }
    .auth-scene::after { content: ""; position: absolute; inset: auto 0 0 0; height: 41px; background: var(--ridge-3); }
    .auth-scene-moon { left: auto; right: 20%; width: 56px; }
    .scene-ridge { bottom: 40px; height: 120px; }
    .auth-brand { position: relative; gap: var(--space-7); padding: var(--space-6) var(--space-5) 200px; }
    .auth-brand-title { font-size: clamp(2.25rem, 1.4rem + 4vw, 3rem); }
    .auth-card {
      position: relative; align-self: stretch; margin-top: -52px;
      padding: var(--space-7) var(--space-5) var(--space-6);
      border-width: 1px 0 0; border-radius: 28px 28px 0 0; box-shadow: 0 -14px 30px -18px rgb(0 0 0 / .5);
    }
    .auth-card > * { justify-self: center; width: min(100%, 440px); }
    .auth-foot {
      flex-direction: column-reverse; justify-content: center;
      padding: var(--space-4) var(--space-5) var(--space-6); background: var(--card); color: var(--ink-muted);
    }
    .theme-switch { background: var(--paper-subtle); }
    .theme-switch .theme-switch-option { color: var(--ink-muted); }
    .theme-switch .theme-switch-option:hover { color: var(--ink); }
    .theme-switch .theme-switch-option[aria-pressed="true"] { background: var(--paper-raised); color: var(--ink); box-shadow: 0 1px 2px rgb(0 0 0 / .12); }
  }
  @media (prefers-reduced-motion: reduce) { .auth-scene-moon { animation: none; } }
  /* Quiet secondary action under an auth form's button. */
  .auth-link {
    justify-self: center; padding: var(--space-1) var(--space-2);
    font-size: 14px; font-weight: 500; color: var(--ink-muted);
    text-decoration: underline; text-decoration-color: var(--line-control);
    text-decoration-thickness: 1px; text-underline-offset: 5px;
    transition: color var(--bp-dur-quick) var(--bp-ease-tide), text-decoration-color var(--bp-dur-quick) var(--bp-ease-tide);
  }
  .auth-link:hover { color: var(--ink); text-decoration-color: currentColor; }

  /* ---------- Error pages ---------- */
  .error-page { display: grid; place-items: center; min-height: 100dvh; padding: var(--space-7) var(--fluid-gutter); }
  .error-page-inner { display: grid; gap: var(--space-5); justify-items: start; max-width: 40rem; }
  .error-code { font: 700 var(--fluid-display-xl)/.9 var(--font-poster); letter-spacing: -.04em; color: var(--sage); }

} /* @layer layout */
