@layer tokens, base, components, layout;

@layer base {
  *, *::before, *::after { box-sizing: border-box; }
  html { scroll-behavior: smooth; scrollbar-gutter: stable; }
  html.layer-open { overflow: hidden; }
  body { margin: 0; background: var(--page); color: var(--text); font: 400 1rem/1.65 var(--font-body); -webkit-font-smoothing: antialiased; overflow-wrap: break-word; }
  a { color: inherit; text-underline-offset: .2em; }
  a:hover { color: var(--accent-text); }
  button, input, select, textarea { font: inherit; }
  button, summary { cursor: pointer; }
  button { color: inherit; }
  input, select, textarea { min-width: 0; max-width: 100%; }
  img, video, svg { max-width: 100%; }
  img, video { display: block; height: auto; }
  h1, h2, h3, h4, p, figure { margin: 0 0 var(--s4); }
  h1, h2, h3, h4, strong { font-weight: 600; }
  h1 { font-size: clamp(2.25rem, 4vw, 3.25rem); line-height: 1.08; letter-spacing: -.04em; }
  h2 { font-size: clamp(1.6rem, 3vw, 2rem); line-height: 1.2; letter-spacing: -.03em; }
  h3 { font-size: 1.35rem; line-height: 1.3; letter-spacing: -.02em; }
  :focus-visible { outline: 2px solid var(--accent-text); outline-offset: var(--s1); }
  :disabled, [aria-disabled='true'] { opacity: .45; cursor: not-allowed; }
  hr { border: 0; border-top: 1px solid var(--border); margin: var(--s4) 0; }
  [hidden] { display: none; }
  @media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
}

@layer components {
  /* FINAL v18 eyebrow: short rule before the label (components layer so route rules can still hide or align it). */
  .eyebrow { display: flex; align-items: center; gap: 9px; }
  .eyebrow::before { content: ''; flex: none; width: 18px; height: 2px; border-radius: 2px; background: var(--eyebrow-rule); }
  .visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
  .back-top { position: fixed; right: max(var(--s4), env(safe-area-inset-right)); bottom: max(var(--s4), env(safe-area-inset-bottom)); z-index: var(--z-sticky); box-shadow: var(--shadow-elevated); }
  .skip-link { position: fixed; top: var(--s4); left: var(--s4); transform: translateY(-200%); z-index: var(--z-toast); background: var(--surface); color: var(--text); padding: var(--s3) var(--s4); }
  .skip-link:focus { transform: none; }
  .btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--s2); min-height: 46px; min-width: var(--touch-target); max-width: 100%; padding: var(--s2) var(--s4); border: 1px solid transparent; border-radius: var(--radius-button); font-size: .92rem; font-weight: 500; line-height: 1.3; text-decoration: none; text-align: center; transition: background var(--motion-fast) var(--ease-standard), border-color var(--motion-fast) var(--ease-standard), transform var(--motion-fast) var(--ease-standard); }
  .btn-primary { background: var(--gold); border-color: var(--gold); color: var(--button-text); }
  .btn-primary:hover:enabled, a.btn-primary:hover { background: var(--gold-hover); border-color: var(--gold-hover); color: var(--button-text); transform: translateY(-1px); }
  .btn-secondary { background: var(--surface); border-color: var(--border); color: var(--text); }
  .btn-secondary:hover:enabled, a.btn-secondary:hover { border-color: var(--gold-border); color: var(--accent-text); }
  .btn-text, .text-action { background: transparent; border-color: transparent; color: var(--text); }
  .btn-text:hover:enabled, a.btn-text:hover, .text-action:hover { color: var(--accent-text); }
  .btn:active:enabled, a.btn:active { transform: translateY(1px); }
  .text-action { padding: 0; border: 0; text-align: left; text-decoration: underline; text-underline-offset: .2em; }
  .badge { display: inline-flex; align-items: center; min-height: 28px; padding: var(--s1) 10px; border: 1px solid var(--border); border-radius: var(--radius-badge); background: var(--surface-muted); color: var(--text-muted); font-size: .72rem; line-height: 1.4; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
  .badge-plus { background: var(--gold-soft); border-color: var(--gold-border); color: var(--accent-text); }
  .badge-free { background: color-mix(in srgb, var(--text) 5%, transparent); }
  .badge-on-media { background: var(--brand-page); border-color: var(--brand-border); color: var(--brand-text); }
  .badge-plus.badge-on-media { border-color: var(--gold-border); color: var(--gold-hover); }
  .badge-success { color: var(--success); }
  .badge-warning { color: var(--warning); }
  .badge-danger { color: var(--danger); }
  .badge-info { color: var(--info); }
  .chip { display: inline-flex; align-items: center; justify-content: center; min-height: var(--touch-target); min-width: var(--touch-target); padding: var(--s2) var(--s3); border-radius: var(--radius-pill); border: 1px solid var(--border); background: var(--surface-muted); color: var(--text-muted); font-size: .8125rem; }
  .chip[aria-pressed='true'] { background: var(--gold-soft); color: var(--accent-text); border-color: var(--gold-border); }
  .chip:hover { border-color: var(--gold-border); }
  .card { min-width: 0; padding: var(--s5); border: 1px solid var(--border); border-radius: var(--radius-card); background: var(--surface); box-shadow: var(--shadow-card); }
  .card > :last-child { margin-bottom: 0; }
  .card-accent { border-color: var(--gold-border); position: relative; }
  .card-accent::before { content: ''; position: absolute; top: var(--s4); bottom: var(--s4); left: 0; width: 2px; background: var(--gold); }
  .card-muted { background: var(--surface-muted); box-shadow: none; }
  .tool-icon { display: inline-grid; place-items: center; width: 44px; height: 44px; flex: 0 0 44px; padding: 6px; border: 1px solid var(--tool-border); border-radius: var(--radius-control); background: var(--tool-surface); color: var(--tool-text); box-shadow: var(--tool-shadow); }
  .tool-icon--situation { background: var(--brand-page); border-color: var(--brand-border); color: var(--brand-text); }
  .plain-icon { display: inline-grid; place-items: center; width: 34px; height: 34px; flex: 0 0 34px; padding: 0; background: transparent; border: 0; box-shadow: none; }
  .tool-icon img, .plain-icon img { width: 30px; height: 30px; object-fit: contain; }
  /* r337 section titles with an illustration in front (news icon, .r4x-news-title-with-icon, 24-26 px). */
  .heading-with-icon { display: inline-flex; align-items: center; gap: var(--s3); }
  .heading-icon { flex: none; width: 26px; height: 26px; object-fit: contain; }
  .breadcrumbs { color: var(--text-muted); font-size: .8125rem; margin-bottom: var(--s5); }
  .breadcrumbs ol { display: flex; flex-wrap: wrap; gap: var(--s2); padding: 0; margin: 0; list-style: none; }
  .breadcrumbs li { min-width: 0; display: inline-flex; gap: var(--s2); align-items: center; }
  .breadcrumbs a { text-decoration: none; }
  .field { display: grid; gap: var(--s2); }
  .field label { font-size: .8125rem; font-weight: 600; }
  .input { width: 100%; min-height: 48px; padding: var(--s3); border: 1px solid var(--border); border-radius: var(--radius-control); background: var(--input); color: var(--text); transition: border-color var(--motion-fast) var(--ease-standard); }
  .input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft); }
  .input::placeholder { color: var(--text-muted); }
  textarea.input { min-height: 128px; resize: vertical; }
  .field-hint { color: var(--text-muted); font-size: .8125rem; }
  .field-check { grid-template-columns: auto 1fr; align-items: center; min-height: var(--touch-target); }
  .field-check label { grid-column: 2; grid-row: 1; padding-block: var(--s3); }
  .field-check input { grid-column: 1; grid-row: 1; width: 20px; height: 20px; accent-color: var(--gold); }
  .field-check .field-hint { grid-column: 2; }
  .accordion { border: 1px solid var(--border); border-radius: var(--radius-card); background: var(--surface); }
  .accordion summary { display: flex; justify-content: space-between; align-items: center; gap: var(--s3); padding: var(--s4); min-height: var(--touch-target); font-weight: 600; list-style: none; }
  .accordion summary::-webkit-details-marker { display: none; }
  .accordion-icon { display: grid; place-items: center; width: 30px; height: 30px; flex: 0 0 30px; border: 1px solid var(--gold-border); border-radius: var(--radius-control); color: var(--accent-text); background: var(--gold-soft); transition: transform var(--motion-fast) var(--ease-standard); }
  .accordion[open] .accordion-icon { transform: rotate(45deg); }
  .accordion-content { padding: 0 var(--s4) var(--s4); color: var(--text-muted); }
  .metric { display: grid; gap: var(--s1); padding: var(--s4); border: 1px solid var(--border); border-radius: var(--radius-card); background: var(--surface); }
  .metric-label, .metric-detail { color: var(--text-muted); font-size: .8125rem; }
  .metric-value { font-size: 1.75rem; line-height: 1.2; }
  .metric-detail-success { color: var(--success); }
  .metric-detail-danger { color: var(--danger); }
  .progress { display: grid; gap: var(--s2); font-size: .8125rem; }
  progress { width: 100%; height: var(--s2); appearance: none; border: 0; border-radius: var(--radius-pill); background: var(--surface-strong); accent-color: var(--gold); overflow: hidden; }
  progress::-webkit-progress-bar { background: var(--surface-strong); }
  progress::-webkit-progress-value { background: var(--gold); border-radius: var(--radius-pill); }
  progress::-moz-progress-bar { background: var(--gold); border-radius: var(--radius-pill); }
  /* Full-width descriptive scale (r337 Fear-and-Greed track): token gradient, value shown as a marker line. */
  .meter-scale { display: block; width: 100%; height: var(--s3); margin-block: var(--s4) var(--s2); appearance: none; border: 0; border-radius: var(--radius-pill); background: linear-gradient(90deg, var(--danger), var(--warning) 50%, var(--success)); }
  .meter-scale::-webkit-meter-bar { height: var(--s3); border: 0; border-radius: var(--radius-pill); background: linear-gradient(90deg, var(--danger), var(--warning) 50%, var(--success)); }
  .meter-scale::-webkit-meter-optimum-value, .meter-scale::-webkit-meter-suboptimum-value, .meter-scale::-webkit-meter-even-less-good-value { background: transparent; box-shadow: inset -4px 0 0 var(--text), inset -6px 0 0 var(--surface); }
  .meter-scale::-moz-meter-bar { background: transparent; box-shadow: inset -4px 0 0 var(--text), inset -6px 0 0 var(--surface); }
  .meter-scale-labels { display: grid; grid-template-columns: 1fr auto 1fr; gap: var(--s3); margin: 0 0 var(--s4); font-size: .8125rem; }
  .meter-scale-labels > :nth-child(2) { text-align: center; }
  .meter-scale-labels > :last-child { text-align: end; }
  .status { --status-color: var(--info); display: grid; gap: var(--s2); padding: var(--s4); background: var(--surface); border: 1px solid color-mix(in srgb, var(--status-color) 40%, var(--border)); border-radius: var(--radius-card); }
  .status > strong { color: var(--status-color); }
  .status-success { --status-color: var(--success); }
  .status-warning { --status-color: var(--warning); }
  .status-danger { --status-color: var(--danger); }
  .status p:last-child { margin-bottom: 0; }
  .status-action { display: flex; gap: var(--s3); flex-wrap: wrap; }
  .table-scroll { max-width: 100%; overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-card); background: var(--surface); }
  .table-scroll table { width: 100%; min-width: 620px; border-collapse: collapse; font-size: .875rem; }
  .table-scroll th, .table-scroll td { text-align: left; vertical-align: top; padding: var(--s3) var(--s4); border-bottom: 1px solid var(--border-soft); }
  .table-scroll th { color: var(--text-muted); font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; }
  .table-scroll caption { padding: var(--s4); font-weight: 600; text-align: left; }
  .list-row { display: flex; justify-content: space-between; gap: var(--s4); padding-block: var(--s3); border-bottom: 1px solid var(--border-soft); }
  .list-row small { display: block; color: var(--text-muted); }
  .tabs > [role='tablist'] { display: flex; flex-wrap: wrap; padding: var(--s1); gap: var(--s1); background: var(--surface-muted); border: 1px solid var(--border); border-radius: var(--radius-control); }
  .tabs [role='tab'] { min-height: var(--touch-target); min-width: var(--touch-target); padding: var(--s2) var(--s3); border: 1px solid transparent; border-radius: var(--radius-button); background: transparent; color: var(--text-muted); }
  .tabs [role='tab'][aria-selected='true'] { background: var(--surface); color: var(--text); border-color: var(--border); box-shadow: var(--shadow-card); }
  .tabs > [role='tabpanel'] { padding-block: var(--s4); }
  .chart-surface { position: relative; margin: 0; padding: var(--s4); border: 1px solid var(--border); border-radius: var(--radius-card); background: var(--surface); }
  .chart-surface svg { display: block; width: 100%; height: auto; }
  .chart-tooltip { display: grid; gap: var(--s1); max-width: 100%; padding: var(--s3); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-control); box-shadow: var(--shadow-elevated); font-size: .8125rem; }
  .chart-tooltip span { color: var(--text-muted); }
  .skeleton { display: grid; gap: var(--s2); }
  .skeleton-bar { height: var(--s4); border-radius: var(--radius-pill); background: var(--surface-strong); animation: skeleton-pulse 1.5s var(--ease-standard) infinite alternate; }
  @keyframes skeleton-pulse { to { opacity: .4; } }
  .theme-control, .icon-control { display: inline-grid; place-items: center; width: var(--touch-target); height: var(--touch-target); flex: 0 0 var(--touch-target); border: 1px solid var(--border); border-radius: var(--radius-button); background: var(--surface); color: var(--text); font-size: 1.25rem; }
  .theme-control:hover, .icon-control:hover { background: var(--surface-muted); border-color: var(--gold-border); }
  .theme-control[hidden] { display: none; }
  .dialog { width: min(640px, calc(100% - var(--s6))); max-height: calc(100dvh - var(--s6) - env(safe-area-inset-top) - env(safe-area-inset-bottom)); padding: var(--s5); border: 1px solid var(--border); border-radius: var(--radius-card); background: var(--surface); color: var(--text); box-shadow: var(--shadow-elevated); overflow: auto; overscroll-behavior: contain; z-index: var(--z-modal); }
  .dialog::backdrop { background: var(--overlay); }
  .dialog-heading { display: flex; align-items: start; justify-content: space-between; gap: var(--s4); margin-bottom: var(--s4); }
  .dialog-heading h2 { margin: 0; padding-top: var(--s2); }
  .dialog-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: var(--s3); margin-top: var(--s5); }
  .dialog-actions:empty { display: none; }
  .dialog-media { width: min(1200px, calc(100% - var(--s6))); }
  .dialog-tour { width: min(480px, calc(100% - var(--s6))); max-height: 55dvh; margin: auto max(var(--s4), env(safe-area-inset-right)) max(var(--s4), env(safe-area-inset-bottom)) auto; }
  /* FINAL v18 Exit Guard: centred elevated panel, gold edge, white tool icon, two equal actions. */
  .dialog-exit { position: relative; width: min(390px, calc(100% - var(--s6))); padding: 28px 24px 23px; border-color: var(--gold-border); text-align: center; }
  .dialog-exit::before { content: ''; position: absolute; top: 0; left: 18%; right: 18%; height: 1px; background: linear-gradient(90deg, transparent, var(--gold-hover), transparent); }
  .dialog-exit .dialog-heading { flex-direction: column; align-items: center; gap: var(--s4); margin-bottom: var(--s2); }
  .dialog-exit .dialog-heading h2 { padding-top: 0; font-size: 1.15rem; line-height: 1.3; font-weight: 600; }
  .dialog-exit [data-dialog-close] { display: none; }
  .dialog-exit [data-dialog-content] p { max-width: 31ch; margin: 0 auto; color: var(--text-muted); font-size: .87rem; line-height: 1.55; }
  .dialog-exit .dialog-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: var(--s5); }
  .dialog-exit .dialog-actions .btn { width: 100%; min-height: 48px; padding: var(--s2) 13px; white-space: normal; }
  .dialog-tool-icon { overflow: hidden; }
  @media (max-width: 520px) { .dialog-exit { padding: 24px 18px 18px; } .dialog-exit .dialog-actions { grid-template-columns: 1fr; } }
  /* r32 share dialog (Daniel 30.09.2026): all actions stay, as a grid; the first (primary) action spans the row. */
  .dialog-share [data-dialog-content] p { overflow-wrap: anywhere; }
  .dialog-share .dialog-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
  .dialog-share .dialog-actions .btn { width: 100%; min-width: 0; white-space: normal; }
  .dialog-share .dialog-actions .btn-primary { grid-column: 1 / -1; }
  @media (max-width: 640px) { .dialog-share .dialog-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
  [data-tour-highlight] { outline: 3px solid var(--accent-text); outline-offset: var(--s2); animation: tour-mark-in calc(var(--motion-base) + var(--motion-fast)) var(--ease-standard); }
  /* r43 (Prüfliste C1): "So entsteht ein Hinweis" on the account page: four stations. The layout follows the card
     width (container query): stacked with downward arrows in a narrow card, in a row with arrows in a wide one. */
  .hint-flow { margin: var(--s4) 0; container-type: inline-size; }
  .hint-flow > figcaption { margin-bottom: var(--s3); }
  .hint-flow ol { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s5); margin: 0; padding: 0; list-style: none; }
  .hint-flow__step { position: relative; display: grid; grid-template-columns: var(--s6) minmax(0, 1fr); column-gap: var(--s3); row-gap: var(--s1); align-items: start; padding: var(--s3); border: 1px solid var(--border); border-radius: var(--radius-card); background: var(--surface-muted); }
  .hint-flow__step:not(:last-child)::after { content: '↓'; position: absolute; left: calc(var(--s3) + var(--s2)); bottom: calc(-1 * var(--s5)); display: grid; place-items: center; height: var(--s5); color: var(--accent-text); font-weight: 700; }
  .hint-flow__icon { grid-row: span 2; display: inline-grid; place-items: center; width: var(--s6); height: var(--s6); border: 1px solid var(--gold-border); border-radius: var(--radius-control); background: var(--gold-soft); color: var(--accent-text); }
  .hint-flow__icon svg { width: 18px; height: 18px; }
  .hint-flow__step strong { font-size: .9rem; }
  .hint-flow__step > span:last-child { color: var(--text-muted); font-size: .8125rem; line-height: 1.45; }
  @container (min-width: 760px) {
    .hint-flow ol { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .hint-flow__step { grid-template-columns: minmax(0, 1fr); }
    .hint-flow__icon { grid-row: auto; }
    .hint-flow__step:not(:last-child)::after { content: '→'; left: auto; right: calc(-1 * var(--s5)); bottom: auto; top: 50%; width: var(--s5); height: auto; transform: translateY(-50%); }
  }
  /* r43 (Prüfliste A1): the tour mark settles onto its target instead of jumping. */
  @keyframes tour-mark-in { from { outline-color: transparent; outline-offset: var(--s4); } to { outline-color: var(--accent-text); outline-offset: var(--s2); } }
  @media (prefers-reduced-motion: reduce) { [data-tour-highlight] { animation: none; } }
  .media-viewer { max-width: 100%; max-height: 65dvh; overflow: auto; overscroll-behavior: contain; touch-action: pan-x pan-y pinch-zoom; border-radius: var(--radius-control); background: var(--surface-muted); }
  .media-viewer-image { display: block; height: auto; max-width: none; margin: 0; }
  .media-viewer-image[data-zoom='1'] { width: 100%; }
  .media-viewer-image[data-zoom='1.5'] { width: 150%; }
  .media-viewer-image[data-zoom='2'] { width: 200%; }
  .media-viewer-image[data-zoom='2.5'] { width: 250%; }
  .media-viewer-image[data-zoom='3'] { width: 300%; }
  .dialog-theme { width: min(320px, calc(100% - var(--s6))); }
  .theme-picker { display: grid; gap: var(--s1); }
  .theme-picker button { display: flex; justify-content: space-between; min-height: var(--touch-target); padding: var(--s2) var(--s3); border: 1px solid transparent; border-radius: var(--radius-button); background: transparent; color: var(--text); text-align: left; }
  .theme-picker button:hover { background: var(--surface-muted); }
  .theme-picker button[aria-pressed='true'] { color: var(--accent-text); background: var(--gold-soft); }
  .feedback { position: fixed; left: max(var(--s4), env(safe-area-inset-left)); right: max(var(--s4), env(safe-area-inset-right)); bottom: max(var(--s4), env(safe-area-inset-bottom)); z-index: var(--z-toast); pointer-events: none; display: grid; justify-items: end; gap: var(--s2); }
  .feedback > div { max-width: min(100%, 480px); }
  .toast { display: flex; align-items: start; gap: var(--s3); box-shadow: var(--shadow-elevated); pointer-events: auto; }
  .toast .icon-control { background: transparent; }
  .toast > span { flex: 1; }
  @media (prefers-reduced-motion: reduce) { .skeleton-bar { animation: none; } }
}

@layer layout {
  .container { width: 100%; max-width: var(--desktop-max); padding-inline: max(var(--desktop-pad), env(safe-area-inset-left)) max(var(--desktop-pad), env(safe-area-inset-right)); margin-inline: auto; }
  .consent-notice { position: fixed; z-index: var(--z-sticky); left: max(var(--s4), env(safe-area-inset-left)); right: max(var(--s4), env(safe-area-inset-right)); bottom: max(var(--s4), env(safe-area-inset-bottom)); width: auto; max-width: 640px; max-height: calc(100dvh - var(--s6) - env(safe-area-inset-top) - env(safe-area-inset-bottom)); overflow: auto; overscroll-behavior: contain; box-shadow: var(--shadow-elevated); }
  .consent-notice .r4x-actions { margin-bottom: 0; }
  .main-content { min-height: 40vh; padding-block: var(--s7) var(--s8); }
  .site-header { position: sticky; top: 0; z-index: var(--z-nav); background: var(--header-surface); }
  .header-brand { display: flex; justify-content: space-between; align-items: center; gap: var(--s4); padding-top: env(safe-area-inset-top); }
  .brand-logo { display: block; flex: 0 0 112px; width: 112px; }
  .brand-logo img { width: 112px; height: 112px; object-fit: contain; }
  .logo-dark { display: none; }
  html[data-theme='dark'] .logo-dark { display: block; }
  html[data-theme='dark'] .logo-light { display: none; }
  .header-controls { display: flex; align-items: center; gap: var(--s4); }
  .header-session { color: var(--text-muted); font-size: .8125rem; }
  .header-session a { margin-left: var(--s3); }
  .header-navigation, .site-footer { --surface: var(--brand-page); --surface-muted: var(--brand-surface); --text: var(--brand-text); --text-muted: var(--brand-muted); --border: var(--brand-border); --accent-text: var(--gold-hover); color: var(--brand-text); background: var(--brand-page); color-scheme: dark; }
  .header-navigation-inner { display: flex; align-items: center; justify-content: space-between; gap: var(--s4); padding-block: var(--s3); }
  .primary-navigation { display: flex; gap: var(--s2); }
  .primary-navigation .btn { border-color: var(--gold-border); }
  .primary-navigation [aria-current='page'] { color: var(--gold-hover); background: var(--gold-soft); }
  .menu-disclosure > summary { display: grid; place-items: center; width: var(--touch-target); height: var(--touch-target); border: 1px solid var(--gold-border); border-radius: var(--radius-button); font-size: 1.5rem; list-style: none; }
  .menu-disclosure > summary::-webkit-details-marker { display: none; }
  .menu-disclosure .menu-content { position: absolute; right: var(--s5); top: 100%; width: min(360px, calc(100% - var(--s6))); max-height: 70vh; overflow: auto; padding: var(--s5); background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius-card); box-shadow: var(--shadow-elevated); }
  .dialog-menu { width: min(400px, calc(100% - var(--s6))); margin-right: max(var(--s4), env(safe-area-inset-right)); z-index: var(--z-drawer); }
  .menu-navigation { display: grid; }
  .menu-navigation a { display: flex; align-items: center; min-height: var(--touch-target); padding: var(--s2) var(--s3); text-decoration: none; border-radius: var(--radius-button); }
  .menu-navigation a:hover, .menu-navigation [aria-current='page'] { color: var(--accent-text); background: var(--gold-soft); }
  .menu-heading { display: block; color: var(--accent-text); font-size: .75rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
  .menu-status { display: grid; gap: var(--s2); padding: var(--s4); margin-top: var(--s4); border: 1px solid var(--gold-border); border-radius: var(--radius-card); background: var(--gold-soft); }
  .account-status { padding-top: var(--s3); border-top: 1px solid var(--border); }
  .account-status p { margin-block: var(--s1); font-size: .8125rem; color: var(--text-muted); }
  .site-footer { --surface: var(--footer-page); --surface-muted: var(--footer-surface); background: var(--footer-page); padding-block: var(--s7) max(var(--s7), env(safe-area-inset-bottom)); }
  .footer-insights { display: flex; align-items: center; justify-content: space-between; gap: var(--s5); border: 1px solid var(--gold-border); background: var(--gold-soft); border-radius: var(--radius-card); padding: var(--s4) var(--s5); margin-bottom: var(--s7); }
  .footer-insights-copy { display: flex; align-items: center; gap: var(--s4); }
  .footer-insights-copy strong, .footer-insights-copy span { display: block; }
  .footer-insights-copy strong { color: var(--gold-hover); }
  .footer-insights-copy > div > span { color: var(--text-muted); font-size: .875rem; }
  .insights-mark { color: var(--gold); flex: 0 0 32px; }
  .footer-main { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: var(--s7); }
  .footer-logo { display: inline-block; }
  .footer-logo img { width: 87px; height: 44px; object-fit: contain; }
  .footer-claim { color: var(--text-muted); font-size: .875rem; margin: var(--s2) 0 0; }
  .footer-promise { color: var(--gold); font-size: .875rem; margin: var(--s1) 0 var(--s3); }
  .footer-ai { font-size: .75rem; }
  .footer-ai summary { display: inline-flex; align-items: center; gap: var(--s1); min-height: var(--touch-target); color: var(--gold-hover); list-style: none; }
  .footer-ai summary::-webkit-details-marker { display: none; }
  .footer-ai > div { max-width: var(--reading-max); padding-top: var(--s3); }
  .footer-navigation { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: var(--s5); }
  .footer-column { display: flex; flex-direction: column; align-items: start; gap: var(--s2); }
  .footer-column a, .footer-column button { font-size: .875rem; text-decoration: none; color: var(--text-muted); }
  .footer-column a:hover, .footer-column button:hover { color: var(--gold-hover); }
  .footer-column .footer-heading { font-size: .8125rem; color: var(--gold); font-weight: 600; }
  .footer-legal { max-width: 88ch; border-top: 1px solid var(--border); margin: var(--s6) 0 0; padding-top: var(--s5); color: var(--text-muted); font-size: .8125rem; line-height: 1.6; }
  .wordmark { color: var(--gold); }
  .wordmark i { color: var(--text); font-style: normal; } /* footer chrome sets --text to the brand text */
  .r4x-editorial { min-width: 0; }
  .r4x-editorial p, .r4x-editorial li { max-width: var(--reading-max); }
  .r4x-hero { padding-block: var(--s5) var(--s7); border-bottom: 1px solid var(--border); }
  .r4x-section { padding-block: var(--s7); }
  .r4x-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s5); }
  .r4x-grid--two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .r4x-grid > * { min-width: 0; }
  /* r337 market ticker (/news/ and Zentrale): desktop one row, mobile two columns. */
  @media (min-width: 1200px) { .r4x-grid.market-ticker { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: var(--s3); } }
  @media (max-width: 767px) { .r4x-grid.market-ticker { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s3); } }
  .r4x-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s3); margin-block: var(--s5); }
  .r4x-lead { font-size: 1.125rem; color: var(--text-muted); max-width: var(--reading-max); }
  .r4x-callout { padding: var(--s5); border-left: 2px solid var(--gold); background: var(--surface-muted); margin-block: var(--s5); }
  .r4x-editorial-context, .eyebrow { color: var(--accent-text); font-size: .72rem; font-weight: 700; letter-spacing: .18em; text-transform: uppercase; }
  .r4x-media { max-width: 100%; margin-block: var(--s5); }
  .r4x-media img { max-width: 100%; height: auto; border-radius: var(--radius-card); }
  .r4x-media figcaption { font-size: .8125rem; color: var(--text-muted); margin-top: var(--s2); }
  .editorial-illustration { margin-inline: 0; }
  .editorial-illustration > .btn { display: grid; gap: var(--s2); width: 100%; padding: 0; text-align: start; white-space: normal; }
  .editorial-illustration img { display: block; width: 100%; height: auto; }
  /* r36: r337 knowledge card images (/wissen/) with the access badges on the image; the wide cards put image and text
     side by side from 701 px (r337 breakpoint of the navigator picture). */
  .r4x-card-media { position: relative; min-width: 0; margin-bottom: var(--s4); overflow: hidden; border-radius: var(--radius-control); background: var(--brand-page); }
  .r4x-card-media picture, .r4x-card-media img { display: block; width: 100%; height: auto; }
  .r4x-card-media-badges { position: absolute; top: var(--s3); right: var(--s3); }
  .r4x-card-media-badges, .r4x-card-media-badges > div { display: flex; gap: var(--s2); }
  .r4x-media-card { display: grid; align-items: center; column-gap: var(--s5); }
  .r4x-title-row { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); }
  @media (min-width: 701px) {
    .r4x-media-card { grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); }
    .r4x-media-card > .r4x-card-media { margin-bottom: 0; }
    .r4x-only-mobile { display: none; }
  }
  @media (max-width: 700px) { .r4x-only-desktop { display: none; } }
  /* r36: r337 area hero (v846/v846.1): desktop shows eyebrow and lead; up to 760 px an "i" row replaces both and opens
     the lead in place. Never both at once. */
  .r4x-hero-info { display: none; }
  @media (max-width: 760px) {
    .r4x-hero-info { display: block; margin-bottom: var(--s2); }
    .r4x-hero-info > summary { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); min-height: var(--touch-target); list-style: none; cursor: pointer; }
    .r4x-hero-info > summary::-webkit-details-marker { display: none; }
    .r4x-hero-info > summary .eyebrow { margin: 0; }
    .r4x-hero-info__icon { display: inline-grid; place-items: center; width: 28px; height: 28px; flex: none; border: 1px solid var(--gold-border); border-radius: var(--radius-pill); background: var(--gold-soft); color: var(--accent-text); font-weight: 700; line-height: 1; }
    .r4x-hero-info[open] .r4x-hero-info__icon { border-color: var(--gold); }
    .r4x-hero-info > p { margin: var(--s2) 0 var(--s3); padding: var(--s3); border: 1px solid var(--border); border-radius: var(--radius-card); background: var(--surface-muted); color: var(--text-muted); }
    .r4x-hero-eyebrow, .r4x-hero-sub { display: none; }
  }
  .beginner-editorial { background: var(--beginner-canvas); }
  .beginner-display { font-family: var(--font-beginner); }
  @media (min-width: 768px) { .theme-control { width: 40px; height: 40px; flex-basis: 40px; } }
  @media (min-width: 768px) and (max-width: 1023px) { .r4x-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .footer-main { grid-template-columns: 1fr; gap: var(--s6); } }
  @media (max-width: 767px) {
    .container { padding-inline: max(var(--mobile-pad), env(safe-area-inset-left)) max(var(--mobile-pad), env(safe-area-inset-right)); }
    .main-content { padding-block: var(--s6) var(--s7); }
    .brand-logo, .brand-logo img { width: 96px; height: 96px; flex-basis: 96px; }
    .header-session { display: none; }
    .header-navigation-inner { gap: var(--s2); }
    .primary-navigation { flex: 1; gap: var(--s1); min-width: 0; }
    .primary-navigation .btn { font-size: .75rem; padding-inline: var(--s2); flex: 1; }
    .primary-navigation .btn span[aria-hidden] { display: none; }
    .primary-navigation [data-wide-only] { display: none; }
    .menu-disclosure .menu-content { right: var(--s4); }
    .card, .dialog { padding: var(--s4); }
    .dialog-actions .btn { flex: 1; }
    .footer-main, .footer-navigation, .r4x-grid { grid-template-columns: 1fr; }
    .footer-main, .footer-navigation { gap: var(--s6); }
    .footer-insights { flex-wrap: wrap; padding: var(--s4); gap: var(--s4); }
    .footer-column { gap: 0; }
    .footer-column a, .footer-column button { display: inline-flex; align-items: center; min-height: var(--touch-target); min-width: var(--touch-target); }
    .footer-column .footer-heading { min-height: var(--touch-target); display: flex; align-items: center; }
    .breadcrumbs a { display: inline-flex; align-items: center; min-height: var(--touch-target); }
    .r4x-section { padding-block: var(--s6); }
    .feedback { bottom: max(var(--s4), env(safe-area-inset-bottom)); }
  }
  /* Shared dashboard navigation (decision 26.09.2026). Wide screens: only the slim workspace bar stays pinned,
     the tall brand header scrolls away. Narrow screens: bottom navigation with Mein Bereich, Prüfen, Zuletzt, Bereiche. */
  html { scroll-padding-top: calc(var(--workspace-bar-height, 0px) + var(--s3)); }
  body[data-surface='dashboard'] .site-header { position: static; }
  .menu-group + .menu-group { margin-top: var(--s3); padding-top: var(--s3); border-top: 1px solid var(--border); }
  .menu-group .menu-heading { margin-bottom: var(--s1); }
  .menu-current-tool { display: block; padding: 0 var(--s3) var(--s2) var(--s5); color: var(--text-muted); font-size: .8125rem; }
  .menu-learning-path { display: grid; padding: 0 0 var(--s2) var(--s4); }
  .menu-learning-path__label { margin: var(--s1) 0; color: var(--text-muted); font-size: .75rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
  .menu-navigation .menu-learning-path a { gap: var(--s2); font-size: .875rem; }
  .menu-learning-path__num { flex: 0 0 24px; color: var(--accent-text); font-weight: 700; }
  .workspace-bar, .bottom-nav { --surface: var(--brand-page); --surface-muted: var(--brand-surface); --text: var(--brand-text); --text-muted: var(--brand-muted); --border: var(--brand-border); --accent-text: var(--gold-hover); color: var(--brand-text); background: var(--brand-page); color-scheme: dark; }
  .workspace-bar { position: sticky; top: 0; z-index: var(--z-nav); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
  .workspace-bar__inner { display: flex; align-items: center; gap: var(--s4); min-height: 56px; }
  .workspace-nav { display: flex; flex: 1; align-items: center; gap: var(--s1); min-width: 0; overflow-x: auto; scrollbar-width: none; }
  .workspace-nav::-webkit-scrollbar { display: none; }
  .workspace-nav__item { display: inline-flex; align-items: center; min-height: 40px; padding: 0 var(--s3); border-radius: var(--radius-button); color: var(--text-muted); font-size: .875rem; font-weight: 600; text-decoration: none; white-space: nowrap; }
  .workspace-nav__item:hover { color: var(--text); background: var(--surface-muted); }
  .workspace-nav__item[aria-current='page'] { color: var(--gold-hover); background: var(--gold-soft); box-shadow: inset 0 -2px 0 var(--gold); }
  .workspace-nav__tools { display: flex; flex: none; gap: var(--s2); }
  .workspace-nav__tool { display: inline-flex; align-items: center; gap: var(--s2); min-height: 40px; padding: 0 var(--s3); border: 1px solid var(--border); border-radius: var(--radius-button); background: transparent; color: var(--text); font: inherit; font-size: .8125rem; font-weight: 600; text-decoration: none; white-space: nowrap; cursor: pointer; }
  .workspace-nav__tool:hover { border-color: var(--gold-border); color: var(--gold-hover); }
  .workspace-nav__tool svg, .bottom-nav__icon svg, .search-control svg { width: 18px; height: 18px; }
  .workspace-nav__tool[hidden] { display: none; }
  .bottom-nav { display: none; }
  /* r337 tool resume: the remembered tool card is briefly highlighted after returning. */
  .r4x-focus-pulse { outline: 2px solid var(--gold); outline-offset: 4px; border-radius: var(--radius-card); }
  .dialog-search { width: min(680px, calc(100% - var(--s6))); }
  .search-panel { display: grid; gap: var(--s4); }
  .search-input { width: 100%; min-height: var(--touch-target); padding: var(--s2) var(--s3); border: 1px solid var(--border); border-radius: var(--radius-control); background: var(--surface); color: var(--text); font: inherit; font-size: 1rem; }
  .search-input:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
  .search-results { max-height: min(60vh, 560px); overflow: auto; overscroll-behavior: contain; }
  .search-results__list { display: grid; gap: var(--s1); margin: 0; padding: 0; list-style: none; }
  .search-result { display: grid; gap: 2px; padding: var(--s3); border: 1px solid transparent; border-radius: var(--radius-control); color: var(--text); text-decoration: none; }
  a.search-result:hover, a.search-result:focus-visible { border-color: var(--gold-border); background: var(--surface-muted); }
  .search-result__type { color: var(--accent-text); font-size: .6875rem; font-weight: 700; letter-spacing: .11em; text-transform: uppercase; }
  .search-result__title { font-weight: 600; line-height: 1.35; }
  .search-result__plus { color: var(--accent-text); }
  .search-result__included { color: var(--accent-text); font-size: .75rem; }
  .search-result__desc { color: var(--text-muted); font-size: .8125rem; line-height: 1.45; }
  .search-hint, .search-empty { margin: 0; padding: var(--s5) var(--s3); color: var(--text-muted); text-align: center; }
  .dialog-areas { width: min(400px, calc(100% - var(--s6))); }
  .areas-drawer { display: grid; gap: var(--s2); }
  .areas-drawer__group { display: grid; padding-top: var(--s3); border-top: 1px solid var(--border); }
  .areas-drawer__group .menu-heading { margin-bottom: var(--s1); }
  .areas-drawer__item { display: flex; align-items: center; gap: var(--s3); min-height: var(--touch-target); padding: var(--s2) var(--s3); border: 0; border-radius: var(--radius-button); background: transparent; color: var(--text); font: inherit; text-align: start; text-decoration: none; cursor: pointer; }
  .areas-drawer__item:hover, .areas-drawer__item[aria-current='page'] { color: var(--accent-text); background: var(--gold-soft); }
  .areas-drawer__icon { display: inline-grid; place-items: center; flex: 0 0 28px; width: 28px; height: 28px; }
  .areas-drawer__icon img, .areas-drawer__icon svg { width: 24px; height: 24px; object-fit: contain; }
  @media (max-width: 767px) {
    body[data-surface='dashboard'] { --bottom-nav-space: calc(64px + env(safe-area-inset-bottom)); padding-bottom: var(--bottom-nav-space); }
    html { scroll-padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
    .workspace-bar { display: none; }
    .bottom-nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: var(--z-nav); display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); padding: 0 env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); border-top: 1px solid var(--border); }
    .bottom-nav__item { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 64px; padding: var(--s1); border: 0; background: transparent; color: var(--text-muted); font: inherit; font-size: .6875rem; font-weight: 600; text-decoration: none; cursor: pointer; }
    .bottom-nav__icon svg { width: 22px; height: 22px; }
    .bottom-nav__item[aria-current='page'], .bottom-nav__item[data-active] { color: var(--gold-hover); }
    body[data-surface='dashboard'] :is(.back-top, .feedback, .consent-notice) { bottom: calc(var(--bottom-nav-space) + var(--s3)); }
    .dialog-search { width: calc(100% - var(--s4)); }
  }
  /* r39 dashboard header (decision Daniel 04.10.2026): one row in the dark brand chrome (both themes) with logo,
     Startseite, Mein Bereich, Shop and menu; the r337 gold line (shared-header: 3px) closes it. */
  .site-header--app { --header-surface: var(--brand-page); --surface: var(--brand-page); --surface-muted: var(--brand-surface); --text: var(--brand-text); --text-muted: var(--brand-muted); --border: var(--brand-border); --accent-text: var(--gold-hover);
    color: var(--brand-text); border-bottom: 3px solid var(--gold); color-scheme: dark; }
  .header-app { display: flex; align-items: center; gap: var(--s4); min-height: var(--s8); padding-top: env(safe-area-inset-top); }
  .header-app__logo { display: block; flex: none; }
  .header-app__logo img { display: block; width: auto; height: 44px; }
  .site-header--app .primary-navigation { margin-left: auto; }
  /* r39 info bar (r337 cockpit-topbar): context, tour entry, account, Plus and theme, scrolls away with the header. */
  .info-bar { --surface: var(--brand-surface); --surface-muted: var(--brand-page); --text: var(--brand-text); --text-muted: var(--brand-muted); --border: var(--brand-border); --accent-text: var(--gold-hover);
    color: var(--brand-text); background: var(--brand-surface); border-bottom: 1px solid var(--border); color-scheme: dark; }
  .info-bar__inner { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); min-height: var(--touch-target); padding-block: var(--s1); }
  .info-bar__context { display: flex; align-items: baseline; gap: var(--s2); min-width: 0; margin: 0; white-space: nowrap; }
  .info-bar__mark { color: var(--gold); font-size: .875rem; font-weight: 500; letter-spacing: .02em; }
  .info-bar__mark span { color: var(--text); }
  .info-bar__title { min-width: 0; overflow: hidden; text-overflow: ellipsis; font-size: .875rem; font-weight: 600; }
  .info-bar__sub { color: var(--text-muted); font-size: .8125rem; }
  .info-bar__tour { color: var(--gold); font-size: .8125rem; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
  .info-bar__tour:hover { color: var(--gold-hover); }
  .info-bar__status { display: flex; flex: none; align-items: center; gap: var(--s2); }
  .info-pill { display: inline-flex; align-items: center; gap: var(--s2); min-height: var(--s6); padding: 0 var(--s3); border: 1px solid var(--border); border-radius: var(--radius-pill); color: var(--text); font-size: .75rem; font-weight: 600; text-decoration: none; white-space: nowrap; }
  a.info-pill:hover { border-color: var(--gold-border); color: var(--accent-text); }
  .info-pill__dot { width: var(--s2); height: var(--s2); border-radius: var(--radius-pill); background: var(--text-muted); }
  .info-pill[data-session-state='active'] .info-pill__dot { background: var(--brand-success); }
  .info-pill:is([data-session-state='unavailable'],[data-session-state='checking']) .info-pill__dot { background: var(--brand-warning); }
  .info-pill__sep { color: var(--text-muted); font-weight: 400; }
  .info-pill--plus { border-color: var(--gold-border); background: var(--gold-soft); color: var(--gold); }
  .info-pill[hidden] { display: none; }
  .info-bar .theme-control { width: var(--s6); height: var(--s6); flex-basis: var(--s6); font-size: 1rem; }
  /* r337 r4x-pwa v9: install hint under the bars on phones and touch tablets, and the lasting menu entry. */
  .install-hint { display: flex; align-items: center; gap: var(--s2); margin-top: var(--s3); padding: var(--s2) var(--s2) var(--s2) var(--s3); background: var(--surface); border: 1px solid var(--gold-border); border-radius: var(--radius-card); box-shadow: var(--shadow-card); color: var(--text); }
  .install-hint__label { display: flex; flex: 1; align-items: center; gap: var(--s2); min-width: 0; font-size: .875rem; font-weight: 650; line-height: 1.25; }
  .install-hint .icon-control { border: 0; background: transparent; color: var(--text-muted); }
  .install-hint svg, .install-entry svg { width: 18px; height: 18px; flex: none; color: var(--accent-text); }
  .install-entry { display: flex; align-items: center; gap: var(--s2); width: 100%; min-height: var(--touch-target); margin-block: var(--s3) 0; padding: var(--s2) var(--s4); border: 1px solid var(--gold-border); border-radius: var(--radius-control); background: var(--gold-soft); color: var(--text); font: inherit; font-weight: 700; text-align: start; cursor: pointer; }
  .install-entry:hover { border-color: var(--gold); }
  @media (max-width: 767px) {
    .header-app { gap: var(--s2); min-height: calc(var(--s7) + var(--s3)); }
    .header-app__logo img { height: var(--s6); }
    .site-header--app .primary-navigation { flex: none; }
    .site-header--app .primary-navigation .btn { flex: none; }
    .site-header--app .menu-disclosure > summary { width: calc(var(--s6) + var(--s2)); height: calc(var(--s6) + var(--s2)); font-size: 1.25rem; }
    .info-bar__sub, .info-pill--account { display: none; }
  }
  @media (max-width: 380px) {
    .header-app__logo img { height: 28px; }
    .site-header--app .primary-navigation .btn { padding-inline: var(--s1); }
  }
  /* r17 start page header: one slim sticky bar in the dark brand chrome (both themes), with menu, search and theme control. */
  .site-header--compact { --header-surface: var(--brand-page); --surface: var(--brand-page); --surface-muted: var(--brand-surface); --text: var(--brand-text); --text-muted: var(--brand-muted); --border: var(--brand-border); --accent-text: var(--gold-hover);
    color: var(--brand-text); background: color-mix(in srgb, var(--brand-page) 90%, transparent); backdrop-filter: blur(14px); border-bottom: 1px solid var(--brand-border); color-scheme: dark; }
  .header-compact { display: flex; align-items: center; gap: 14px; min-height: 58px; padding-top: env(safe-area-inset-top); }
  .header-compact__logo { display: block; flex: none; }
  .header-compact__logo img { display: block; width: auto; height: 30px; }
  .header-compact__nav { display: flex; align-items: center; gap: 18px; margin-left: auto; }
  .header-compact__link { color: var(--text-muted); font-size: 14px; text-decoration: none; }
  .header-compact__link:hover { color: var(--text); }
  .header-compact__nav .btn { min-height: 38px; padding: 9px 14px; font-size: 13.5px; white-space: nowrap; }
  .header-compact__controls { display: flex; align-items: center; gap: 8px; }
  .header-compact__controls .theme-control, .header-compact__controls .menu-disclosure > summary { width: 38px; height: 38px; flex-basis: 38px; font-size: 1.1rem; }
  @media (min-width: 721px) {
    .header-compact { min-height: 64px; gap: 26px; }
    .header-compact__logo img { height: 36px; }
    .header-compact__nav { gap: 24px; }
    .header-compact__nav .btn { padding: 9px 18px; font-size: 14.5px; }
  }
  @media (max-width: 720px) {
    .header-compact__nav [data-wide-only], .header-compact__nav .btn span[aria-hidden] { display: none; }
    .header-compact { gap: 8px; }
    .header-compact__nav .btn { padding-inline: 10px; }
  }  html [hidden] { display: none; }
}

@layer layout {
  /* Brand-scene card variant: independent from the generic accent stripe. */
  .card-ritual {
    --surface: var(--brand-surface); --text: var(--brand-text); --text-muted: var(--brand-muted);
    --text-faint: var(--brand-muted); --accent-text: var(--gold-hover);
    position: relative; overflow: hidden; isolation: isolate; border-top: var(--s1) solid var(--gold);
    background: var(--brand-surface); color: var(--brand-text);
  }
  .card-ritual::before {
    content: ''; position: absolute; inset: 0; z-index: -1; pointer-events: none;
    background:
      linear-gradient(90deg, var(--brand-surface) 0%, color-mix(in srgb, var(--brand-surface) 96%, transparent) 44%, color-mix(in srgb, var(--brand-surface) 84%, transparent) 64%, color-mix(in srgb, var(--brand-surface) 30%, transparent) 100%),
      url('/assets/feature-carousel/ritual-underlay-v2163.webp') right bottom / cover no-repeat;
  }

  @media (max-width: 767px) {
    .card-ritual::before {
      background:
        linear-gradient(180deg, var(--brand-surface) 0%, color-mix(in srgb, var(--brand-surface) 93%, transparent) 44%, color-mix(in srgb, var(--brand-surface) 76%, transparent) 72%, color-mix(in srgb, var(--brand-surface) 24%, transparent) 100%),
        url('/assets/feature-carousel/ritual-underlay-v2163.webp') 92% 100% / 185% auto no-repeat;
    }
  }
  .ritual-heading, .ritual-week { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: var(--s3); }
  .ritual-heading .eyebrow { display: inline-flex; align-items: center; gap: var(--s2); margin: 0; }
  .ritual-heading .eyebrow::before { display: none; }
  .ritual-heading > strong { font-size: .875rem; }
  .ritual-sun { width: var(--s5); height: var(--s5); flex: 0 0 var(--s5); fill: none; stroke: var(--accent-text); stroke-width: 1.6; }
  .ritual-week { padding-block: var(--s3); }
  .ritual-dots { display: flex; gap: var(--s2); }
  .ritual-dot { width: var(--s2); height: var(--s2); border: 1px solid var(--accent-text); border-radius: var(--radius-pill); }
  .ritual-dot.is-filled { background: var(--accent-text); }
  .ritual-dot.is-today { outline: 1px solid var(--accent-text); outline-offset: var(--s1); }
  .ritual-body { position: relative; padding-right: var(--s7); padding-bottom: var(--s6); }
  .ritual-body .r4x-stack { max-width: 48ch; }
  .ritual-rocket { position: absolute; right: 0; top: 0; width: var(--s5); height: 100%; overflow: visible; fill: var(--accent-text); stroke: var(--accent-text); stroke-width: 1; }
  .ritual-rocket > line { stroke: var(--gold-border); }
  .ritual-rocket circle { fill: var(--brand-surface); }
  .ritual-ladder { display: flex; flex-wrap: wrap; gap: var(--s2); }
  .ritual-ladder .btn { padding-inline: var(--s1); font-size: .75rem; }
  .ritual-discovery { width: 160px; max-width: 100%; height: 130px; fill: var(--gold-soft); stroke: var(--accent-text); stroke-width: 1.5; }
  .ritual-reward { display: flex; align-items: center; gap: var(--s4); flex-wrap: wrap; }
  .r4x-stack { display: grid; gap: var(--s5); align-content: start; }
  .feature-track { display: flex; position: relative; gap: var(--s5); overflow-x: auto; scroll-snap-type: x mandatory; overscroll-behavior-inline: contain; padding-bottom: var(--s4); }
  .feature-track[data-feature-dragging] { scroll-snap-type: none; user-select: none; cursor: grabbing; }
  .feature-slide { flex: 0 0 min(340px, 90%); min-width: 0; scroll-snap-align: start; }
  .feature-slide > .card { height: 100%; display: flex; flex-direction: column; gap: var(--s3); }
  .feature-slide > .card > .btn { margin-top: auto; }
  .section-navigation-mobile { display: none; }
  .section-navigation-row { display: flex; align-items: center; gap: var(--s2); }
  .section-navigation-position { display: grid; gap: var(--s1); flex: 1; text-align: center; min-width: 0; }
  .section-navigation-row .btn { flex: 0 0 var(--touch-target); padding-inline: var(--s2); }
  .section-attention-summary { display: flex; justify-content: center; gap: var(--s3); }
  .section-attention-indicator { width: 8px; height: 8px; border: 1px solid var(--border); border-radius: var(--radius-pill); }
  .section-attention-indicator[data-has-attention='true'] { background: var(--info); border-color: var(--info); }
  [data-section-navigation] button[data-has-attention='true']::after { content: ''; display: inline-block; flex: 0 0 8px; width: 8px; height: 8px; margin-inline-start: var(--s2); border-radius: var(--radius-pill); background: var(--info); }
  /* r43 (Prüfliste A5): a new hint pulses twice, then rests. */
  .section-attention-indicator[data-has-attention='true'], [data-section-navigation] button[data-has-attention='true']::after { animation: attention-pulse calc(var(--motion-base) * 6) var(--ease-standard) 2; }
  @keyframes attention-pulse { 0% { box-shadow: 0 0 0 0 var(--info-border); } 70% { box-shadow: 0 0 0 var(--s2) transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
  @media (prefers-reduced-motion: reduce) { .section-attention-indicator[data-has-attention='true'], [data-section-navigation] button[data-has-attention='true']::after { animation: none; } }
  [data-home-section], [data-home-section] [id] { scroll-margin-top: 12rem; }
  @media (max-width: 767px) {
    .section-navigation-desktop { display: none; }
    .section-navigation-mobile { display: grid; }
    [data-section-workspace] { touch-action: pan-y pinch-zoom; }
  }
  .r4x-columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s5); align-items: start; }
  .r4x-columns > * { min-width: 0; }
  /* Source page composition; colors, controls and surfaces retain central v18 tokens. */
  .cockpit-hero { margin-block: var(--s5) var(--s6); padding: var(--s6); }
  .cockpit-entry-layout { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(250px, .75fr); gap: var(--s7); align-items: center; }
  .cockpit-entry-layout > * { min-width: 0; }
  /* r40 (r35 C07): r337 activation artifact (r4x-activation v2885): returner rows with icon, title, explanation and
     action; account rows in the info tone, backup rows in the success tone. */
  .entry-returner { display: grid; gap: var(--s3); }
  .entry-returner__head { display: grid; gap: var(--s1); }
  .entry-returner__head > * { margin: 0; }
  .entry-returner__head > p:last-child { color: var(--text-muted); font-size: .875rem; }
  .entry-returner b { color: var(--accent-text); font-weight: 600; }
  .entry-returner__preview { margin: 0; padding-left: var(--s5); font-size: .875rem; }
  .entry-returner__list { display: grid; gap: var(--s2); }
  .entry-returner__row { display: grid; grid-template-columns: 38px minmax(0, 1fr); align-items: center; gap: var(--s3); padding: var(--s3); border: 1px solid var(--border); border-radius: var(--radius-card); background: var(--surface); }
  .entry-returner__action { grid-column: 1 / -1; width: 100%; }
  .entry-returner__icon { display: grid; place-items: center; width: 38px; height: 38px; border: 1px solid var(--border); border-radius: var(--radius-control); background: var(--surface-muted); color: var(--text-muted); }
  .entry-returner__copy { min-width: 0; }
  .entry-returner__copy strong { display: block; margin-bottom: var(--s1); font-size: .9rem; }
  .entry-returner__copy > span { display: block; color: var(--text-muted); font-size: .8125rem; line-height: 1.45; }
  .entry-returner__row--account { border-color: var(--info-border); background: var(--info-soft); }
  .entry-returner__row--account .entry-returner__icon { border-color: var(--info-border); color: var(--info); }
  .entry-returner__row--backup { border-color: var(--success-border); background: var(--success-soft); }
  .entry-returner__row--backup .entry-returner__icon { border-color: var(--success-border); color: var(--success); }
  .entry-returner__divider { display: flex; align-items: center; gap: var(--s2); margin: var(--s1) 0 0; color: var(--text-muted); font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
  .entry-returner__divider::before, .entry-returner__divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
  .entry-returner__note { margin: 0; padding: var(--s3); border: 1px solid var(--success-border); border-radius: var(--radius-control); background: var(--success-soft); font-size: .8125rem; }
  /* minmax(0, 1fr): the welcome feature carousel must scroll inside the column instead of widening the page. */
  .cockpit-welcome { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s7); margin-block: var(--s7); }
  .cockpit-welcome > section { min-width: 0; }
  .cockpit-heading-link { display: flex; align-items: center; justify-content: space-between; gap: var(--s4); flex-wrap: wrap; margin-bottom: var(--s5); }
  .cockpit-activities { margin-block: var(--s6); }
  /* FINAL v18 section head: H2 at the global scale, lead in muted text directly below. */
  .cockpit-section-heading { margin-block: var(--s6) var(--s5); }
  .cockpit-section-heading > h2 { margin: 0; }
  .cockpit-section-heading > p { margin: var(--s2) 0 0; max-width: 72ch; color: var(--text-muted); }
  .cockpit-activities > h2 { margin-bottom: var(--s5); }
  .cockpit-personal-summary { padding: 0; }
  .cockpit-personal-summary a { color: var(--text); text-decoration: none; min-width: 0; padding: var(--s4); text-align: center; }
  .cockpit-personal-summary a:hover { background: var(--surface-muted); }
  .cockpit-personal-primary { display: grid; gap: var(--s2); }
  .cockpit-personal-primary > span { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: var(--s3); }
  .cockpit-personal-secondary { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-top: 1px solid var(--border); }
  .cockpit-personal-secondary > a { display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: var(--s2); font-size: .875rem; overflow-wrap: anywhere; }
  .cockpit-personal-secondary > a + a { border-left: 1px solid var(--border); }
  .cockpit-summary-action { color: var(--accent-text); font-size: .875rem; }
  .cockpit-editorial { display: grid; gap: var(--s5); align-items: stretch; }
  .cockpit-portfolio-layout { grid-template-columns: minmax(300px, 384px) minmax(0, 1fr); }
  .cockpit-editorial > *, .cockpit-learning-layout > * { min-width: 0; }
  .cockpit-editorial > .cockpit-area-media { aspect-ratio: auto; }
  .cockpit-learning-layout { display: grid; grid-template-areas: "education kompass" "education memory" "daily daily"; grid-template-columns: minmax(270px, .72fr) minmax(0, 1.28fr); gap: var(--s5); align-items: start; }
  .cockpit-learning-layout > .cockpit-area-media { grid-area: education; height: 326px; aspect-ratio: auto; }
  .cockpit-learning-layout > [data-compass] { grid-area: kompass; }
  .cockpit-learning-layout > [data-learning] { display: contents; }
  .cockpit-learning-layout [data-learning-memory] { grid-area: memory; min-width: 0; }
  .cockpit-learning-layout [data-learning-daily], .cockpit-learning-layout > [data-learning] > .status { grid-area: daily; min-width: 0; }
  .cockpit-learning-summary { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: var(--s4); }
  .cockpit-learning-summary-heading { display: flex; align-items: center; flex-wrap: wrap; gap: var(--s2); }
  .cockpit-learning-summary h3, .cockpit-learning-summary p { margin-bottom: var(--s2); }
  .cockpit-learning-summary p { font-size: .875rem; }
  .cockpit-learning-summary .progress { margin-bottom: var(--s2); }
  .cockpit-market { margin-top: var(--s6); }
  .cockpit-discovery { margin-top: var(--s8); }
  .cockpit-portfolio-layout .r4x-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cockpit-portfolio-overview { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, .8fr); gap: var(--s4); align-items: start; }
  .cockpit-portfolio-overview > * { min-width: 0; }
  .cockpit-snapshot-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s2); }
  .cockpit-snapshot-stats .metric { min-width: 0; padding: var(--s2); overflow-wrap: anywhere; }
  .cockpit-snapshot-stats .metric-label, .cockpit-snapshot-stats .metric-detail { font-size: .75rem; }
  .cockpit-snapshot-stats .metric-value { font-size: 1.125rem; }
  @media (min-width: 768px) and (max-width: 1023px) {
    .cockpit-portfolio-layout { grid-template-columns: minmax(240px, 32vw) minmax(0, 1fr); }
  }
  @media (max-width: 767px) {
    .cockpit-hero { padding: var(--s4); }
    .cockpit-learning-summary { grid-template-columns: minmax(0, 1fr); }
    .cockpit-entry-layout, .cockpit-editorial { grid-template-columns: minmax(0, 1fr); gap: var(--s4); }
    .cockpit-learning-layout { grid-template-areas: "education" "kompass" "memory" "daily"; grid-template-columns: minmax(0, 1fr); gap: var(--s4); }
    .cockpit-learning-layout > .cockpit-area-media, .cockpit-editorial > .cockpit-area-media { height: auto; aspect-ratio: 16 / 9; }
    .cockpit-personal-secondary > a { flex-direction: column; padding: var(--s3); }
    .cockpit-portfolio-layout .r4x-grid { grid-template-columns: minmax(0, 1fr); }
    .cockpit-portfolio-overview { grid-template-columns: minmax(0, 1fr); }
    .cockpit-portfolio-layout .accordion-content { padding-inline: var(--s1); }
    .cockpit-snapshot-stats .metric { padding: var(--s1); }
    .cockpit-snapshot-stats .metric-value { font-size: .875rem; }
    .cockpit-discovery { margin-top: var(--s7); }
  }
  .otp-fields { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: var(--s1); }
  .otp-fields .input { padding-inline: 0; text-align: center; }
  .otp-fields label { text-align: center; font-size: .75rem; }
  @media (max-width: 399px) { .otp-fields { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
  @media (max-width: 767px) {
    .r4x-columns { grid-template-columns: 1fr; }

  }
}
