/* MindHealthy design system
   Layers: reset → tokens → base → layout → components → tools → utilities.
   Colours use oklch() + light-dark(); theme is driven by color-scheme on <html>. */

@layer reset, tokens, base, layout, components, tools, utilities;

@view-transition { navigation: auto; }

/* ------------------------------------------------------------------ reset */
@layer reset {
  *, *::before, *::after { box-sizing: border-box; }
  * { margin: 0; }
  html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
  body { min-height: 100dvh; }
  img, svg, video, canvas { display: block; max-width: 100%; }
  input, button, textarea, select { font: inherit; color: inherit; }
  button { cursor: pointer; background: none; border: 0; padding: 0; }
  p, h1, h2, h3, h4, li { overflow-wrap: break-word; }
  ul[role="list"], ol[role="list"] { list-style: none; padding: 0; }
  fieldset { border: 0; padding: 0; min-width: 0; }
  legend { padding: 0; }
}

/* ----------------------------------------------------------------- tokens */
@layer tokens {
  :root {
    color-scheme: light dark;

    --bg:          light-dark(oklch(98.4% 0.009 95),  oklch(17.5% 0.014 210));
    --bg-tint:     light-dark(oklch(96.2% 0.022 165), oklch(21% 0.025 195));
    --surface:     light-dark(oklch(100% 0 0),        oklch(21.5% 0.016 210));
    --surface-2:   light-dark(oklch(96.8% 0.011 150), oklch(25.5% 0.018 205));
    --glass:       light-dark(oklch(99% 0.006 95 / .72), oklch(19% 0.015 210 / .72));
    --text:        light-dark(oklch(24% 0.022 210),  oklch(94.5% 0.01 180));
    --muted:       light-dark(oklch(46% 0.02 210),   oklch(76% 0.02 190));
    --line:        light-dark(oklch(90.5% 0.012 150), oklch(31% 0.018 205));
    --line-strong: light-dark(oklch(82% 0.015 160),  oklch(40% 0.02 200));

    --brand:        light-dark(oklch(50% 0.09 178),  oklch(79% 0.1 175));
    --brand-strong: light-dark(oklch(40% 0.075 185), oklch(87% 0.08 172));
    --brand-soft:   light-dark(oklch(94.5% 0.035 170), oklch(29% 0.045 182));
    --on-brand:     light-dark(oklch(99% 0.005 170), oklch(18% 0.03 200));

    --peach:       light-dark(oklch(74% 0.11 55),   oklch(78% 0.1 55));
    --peach-soft:  light-dark(oklch(95.5% 0.03 60), oklch(29% 0.04 50));
    --lilac:       light-dark(oklch(66% 0.09 295),  oklch(78% 0.08 295));
    --lilac-soft:  light-dark(oklch(95.5% 0.025 295), oklch(28% 0.04 295));
    --sky:         light-dark(oklch(64% 0.1 235),   oklch(78% 0.09 235));
    --sky-soft:    light-dark(oklch(95.5% 0.025 235), oklch(28% 0.04 235));
    --sun:         light-dark(oklch(80% 0.13 85),   oklch(84% 0.12 88));
    --sun-soft:    light-dark(oklch(96.5% 0.04 90), oklch(30% 0.04 85));

    --danger:      light-dark(oklch(48% 0.16 28),   oklch(78% 0.12 28));
    --danger-soft: light-dark(oklch(95.5% 0.03 28), oklch(27% 0.05 25));

    /* mood scale 1–5 */
    --mood-1: light-dark(oklch(62% 0.12 25),  oklch(70% 0.12 25));
    --mood-2: light-dark(oklch(72% 0.12 55),  oklch(76% 0.11 55));
    --mood-3: light-dark(oklch(82% 0.12 90),  oklch(84% 0.11 90));
    --mood-4: light-dark(oklch(72% 0.11 150), oklch(76% 0.1 150));
    --mood-5: light-dark(oklch(60% 0.1 180),  oklch(74% 0.1 180));

    --font-sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-display: ui-rounded, "SF Pro Rounded", "Nunito", "Segoe UI Variable Display", system-ui, sans-serif;

    --step--1: clamp(.84rem, .82rem + .1vw, .9rem);
    --step-0:  clamp(1rem, .97rem + .15vw, 1.08rem);
    --step-1:  clamp(1.18rem, 1.1rem + .35vw, 1.35rem);
    --step-2:  clamp(1.4rem, 1.25rem + .7vw, 1.8rem);
    --step-3:  clamp(1.75rem, 1.45rem + 1.4vw, 2.6rem);
    --step-4:  clamp(2.15rem, 1.6rem + 2.6vw, 3.7rem);

    --space-2xs: .375rem; --space-xs: .5rem; --space-s: .75rem; --space-m: 1rem;
    --space-l: 1.5rem; --space-xl: 2.25rem; --space-2xl: 3.5rem; --space-3xl: clamp(3.5rem, 2rem + 6vw, 7rem);

    --radius-s: .6rem; --radius-m: 1rem; --radius-l: 1.5rem; --radius-xl: 2rem; --radius-full: 999px;
    --shadow-s: 0 1px 2px oklch(30% 0.03 200 / .06), 0 2px 8px oklch(30% 0.03 200 / .05);
    --shadow-m: 0 2px 6px oklch(30% 0.03 200 / .06), 0 12px 32px oklch(30% 0.03 200 / .08);
    --shadow-l: 0 8px 24px oklch(30% 0.03 200 / .08), 0 32px 64px oklch(30% 0.03 200 / .1);
    --ease-out: cubic-bezier(.22, 1, .36, 1);
    --ease-in-out: cubic-bezier(.65, 0, .35, 1);
    --focus: 0 0 0 3px var(--bg), 0 0 0 6px var(--brand);
    --header-h: 4rem;
    --measure: 68ch;
  }
  :root[data-theme="light"] { color-scheme: light; }
  :root[data-theme="dark"]  { color-scheme: dark; }
  :root[data-text="large"]  { font-size: 112.5%; }
}

/* ------------------------------------------------------------------- base */
@layer base {
  html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 1rem); }
  @media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

  body {
    font-family: var(--font-sans);
    font-size: var(--step-0);
    line-height: 1.65;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    display: flex;
    flex-direction: column;
  }
  main { flex: 1; }

  h1, h2, h3, h4 {
    font-family: var(--font-display);
    line-height: 1.15;
    letter-spacing: -.02em;
    text-wrap: balance;
    font-weight: 700;
  }
  h1 { font-size: var(--step-4); }
  h2 { font-size: var(--step-3); }
  h3 { font-size: var(--step-1); }
  p, li { text-wrap: pretty; }

  a { color: var(--brand-strong); text-underline-offset: .18em; text-decoration-thickness: 1px; }
  a:hover { text-decoration-thickness: 2px; }
  :focus-visible { outline: none; box-shadow: var(--focus); border-radius: var(--radius-s); }
  ::selection { background: var(--brand-soft); color: var(--text); }

  strong { font-weight: 650; }
  hr { border: 0; border-top: 1px solid var(--line); margin-block: var(--space-xl); }
  kbd { font: .85em/1 var(--font-sans); padding: .15em .45em; border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: .35em; background: var(--surface); }
}

/* ----------------------------------------------------------------- layout */
@layer layout {
  .wrap { width: min(100% - 2.5rem, 72rem); margin-inline: auto; }
  .wrap-narrow { width: min(100% - 2.5rem, 46rem); margin-inline: auto; }
  .section { padding-block: var(--space-3xl); }
  .section-tight { padding-block: var(--space-2xl); }
  .stack > * + * { margin-top: var(--flow, var(--space-m)); }
  .cluster { display: flex; flex-wrap: wrap; gap: var(--gap, var(--space-s)); align-items: center; }
  .grid-auto { display: grid; gap: var(--gap, var(--space-l)); grid-template-columns: repeat(auto-fill, minmax(min(100%, var(--min, 16rem)), 1fr)); }

  /* Skip link */
  .skip-link {
    position: absolute; left: 1rem; top: -4rem; z-index: 100;
    background: var(--brand); color: var(--on-brand); padding: .6rem 1rem; border-radius: var(--radius-s); font-weight: 600;
    transition: top .2s;
    &:focus { top: 1rem; }
  }

  /* ---------- header */
  .site-header {
    position: sticky; top: 0; z-index: 50;
    background: var(--glass);
    backdrop-filter: saturate(1.6) blur(16px);
    -webkit-backdrop-filter: saturate(1.6) blur(16px);
    border-bottom: 1px solid color-mix(in oklch, var(--line) 70%, transparent);
    view-transition-name: site-header;
  }
  .header-inner { height: var(--header-h); display: flex; align-items: center; gap: var(--space-m); }
  .brand {
    display: inline-flex; align-items: center; gap: .6rem; text-decoration: none; color: var(--text);
    font-family: var(--font-display); font-weight: 800; font-size: 1.2rem; letter-spacing: -.03em;
    & svg { width: 2.1rem; height: 2.1rem; flex: none; }
    & span b { color: var(--brand); font-weight: inherit; }
  }
  .main-nav { margin-left: auto; }
  .main-nav ul { display: flex; gap: .25rem; list-style: none; padding: 0; }
  .main-nav a {
    display: block; padding: .5rem .8rem; border-radius: var(--radius-full); text-decoration: none; color: var(--muted); font-weight: 550; font-size: .95rem;
    transition: background .2s, color .2s;
    &:hover { background: var(--surface-2); color: var(--text); }
    &[aria-current="page"] { color: var(--brand-strong); background: var(--brand-soft); }
  }
  .header-actions { display: flex; align-items: center; gap: .4rem; }
  .i-sun { display: none; }
  :root[data-theme="dark"] .i-sun { display: block; }
  :root[data-theme="dark"] .i-moon { display: none; }
  @media (prefers-color-scheme: dark) {
    :root:not([data-theme]) .i-sun { display: block; }
    :root:not([data-theme]) .i-moon { display: none; }
  }
  .icon-btn {
    display: inline-grid; place-items: center; width: 2.6rem; height: 2.6rem; border-radius: var(--radius-full);
    color: var(--muted); transition: background .2s, color .2s;
    &:hover { background: var(--surface-2); color: var(--text); }
    & svg { width: 1.25rem; height: 1.25rem; }
  }
  .help-pill {
    display: inline-flex; align-items: center; gap: .45rem; white-space: nowrap;
    padding: .5rem .95rem; border-radius: var(--radius-full); text-decoration: none; font-weight: 650; font-size: .92rem;
    background: var(--danger-soft); color: var(--danger);
    border: 1px solid color-mix(in oklch, var(--danger) 25%, transparent);
    transition: transform .2s var(--ease-out), box-shadow .2s;
    &:hover { transform: translateY(-1px); box-shadow: var(--shadow-s); }
    & .dot { width: .5rem; height: .5rem; border-radius: 50%; background: currentColor; animation: pulse 2.4s infinite; }
  }
  @keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }

  .quick-exit {
    position: fixed; right: 1rem; bottom: 1rem; z-index: 60;
    display: inline-flex; align-items: center; gap: .5rem;
    padding: .7rem 1.1rem; border-radius: var(--radius-full);
    background: var(--text); color: var(--bg); font-weight: 650; font-size: .92rem;
    box-shadow: var(--shadow-l);
    transition: transform .2s var(--ease-out);
    &:hover { transform: translateY(-2px); }
    & svg { width: 1.05rem; height: 1.05rem; }
    & small { font-weight: 500; opacity: .7; font-size: .78rem; }
  }

  /* account link in header */
  .account-link { font-weight: 600; font-size: .92rem; color: var(--muted); text-decoration: none; padding: .5rem .8rem; border-radius: var(--radius-full); white-space: nowrap;
    &:hover { background: var(--surface-2); color: var(--text); }
    &[data-signed-in] { color: var(--brand-strong); }
  }

  /* mobile menu (popover) */
  .menu-btn { display: none; }
  .menu-sheet {
    inset: auto 0 0 0; margin: 0; width: 100%; max-width: none; max-height: 85dvh; border: 0;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0; padding: var(--space-l) var(--space-l) calc(var(--space-xl) + env(safe-area-inset-bottom));
    background: var(--surface); color: var(--text); box-shadow: var(--shadow-l);
    transition: translate .35s var(--ease-out), opacity .35s, display .35s allow-discrete, overlay .35s allow-discrete;
    translate: 0 100%; opacity: 0;
    &:popover-open { translate: 0 0; opacity: 1; @starting-style { translate: 0 100%; opacity: 0; } }
    &::backdrop { background: oklch(20% 0.02 210 / .35); backdrop-filter: blur(3px); }
    & ul { list-style: none; padding: 0; display: grid; gap: .25rem; }
    & a { display: flex; align-items: center; gap: .8rem; padding: .85rem 1rem; border-radius: var(--radius-m); text-decoration: none; color: var(--text); font-weight: 600; font-size: 1.05rem;
      &:hover, &[aria-current="page"] { background: var(--brand-soft); color: var(--brand-strong); } }
    & .sheet-grip { width: 3rem; height: .3rem; border-radius: 9px; background: var(--line-strong); margin: -.5rem auto var(--space-m); }
    & .sheet-group { font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; padding: var(--space-m) 1rem .25rem; }
  }

  /* bottom tab bar (mobile) */
  .tabbar { display: none; }

  @media (max-width: 52rem) {
    .main-nav, .header-actions .account-link { display: none; }
    .menu-btn { display: inline-grid; }
    .header-actions { margin-left: auto; }
    .tabbar {
      display: grid; grid-template-columns: repeat(4, 1fr);
      position: fixed; inset: auto 0 0 0; z-index: 55;
      padding: .35rem .5rem calc(.35rem + env(safe-area-inset-bottom));
      background: var(--glass); backdrop-filter: saturate(1.6) blur(16px); -webkit-backdrop-filter: saturate(1.6) blur(16px);
      border-top: 1px solid var(--line);
      view-transition-name: tabbar;
      & a { display: grid; justify-items: center; gap: .1rem; padding: .35rem 0; text-decoration: none; color: var(--muted); font-size: .72rem; font-weight: 600; border-radius: var(--radius-m);
        & svg { width: 1.4rem; height: 1.4rem; }
        &[aria-current="page"] { color: var(--brand-strong); }
        &.tab-help { color: var(--danger); } }
    }
    body { padding-bottom: calc(4.2rem + env(safe-area-inset-bottom)); }
    .quick-exit { bottom: calc(4.9rem + env(safe-area-inset-bottom)); right: .75rem; padding: .6rem .9rem; & small { display: none; } }
    .help-pill .label-long { display: none; }
  }
  @media (max-width: 26rem) { .brand span { display: none; } }

  /* ---------- footer */
  .site-footer {
    margin-top: var(--space-3xl); background: var(--surface-2); border-top: 1px solid var(--line);
    padding-block: var(--space-2xl) var(--space-xl); font-size: var(--step--1); color: var(--muted);
    & a { color: var(--muted); text-decoration: none; &:hover { color: var(--text); text-decoration: underline; } }
    & h2 { font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--text); margin-bottom: var(--space-s); font-family: var(--font-sans); }
    & ul { list-style: none; padding: 0; display: grid; gap: .45rem; }
  }
  .footer-grid { display: grid; gap: var(--space-xl); grid-template-columns: 1.6fr repeat(3, 1fr);
    @media (max-width: 52rem) { grid-template-columns: 1fr 1fr; } }
  .footer-about { max-width: 34ch; & .brand { margin-bottom: var(--space-s); } }
  .footer-crisis { margin-top: var(--space-xl); padding: var(--space-m) var(--space-l); border-radius: var(--radius-m); background: var(--surface); border: 1px solid var(--line); color: var(--text); }
  .footer-bottom { margin-top: var(--space-xl); padding-top: var(--space-l); border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: var(--space-m); justify-content: space-between; }
}

/* ------------------------------------------------------------- components */
@layer components {
  /* buttons */
  .btn {
    --btn-bg: var(--brand); --btn-fg: var(--on-brand);
    display: inline-flex; align-items: center; justify-content: center; gap: .55rem;
    min-height: 2.9rem; padding: .7rem 1.35rem; border-radius: var(--radius-full);
    background: var(--btn-bg); color: var(--btn-fg); font-weight: 650; text-decoration: none; line-height: 1.2;
    border: 1px solid transparent;
    transition: transform .2s var(--ease-out), box-shadow .2s, background .2s, opacity .2s;
    &:hover { transform: translateY(-1px); box-shadow: var(--shadow-m); }
    &:active { transform: translateY(0) scale(.98); }
    &:disabled, &[aria-disabled="true"] { opacity: .5; pointer-events: none; }
    & svg { width: 1.15rem; height: 1.15rem; flex: none; }
  }
  .btn-soft { --btn-bg: var(--brand-soft); --btn-fg: var(--brand-strong); }
  .btn-ghost { --btn-bg: transparent; --btn-fg: var(--text); border-color: var(--line-strong); &:hover { background: var(--surface-2); box-shadow: none; } }
  .btn-danger { --btn-bg: var(--danger); --btn-fg: oklch(99% 0 0); }
  .btn-sm { min-height: 2.3rem; padding: .45rem .95rem; font-size: .9rem; }
  .btn-lg { min-height: 3.4rem; padding: .9rem 1.8rem; font-size: 1.08rem; }
  .btn-block { width: 100%; }
  .link-btn { color: var(--brand-strong); font-weight: 600; text-decoration: underline; text-underline-offset: .18em; }

  /* eyebrow / badges */
  .eyebrow svg { width: 1.1rem; height: 1.1rem; flex: none; }
  .eyebrow { display: inline-flex; align-items: center; gap: .45rem; font-size: .8rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--brand); }
  .badge { display: inline-flex; align-items: center; gap: .35rem; padding: .2rem .65rem; border-radius: var(--radius-full); font-size: .78rem; font-weight: 650; background: var(--brand-soft); color: var(--brand-strong); }
  .lead { font-size: var(--step-1); color: var(--muted); max-width: 60ch; line-height: 1.55; }

  /* ---------- hero */
  .hero { position: relative; overflow: clip; padding-block: clamp(3rem, 2rem + 6vw, 7rem) clamp(3rem, 2rem + 4vw, 5rem); isolation: isolate; }
  .hero-bg { position: absolute; inset: 0; z-index: -1; pointer-events: none;
    & .blob { position: absolute; border-radius: 50%; filter: blur(60px); opacity: .55; animation: drift 22s var(--ease-in-out) infinite alternate; }
    & .b1 { width: 38rem; height: 38rem; background: var(--brand-soft); top: -14rem; right: -10rem; }
    & .b2 { width: 28rem; height: 28rem; background: var(--peach-soft); bottom: -12rem; left: -8rem; animation-duration: 28s; }
    & .b3 { width: 22rem; height: 22rem; background: var(--lilac-soft); top: 30%; left: 45%; animation-duration: 34s; }
  }
  @keyframes drift { to { transform: translate(4rem, 3rem) scale(1.12); } }
  .hero h1 { max-width: 18ch; }
  .hero h1 em { font-style: normal; background: linear-gradient(100deg, var(--brand), var(--sky) 60%, var(--lilac)); -webkit-background-clip: text; background-clip: text; color: transparent; }
  .hero .lead { margin-top: var(--space-l); }

  /* feelings picker */
  .feelings { margin-top: var(--space-2xl); padding: var(--space-l); border-radius: var(--radius-xl); background: var(--glass); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border: 1px solid var(--line); box-shadow: var(--shadow-m); max-width: 52rem; }
  .feelings h2 { font-size: var(--step-1); margin-bottom: var(--space-m); }
  .chips { display: flex; flex-wrap: wrap; gap: .55rem; }
  .chip {
    position: relative; display: inline-flex; align-items: center; gap: .45rem; min-height: 2.75rem;
    padding: .55rem 1.05rem; border-radius: var(--radius-full); border: 1px solid var(--line-strong);
    background: var(--surface); color: var(--text); font-weight: 600; text-decoration: none; font-size: .96rem;
    transition: transform .2s var(--ease-out), background .2s, border-color .2s, box-shadow .2s;
    &:hover { transform: translateY(-2px); border-color: var(--brand); box-shadow: var(--shadow-s); }
    &[aria-pressed="true"], &:has(input:checked) { background: var(--brand-soft); border-color: var(--brand); color: var(--brand-strong); }
    &.chip-crisis { background: var(--danger-soft); border-color: color-mix(in oklch, var(--danger) 30%, transparent); color: var(--danger); }
    & .emoji { font-size: 1.15em; line-height: 1; }
    & input { position: absolute; opacity: 0; pointer-events: none; }
    &:has(input:focus-visible) { box-shadow: var(--focus); }
  }
  .feeling-result { margin-top: var(--space-l); padding-top: var(--space-l); border-top: 1px dashed var(--line-strong);
    &[hidden] { display: none; }
    & p { color: var(--muted); margin-bottom: var(--space-m); }
  }

  /* ---------- cards */
  .card-grid { display: grid; gap: var(--space-l); grid-template-columns: repeat(auto-fill, minmax(min(100%, 17rem), 1fr)); }
  .card {
    container-type: inline-size;
    position: relative; display: flex; flex-direction: column; gap: var(--space-s);
    padding: var(--space-l); border-radius: var(--radius-l); background: var(--surface); border: 1px solid var(--line);
    text-decoration: none; color: var(--text);
    transition: transform .3s var(--ease-out), box-shadow .3s, border-color .3s;
    & h3 { font-size: var(--step-1); }
    & p { color: var(--muted); font-size: .96rem; }
    & .card-icon { width: 3rem; height: 3rem; display: grid; place-items: center; border-radius: var(--radius-m); background: var(--tint, var(--brand-soft)); color: var(--ink, var(--brand-strong)); font-size: 1.5rem;
      & svg { width: 1.5rem; height: 1.5rem; } }
    & .card-meta { margin-top: auto; padding-top: var(--space-s); font-size: .85rem; font-weight: 650; color: var(--brand-strong); display: flex; align-items: center; gap: .35rem; }
    & .card-meta svg { width: 1rem; height: 1rem; transition: translate .25s var(--ease-out); }
  }
  a.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-m); border-color: var(--line-strong);
    & .card-meta svg { translate: 4px 0; } }
  a.card::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
  .card[data-tint="peach"] { --tint: var(--peach-soft); --ink: oklch(from var(--peach) calc(l - .2) c h); }
  .card[data-tint="lilac"] { --tint: var(--lilac-soft); --ink: oklch(from var(--lilac) calc(l - .12) c h); }
  .card[data-tint="sky"]   { --tint: var(--sky-soft);   --ink: oklch(from var(--sky) calc(l - .1) c h); }
  .card[data-tint="sun"]   { --tint: var(--sun-soft);   --ink: oklch(from var(--sun) calc(l - .35) c h); }
  @container (min-width: 26rem) {
    .card.card-wide { flex-direction: row; align-items: flex-start; gap: var(--space-l); & .card-icon { flex: none; } }
  }

  .section-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: end; gap: var(--space-m); margin-bottom: var(--space-xl);
    & h2 { max-width: 22ch; }
    & p { color: var(--muted); max-width: 48ch; }
  }

  /* ---------- helplines */
  .helplines { display: grid; gap: var(--space-m); grid-template-columns: repeat(auto-fill, minmax(min(100%, 19rem), 1fr)); }
  .helpline {
    display: flex; flex-direction: column; gap: .35rem; padding: var(--space-l); border-radius: var(--radius-l);
    background: var(--surface); border: 1px solid var(--line);
    & h3 { font-size: 1.1rem; font-family: var(--font-sans); letter-spacing: -.01em; }
    & .when { font-size: .85rem; color: var(--muted); }
    & p { font-size: .95rem; color: var(--muted); }
    & .actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: auto; padding-top: var(--space-s); }
  }
  .helpline-strip { border-radius: var(--radius-xl); padding: clamp(1.5rem, 1rem + 3vw, 3rem); background: linear-gradient(135deg, var(--brand-soft), var(--sky-soft)); border: 1px solid var(--line);
    & h2 { font-size: var(--step-2); }
    & .helplines { margin-top: var(--space-l); }
  }

  .callout { padding: var(--space-l); border-radius: var(--radius-l); border: 1px solid var(--line); background: var(--surface-2);
    & > * + * { margin-top: var(--space-s); }
    & h2, & h3 { font-size: var(--step-1); }
  }
  .callout-crisis { background: var(--danger-soft); border-color: color-mix(in oklch, var(--danger) 30%, transparent);
    & h2, & h3, & strong { color: var(--danger); }
  }
  .callout-info { background: var(--sky-soft); border-color: color-mix(in oklch, var(--sky) 30%, transparent); }
  .callout-calm { background: var(--brand-soft); border-color: color-mix(in oklch, var(--brand) 25%, transparent); }

  .emergency-banner { display: flex; flex-wrap: wrap; gap: var(--space-m); align-items: center; justify-content: space-between;
    padding: var(--space-l); border-radius: var(--radius-l); background: var(--danger); color: oklch(99% 0 0);
    & h2 { font-size: var(--step-1); color: inherit; }
    & p { opacity: .92; }
    & .btn { --btn-bg: oklch(99% 0 0); --btn-fg: var(--danger); }
  }

  /* ---------- page header */
  .page-head { padding-block: clamp(2.5rem, 1.5rem + 4vw, 5rem) var(--space-xl); position: relative; isolation: isolate; overflow: clip;
    & .breadcrumb { font-size: .88rem; color: var(--muted); margin-bottom: var(--space-m);
      & a { color: var(--muted); } }
    & h1 { font-size: var(--step-4); max-width: 20ch; }
    & .lead { margin-top: var(--space-m); }
    &::before { content: ""; position: absolute; z-index: -1; inset: -40% -20% auto auto; width: 34rem; height: 34rem; border-radius: 50%; background: var(--tint, var(--brand-soft)); filter: blur(70px); opacity: .6; }
  }

  /* ---------- prose */
  .prose { max-width: var(--measure);
    & > * + * { margin-top: 1em; }
    & h2 { font-size: var(--step-2); margin-top: 2.2em; }
    & h3 { margin-top: 1.8em; }
    & ul, & ol { padding-left: 1.3em; }
    & li + li { margin-top: .4em; }
    & li::marker { color: var(--brand); }
    & .callout, & .helplines { margin-top: 1.5em; }
  }
  .with-toc { display: grid; gap: var(--space-2xl); grid-template-columns: minmax(0, 1fr) 16rem; align-items: start;
    @media (max-width: 62rem) { grid-template-columns: 1fr; & .toc { display: none; } } }
  .toc { position: sticky; top: calc(var(--header-h) + 1.5rem); font-size: .92rem;
    & h2 { font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-family: var(--font-sans); margin-bottom: var(--space-s); }
    & ol { list-style: none; padding: 0; border-left: 2px solid var(--line); }
    & a { display: block; padding: .35rem 0 .35rem 1rem; margin-left: -2px; border-left: 2px solid transparent; color: var(--muted); text-decoration: none;
      &:hover { color: var(--text); }
      &.is-active { color: var(--brand-strong); border-left-color: var(--brand); font-weight: 600; } }
    & .toc-card { margin-top: var(--space-l); }
  }
  .check-list { list-style: none; padding: 0 !important;
    & li { position: relative; padding-left: 2rem; }
    & li::before { content: ""; position: absolute; left: 0; top: .3em; width: 1.2rem; height: 1.2rem; border-radius: 50%; background: var(--brand-soft) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23267a6d' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center / .75rem no-repeat; }
  }
  .try-list { display: grid; gap: var(--space-m); list-style: none; padding: 0 !important; counter-reset: try;
    & li { counter-increment: try; position: relative; padding: var(--space-m) var(--space-l) var(--space-m) 3.6rem; border-radius: var(--radius-m); background: var(--surface); border: 1px solid var(--line); margin: 0 !important; }
    & li::before { content: counter(try); position: absolute; left: var(--space-m); top: var(--space-m); width: 1.9rem; height: 1.9rem; border-radius: 50%; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-strong); font-weight: 700; font-size: .9rem; }
    & strong { display: block; }
  }
  .sources { font-size: .88rem; color: var(--muted); }

  /* ---------- forms */
  .field { display: grid; gap: .4rem; }
  .field + .field { margin-top: var(--space-m); }
  .label { font-weight: 650; font-size: .95rem; }
  .hint { font-size: .86rem; color: var(--muted); }
  .input, .textarea, .select {
    width: 100%; min-height: 2.9rem; padding: .7rem .95rem; border-radius: var(--radius-m);
    background: var(--surface); border: 1.5px solid var(--line-strong); color: var(--text);
    transition: border-color .2s, box-shadow .2s;
    &:hover { border-color: color-mix(in oklch, var(--brand) 50%, var(--line-strong)); }
    &:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px color-mix(in oklch, var(--brand) 18%, transparent); }
    &::placeholder { color: color-mix(in oklch, var(--muted) 70%, transparent); }
  }
  .textarea { min-height: 7rem; resize: vertical; line-height: 1.55; field-sizing: content; }
  .field:has(.input:user-invalid) .hint-error { display: block; }
  .hint-error { display: none; color: var(--danger); font-size: .86rem; }
  .input:user-invalid { border-color: var(--danger); }
  .form-error { color: var(--danger); background: var(--danger-soft); padding: .7rem 1rem; border-radius: var(--radius-m); font-size: .93rem; &:empty { display: none; } }
  .form-ok { color: var(--brand-strong); background: var(--brand-soft); padding: .7rem 1rem; border-radius: var(--radius-m); font-size: .93rem; &:empty { display: none; } }
  .checkbox { display: flex; gap: .65rem; align-items: flex-start; font-size: .95rem;
    & input { width: 1.2rem; height: 1.2rem; accent-color: var(--brand); margin-top: .2rem; flex: none; } }

  input[type="range"] { width: 100%; accent-color: var(--brand); height: 2rem; }

  .segmented { display: inline-flex; flex-wrap: wrap; gap: .25rem; padding: .3rem; border-radius: var(--radius-full); background: var(--surface-2); border: 1px solid var(--line);
    & label { position: relative; }
    & input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
    & span { display: block; padding: .5rem 1rem; border-radius: var(--radius-full); font-weight: 600; font-size: .92rem; color: var(--muted); transition: background .2s, color .2s; }
    & input:checked + span { background: var(--surface); color: var(--text); box-shadow: var(--shadow-s); }
    & input:focus-visible + span { box-shadow: var(--focus); }
  }

  /* ---------- dialog */
  dialog.modal {
    width: min(100% - 2rem, 32rem); max-height: 90dvh; border: 0; padding: 0; border-radius: var(--radius-xl);
    background: var(--surface); color: var(--text); box-shadow: var(--shadow-l);
    opacity: 0; scale: .96; translate: 0 1rem;
    transition: opacity .3s, scale .3s var(--ease-out), translate .3s var(--ease-out), display .3s allow-discrete, overlay .3s allow-discrete;
    &[open] { opacity: 1; scale: 1; translate: 0 0; @starting-style { opacity: 0; scale: .96; translate: 0 1rem; } }
    &::backdrop { background: oklch(20% 0.02 210 / 0); backdrop-filter: blur(0); transition: all .3s allow-discrete; }
    &[open]::backdrop { background: oklch(20% 0.02 210 / .45); backdrop-filter: blur(4px); @starting-style { background: oklch(20% 0.02 210 / 0); backdrop-filter: blur(0); } }
    & .modal-body { padding: var(--space-xl); }
    & .modal-body > * + * { margin-top: var(--space-m); }
    & .modal-close { position: absolute; top: .75rem; right: .75rem; }
  }

  /* ---------- toast */
  .toast-region { position: fixed; left: 50%; bottom: 1.25rem; translate: -50% 0; z-index: 90; display: grid; gap: .5rem; pointer-events: none;
    @media (max-width: 52rem) { bottom: calc(5.2rem + env(safe-area-inset-bottom)); } }
  .toast { pointer-events: auto; padding: .75rem 1.2rem; border-radius: var(--radius-full); background: var(--text); color: var(--bg); font-weight: 600; font-size: .93rem; box-shadow: var(--shadow-l);
    animation: toast-in .35s var(--ease-out); }
  @keyframes toast-in { from { opacity: 0; translate: 0 1rem; } }

  /* ---------- sync banner */
  .sync-note { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; justify-content: space-between; font-size: .9rem; color: var(--muted);
    padding: .75rem 1rem; border-radius: var(--radius-m); background: var(--surface-2); border: 1px solid var(--line);
    & svg { width: 1.1rem; height: 1.1rem; flex: none; }
    & .sync-text { display: flex; gap: .5rem; align-items: center; }
  }

  /* reveal on scroll (progressive) */
  @supports (animation-timeline: view()) {
    @media (prefers-reduced-motion: no-preference) {
      .reveal { animation: reveal linear both; animation-timeline: view(); animation-range: entry 0% entry 55%; }
    }
  }
  @keyframes reveal { from { opacity: 0; translate: 0 2rem; } }

  /* stats / features band */
  .feature-band { display: grid; gap: var(--space-l); grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr));
    & .feature { display: grid; gap: .4rem; }
    & .feature svg { width: 1.6rem; height: 1.6rem; color: var(--brand); }
    & h3 { font-size: 1.05rem; font-family: var(--font-sans); letter-spacing: -.01em; }
    & p { font-size: .94rem; color: var(--muted); }
  }

  .quote-card { padding: var(--space-xl); border-radius: var(--radius-xl); background: var(--surface); border: 1px solid var(--line); font-family: var(--font-display); font-size: var(--step-2); line-height: 1.35; letter-spacing: -.01em; text-wrap: balance;
    & footer { margin-top: var(--space-m); font-family: var(--font-sans); font-size: var(--step--1); color: var(--muted); }
  }

  .empty { text-align: center; padding: var(--space-2xl) var(--space-l); color: var(--muted); border: 1.5px dashed var(--line-strong); border-radius: var(--radius-l); }

  .details { border: 1px solid var(--line); border-radius: var(--radius-m); background: var(--surface);
    & + .details { margin-top: var(--space-s); }
    & summary { cursor: pointer; padding: var(--space-m) var(--space-l); font-weight: 650; list-style: none; display: flex; justify-content: space-between; gap: 1rem; align-items: center;
      &::-webkit-details-marker { display: none; }
      &::after { content: "+"; font-size: 1.4rem; line-height: 1; color: var(--brand); transition: rotate .25s var(--ease-out); } }
    &[open] summary::after { rotate: 45deg; }
    & .details-body { padding: 0 var(--space-l) var(--space-l); color: var(--muted); & > * + * { margin-top: .75em; } }
    &::details-content { block-size: 0; overflow: clip; transition: block-size .35s var(--ease-out), content-visibility .35s allow-discrete; }
    &[open]::details-content { block-size: auto; }
  }
  :root { interpolate-size: allow-keywords; }
}

/* ------------------------------------------------------------------ tools */
@layer tools {
  .tool-shell { display: grid; gap: var(--space-xl); }
  .tool-panel { padding: clamp(1.25rem, .8rem + 2vw, 2.25rem); border-radius: var(--radius-xl); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-s);
    & > * + * { margin-top: var(--space-l); }
    & h2 { font-size: var(--step-2); }
  }
  .tool-panel-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: var(--space-m); }
  .two-col { display: grid; gap: var(--space-xl); grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); align-items: start;
    @media (max-width: 58rem) { grid-template-columns: 1fr; } }

  /* ---------- breathing */
  .breath-stage { display: grid; place-items: center; min-height: min(78vw, 26rem); position: relative; }
  .breath-orb {
    --scale: .55; --dur: 4s;
    width: min(70vw, 20rem); aspect-ratio: 1; border-radius: 50%; position: relative; display: grid; place-items: center;
    background: radial-gradient(circle at 35% 30%, color-mix(in oklch, var(--brand) 35%, white), var(--brand) 70%);
    box-shadow: 0 0 0 1.25rem color-mix(in oklch, var(--brand) 12%, transparent), 0 0 0 2.75rem color-mix(in oklch, var(--brand) 6%, transparent), 0 30px 80px color-mix(in oklch, var(--brand) 35%, transparent);
    scale: var(--scale);
    transition: scale var(--dur) var(--ease-in-out);
    &::before { content: ""; position: absolute; inset: -6%; border-radius: 50%; border: 2px dashed color-mix(in oklch, var(--brand) 35%, transparent); animation: spin 60s linear infinite; }
  }
  @keyframes spin { to { rotate: 1turn; } }
  .breath-label { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; pointer-events: none;
    & strong { display: block; font-family: var(--font-display); font-size: var(--step-3); color: var(--text); letter-spacing: -.02em; }
    & span { font-size: var(--step-2); font-variant-numeric: tabular-nums; color: var(--muted); font-weight: 600; }
  }
  .breath-ring { position: absolute; width: min(78vw, 23rem); aspect-ratio: 1; rotate: -90deg; pointer-events: none;
    & circle { fill: none; stroke-width: 4; }
    & .track { stroke: var(--line); }
    & .progress { stroke: var(--brand); stroke-linecap: round; transition: stroke-dashoffset .25s linear; }
  }
  .breath-controls { display: flex; flex-wrap: wrap; gap: var(--space-m); justify-content: center; align-items: center; }
  .breath-stats { display: flex; justify-content: center; gap: var(--space-xl); color: var(--muted); font-size: .92rem; font-variant-numeric: tabular-nums;
    & b { display: block; color: var(--text); font-size: var(--step-1); } }
  @media (prefers-reduced-motion: reduce) {
    .breath-orb { transition: none; scale: .8; &::before { animation: none; } }
  }

  /* ---------- stepper (grounding / self-check) */
  .progress-bar { height: .5rem; border-radius: var(--radius-full); background: var(--surface-2); overflow: hidden;
    & span { display: block; height: 100%; width: var(--p, 0%); background: linear-gradient(90deg, var(--brand), var(--sky)); border-radius: inherit; transition: width .5s var(--ease-out); } }
  .step-card { text-align: center; display: grid; gap: var(--space-m); justify-items: center; padding-block: var(--space-l);
    & .big-num { font-family: var(--font-display); font-size: clamp(4rem, 3rem + 6vw, 7rem); font-weight: 800; line-height: 1; color: var(--brand); }
    & h2 { font-size: var(--step-3); }
    & p { color: var(--muted); max-width: 44ch; }
    & .input-list { width: 100%; max-width: 30rem; display: grid; gap: .5rem; }
  }
  .step-anim { animation: step-in .45s var(--ease-out); }
  @keyframes step-in { from { opacity: 0; translate: 1.5rem 0; } }

  .answer-list { display: grid; gap: .6rem; list-style: none; padding: 0; }
  .answer {
    display: flex; align-items: center; gap: .9rem; width: 100%; text-align: left;
    padding: .95rem 1.15rem; border-radius: var(--radius-m); border: 1.5px solid var(--line-strong); background: var(--surface); font-weight: 550;
    transition: border-color .2s, background .2s, transform .15s;
    &:hover { border-color: var(--brand); background: var(--brand-soft); }
    &:active { transform: scale(.99); }
    &[aria-pressed="true"] { border-color: var(--brand); background: var(--brand-soft); }
    & .pts { margin-left: auto; font-size: .8rem; color: var(--muted); font-weight: 600; }
  }
  .q-text { font-family: var(--font-display); font-size: var(--step-2); line-height: 1.3; letter-spacing: -.01em; }
  .q-stem { color: var(--muted); font-size: .95rem; }

  .score-dial { --v: 0; --max: 27; display: grid; place-items: center; width: 11rem; aspect-ratio: 1; border-radius: 50%; margin-inline: auto;
    background: conic-gradient(var(--dial, var(--brand)) calc(var(--v) / var(--max) * 1turn), var(--surface-2) 0);
    & > div { width: 78%; aspect-ratio: 1; border-radius: 50%; background: var(--surface); display: grid; place-items: center; text-align: center; }
    & b { font-family: var(--font-display); font-size: 2.6rem; line-height: 1; }
    & small { color: var(--muted); font-size: .82rem; }
  }
  .band-scale { display: flex; gap: 3px; margin-top: var(--space-m);
    & span { flex: 1; height: .5rem; border-radius: 4px; background: var(--surface-2); }
    & span.on { background: var(--brand); }
  }

  /* ---------- mood */
  .mood-picker { display: grid; grid-template-columns: repeat(5, 1fr); gap: .5rem; }
  .mood-opt { position: relative;
    & input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
    & > span { display: grid; justify-items: center; gap: .25rem; padding: .8rem .25rem; border-radius: var(--radius-m); border: 1.5px solid var(--line); background: var(--surface); font-size: .78rem; font-weight: 600; color: var(--muted); transition: all .2s var(--ease-out); }
    & .face { font-size: 2rem; line-height: 1; transition: transform .25s var(--ease-out); }
    & input:hover + span { border-color: var(--line-strong); }
    & input:checked + span { border-color: var(--c); background: color-mix(in oklch, var(--c) 18%, var(--surface)); color: var(--text); & .face { transform: scale(1.18); } }
    & input:focus-visible + span { box-shadow: var(--focus); }
  }
  .tag-picker { display: flex; flex-wrap: wrap; gap: .4rem;
    & .chip { min-height: 2.3rem; padding: .35rem .85rem; font-size: .88rem; }
  }
  .chart-wrap { position: relative; }
  .chart-svg { width: 100%; height: auto; overflow: visible;
    & .grid line { stroke: var(--line); stroke-dasharray: 3 4; }
    & .axis text { fill: var(--muted); font-size: 11px; }
    & .area { fill: url(#moodFill); }
    & .line { fill: none; stroke: var(--brand); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
    & .pt { stroke: var(--surface); stroke-width: 2; }
  }
  .heatmap { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px;
    & .d { aspect-ratio: 1; border-radius: 5px; background: var(--surface-2); position: relative; }
    & .d[data-m="1"] { background: var(--mood-1); } & .d[data-m="2"] { background: var(--mood-2); } & .d[data-m="3"] { background: var(--mood-3); }
    & .d[data-m="4"] { background: var(--mood-4); } & .d[data-m="5"] { background: var(--mood-5); }
    & .d.today { outline: 2px solid var(--text); outline-offset: 1px; }
    & .dow { font-size: .7rem; color: var(--muted); text-align: center; }
  }
  .legend { display: flex; gap: .75rem; flex-wrap: wrap; font-size: .8rem; color: var(--muted); align-items: center;
    & i { display: inline-block; width: .8rem; height: .8rem; border-radius: 3px; vertical-align: -1px; margin-right: .25rem; } }

  .entry-list { display: grid; gap: .6rem; list-style: none; padding: 0; }
  .entry { display: grid; grid-template-columns: auto 1fr auto; gap: .9rem; align-items: start; padding: .9rem 1rem; border-radius: var(--radius-m); background: var(--surface-2); border: 1px solid var(--line);
    & .entry-face { font-size: 1.6rem; line-height: 1; }
    & .entry-date { font-size: .82rem; color: var(--muted); font-weight: 600; }
    & .entry-text { font-size: .95rem; white-space: pre-wrap; }
    & .entry-tags { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .35rem; }
    & .entry-tags span { font-size: .75rem; padding: .1rem .5rem; border-radius: var(--radius-full); background: var(--surface); border: 1px solid var(--line); }
  }
  .stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: .75rem;
    & div { padding: .9rem; border-radius: var(--radius-m); background: var(--surface-2); text-align: center; }
    & b { display: block; font-family: var(--font-display); font-size: var(--step-2); }
    & small { color: var(--muted); font-size: .8rem; }
  }

  /* ---------- thought record / journal */
  .wizard-steps { display: flex; gap: .35rem; list-style: none; padding: 0; counter-reset: ws;
    & li { flex: 1; height: .35rem; border-radius: 9px; background: var(--surface-2); }
    & li.done { background: var(--brand); }
    & li.current { background: color-mix(in oklch, var(--brand) 50%, var(--surface-2)); }
  }
  .prompt-card { padding: var(--space-l); border-radius: var(--radius-l); background: linear-gradient(135deg, var(--lilac-soft), var(--sky-soft)); border: 1px solid var(--line);
    & .prompt-text { font-family: var(--font-display); font-size: var(--step-2); line-height: 1.3; letter-spacing: -.01em; }
  }
  .saved-card { padding: var(--space-m) var(--space-l); border-radius: var(--radius-m); background: var(--surface-2); border: 1px solid var(--line);
    & summary { cursor: pointer; font-weight: 650; display: flex; justify-content: space-between; gap: 1rem; list-style: none; &::-webkit-details-marker { display: none; } }
    & summary small { color: var(--muted); font-weight: 500; white-space: nowrap; }
    & dl { margin-top: var(--space-m); display: grid; gap: .6rem; }
    & dt { font-size: .8rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
    & dd { margin: 0; white-space: pre-wrap; }
    & .saved-actions { margin-top: var(--space-m); display: flex; gap: .5rem; }
  }
  .saved-card + .saved-card { margin-top: .6rem; }

  /* ---------- safety plan */
  .plan-section { padding: var(--space-l); border-radius: var(--radius-l); background: var(--surface); border: 1px solid var(--line);
    & h2 { font-size: var(--step-1); display: flex; gap: .75rem; align-items: center; }
    & h2 .n { width: 2rem; height: 2rem; border-radius: 50%; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-strong); font-size: .95rem; flex: none; }
    & > p { color: var(--muted); font-size: .94rem; margin-top: .4rem; }
    & .plan-items { display: grid; gap: .5rem; margin-top: var(--space-m); }
    & .plan-item { display: flex; gap: .5rem; }
    & .plan-item .input { flex: 1; }
  }
  .plan-section + .plan-section { margin-top: var(--space-m); }

  .save-state { font-size: .85rem; color: var(--muted); display: inline-flex; align-items: center; gap: .35rem; }
}

/* -------------------------------------------------------------- utilities */
@layer utilities {
  .visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
  .muted { color: var(--muted); }
  .center { text-align: center; }
  .mt-s { margin-top: var(--space-s); } .mt-m { margin-top: var(--space-m); } .mt-l { margin-top: var(--space-l); } .mt-xl { margin-top: var(--space-xl); } .mt-2xl { margin-top: var(--space-2xl); }
  .small { font-size: var(--step--1); }
  [hidden] { display: none !important; }
  .print-only { display: none; }

  @media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
    ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
  }

  @media print {
    .site-header, .site-footer, .tabbar, .quick-exit, .no-print, .toast-region, .skip-link, .page-head::before { display: none !important; }
    .print-only { display: block; }
    body { background: #fff; color: #000; padding: 0; font-size: 11pt; }
    .plan-section, .tool-panel { border: 1px solid #999; box-shadow: none; break-inside: avoid; }
    .input, .textarea { border: 0; border-bottom: 1px solid #bbb; border-radius: 0; padding: .2rem 0; min-height: 0; }
    .page-head { padding-block: 0 1rem; }
  }
}
