:root {
  /* Shared, theme-aware syntax roles for language previews. */
  --syntax-text: var(--ink);
  --syntax-keyword: var(--purple);
  --syntax-string: var(--blue-ink);
  --syntax-number: var(--purple);
  --syntax-name: var(--ink);
  --syntax-comment: var(--muted);
  --syntax-operator: var(--muted);
  --syntax-error: var(--danger);
  color-scheme: light;
  --bg: #f7f6fc;
  --surface: #fff;
  --ink: #282335;
  --muted: #6b617b;
  --purple: #6740d9;
  --purple-hover: #5329c4;
  --collective-bg: var(--purple);
  --collective-ink: var(--on-accent);
  --collective-number: var(--coral-soft);
  --lavender: #eee7ff;
  --blue: #dfecff;
  --blue-ink: #2e5f9e;
  --coral: #ffc2ae;
  --coral-hover: #ffaf96;
  --coral-ink: #572a21;
  --mint: #e1edb4;
  --mint-ink: #354323;
  --next-bg: #f0f6df;
  --border: #e1dce9;
  --floating-border: color-mix(in srgb, var(--border) 88%, var(--muted));
  --soft: #f1eef7;
  --focus: #4c269d;
  --danger: #b33749;
  --danger-soft: #fbecef;
  --text-note: .75rem;
  --text-caption: .8125rem;
  --text-small: .875rem;
  --text-body-small: .9375rem;
  --text-body: 1rem;
  --text-status: var(--text-small);
  --text-dialog-title: 1.875rem;
  --text-page-title: 2.25rem;
  --weight-regular: 400;
  --weight-strong: 700;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --radius-control: 12px;
  --radius-surface: 16px;
  --radius-panel: 20px;
  --radius-dialog: 24px;
  --dialog-max-height: 48rem;
  --shadow-panel: 0 8px 30px #35215305;
  --shadow-dialog: 0 30px 100px #140a3933;
  --shadow-tooltip: 0 6px 22px #20104024;
  --font-ui: Arial, sans-serif;
  --font-code: ui-monospace, SFMono-Regular, Consolas, monospace;
  --font-quote: 700 56px/1 Georgia, 'Times New Roman', serif;
  --text-lead: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 1.75rem;
  --text-4xl: 2rem;
  --text-display: 2.75rem;
  --text-cost: clamp(1.65rem, 10vw, 2.625rem);
  --text-utility: var(--text-small);
  --text-brand: 1.8125rem;
  --leading-none: 1;
  --leading-heading: 1.2;
  --leading-label: 1.4;
  --leading-body: 1.5;
  --leading-detail: 1.6;
  --leading-reading: 1.65;
  --leading-editorial: 1.8;
  --space-half: 2px;
  --space-compact: 6px;
  --space-section: 20px;
  --space-wide: 32px;
  --shell-max-width: 1280px;
  --shell-gutter: var(--space-wide);
  --control-min: 44px;
  --control-prominent: 48px;
  --control-padding-block: 10px;
  --control-padding-inline: 14px;
  --option-inset: var(--space-5);
  --option-summary-air: calc((var(--control-prominent) - var(--text-small) * var(--leading-body)) / 2);
  --option-alternative-summary-air: calc((var(--control-min) - var(--text-small) * var(--leading-body)) / 2);
  --icon-caret: 14px;
  --radius-small: 8px;
  --radius-tight: 4px;
  --radius-pill: 999px;
  --radius-circle: 50%;
  --on-accent: #fff;
  --backdrop: #20173570;
  --sparkle-green: #b4d369;
  --icon-ink: #3b2e51;
  --icon-soft: #e5d9ff;
  --coral-soft: #ffd5c9;
  --shadow-popover: 0 12px 36px color-mix(in srgb, var(--ink) 12%, transparent);
  --shadow-voice: 0 3px 10px #572a2118;
  --shadow-coin: inset 0 0 0 3px color-mix(in srgb, var(--surface) 50%, transparent);
  --shadow-mascot: drop-shadow(0 5px 8px #6740d933);
  --motion-fast: .16s;
  --motion-feedback: .18s;
  --motion-theme: .2s;
  --motion-surface: .22s;
  --motion-overlay: .16s;
  --motion-exit: .17s;
  --motion-layout: .28s;
  --motion-tooltip: .12s;

}
:root[data-theme='dark'] {
  --on-accent: #21192f;
  color-scheme: dark;
  --bg: #1b1823;
  --surface: #25212f;
  --ink: #f5f1fd;
  --muted: #c2b8d2;
  --purple: #b59bff;
  --purple-hover: #c8b4ff;
  --collective-bg: var(--lavender);
  --collective-ink: var(--ink);
  --collective-number: var(--coral);
  --lavender: #34294b;
  --blue: #293b55;
  --blue-ink: #a9cfff;
  --border: #453b55;
  --soft: #2d2738;
  --next-bg: #302740;
  --focus: #e3d5ff;
  --danger: #ff9eac;
  --danger-soft: #452832;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: var(--text-body);
  -webkit-font-smoothing: antialiased;
  line-height: var(--leading-body);
}
button,
textarea,
input {
  font: inherit;
}
button,
a,
label,
summary {
  -webkit-tap-highlight-color: transparent;
}
button,
a {
  touch-action: manipulation;
}
button {
  cursor: pointer;
  color: inherit;
  transition:
    background var(--motion-fast),
    border-color var(--motion-fast),
    transform var(--motion-feedback) ease-out;
}
button:disabled {
  cursor: not-allowed;
  opacity: 0.4;
}
/* Keep hover targeting the disabled control so its reason tooltip still opens. */
button:disabled > * {
  pointer-events: none;
}
button,
.brand,
.skip-link,
.ha-button {
  min-height: var(--control-min);
}
a {
  color: inherit;
}
svg {
  display: block;
}
button svg {
  width: 21px;
  height: 21px;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
button:focus-visible,
a:focus-visible,
summary:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 4px;
}
dialog[data-focus-input='pointer']:focus,
dialog[data-focus-input='pointer'] :focus:not(input, textarea) {
  outline: none;
}
h1:focus,
main:focus {
  outline: none;
}
h1,
h2,
p {
  margin: 0;
}
h1,
h2 {
  letter-spacing: -0.045em;
  line-height: var(--leading-heading);
}
button {
  border: 0;
}
button:active:not(:disabled) {
  transform: translateY(1px);
}
[hidden] {
  display: none !important;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px /* design-geometry: alignment, reserved icon space or optical scale. */;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
.skip-link {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 100;
  padding: var(--space-2) var(--space-4);
  background: var(--surface);
  transform: translateY(-160%);
}
.skip-link:focus {
  transform: none;
}
.shell {
  max-width: var(--shell-max-width);
  padding: 0 var(--shell-gutter);
  margin: auto;
}
@media (min-width: 901px) {
  :root { --shell-gutter: calc(var(--space-5) * 2); }
}
.header {
  --header-fade-start: 8px;
  --header-fade-end: 0px;
  position: sticky;
  top: 0;
  z-index: 30;
  height: 88px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}
.header::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  /* Animate the color with the page; keep the fade and navigation geometry fixed. */
  background-color: var(--bg);
  mask-image: linear-gradient(to bottom, #000 calc(100% - var(--header-fade-start)), transparent calc(100% - var(--header-fade-end)));
}
.brand {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  text-decoration: none;
  font-size: var(--text-brand);
  letter-spacing: -0.07em;
  font-weight: var(--weight-strong);
}
.brand-period {
  color: var(--purple);
}
.brand img {
  object-fit: contain;
}
.header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
.icon-button,
.back-button {
  width: var(--control-min);
  height: var(--control-min);
  border-radius: var(--radius-control);
  padding: 0;
  line-height: var(--leading-none);
  background: var(--lavender);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.header .icon-button {
  color: var(--muted);
  background: transparent;
}
main {
  /* Balance the navigation above with equal space below the active view. */
  min-height: calc(100svh - 88px - 88px);
  display: grid;
  align-items: center;
  padding: 40px 0 /* design-geometry: alignment, reserved icon space or optical scale. */;
}
.screen {
  max-width: 600px;
  width: 100%;
  margin: auto;
  animation: arrive 0.3s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}
.home-screen {
  text-align: center;
}
.collective-region {
  display: flow-root;
  min-height: calc(var(--control-prominent) + var(--space-wide));
}
.collective-counter,
.collective-celebration {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  color: var(--muted);
  font-size: var(--text-small);
  line-height: var(--leading-detail);
  text-align: center;
}
.collective-counter {
  position: relative;
  width: fit-content;
  max-width: 100%;
  min-height: 0;
  margin: var(--space-4) auto 0;
  padding: var(--space-2) var(--space-3);
  gap: var(--space-2);
  border: 0;
  border-radius: var(--radius-pill);
  background: var(--collective-bg);
  color: var(--collective-ink);
  font-size: var(--text-caption);
  font-weight: var(--weight-strong);
  text-align: left;
  cursor: help;
}
.collective-counter::before {
  content: '';
  position: absolute;
  inset-inline: 0;
  top: 50%;
  height: 100%;
  min-height: var(--control-min);
  transform: translateY(-50%);
}
.collective-emblem {
  display: flex;
  flex-shrink: 0;
  width: var(--space-4);
  height: var(--space-4);
}
.collective-emblem svg { width: 100%; height: 100%; fill: currentColor; }
.collective-total { min-width: 0; color: inherit; font-weight: inherit; line-height: var(--leading-label); }
.collective-counter strong {
  display: inline-block;
  color: var(--collective-number);
  font-size: var(--text-small);
  font-weight: var(--weight-strong);
  font-variant-numeric: tabular-nums;
}
.celebration-region {
  position: fixed;
  inset: 0;
  z-index: 45;
  display: grid;
  place-items: center;
  padding: var(--space-wide);
  background: color-mix(in srgb, var(--bg) 55%, transparent);
  backdrop-filter: blur(8px);
  pointer-events: none;
  animation: celebration-backdrop .9s ease both;
}
.collective-celebration {
  position: relative;
  isolation: isolate;
  width: fit-content;
  max-width: 100%;
  margin: 0 auto;
  flex-direction: column;
  gap: var(--space-4);
  animation: celebration-arrive .9s ease both;
}
.celebration-mascot { position: relative; flex-shrink: 0; width: 88px; height: 88px; }
.celebration-mascot::before,
.celebration-mascot::after {
  content: ''; position: absolute; inset: 0;
  border: 2px solid var(--purple); border-radius: var(--radius-circle);
  animation: celebration-ring .5s .05s ease-out both;
}
.celebration-mascot::after { border-color: var(--coral-hover); animation-delay: .12s; }
.celebration-mascot img {
  display: block; position: relative; width: 100%; height: 100%;
  animation: celebration-flip .6s cubic-bezier(.2,.7,.2,1) both;
}
.celebration-copy { text-align: center; min-width: 0; }
.celebration-copy strong { color: var(--purple); font-size: var(--text-2xl); line-height: var(--leading-heading); }

.celebration-credit {
  display: flex; align-items: center; gap: var(--space-1); flex-shrink: 0;
  color: var(--purple); font-size: var(--text-3xl); font-weight: var(--weight-strong);
  line-height: var(--leading-none); transform-origin: center;
  animation: celebration-credit .4s .08s cubic-bezier(.2,.7,.2,1) both;
}
.celebration-credit svg { width: 18px; height: 18px; fill: currentColor; }
.celebration-burst { position: absolute; inset: 0 0 auto; height: 88px; z-index: -1; }
.celebration-particle {
  /* design-geometry: finite radial burst using runtime particle coordinates. */
  position: absolute; left: 50%; top: 50%; width: 7px; height: 12px;
  background: var(--purple); border-radius: var(--radius-tight);
  animation: celebration-confetti .65s var(--spark-delay) ease-out both;
}
.celebration-particle:nth-child(3n + 1) { background: none; color: var(--purple); width: 15px; height: 15px; }
.celebration-particle:nth-child(3n + 2) { background: var(--coral-hover); }
.celebration-particle:nth-child(3n) { background: var(--sparkle-green); }
.celebration-particle svg { display: block; width: 100%; height: 100%; fill: currentColor; }
.celebration-particle:nth-child(1) { --spark-x: 70.00px; --spark-y: 14.00px; --spark-turn: 0deg; --spark-delay: 0ms; }
.celebration-particle:nth-child(2) { --spark-x: -67.10px; --spark-y: 38.59px; --spark-turn: 80deg; --spark-delay: 70ms; }
.celebration-particle:nth-child(3) { --spark-x: 9.79px; --spark-y: -30.63px; --spark-turn: 160deg; --spark-delay: 140ms; }
.celebration-particle:nth-child(4) { --spark-x: 80.92px; --spark-y: 56.22px; --spark-turn: 240deg; --spark-delay: 0ms; }
.celebration-particle:nth-child(5) { --spark-x: -68.93px; --spark-y: 9.12px; --spark-turn: 320deg; --spark-delay: 70ms; }
.celebration-particle:nth-child(6) { --spark-x: 76.78px; --spark-y: -5.54px; --spark-turn: 400deg; --spark-delay: 140ms; }
.celebration-particle:nth-child(7) { --spark-x: -29.07px; --spark-y: 57.26px; --spark-turn: 480deg; --spark-delay: 0ms; }
.celebration-particle:nth-child(8) { --spark-x: -61.30px; --spark-y: -33.21px; --spark-turn: 560deg; --spark-delay: 70ms; }
.celebration-particle:nth-child(9) { --spark-x: 65.75px; --spark-y: 23.60px; --spark-turn: 640deg; --spark-delay: 140ms; }
.celebration-particle:nth-child(10) { --spark-x: -84.11px; --spark-y: 27.89px; --spark-turn: 720deg; --spark-delay: 0ms; }
.celebration-particle:nth-child(11) { --spark-x: 47.47px; --spark-y: -26.58px; --spark-turn: 800deg; --spark-delay: 70ms; }
.celebration-particle:nth-child(12) { --spark-x: 39.81px; --spark-y: 64.76px; --spark-turn: 880deg; --spark-delay: 140ms; }
.celebration-particle:nth-child(13) { --spark-x: -60.57px; --spark-y: -0.04px; --spark-turn: 960deg; --spark-delay: 0ms; }
.celebration-particle:nth-child(14) { --spark-x: 88.88px; --spark-y: 6.18px; --spark-turn: 1040deg; --spark-delay: 70ms; }
.celebration-particle:nth-child(15) { --spark-x: -64.41px; --spark-y: 50.65px; --spark-turn: 1120deg; --spark-delay: 140ms; }
.celebration-particle:nth-child(16) { --spark-x: -17.10px; --spark-y: -38.76px; --spark-turn: 1200deg; --spark-delay: 0ms; }
.celebration-particle:nth-child(17) { --spark-x: 53.53px; --spark-y: 32.04px; --spark-turn: 1280deg; --spark-delay: 70ms; }
.celebration-particle:nth-child(18) { --spark-x: -90.92px; --spark-y: 15.51px; --spark-turn: 1360deg; --spark-delay: 140ms; }
@keyframes celebration-backdrop {
  0%, 100% { opacity: 0; }
  8%, 60% { opacity: 1; }
}
@keyframes celebration-arrive {
  0% { opacity: 0; transform: translateY(8px) scale(.88); }
  10%, 60% { opacity: 1; transform: none; }
  100% { opacity: 0; transform: translateY(-6px); }
}
@keyframes celebration-flip {
  0% { transform: translateY(8px) scale(.65); }
  18% { transform: translateY(3px) scale(1.16,.84); }
  55% { transform: translateY(-20px) rotate(-22deg) scale(1.18); }
  78% { transform: translateY(2px) rotate(8deg) scale(1.08,.92); }
  100% { transform: none; }
}
@keyframes celebration-credit {
  0% { opacity: 0; transform: translateY(14px) rotate(-15deg) scale(.2); }
  55% { opacity: 1; transform: translateY(-4px) rotate(6deg) scale(1.35); }
  100% { opacity: 1; transform: none; }
}
@keyframes celebration-ring {
  0% { opacity: .75; transform: scale(.6); }
  100% { opacity: 0; transform: scale(2); }
}
@keyframes celebration-confetti {
  0% { opacity: 0; transform: translate(-50%,-50%) rotate(0deg) scale(.2); }
  18% { opacity: 1; }
  75% { opacity: 1; }
  100% { opacity: 0; transform: translate(calc(-50% + var(--spark-x)),calc(-50% + var(--spark-y))) rotate(var(--spark-turn)) scale(1); }
}
@media (prefers-reduced-motion: reduce) {
  .celebration-region, .collective-celebration, .celebration-mascot img, .celebration-credit { animation: none; }
  .celebration-burst, .celebration-mascot::before, .celebration-mascot::after { display: none; }
}
 .mascot-trigger {
  position: relative; display: block; width: max-content; margin: 0 auto;
  padding: 0; border: 0; border-radius: var(--radius-circle); background: transparent;
  line-height: 0; touch-action: manipulation; user-select: none;
}
.mascot-sparkles { position: absolute; inset: 0; pointer-events: none; }
.mascot-sparkle {
  position: absolute; left: 50%; top: 50%; color: var(--purple);
  font-size: var(--text-lead); line-height: var(--leading-none); opacity: 0;
  animation: sparkle-burst .8s ease-out var(--spark-delay) both;
}
.mascot-sparkle:nth-child(3n + 1) { color: var(--coral-hover); font-size: var(--text-small); }
.mascot-sparkle:nth-child(3n + 2) { color: var(--sparkle-green); font-size: var(--text-note); }
.mascot-trigger.is-celebrating { z-index: 31; }
.mascot-trigger.is-celebrating .companion { animation: mascot-jump 1s cubic-bezier(.3,.05,.25,1) both; transform-origin: center; }
@keyframes mascot-jump {
  0% { transform: translateY(0) rotate(0) scale(1); }
  15% { transform: translateY(5px) rotate(0) scale(1.08,.92); }
  55% { transform: translateY(-46px) rotate(180deg) scale(1); }
  85% { transform: translateY(3px) rotate(360deg) scale(1.06,.94); }
  100% { transform: translateY(0) rotate(360deg) scale(1); }
}
@keyframes sparkle-burst {
  0% { opacity: 0; transform: translate(-50%,-50%) scale(.2) rotate(0); }
  25% { opacity: 1; transform: translate(calc(-50% + var(--spark-x) * .35),calc(-50% + var(--spark-y) * .35)) scale(1.1) rotate(20deg); }
  100% { opacity: 0; transform: translate(calc(-50% + var(--spark-x)),calc(-50% + var(--spark-y))) scale(.4) rotate(100deg); }
}
.companion {
  display: block;
  margin: 0 auto;
  object-fit: contain;
  animation: mascot-breathe 5.6s ease-in-out infinite;
  transform-origin: 50% 75%;
}
/* Do not keep resampling a moving decorative background through a modal blur. */
body:has(dialog[open]) .companion {
  animation-play-state: paused;
}
.home-screen h1 {
  font-size: var(--text-display);
  margin: var(--space-4) 0 var(--space-5);
  font-weight: var(--weight-strong);
}
.home-screen h1 span {
  color: var(--purple);
}
.input-panel {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--floating-border);
  border-radius: var(--radius-panel);
  padding: var(--space-section);
  box-shadow: var(--shadow-panel);
  text-align: left;
}
.input-panel:focus-within {
  outline: 2px solid var(--purple);
  outline-offset: 3px;
}
.input-panel.is-listening {
  border-color: var(--coral-hover);
  outline: 2px solid var(--coral-hover);
  outline-offset: 3px;
}
textarea {
  font: inherit;
  display: block;
  resize: none;
  width: 100%;
  height: 112px;
  min-height: 112px;
  max-height: 270px;
  border: 0;
  background: transparent;
  color: var(--ink);
  padding: 0;
  font-size: var(--text-lead);
  line-height: var(--leading-reading);
  field-sizing: content;
}
textarea:focus {
  outline: none;
}
#dilemma { padding-right: 44px /* design-geometry: alignment, reserved icon space or optical scale. */; }
.clear-button {
  background: transparent;
  position: absolute;
  top: 10px;
  right: 10px;
  color: var(--muted);
}
.voice-actions {
  display: inline-flex;
  flex-shrink: 0;
  border-radius: var(--radius-control);
  background: var(--coral);
}
.input-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-3);
}
.input-actions .primary { gap: var(--space-2); padding-inline: var(--space-3); flex-shrink: 0; white-space: nowrap; }
.voice-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: var(--control-prominent);
  padding: var(--space-3) var(--space-3);
  border-radius: var(--radius-control);
  color: var(--coral-ink);
  background: var(--coral);
  font-size: var(--text-body-small);
  font-weight: var(--weight-strong);
  white-space: nowrap;
}

.next-action { margin: var(--space-4) 0; padding: var(--space-4); border-radius: var(--radius-control); background: var(--next-bg); color: var(--ink); font-size: var(--text-small); line-height: var(--leading-detail); }
.next-action strong { display: block; margin-bottom: var(--space-2); color: var(--purple); }
.voice-button svg {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  stroke-width: 1.8;
}
.voice-timer {
  min-width: 4ch;
  font-size: var(--text-caption);
  font-variant-numeric: tabular-nums;
  text-align: right;
}
/* Shared action pictograms, independent of their labels. */
.action-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform var(--motion-feedback) ease-out;
}
.text-button {
  gap: var(--space-2);
}
.primary {
  background: var(--purple);
  color: var(--surface);
  min-height: var(--control-prominent);
  padding: var(--space-3) var(--space-section);
  border-radius: var(--radius-control);
  font-size: var(--text-body-small);
  font-weight: var(--weight-strong);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
}

.scenario-picker {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-4);
}
.scenario-picker button {
  background: var(--lavender);
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-caption);
}
.scenario-picker button[aria-pressed='true'] {
  color: var(--purple);
  background: var(--lavender);
  border-color: transparent;
}

.back-button {
  font-size: var(--text-2xl);
  color: var(--muted);
  margin-left: -10px /* design-geometry: alignment, reserved icon space or optical scale. */;
  margin-bottom: 0;
}
.clarify-screen h1 {
  font-size: var(--text-4xl);
  text-wrap: balance;
  margin-bottom: var(--space-5);
  line-height: var(--leading-heading);
}
.priority-grid {
  display: grid;
  gap: var(--space-3);
}
fieldset {
  padding: 0;
  margin: 0;
  border: 0;
  min-width: 0;
}
.priority-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--space-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-surface);
  padding: var(--space-4) 52px var(--space-4) var(--space-4) /* design-geometry: alignment, reserved icon space or optical scale. */;
  min-height: 78px;
  cursor: pointer;
  transition:
    border-color var(--motion-fast),
    background var(--motion-fast);
}
.priority-card:has(input:checked) {
  border: 2px solid var(--purple);
  padding: calc(var(--space-4) - 1px) 51px calc(var(--space-4) - 1px) calc(var(--space-4) - 1px) /* design-geometry: alignment, reserved icon space or optical scale. */;
  background: var(--lavender);
}
.priority-card:has(input:focus-visible) {
  outline: 3px solid var(--focus);
  outline-offset: 4px;
}
.priority-card input {
  position: absolute;
  right: 20px;
  top: calc(50% - 9px);
  accent-color: var(--purple);
  width: 18px;
  height: 18px;
  margin: 0;
}
.priority-icon {
  border-radius: var(--radius-small);
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  font-size: var(--text-xl);
  color: var(--icon-ink);
  background: var(--icon-soft);
}
.priority-card:nth-child(2) .priority-icon {
  background: var(--coral-soft);
}
.priority-card:nth-child(3) .priority-icon {
  background: var(--mint);
}
.priority-card strong {
  font-size: var(--text-lead);
  font-weight: var(--weight-strong);
  line-height: var(--leading-label);
  letter-spacing: -0.025em;
}
.clarify-nav { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); margin-bottom: var(--space-4); }
.clarify-nav .back-button { margin: 0 0 0 -10px /* design-geometry: alignment, reserved icon space or optical scale. */; }
.skip-decision { display: flex; align-items: center; justify-content: center; gap: var(--space-2); width: max-content; max-width: 100%; margin: var(--space-3) auto 0; padding: var(--space-2) var(--space-3); border-radius: var(--radius-control); background: var(--lavender); color: var(--purple); font-size: var(--text-caption); font-weight: var(--weight-regular); }
.skip-decision .action-icon { width: 17px; height: 17px; }
.clarification-composer textarea { height: 3lh; min-height: 3lh; max-height: 190px; padding-right: 38px /* design-geometry: alignment, reserved icon space or optical scale. */; font-size: var(--text-body); }
textarea::placeholder { color: var(--muted); opacity: 1; }
.reply-suggestions { margin: 0 0 var(--space-3); }
.reply-suggestions .priority-grid { display: grid; gap: var(--space-2); }
.reply-suggestions .priority-card { width: 100%; min-height: 62px; padding: var(--space-3) var(--space-3); gap: var(--space-3); border-radius: var(--radius-surface); text-align: left; }
.reply-suggestions .priority-card.is-selected { border: 2px solid var(--purple); padding: calc(var(--space-3) - 1px) calc(var(--space-3) - 1px) /* design-geometry: alignment, reserved icon space or optical scale. */; background: var(--lavender); }
.reply-suggestions .priority-icon { width: 32px; height: 32px; border-radius: var(--radius-small); font-size: var(--text-lead); }
.reply-suggestions .priority-card strong { flex: 1; font-size: var(--text-body-small); }
.priority-card .choice-action { width: 18px; height: 18px; flex-shrink: 0; color: var(--purple); }
.reply-suggestions input { width: 1px; height: 1px; margin: -1px /* design-geometry: alignment, reserved icon space or optical scale. */; padding: 0; clip-path: inset(50%); overflow: hidden; }
.question-context {
  position: relative;
  padding: var(--space-2) 44px var(--space-3) var(--space-wide) /* design-geometry: alignment, reserved icon space or optical scale. */;
  margin-bottom: var(--space-section);
}
.summary-quote {
  position: absolute;
  color: var(--purple);
  opacity: 0.6;
  font: var(--font-quote);
  pointer-events: none;
  user-select: none;
}
.summary-quote-open {
  top: -5px;
  left: 0;
}
.summary-quote-close {
  right: 0;
  bottom: -13px;
}
.question-text {
  color: var(--ink);
  font-size: var(--text-body);
  font-weight: var(--weight-regular);
  line-height: var(--leading-detail);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.question-text.is-expanded { display: block; }
.question-expand {
  position: absolute;
  top: 0;
  right: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--control-min);
  height: var(--control-min);
  padding: 0 var(--space-2);
  color: var(--purple);
  background: transparent;
  border-radius: var(--radius-control);
}
.question-expand svg { width: 18px; height: 18px; transition: transform var(--motion-feedback) ease-out; }
.question-expand[aria-expanded=true] svg { transform: rotate(180deg); }
/* Shared hover inset: new disclosures keep the same content alignment. */
summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  min-height: var(--control-min);
  font-size: var(--text-small);
  padding-inline: var(--space-3);
  margin-inline: calc(-1 * var(--space-3));
  border-radius: var(--radius-control);
}
summary::-webkit-details-marker {
  display: none;
}

summary > span[aria-hidden='true'] {
  font-size: var(--text-xl);
  line-height: var(--leading-none);
}
.paths-grid {
  display: grid;
  gap: var(--space-4);
}
.option-card {
  min-width: 0;
  border-radius: var(--radius-panel);
  padding: var(--option-inset);
  /* Count the summary's internal air once; expanded content restores it below. */
  padding-bottom: calc(var(--option-inset) - var(--option-summary-air));
}
.recommended {
  background: var(--lavender);
  border: 1px solid var(--purple);
}
.option-label {
  color: var(--purple);
  font-size: var(--text-small);
  margin-bottom: var(--space-3);
}
.option-card h2 {
  font-size: var(--text-page-title);
  letter-spacing: -0.04em;
  line-height: var(--leading-heading);
  overflow-wrap: anywhere;
}
.option-description {
  font-size: var(--text-body);
  line-height: var(--leading-reading);
  margin-top: var(--space-4);
  color: var(--muted);
}
.option-details {
  border-top: 1px solid var(--border);
  margin-top: var(--space-section);
  padding-top: var(--space-compact);
}
.option-details summary {
  font-size: var(--text-small);
  line-height: var(--leading-body);
  color: var(--purple);
  font-weight: var(--weight-strong);
  min-height: var(--control-prominent);
}
.detail-toggle { display: grid; place-items: center; width: 28px; height: 28px; flex-shrink: 0; border-radius: var(--radius-circle); background: var(--surface); color: var(--purple); }
.recommended .option-details {
  border-color: color-mix(in srgb, var(--purple) 22%, transparent);
}
.option-details p {
  font-size: var(--text-small);
  line-height: var(--leading-reading);
  color: var(--muted);
  margin-top: var(--space-4);
}
.option-details p strong {
  display: block;
  color: var(--ink);
  font-size: var(--text-caption);
  font-weight: var(--weight-strong);
  margin-bottom: var(--space-1);
}
.pros {
  padding: 0;
  list-style: none;
  margin: var(--space-4) 0;
  display: grid;
  gap: var(--space-2);
}
.pros li {
  display: flex;
  gap: var(--space-2);
  font-size: var(--text-small);
  line-height: var(--leading-detail);
}
.pro-check {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  border-radius: var(--radius-circle);
  background: var(--mint);
  color: var(--mint-ink);
}
.pro-check svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.insight-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); margin: var(--space-4) 0; }
.option-details .insight { margin: 0; padding: var(--space-4); border-radius: var(--radius-surface); background: color-mix(in srgb, var(--surface) 75%, transparent); color: var(--ink); line-height: var(--leading-detail); }
.option-details .insight strong { display: flex; align-items: center; gap: var(--space-2); line-height: var(--leading-label); margin-bottom: var(--space-2); }
.insight-icon { width: 28px; height: 28px; padding: var(--space-1); flex-shrink: 0; border-radius: var(--radius-small); fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.tradeoff .insight-icon { background: var(--coral); color: var(--coral-ink); }
.pivot .insight-icon { background: var(--lavender); color: var(--purple); }

.decision-usage { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--space-2); margin-top: var(--space-3); }
.decision-usage > span { display: inline-flex; align-items: center; gap: var(--space-compact); padding: var(--space-compact) var(--space-2); border-radius: var(--radius-pill); background: var(--surface); color: var(--muted); font-size: var(--text-note); }
.decision-usage strong { color: var(--ink); font-weight: var(--weight-strong); }
.decision-usage svg { width: 15px; height: 15px; flex-shrink: 0; fill: none; stroke: var(--purple); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.option-extra {
  display: grid;
  gap: var(--space-4);
  padding-top: var(--space-4);
  padding-bottom: var(--option-summary-air);
}
.option-extra > .option-description,
.option-extra > .pros,
.option-extra > .insight-grid { margin-block: 0; }
.option-extra > :empty,
.option-extra:not(:has(> :not(:empty))) { display: none; }
.alternative {
  background: var(--surface);
  border: 1px solid var(--border);
  padding-bottom: calc(var(--option-inset) - var(--option-alternative-summary-air));
}
.alternative .option-extra { padding-bottom: var(--option-alternative-summary-air); }
/* These inner surfaces merge into the alternative's background. */
.alternative .insight { padding-block: 0; }
.alternative .option-label {
  color: var(--muted);
  font-size: var(--text-note);
  margin-bottom: var(--space-1);
}
.alternative h2 {
  font-size: var(--text-xl);
  line-height: var(--leading-heading);
  letter-spacing: -0.025em;
  font-weight: var(--weight-strong);
}
.alternative .option-details {
  margin-top: var(--space-compact);
  border: 0;
  padding-top: 0;
}
.alternative .option-details summary {
  color: var(--muted);
  min-height: var(--control-min);
}
.result-actions {
  display: flex;
  flex-direction: row-reverse;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  margin-top: var(--space-5);
}
.text-button {
  min-width: 44px;
  min-height: var(--control-min);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--lavender);
  color: var(--muted);
  font-size: var(--text-small);
  padding: var(--control-padding-block) var(--control-padding-inline);
  border-radius: var(--radius-control);
  text-decoration: none;
}
.result-actions .primary {
  font-size: var(--text-small);
  gap: var(--space-4);
}
/* Secondary information stays out of the decision flow. */
.help-button {
  position: fixed;
  width: auto;
  height: auto;
  right: max(var(--shell-gutter), calc((100% - var(--shell-max-width)) / 2 + var(--shell-gutter)));
  bottom: 24px;
  z-index: 5;
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  gap: var(--space-2);
  min-height: var(--control-min);
  padding: var(--space-2);
  color: var(--muted);
  border-radius: var(--radius-control);
  font-size: var(--text-caption);
  font-weight: var(--weight-regular);
}
.help-dialog { width: min(520px, calc(100% - 32px)); }
/* A decision-wide cost, separate from option preferences and usage quotas. */
.result-footer { display: grid; gap: var(--space-1); margin-top: var(--space-1); }
.result-completion-actions { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: var(--space-4); }
.result-completion-actions > .cost-ticket { flex-shrink: 0; }
.result-response { flex-shrink: 0; min-width: 0; max-width: 100%; margin-left: auto; display: grid; justify-items: end; gap: var(--space-1); }
.preference-line { display: flex; align-items: center; gap: var(--space-2); min-width: 0; }
.preference-line .preference-note { flex: 1; min-width: 0; margin: 0; }
.preference-line .response-report { flex-shrink: 0; }
.cost-ticket { display: inline-flex; align-items: center; justify-content: center; gap: var(--space-compact); min-height: var(--control-min); max-width: 100%; padding: var(--space-1) var(--space-3) var(--space-1) var(--space-compact); border: 1px solid var(--border); border-radius: var(--radius-pill); background: var(--surface); font-size: var(--text-note); color: var(--muted); }
.cost-ticket strong { font-size: var(--text-caption); font-variant-numeric: tabular-nums; color: var(--ink); overflow-wrap: anywhere; }
.cost-ticket > svg { width: 15px; height: 15px; }
.cost-ticket > span:not(.cost-coin) { white-space: nowrap; }
.cost-ticket .cost-label-short,
.cost-ticket[data-label=short] .cost-label-full,
.cost-ticket[data-label=none] .cost-label-full { display: none; }
.cost-ticket[data-label=short] .cost-label-short { display: inline; }
.cost-coin { display: grid; place-items: center; flex: 0 0 28px; width: 28px; height: 28px; border: 1px solid color-mix(in srgb, var(--purple) 40%, var(--border)); border-radius: var(--radius-circle); color: var(--purple); background: linear-gradient(145deg, var(--surface), var(--lavender)); box-shadow: var(--shadow-coin); }
.cost-coin svg { width: 18px; height: 18px; fill: currentColor; stroke: none; }
.cost-dialog { width: min(390px, calc(100% - 32px)); --dialog-top: 26px; --dialog-side: 26px; --dialog-bottom: 26px; }
.cost-receipt-heading { display: flex; align-items: center; gap: var(--space-2); padding-right: var(--space-section); font-size: var(--text-note); color: var(--muted); }
.cost-receipt-heading .cost-coin { flex-basis: 34px; width: 34px; height: 34px; }
.cost-dialog .dialog-header h2 { margin: 0; font-size: var(--text-lead); letter-spacing: -.025em; }
.cost-dialog .cost-heading { margin: 0; font-size: var(--text-note); }
.cost-dialog .cost-total { margin: var(--space-1) 0 var(--space-section); font-size: var(--text-cost); font-weight: var(--weight-strong); line-height: var(--leading-heading); letter-spacing: -.055em; color: var(--ink); overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.cost-breakdown { margin: 0; padding: var(--space-4) 0; display: grid; gap: var(--space-4); border-block: 1px dashed var(--border); font-size: var(--text-caption); }
.cost-breakdown > div { display: flex; justify-content: space-between; align-items: baseline; gap: var(--space-3); }
.cost-breakdown dt { min-width: 0; }
.cost-breakdown dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.cost-covered { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: var(--space-3); margin: var(--space-section) 0 var(--space-4); }
.cost-covered > span { display: inline-flex; align-items: center; gap: var(--space-compact); padding: var(--space-compact) var(--space-2); border-radius: var(--radius-small); background: var(--next-bg); color: var(--ink); font-size: var(--text-caption); font-weight: var(--weight-strong); }
.cost-covered svg { width: 14px; height: 14px; flex-shrink: 0; stroke: currentColor; fill: none; }
.cost-covered p { font-size: var(--text-caption); margin: 0; }
.cost-covered strong { color: var(--ink); }
.cost-dialog .cost-note { font-size: var(--text-caption); line-height: var(--leading-detail); margin: var(--space-2) 0 0; }
.carbon-receipt { padding-top: var(--space-4); border-top: 1px dashed var(--border); }
.carbon-heading { display: flex; align-items: center; gap: var(--space-3); }
.carbon-heading > div { min-width: 0; flex: 1; }
.carbon-heading p { margin: 0 0 var(--space-1); font-size: var(--text-note); color: var(--muted); }
.carbon-emblem { display: grid; place-items: center; flex: 0 0 42px; width: 42px; height: 42px; border-radius: var(--radius-circle); background: var(--mint); color: var(--mint-ink); box-shadow: var(--shadow-coin); }
.carbon-emblem svg { width: 27px; height: 27px; }
.carbon-amount { display: block; color: var(--ink); font-size: var(--text-xl); font-variant-numeric: tabular-nums; line-height: var(--leading-heading); overflow-wrap: anywhere; }
.carbon-amount small { font-size: var(--text-caption); font-weight: var(--weight-regular); }
.carbon-badge { max-width: 95px; padding: var(--space-compact) var(--space-2); border: 1px solid color-mix(in srgb, var(--purple) 24%, var(--border)); border-radius: var(--radius-pill); color: var(--purple); background: var(--lavender); font-size: var(--text-note); font-weight: var(--weight-strong); text-align: center; }
.cost-dialog .carbon-equivalence { margin: var(--space-3) 0 var(--space-2); color: var(--muted); font-size: var(--text-caption); line-height: var(--leading-detail); }
.carbon-method { font-size: var(--text-caption); line-height: var(--leading-detail); }
.carbon-method > summary { display: flex; justify-content: space-between; align-items: center; gap: var(--space-2); cursor: pointer; list-style: none; color: var(--purple); }
.carbon-method > summary::-webkit-details-marker { display: none; }
.carbon-method > summary > svg { width: 14px; height: 14px; flex-shrink: 0; transition: transform var(--motion-fast); }
.carbon-method[open] > summary > svg { transform: rotate(180deg); }
.carbon-method > div { padding-top: var(--space-2); }
.carbon-method p { margin: var(--space-2) 0; font-size: inherit; }
.carbon-profile { font-weight: var(--weight-strong); color: var(--ink); }
.carbon-parameters { display: grid; gap: var(--space-compact); margin: var(--space-2) 0 var(--space-3); }
.carbon-parameters > div { display: flex; justify-content: space-between; align-items: baseline; gap: var(--space-3); }
.carbon-parameters dt { color: var(--muted); }
.carbon-parameters dd { margin: 0; font-variant-numeric: tabular-nums; }
.cost-dialog[open] .carbon-emblem { animation: cost-coin-in .35s ease-out; }
.cost-dialog[open] .carbon-badge { animation: cost-stamp .3s .15s both ease-out; }
.cost-dialog[open] .cost-receipt-heading .cost-coin { animation: cost-coin-in .3s ease-out; }
.cost-dialog[open] .cost-covered > span { animation: cost-stamp .28s .12s both ease-out; }
@keyframes cost-coin-in { from { transform: rotate(-25deg) scale(.8); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes cost-stamp { from { transform: rotate(-5deg) scale(1.08); opacity: 0; } to { transform: none; opacity: 1; } }
@media (hover: hover) { .cost-ticket:hover { background: var(--lavender); border-color: var(--purple); } }
@media (max-width: 640px) {
  .result-completion-actions { flex-wrap: wrap; gap: var(--space-2); }
  .result-response { margin-left: auto; }
  .cost-ticket { gap: var(--space-1); padding-inline: var(--space-3); white-space: nowrap; }
  .cost-ticket .cost-coin { display: none; }
  .cost-dialog { --dialog-top: 24px; --dialog-side: 24px; --dialog-bottom: 24px; }
}
@media (max-width: 360px) {
  .result-completion-actions { gap: 0; }
  .cost-ticket { padding-inline: var(--space-2); }
  .cost-ticket > svg { display: none; }
}
.help-heading { display: flex; align-items: center; gap: var(--space-3); margin: 0 var(--space-wide) 0 0; }
.help-heading h2 { margin: 0; font-size: var(--text-3xl); }
.help-heading img { object-fit: contain; }
.help-dialog .help-intro { font-size: var(--text-caption); margin-bottom: var(--space-4); }
.help-section { border-top: 1px solid var(--border); }
.help-section > summary { min-height: 62px; gap: var(--space-3); font-size: var(--text-body-small); font-weight: var(--weight-strong); }
.help-section > summary > span:nth-child(2) { flex: 1; }
.help-section > summary > svg {
  width: 18px; height: 18px; flex-shrink: 0; fill: none; stroke: currentColor;
  stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
  transition: transform var(--motion-feedback) ease-out;
}
.help-section[open] > summary > svg { transform: rotate(180deg); }
.help-topic-icon { width: 34px; height: 34px; border-radius: var(--radius-small); display: grid; place-items: center; flex-shrink: 0; }
.help-topic-icon svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.help-topic-how { background: var(--lavender); color: var(--purple); }
.help-topic-usage { background: var(--coral); color: var(--coral-ink); }
.help-topic-privacy { background: var(--mint); color: var(--mint-ink); }
.help-topic-conditions { background: var(--blue); color: var(--blue-ink); }
.help-topic-updates { background: color-mix(in srgb, var(--coral), var(--mint)); color: var(--coral-ink); }
.update-heading { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); margin-bottom: var(--space-4); }
.update-heading time, .update-archive time { color: var(--muted); font-size: var(--text-note); font-weight: var(--weight-regular); }
.update-badge { padding: var(--space-1) var(--space-2); border-radius: var(--radius-pill); background: var(--lavender); color: var(--purple); font-size: var(--text-note); font-weight: var(--weight-strong); }
.update-list { list-style: none; padding: 0; margin: 0; }
.update-list li { position: relative; display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: var(--space-3); padding-bottom: var(--space-4); }
.update-list li:not(:last-child)::before { content: ''; position: absolute; left: 13px; top: 28px; bottom: 0; width: 1px; background: var(--border); }
.update-list li:last-child { padding-bottom: 0; }
.update-icon { display: grid; place-items: center; width: 28px; height: 28px; border-radius: var(--radius-circle); background: var(--lavender); color: var(--purple); }
.update-icon-voice, .update-icon-send { background: var(--coral); color: var(--coral-ink); }
.update-icon-credit { background: var(--mint); color: var(--mint-ink); }
.update-icon svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.update-list h3 { margin: var(--space-half) 0 var(--space-1); font-size: var(--text-body-small); line-height: var(--leading-label); }
.help-content .update-list p { margin: 0; font-size: var(--text-small); line-height: var(--leading-detail); }
.update-archive > summary { gap: var(--space-2); }
.update-archive > summary > span { flex: 1; }
.update-archive .update-list { padding-top: var(--space-3); }
.update-archive-day { padding-top: var(--space-3); }
.update-archive-day + .update-archive-day { margin-top: var(--space-4); }
.help-content { padding: var(--space-3) var(--space-4); margin-bottom: var(--space-3); border-radius: var(--radius-surface); background: var(--soft); }
.help-content p { font-size: var(--text-body-small); line-height: var(--leading-reading); margin-bottom: var(--space-3); }
.help-content > :last-child { margin-bottom: 0; }
.help-content .help-caption { font-size: var(--text-note); }
.help-model { border-top: 1px solid var(--border); margin-top: 0; padding-block: var(--space-2); }
.help-model > summary { min-height: var(--control-min); font-size: var(--text-small); color: var(--purple); font-weight: var(--weight-strong); }
.help-model > summary + * { margin-top: var(--space-3); }
.help-model > :last-child:not(summary) { margin-bottom: 0; }
.help-model > summary > svg { width: 16px; height: 16px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; transition: transform var(--motion-feedback) ease-out; }
.help-model[open] > summary > svg { transform: rotate(180deg); }
.help-model > p { padding-top: var(--space-compact); }
.help-allowances { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-2); margin: var(--space-2) 0 var(--space-4); }
.help-allowances > div { padding: var(--space-3) var(--space-3); border-radius: var(--radius-surface); background: var(--lavender); color: var(--purple); }
.help-allowances > div:nth-child(2) { background: var(--coral); color: var(--coral-ink); }
.help-allowances strong { display: block; font-size: var(--text-3xl); line-height: var(--leading-heading); margin-bottom: var(--space-1); letter-spacing: -.04em; }
.help-allowances span { font-size: var(--text-note); }
.help-cost { padding: var(--space-3) 0; border-top: 1px solid var(--border); }
.help-cost strong { display: block; color: var(--ink); font-size: var(--text-body-small); margin-bottom: var(--space-1); }
.help-cost span { color: var(--muted); font-size: var(--text-caption); line-height: var(--leading-detail); }
.help-link { display: inline-flex; align-items: center; gap: var(--space-2); color: var(--purple); font-size: var(--text-caption); text-decoration: underline; text-underline-offset: 3px; }
.help-link .action-icon { width: 17px; height: 17px; }
.help-footer { display: flex; align-items: center; justify-content: flex-end; gap: var(--space-3); margin-top: var(--space-4); }
.help-footer > a { color: var(--muted); font-size: var(--text-note); text-decoration: underline; text-underline-offset: 3px; }
.help-footer > [data-open-user-feedback] { margin-right: auto; }

dialog {
  background: var(--surface);
  position: fixed;
  inset: var(--dialog-viewport-top, 0px) calc(100% - var(--dialog-viewport-left, 0px) - var(--dialog-viewport-width, 100%)) calc(100% - var(--dialog-viewport-top, 0px) - var(--dialog-viewport-height, 100%)) var(--dialog-viewport-left, 0px);
  margin: auto;
  color: var(--ink);
  border: 1px solid var(--border);
  border-radius: var(--radius-dialog);
  box-shadow: var(--shadow-dialog);
  --dialog-top: 36px;
  --dialog-side: 36px;
  --dialog-bottom: 36px;
  padding: 0;
  width: min(460px, calc(100% - 32px));
  max-height: min(var(--dialog-max-height), calc(var(--dialog-viewport-height, 100dvh) - 32px));
  overflow: hidden;
}
dialog[open] { display: flex; flex-direction: column; }
.dialog-header { position: relative; flex-shrink: 0; padding: var(--dialog-top) var(--dialog-side) var(--space-4); background: var(--surface); }
.dialog-header h2 { margin: 0; padding-right: var(--space-section); }
.dialog-body { min-height: 0; overflow: auto; overscroll-behavior: contain; padding: 0 var(--dialog-side) var(--dialog-bottom); scroll-padding-block: 12px; }
dialog::backdrop {
  background: var(--backdrop);
  backdrop-filter: blur(4px);
}
dialog h2 {
  font-size: var(--text-dialog-title);
  margin: var(--space-3) 0 var(--space-5);
  line-height: var(--leading-heading);
}
dialog p {
  font-size: var(--text-body-small);
  line-height: var(--leading-reading);
  color: var(--muted);
  margin-bottom: var(--space-4);
}
#edit-label { display: block; margin-bottom: var(--space-2); font-size: var(--text-small); font-weight: var(--weight-strong); }
#edit-text { height: auto; min-height: calc(3lh + 30px); max-height: min(280px, 40dvh); font-size: var(--text-body); line-height: var(--leading-reading); }
dialog > .dialog-form { display: flex; flex-direction: column; min-height: 0; width: 100%; }
#edit-form .dialog-body { padding-block: var(--space-1) var(--space-2); }
dialog .dialog-actions { flex-shrink: 0; margin-top: 0; padding: var(--space-3) var(--dialog-side) var(--dialog-bottom); }
.dialog-close {
  position: absolute;
  top: 10px;
  right: 10px;
  background: transparent;
  font-size: var(--text-2xl);
}
dialog > .primary {
  width: 100%;
  margin-top: var(--space-3);
}
@media (hover: hover) {
  .voice-button:hover:not(:disabled) {
    background: var(--coral-hover);
  }
  .primary:hover:not(:disabled) {
    background: var(--purple-hover);
    transform: translateY(-2px);
  }
  .primary:hover:not(:disabled) .action-icon[data-icon="arrow-right"] {
    transform: translateX(3px);
  }
  .icon-button:hover:not(:disabled),
  .back-button:hover:not(:disabled) {
    background: var(--lavender);
    color: var(--purple);
  }
  .text-button:hover:not(:disabled) {
    color: var(--purple-hover);
  }
  .scenario-picker button:hover:not(:disabled),
  .priority-card:hover:not(:disabled) {
    border-color: var(--purple);
  }
}
@media (max-width: 900px) {
  .help-button { position: static; width: var(--control-min); height: var(--control-min); padding: var(--space-2); justify-content: center; }
  .help-button > span { display: none; }
}
@media (max-width: 640px) {
  .voice-button { gap: var(--space-compact); padding-inline: var(--space-2); }
  .help-heading { gap: var(--space-2); }
  .help-heading h2 { font-size: var(--text-3xl); }
  .help-heading img { width: 40px; height: 40px; }
  .insight-grid { grid-template-columns: 1fr; gap: var(--space-2); }
  .shell {
    padding: 0 var(--space-section);
  }
  .header {
    height: 74px;
  }
  .brand {
    font-size: var(--text-brand);
    gap: var(--space-compact);
  }
  .brand img {
    width: 27px;
    height: 27px;
  }
  .header-actions {
    gap: var(--space-1);
  }
  main {
    min-height: calc(100svh - 74px - 74px);
    padding: var(--space-5) 0;
  }
  .companion {
    width: 88px;
    height: 88px;
  }
  .home-screen h1 {
    font-size: var(--text-page-title);
    margin: var(--space-4) 0 var(--space-5);
  }
  .input-panel {
    padding: var(--space-4);
    border-radius: var(--radius-panel);
  }
  textarea {
    font-size: var(--text-body);
    min-height: 116px;
  }
  .primary {
    font-size: var(--text-small);
    padding: var(--space-3) var(--space-4);
    gap: var(--space-section);
  }
  .scenario-picker {
    margin-top: var(--space-4);
  }

  .clarify-screen h1 {
    font-size: var(--text-3xl);
    margin-bottom: var(--space-5);
  }
  .priority-card {
    min-height: 74px;
    padding-top: var(--space-4);
    padding-bottom: var(--space-4);
  }
  .priority-card:has(input:checked) {
    padding-top: calc(var(--space-4) - 1px) /* design-geometry: alignment, reserved icon space or optical scale. */;
    padding-bottom: calc(var(--space-4) - 1px) /* design-geometry: alignment, reserved icon space or optical scale. */;
  }
  .priority-card strong {
    font-size: var(--text-body);
  }

  .brief {
    margin-top: var(--space-3);
  }
  .option-card h2 {
    font-size: var(--text-dialog-title);
  }
  .option-description {
    font-size: var(--text-body-small);
    line-height: var(--leading-detail);
  }
  .option-label {
    font-size: var(--text-caption);
  }
  .option-details {
    margin-top: var(--space-4);
  }
  .alternative h2 {
    font-size: var(--text-xl);
  }
  .result-actions {
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-1);
    margin-top: var(--space-section);
  }
  .result-actions .primary {
    width: 100%;
  }
  .result-actions .text-button {
  min-width: 44px;
  min-height: var(--control-min);
    font-size: var(--text-caption);
  }
  dialog {
    --dialog-top: 30px;
    --dialog-side: 24px;
    --dialog-bottom: 25px;
  }
  dialog h2 {
    font-size: var(--text-3xl);
  }
  dialog p {
    font-size: var(--text-small);
  }
}
@media (max-width: 360px) {
  .question-context {
    padding-right: 44px /* design-geometry: alignment, reserved icon space or optical scale. */;
    padding-left: var(--space-5);
  }
  .question-text { font-size: var(--text-body-small); }
  .summary-quote { font-size: var(--text-display); }
  .voice-button {
    gap: var(--space-compact);
    padding: var(--space-3) var(--space-2);
    font-size: var(--text-small);
  }
  .input-actions {
    gap: var(--space-2);
  }
  .input-actions .primary { width: var(--control-prominent); padding-inline: var(--space-3); }
  .input-actions .primary > span { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px /* design-geometry: alignment, reserved icon space or optical scale. */; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
  .shell {
    padding: 0 var(--space-4);
  }
  .home-screen h1 {
    font-size: var(--text-4xl);
  }
  .companion {
    width: 80px;
    height: 80px;
  }
  .input-panel {
    padding: var(--space-4);
  }
  textarea {
    font-size: var(--text-body);
  }
  .priority-card strong {
    font-size: var(--text-body);
  }
  .clarify-screen h1 {
    font-size: var(--text-3xl);
  }
  :root { --option-inset: var(--space-section); }
  .option-card h2 {
    font-size: var(--text-3xl);
  }
  .alternative h2 {
    font-size: var(--text-lead);
  }
  .option-description {
    font-size: var(--text-small);
  }
}
@keyframes arrive {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes mascot-breathe {
  0%, 100% {
    transform: translateY(0) rotate(-1deg) scale(1);
  }
  50% {
    transform: translateY(-5px) rotate(1deg) scale(1.025);
  }
}
.result-screen {
  animation: none;
}
#paths > * {
  animation: arrive 0.36s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}
#paths > *:nth-child(2) {
  animation-delay: 0.07s;
}
dialog[open] {
  animation: arrive var(--motion-surface) ease-out both;
}
dialog[open]::backdrop { animation: backdrop-in var(--motion-theme) ease-out both; }
dialog.is-closing::backdrop { animation: backdrop-out var(--motion-exit) ease-in both; }
@keyframes backdrop-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes backdrop-out { from { opacity: 1; } to { opacity: 0; } }
.help-section.is-closing[open] > summary > svg { transform: rotate(0); }
body, .header::before, .input-panel, .option-card, dialog { transition: background-color var(--motion-theme) ease, color var(--motion-theme) ease, border-color var(--motion-theme) ease; }
.priority-card { transition: background-color var(--motion-feedback), border-color var(--motion-feedback), transform var(--motion-feedback); }
@media (hover: hover) {
  .priority-card:hover { transform: translateY(-1px); }
}

/* A theme change is one paint, not competing color transitions. */
:root.is-changing-theme,
:root.is-changing-theme *,
:root.is-changing-theme *::before,
:root.is-changing-theme *::after {
  transition: none !important;
}

@media (prefers-reduced-motion: reduce) {
  .mascot-sparkle { opacity: .75; transform: translate(calc(-50% + var(--spark-x)),calc(-50% + var(--spark-y))) scale(.65); }
  *,
  *::before,
  *::after,
  *::backdrop {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
  .primary:hover:not(:disabled),
  button:active:not(:disabled),
  .action-icon {
    transform: none !important;
  }
}

/* Acoustic feedback belongs to the active vocal control, not to another panel. */
.voice-actions { position: relative; isolation: isolate; }
.voice-actions .voice-button { position: relative; z-index: 1; }
.voice-actions .voice-wave { position: absolute; inset: -3px; border-radius: var(--radius-surface); pointer-events: none; background: linear-gradient(125deg, var(--purple), var(--coral-hover)); opacity: 0; z-index: 0; transition: opacity var(--motion-fast) linear, transform var(--motion-fast) ease-out; }
.voice-actions .voice-wave::before { content: ''; position: absolute; inset: -2px; border-radius: inherit; background: inherit; filter: blur(5px); opacity: .6; }

.header :is(.history-button, .newsletter-button) { display: inline-flex; width: auto; gap: var(--space-2); padding: var(--space-2) var(--space-2); border-radius: var(--radius-control); font-size: var(--text-caption); }
.header-tools:not([popover]), .header-language { display: contents; }
.header-menu-toggle, .header-menu-label, .header-menu-icon { display: none; }
.newsletter-button > .header-menu-label { display: inline; }
@media (min-width: 641px) {
  .header-language { display: inline-flex; align-items: center; gap: var(--space-3); }
  .header-language::before { content: ''; width: 1px; height: var(--space-5); background: var(--border); }
}
.history-dialog { width: min(560px, calc(100% - 32px)); }
.history-caption { font-size: var(--text-note); margin: 0 0 var(--space-section); }
.history-list { display: grid; gap: var(--space-2); }
.history-row { display: flex; align-items: center; gap: var(--space-3); width: 100%; padding: var(--space-3); background: var(--soft); border-radius: var(--radius-surface); text-align: left; }
.history-symbol { display: grid; place-items: center; width: 36px; height: 36px; border-radius: var(--radius-control); background: var(--lavender); color: var(--purple); flex-shrink: 0; }
.history-row:nth-child(3n + 2) .history-symbol { background: var(--coral); color: var(--coral-ink); }
.history-row:nth-child(3n + 3) .history-symbol { background: var(--mint); color: var(--mint-ink); }
.history-copy { flex: 1; min-width: 0; }
.history-copy strong { font-size: var(--text-small); font-weight: var(--weight-strong); line-height: var(--leading-body); display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; overflow-wrap: anywhere; }
.history-choice { display: block; font-size: var(--text-note); color: var(--purple); margin-top: var(--space-compact); }
.history-copy time { display: block; font-size: var(--text-note); color: var(--muted); margin-top: var(--space-compact); }
.history-row > .action-icon { width: 18px; height: 18px; color: var(--purple); }
.history-empty { text-align: center; padding: var(--space-5) var(--space-2); margin: 0; font-size: var(--text-small); }
.history-message { font-size: var(--text-note); margin-top: var(--space-4); }
@media (hover: hover) {
  .history-row:hover { background: var(--lavender); }
  .history-row:hover > .action-icon { transform: translateX(3px); }
  .skip-decision:hover { background: var(--lavender); }
}
@media (max-width: 640px) {
  .header { gap: var(--space-2); }
  .header-actions { min-width: 0; }
  .brand { flex-shrink: 0; }
  .header .history-button { width: auto; min-width: 0; height: var(--control-min); gap: var(--space-compact); justify-content: center; padding: var(--space-2); font-size: var(--text-note); flex-shrink: 1; }
  .history-button > span { display: inline; min-width: 0; line-height: var(--leading-heading); }
  .header-menu-toggle { display: grid; }
  .header-tools:not([popover]) { display: none; }
  .header-tools[popover] { position: fixed; inset: auto; top: var(--menu-top); right: var(--menu-right); margin: 0; width: min(260px, calc(100% - 44px)); max-height: calc(100dvh - 96px); padding: var(--space-2); border: 1px solid var(--border); border-radius: var(--radius-surface); background: var(--surface); color: var(--ink); box-shadow: var(--shadow-popover); }
  .header-tools:popover-open { display: grid; gap: var(--space-1); }

  .header-tools .header-language, .header-tools #theme-toggle, .header-tools :is(#newsletter-button, #user-feedback-button), .header-tools #help-button { position: static; display: grid; grid-template-columns: 20px minmax(0, 1fr) auto; align-items: center; justify-items: start; width: 100%; height: auto; min-height: var(--control-min); gap: var(--space-2); padding: 0 var(--space-2); border-radius: var(--radius-small); color: var(--muted); font-size: var(--text-small); font-weight: var(--weight-regular); line-height: var(--leading-label); text-align: left; }
  .header-tools .header-language > svg, .header-tools #theme-toggle > svg, .header-tools :is(#newsletter-button, #user-feedback-button) > svg, .header-tools #help-button > svg { display: block; width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
  .header-tools .header-menu-label { display: inline; }
  .header-tools #theme-toggle > span, .header-tools :is(#newsletter-button, #user-feedback-button) > span, .header-tools #help-button > span { grid-column: 2 / -1; }
  .header-tools .language-control { width: auto; justify-self: end; color: var(--ink); }
  .header-tools .language-control, #header-menu .lang-toggle { border-radius: var(--radius-small); }
  .header-tools .language-code { display: none; }
  #header-menu .lang-toggle { width: auto; max-width: 140px; color: var(--ink); font: inherit; }
  .header-tools :is(#newsletter-button, #user-feedback-button) > span, .header-tools #help-button > span { display: inline; }

}
@media (prefers-reduced-motion: reduce) { .history-row:hover > .action-icon { transform: none; } }
/* A compact alternative to the suggested responses, expanded only when used. */
.clarification-composer:not(.is-expanded) { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; gap: var(--space-2); padding: var(--space-3); }
.clarification-composer:not(.is-expanded) textarea { height: var(--control-min); min-height: var(--control-min); padding: var(--space-2) 0; font-size: var(--text-body-small); line-height: calc(var(--text-body) * var(--leading-body)); }
.clarification-composer:not(.is-expanded) .input-actions { display: contents; }
.clarification-composer:not(.is-expanded) .primary { display: none; }
@media (max-width: 360px) {
  .reply-suggestions .priority-card { min-height: 52px; padding: var(--space-2) var(--space-3); }
  .reply-suggestions .priority-card.is-selected { padding: calc(var(--space-2) - 1px) calc(var(--space-3) - 1px) /* design-geometry: alignment, reserved icon space or optical scale. */; }
  .reply-suggestions .priority-icon { width: 28px; height: 28px; }
  .reply-suggestions .priority-card strong { font-size: var(--text-small); }
}

/* Contextual help follows the same palette in the page and native dialogs. */
.action-tooltip { position: fixed; z-index: 50; display: flex; align-items: center; gap: var(--space-2); width: max-content; max-width: min(280px,calc(100vw - 24px)); padding: var(--space-2) var(--space-3); border: 1px solid var(--border); border-radius: var(--radius-control); background: var(--surface); color: var(--ink); box-shadow: var(--shadow-tooltip); font-size: var(--text-caption); font-weight: var(--weight-regular); line-height: var(--leading-body); text-align: left; opacity: 0; transform: translateY(3px); transition: opacity var(--motion-fast) ease,transform var(--motion-fast) ease; }
.action-tooltip.is-visible { opacity: 1; transform: none; }
.action-tooltip::after { content: ''; position: absolute; left: var(--tip-arrow); width: 8px; height: 8px; background: var(--surface); transform: translateX(-50%) rotate(45deg); }
.action-tooltip[data-side="top"]::after { bottom: -5px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.action-tooltip[data-side="bottom"]::after { top: -5px; border-left: 1px solid var(--border); border-top: 1px solid var(--border); }
.action-tooltip kbd { padding: 1px var(--space-1) /* design-geometry: alignment, reserved icon space or optical scale. */; border: 1px solid var(--border); border-radius: var(--radius-tight); background: var(--soft); color: var(--muted); font: inherit; font-size: var(--text-note); white-space: nowrap; }
summary { transition: background var(--motion-fast),color var(--motion-fast),transform var(--motion-feedback); }
.brand { transition: color var(--motion-fast); }
.brand img,.icon-button svg,.back-button svg,.voice-button > svg,.priority-icon,.help-topic-icon { transition: transform var(--motion-feedback) ease-out; }
@media (hover: hover) {
  button:hover:not(:disabled):not(.voice-button) { transform: translateY(-1px); }
  a:hover { color: var(--purple); }
  .brand:hover img { transform: rotate(-7deg) scale(1.05); }
  .skip-link:hover { color: var(--surface); background: var(--purple); }
  .icon-button:hover:not(:disabled) svg { transform: rotate(-6deg); }
  .back-button:hover:not(:disabled) svg { transform: translateX(-3px); }
  .voice-button:hover:not(:disabled) { box-shadow: var(--shadow-voice); }
  .voice-button[aria-pressed="false"]:hover:not(:disabled) > svg { transform: rotate(-6deg); }
  .scenario-picker button:hover { transform: translateY(-1px); background: var(--lavender); }
  .priority-card:hover { background: color-mix(in srgb,var(--purple) 7%,var(--surface)); }
  .priority-card:hover .priority-icon,.help-section > summary:hover .help-topic-icon { transform: rotate(-5deg); }
  .priority-card:hover .choice-action,.skip-decision:hover .action-icon { transform: translateX(3px); }
  summary:hover { background: color-mix(in srgb,var(--purple) 7%,transparent); color: var(--purple); }
  .option-details > summary:hover .detail-toggle { color: var(--surface); background: var(--purple); transform: scale(1.08); }
  .mascot-trigger:hover { filter: var(--shadow-mascot); }
  .input-panel:hover:not(:focus-within):not(.is-listening) { border-color: color-mix(in srgb,var(--purple) 45%,var(--border)); }
}
@media (prefers-reduced-motion: reduce) {
  button:hover:not(:disabled),a:hover img,.icon-button:hover:not(:disabled) svg,.back-button:hover:not(:disabled) svg,.voice-button:hover > svg,.priority-card:hover .priority-icon,.priority-card:hover .choice-action,.help-section > summary:hover .help-topic-icon,.skip-decision:hover .action-icon,.option-details > summary:hover .detail-toggle,.action-tooltip { transform: none !important; }
}

/* Service information stays outside the primary decision flow. */
.shell { min-height: 100svh; display: flex; flex-direction: column; }
.header { flex-shrink: 0; }
.shell > main { flex: 1; min-height: min-content; }
.app-footer { flex-shrink: 0; width: 100%; max-width: 650px; margin: 0 auto; padding: var(--space-3) 0 var(--space-section); text-align: center; color: var(--muted); font-size: var(--text-note); line-height: var(--leading-reading); }
.app-footer-line { display: block; text-wrap: balance; }
@media(max-width:640px) {
 .app-footer { width:calc(100% + 20px);margin-inline:-10px /* design-geometry: alignment, reserved icon space or optical scale. */;letter-spacing:-.02em; }
 .app-footer p { text-wrap:balance; }
 .app-footer-line { display:inline; }
}
.app-footer a { text-decoration: underline; text-decoration-color: color-mix(in srgb,var(--muted) 55%,transparent); text-underline-offset: 3px; transition: color var(--motion-fast); }
.help-content.privacy-content { padding: 0; background: transparent; }
.privacy-detail { margin-bottom: var(--space-2); border: 1px solid var(--border); border-radius: var(--radius-surface); }
.privacy-detail > summary { padding: var(--space-3); margin-inline: 0; gap: var(--space-2); border-radius: var(--radius-surface); }
.privacy-topic-icon { display: grid; place-items: center; flex-shrink: 0; width: 32px; height: 32px; border-radius: var(--radius-small); background: var(--lavender); color: var(--purple); }
.privacy-topic-icon svg,.privacy-chevron { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.privacy-summary { flex: 1; min-width: 0; }
.privacy-summary strong { display: block; font-size: var(--text-small); font-weight: var(--weight-strong); }
.privacy-summary small { display: block; margin-top: var(--space-half); color: var(--muted); font-size: var(--text-note); }
.privacy-chevron { width: 16px; height: 16px; flex-shrink: 0; transition: transform var(--motion-feedback) ease-out; }
.privacy-detail[open]:not(.is-closing) > summary .privacy-chevron { transform: rotate(180deg); }
.privacy-body { padding: var(--space-1) var(--space-3) var(--space-3); overflow-wrap: anywhere; }
.privacy-body p { font-size: var(--text-caption); line-height: var(--leading-reading); margin-bottom: var(--space-3); }
.privacy-body > :last-child { margin-bottom: 0; }
.privacy-body strong { color: var(--ink); }
.privacy-flow { padding-left: var(--space-5); margin: var(--space-2) 0 var(--space-4); }
.privacy-flow li { padding-left: var(--space-compact); margin-bottom: var(--space-4); font-size: var(--text-caption); }
.privacy-flow li::marker { color: var(--purple); font-weight: var(--weight-strong); }
.privacy-flow li p { margin: var(--space-1) 0 0; }
.privacy-service + .privacy-service { margin-top: var(--space-4); padding-top: var(--space-4); border-top: 1px solid var(--border); }
.privacy-service h2 { margin: 0 0 var(--space-2); font-size: var(--text-body-small); letter-spacing: -.02em; }
.privacy-models,.privacy-retention { margin: 0; }
.privacy-model + .privacy-model { margin-top: var(--space-3); }
.privacy-model dt { font-size: var(--text-caption); font-weight: var(--weight-strong); }
.privacy-model code { display: block; width: fit-content; max-width: 100%; margin: var(--space-1) 0; padding: var(--space-half) var(--space-compact); border-radius: var(--radius-small); background: var(--lavender); color: var(--purple); font-size: var(--text-note); font-weight: var(--weight-regular); overflow-wrap: anywhere; }
.privacy-model dd,.privacy-retention dd { margin: var(--space-1) 0 0; color: var(--muted); font-size: var(--text-caption); line-height: var(--leading-reading); }
.privacy-links { display: flex; flex-wrap: wrap; gap: 0 var(--space-2); }
.privacy-link { display: inline-flex; align-items: center; gap: var(--space-compact); color: var(--purple); font-size: var(--text-note); text-decoration: underline; text-underline-offset: 3px; transition: color var(--motion-fast); }
.privacy-link .action-icon { width: 15px; height: 15px; }
.privacy-retention > div { padding: var(--space-3) 0; border-bottom: 1px solid var(--border); }
.privacy-retention > div:first-child { padding-top: var(--space-1); }
.privacy-retention > div:last-child { border: 0; }
.privacy-retention dt { color: var(--ink); font-size: var(--text-caption); font-weight: var(--weight-strong); }
.privacy-retention dt span { display: block; color: var(--purple); font-size: var(--text-note); margin-top: var(--space-1); }
.privacy-guarantee { margin-top: var(--space-3); padding: var(--space-3); border-radius: var(--radius-control); background: var(--lavender); font-size: var(--text-caption); }
.privacy-guarantee > strong { display: block; margin-bottom: var(--space-2); }
.privacy-guarantee p:last-child { margin-bottom: 0; }
.help-dialog .help-footer { flex-shrink: 0; margin: 0; padding: var(--space-3) var(--dialog-side) var(--dialog-bottom); background: var(--surface); }
.help-dialog .dialog-body { padding-bottom: 0; }
@media (hover: hover) {
  .app-footer a:hover { color: var(--purple); }
  .privacy-link:hover { color: var(--purple-hover); }
  .privacy-link:hover .action-icon { transform: translate(1px,-1px); }
}

/* Product states use the approved lab layout; persistent transaction/history engine underneath. */
:root { --dock-height: 0px; --keyboard-inset: 0px; --inline-height: 0px; --visible-height: 100dvh; }
html { scroll-padding-top: calc(var(--header-height, 88px) + 12px); scroll-padding-bottom: calc(var(--dock-height) + 12px); }
body[data-docked=true] .shell { padding-bottom: calc(var(--dock-height) + env(safe-area-inset-bottom)); }
body[data-state=processing] main { min-height: 0; }
body[data-docked=true] .app-footer { display: none; }
body[data-state=processing] .status-region { position: fixed; inset: var(--header-height, 88px) 22px calc(var(--dock-height) - 12px + env(safe-area-inset-bottom)); display: grid; place-items: center; width: auto; pointer-events: none; }
.status-line.thinking-state { display: flex; flex-direction: column; align-items: center; gap: var(--space-section); max-width: 480px; margin: 0; text-align: center; color: var(--ink); }
.thinking-companion { object-fit: contain; animation: thinking-float 2.4s ease-in-out infinite; }
.thinking-state #status-text { margin: 0; font-size: var(--text-xl); line-height: var(--leading-body); font-weight: var(--weight-strong); letter-spacing: -.015em; text-wrap: balance; }
.thinking-dots { display: flex; align-items: center; gap: var(--space-2); height: 10px; }
.thinking-dots i { width: 7px; height: 7px; border-radius: var(--radius-circle); background: var(--purple); animation: thinking-dot 1.2s ease-in-out infinite; }
.thinking-dots i:nth-child(2) { background: var(--coral); animation-delay: .15s; }
.thinking-dots i:nth-child(3) { background: var(--mint); animation-delay: .3s; }
@keyframes thinking-float { 0%,100% { transform: translateY(2px) rotate(-3deg); } 50% { transform: translateY(-4px) rotate(3deg); } }
@keyframes thinking-dot { 0%,70%,100% { opacity: .35; transform: scale(.8); } 35% { opacity: 1; transform: scale(1.1); } }
@media(prefers-reduced-motion:reduce) { .thinking-companion,.thinking-dots i { animation: none; } }

.dock-toolbar { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: var(--space-2); margin-bottom: var(--space-2); }
.dock-toolbar:not(:has(#usage-button:not([hidden]))) { grid-template-columns: minmax(0, 1fr) auto auto; }
/* Inset contours preserve button geometry and yield to the keyboard focus ring. */
.dock-toolbar button:not(:focus-visible) { outline: 1px solid var(--floating-border); outline-offset: -1px; }
.dock-toolbar .back-button { grid-area: 1 / 1; justify-self: start; margin: 0; }
.dock-toolbar > .dock-slot { grid-area: 1 / 3; justify-self: end; }
.dock-toolbar > .dock-slot:has(#write-button), .dock-toolbar #back-home { grid-area: 1 / 1; justify-self: start; }
.dock-toolbar #new-question { width: auto; min-width: 0; height: var(--control-min); padding-block: 0; white-space: nowrap; }
#usage-button { grid-area: 1 / 2; justify-self: center; gap: var(--space-1); }
#usage-button span { max-width: 10ch; font-size: var(--text-note); line-height: var(--leading-heading); text-align: left; white-space: normal; }
.dock-toolbar:has(#result-share:not([hidden])) { grid-template-columns: minmax(var(--control-min), 1fr) auto auto; }
@media(max-width:640px) {
 .dock-toolbar, .dock-toolbar:has(#result-share:not([hidden])) { grid-template-columns: var(--control-min) minmax(0, 1fr) auto; }
 .dock-toolbar:not(:has(#usage-button:not([hidden]))) { grid-template-columns: minmax(var(--control-min), 1fr) auto auto; }
 .result-share-button { width: var(--control-min); height: var(--control-min); padding: 0; }
 .result-share-button > span, #usage-button > span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
 #usage-button { min-width: var(--control-min); padding-inline: var(--space-2); white-space: nowrap; }
 .dock-toolbar:has(#usage-button:not([hidden])) #new-question { width: var(--control-min); height: var(--control-min); padding: 0; }
 .dock-toolbar:has(#usage-button:not([hidden])) #new-question > span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
}
.dock-toolbar > .dock-result-actions { display: flex; align-items: center; gap: var(--space-2); }
.result-share-button { background: var(--lavender); color: var(--purple); min-width: var(--control-min); min-height: var(--control-min); }
.result-share-dialog[open] { display: flex; flex-direction: column; }
.result-share-dialog .dialog-body { min-height: 0; overflow: auto; }
.result-share-dialog .dialog-header, .result-share-dialog .dialog-actions { flex-shrink: 0; }
.result-share-dialog .dialog-actions { flex-wrap: wrap; }
#result-share-preview { display: block; width: 100%; height: auto; border-radius: var(--radius-control); }
#result-share-preview[hidden] { display: none; }
#result-share-status:empty { display: none; }
#usage-button svg { width: 18px; height: 18px; }
#usage-button[data-level=low] { color: var(--purple); background: var(--lavender); }
#usage-button[data-level=empty] { color: var(--danger); background: var(--danger-soft); }
@media (hover: hover) {
 #usage-button[data-level=low]:hover:not(:disabled) { color: var(--purple-hover); }
 #usage-button[data-level=empty]:hover:not(:disabled) { background: color-mix(in srgb,var(--danger) 18%,var(--surface)); }
}
.help-allowances > div { min-width: 0; }
.help-allowances strong { overflow-wrap: anywhere; }
body[data-docked=true] .composer-region { position: fixed; z-index: 20; left: 50%; width: min(600px, calc(100% - 44px)); transform: translateX(-50%); margin: 0; }
body[data-docked=true] .composer-region { bottom: calc(12px + env(safe-area-inset-bottom) + var(--keyboard-inset)); padding-top: var(--space-2); background: transparent; }
body[data-inline=true] .answer-form.input-panel { width: 100%; margin: 0; }
/* Inline mobile replies and their shortcut share the flow; a floating toolbar can cover either. */
@media(max-width:640px) {
 body[data-docked=true][data-inline=true] .composer-region { position: static; width: 100%; transform: none; margin-top: 0; padding-top: var(--space-3); }
}
body[data-docked=true] #composer-text,
body[data-docked=true][data-inline=true] #answer-input { max-height: min(190px, max(76px, calc(var(--visible-height) - 260px))); }
.voice-dock { margin-top: 0; }
.voice-dock:has(> :not([hidden])) { margin-top: var(--space-2); }


.primary { color: var(--on-accent); }
:root[data-theme='dark'] .primary { color: #21192f; }
.lang-toggle { appearance: none; max-width: 112px; min-height: var(--control-min); padding: var(--space-compact) var(--space-wide) var(--space-compact) var(--space-2); border: 0; border-radius: var(--radius-control); background: transparent; color: var(--muted); font: inherit; font-size: var(--text-utility); line-height: var(--leading-label); cursor: pointer; }
.lang-toggle { transition: background-color var(--motion-fast),color var(--motion-fast); }
.lang-toggle:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
@media(hover:hover) {
 .lang-toggle:hover, #header-menu .lang-toggle:hover { background:var(--lavender);color:var(--purple); }
 .language-control:has(.lang-toggle:hover) { color:var(--purple); }
 .help-button:hover { color:var(--purple); }

 .question-expand:hover { background:var(--lavender); }
 .prov-toggle:hover { background:var(--soft);color:var(--purple); }
}
.stage { animation: none; }
body[data-docked=true]:not(.information-page) .shell > main { align-items: start; padding-block: var(--space-5); }
body[data-docked=true] .stage { margin-block: 0; }
.language-control { position: relative; display: inline-flex; border-radius: var(--radius-control); color: var(--muted); }
.language-control::after { content: ''; position: absolute; top: 50%; right: 8px; width: var(--icon-caret); height: var(--icon-caret); transform: translateY(-50%); background: currentColor; mask: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="none" stroke="black" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" d="m6 9 6 6 6-6"/></svg>') center / contain no-repeat; pointer-events: none; }
.language-code { display: none; }
/* One compact header variant; mobile utility menus retain their full names. */
.language-control-compact .language-code { position: absolute; inset-inline-start: var(--space-2); top: 50%; transform: translateY(-50%); display: block; font-size: var(--text-caption); line-height: var(--leading-label); text-transform: uppercase; pointer-events: none; }
.language-control-compact > .lang-toggle { width: calc(2ch + var(--space-wide) + var(--space-2)); max-width: none; color: transparent; font-size: var(--text-caption); opacity: 0; }
.language-control-compact:has(.lang-toggle:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }
.language-control-compact option { color: var(--ink); background: var(--surface); }
@media (hover: hover) { .language-control-compact:has(.lang-toggle:hover) { background: var(--lavender); } }
@media (max-width: 640px) {
  .header-tools .language-control-compact .language-code { display: none; }
  #header-menu .language-control-compact .lang-toggle { opacity: 1; }
}
.language-control[data-open] { background: var(--lavender); color: var(--purple); }
.language-control[data-open]::after { transform: translateY(-50%) rotate(180deg); }
.language-menu { position: fixed; inset: auto; outline: none; width: min(200px, calc(100vw - var(--space-wide))); /* design-geometry: six full language names without clipping. */ max-height: 320px; margin: 0; padding: var(--space-2); overflow-y: auto; overscroll-behavior: contain; list-style: none; border: 1px solid var(--border); border-radius: var(--radius-surface); background: var(--surface); color: var(--ink); box-shadow: var(--shadow-popover); font-family: var(--font-ui); font-size: var(--text-small); line-height: var(--leading-label); }
.language-menu[data-keyboard=true]:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.language-menu [role=option] { display: flex; align-items: center; justify-content: space-between; min-height: var(--control-min); gap: var(--space-3); padding: var(--space-2) var(--space-3); border-radius: var(--radius-small); cursor: pointer; }
.language-menu [aria-selected=true] { color: var(--purple); font-weight: var(--weight-strong); }
.language-menu [aria-selected=true]::after { content: ''; flex-shrink: 0; width: var(--space-4); height: var(--space-4); background: currentColor; mask: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="none" stroke="black" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" d="m5 12 4 4L19 6"/></svg>') center / contain no-repeat; }
.language-menu .is-active { background: var(--lavender); }
@media (hover: hover) { .language-menu [role=option]:hover { background: var(--lavender); } }
.idle-region { text-align: center; }
.idle-region h1 { font-size: var(--text-display); margin: var(--space-4) 0 var(--space-5); text-wrap: balance; }
.idle-region h1::first-line { color: var(--ink); }
.composer-region { margin-top: var(--space-section); }
.idle-stage .composer-region { margin-top: 0; }
#composer-text { padding-right: 38px /* design-geometry: alignment, reserved icon space or optical scale. */; }
body[data-docked=false] #composer-text,
.composer:not(.clarification-composer) #composer-text { height: 3lh; min-height: 3lh; }
.voice-dock { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); margin-top: var(--space-2); }
.voice-dock > .dock-slot:has(#new-question) { margin-left: auto; }
.clarify-screen h1 { margin: 0 0 var(--space-5); }
.priority-grid { margin-bottom: var(--space-section); }
.priority-card { width: 100%; text-align: left; padding-right: var(--space-4); }
.priority-card:has(input:checked) { padding-right: calc(var(--space-4) - 1px) /* design-geometry: alignment, reserved icon space or optical scale. */; }
.priority-card > svg { margin-left: auto; flex-shrink: 0; }
.priority-card input { position: static; opacity: 1; width: 20px; height: 20px; margin: 0; accent-color: var(--purple); }
.answer-form > .primary { margin: 0 0 var(--space-2); }
.answer-form.input-panel .primary { margin: 0; }
.answer-number { display: flex; align-items: center; gap: var(--space-3); padding-right: 38px /* design-geometry: alignment, reserved icon space or optical scale. */; }
.answer-number input { min-width: 0; width: 100%; min-height: 76px; border: 0; background: transparent; color: var(--ink); font-size: var(--text-2xl); }
.answer-number input:focus { outline: none; }
.answer-number span { color: var(--muted); }
.voice-button { min-width: 102px; height: var(--control-prominent); }
.voice-button[aria-pressed='true'] > svg { transform: none !important; }
.clarification-composer:not(.is-expanded) .voice-button { min-width: 102px; }
#mic.is-recording { background: var(--coral); }
#voice-message,#reply-voice-message { margin-bottom: 0; }
.decision-score { float: right; margin-left: var(--space-3); font-size: var(--text-2xl); font-weight: var(--weight-strong); line-height: .8 /* design-geometry: alignment, reserved icon space or optical scale. */; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.decision-score.is-net { font-size: var(--text-body); line-height: var(--leading-heading); letter-spacing: -.02em; }
.option-label:has(.is-net) { display: flex; justify-content: flex-end; min-height: 1.5em; }
.detail-toggle svg { display: block; width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.option-details[open] > summary .detail-plus-stem { display: none; }
.insight ul { padding-left: var(--space-4); margin: 0; font-size: var(--text-small); }
.next-action strong > svg { width: 20px; height: 20px; }
.preference-note,.decision-caution,.stale-label,.save-status { color: var(--muted); font-size: var(--text-note); margin: var(--space-3) 0; }
.prov-region { margin-top: var(--space-4); }
.prov-section { min-width: 0; }
.prov-heading { font-size: var(--text-small); margin: 0; }
.prov-toggle { display: grid; grid-template-columns: minmax(0,1fr) 18px; align-items: center; gap: var(--space-1) var(--space-3); padding: var(--space-3) var(--space-4); width: 100%; border: 1px solid var(--border); border-radius: var(--radius-surface); background: var(--surface); text-align: left; color: var(--muted); font-size: var(--text-caption); font-weight: var(--weight-regular); }
.prov-title { min-width: 0; overflow-wrap: anywhere; }
.prov-toggle:has(.prov-meta) .prov-title { font-size: var(--text-note); }
.prov-toggle > svg { grid-column: 2; grid-row: 1; width: 18px; height: 18px; justify-self: end; }
.prov-toggle:has(.prov-meta) > svg { grid-row: 1 / span 2; }
.prov-toggle[aria-expanded='true'] > svg { transform: rotate(180deg); }
.prov-meta { grid-column: 1; grid-row: 2; min-width: 0; color: var(--ink); font-size: var(--text-body-small); font-weight: var(--weight-strong); line-height: var(--leading-label); overflow-wrap: anywhere; }
.prov-body { padding: var(--space-3) 0; overflow-wrap: anywhere; font-size: var(--text-small); }
.prov-body h3 { margin: var(--space-3) 0 var(--space-compact); font-size: var(--text-small); }
.source-links { display: grid; gap: var(--space-3); }
.source-link { display: grid; grid-template-columns: minmax(0,1fr) 18px; align-items: start; gap: var(--space-3); text-decoration: none; }
.source-link-copy { display: grid; gap: var(--space-1); min-width: 0; }
.source-link-title { text-decoration: underline; text-underline-offset: .16em; overflow-wrap: anywhere; }
.source-link-domain { color: var(--muted); font-size: var(--text-note); overflow-wrap: anywhere; }
.source-link > svg { width: 18px; height: 18px; }
.thread { list-style: none; padding: 0; display: grid; gap: var(--space-3); }
.turn { display: flex; gap: var(--space-2); align-items: start; }
.turn-body { flex: 1; min-width: 0; }
.turn-label,.turn-state { font-size: var(--text-note); color: var(--muted); }
.turn-text { white-space: pre-wrap; font-size: var(--text-small); }
.turn-asked { border-left: 2px solid var(--purple); padding-left: var(--space-3); }
.turn.is-pending { opacity: .8; }
.turn.is-removed { text-decoration: line-through; }
.turn-action { flex-shrink: 0; }
.ha-button,.ha-icon-button { display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2); min-height: var(--control-min); border-radius: var(--radius-control); padding: var(--control-padding-block) var(--control-padding-inline); background: var(--lavender); color: var(--ink); font-size: var(--text-small); text-decoration: none; }
.ha-button svg,.ha-icon-button svg { width: 20px; height: 20px; flex-shrink: 0; }
.ha-icon-button { width: var(--control-min); padding: var(--space-2); }
.ha-button--primary { background: var(--purple); color: var(--on-accent); }
.ha-button--quiet { background: transparent; color: var(--muted); }
:root[data-theme='dark'] .ha-button--primary { color: var(--on-accent); }
.ha-button[aria-pressed='true'] { color: var(--purple); background: var(--lavender); }
.ha-button[aria-pressed='true']:not(:focus-visible) { outline: 1px solid var(--purple); outline-offset: -1px; }
@media (hover:hover) {
 .ha-button:hover:not(:disabled),.ha-icon-button:hover:not(:disabled) { background: var(--lavender); color: var(--purple); }
 .ha-button--primary:hover:not(:disabled) { background: var(--purple-hover); color: var(--on-accent); }
 .ha-button--quiet:hover:not(:disabled) { background: transparent; color: var(--purple); }
 :root[data-theme='dark'] .ha-button--primary:hover:not(:disabled) { color: var(--on-accent); }
 .voice-button:active { transform: none; }
}
/* Destructive actions stay distinct from feedback, refinement and the vocal accent. */
.ha-button.danger-button,.ha-icon-button.danger-button { background: var(--danger-soft); color: var(--danger); }
.ha-icon-button.danger-button { align-self: center; }
.history-confirm { border-left: 3px solid var(--danger); padding-left: var(--space-3); }
@media (hover:hover) { .ha-button.danger-button:hover:not(:disabled),.ha-icon-button.danger-button:hover:not(:disabled) { background: color-mix(in srgb,var(--danger) 18%,var(--surface)); color: var(--danger); } }
.decision-feedback { min-width: 0; width: 100%; text-align: left; }
.feedback-prompt { display: flex; align-items: center; gap: var(--space-3); white-space: nowrap; }
.decision-feedback h3 { margin: 0; font-size: var(--text-small); font-weight: var(--weight-strong); }
.feedback-actions { display: flex; gap: var(--space-2); }
@media (max-width: 640px) {
  .feedback-prompt, .feedback-actions { gap: var(--space-2); }
  .feedback-actions .ha-button { min-width: var(--control-min); gap: var(--space-1); padding-inline: var(--space-3); }
}
@media (max-width: 380px) {
  .feedback-prompt, .feedback-actions { gap: var(--space-1); }
  .feedback-actions .ha-button { padding-inline: var(--space-2); }
  .feedback-actions .ha-button svg { width: 16px; height: 16px; }
}
[popover] { opacity: 0; transform: translateY(4px); transition: opacity var(--motion-overlay) ease-out, transform var(--motion-overlay) ease-out, display var(--motion-overlay) allow-discrete, overlay var(--motion-overlay) allow-discrete; }
[popover]:popover-open { opacity: 1; transform: none; }
@starting-style { [popover]:popover-open { opacity: 0; transform: translateY(4px); } }
.feedback-popover { position: fixed; inset: auto; margin: 0; width: min(320px, calc(100vw - var(--space-wide))); padding: var(--space-2); overflow-y: auto; overscroll-behavior: contain; border: 1px solid var(--border); border-radius: var(--radius-surface); background: var(--surface); color: var(--ink); box-shadow: var(--shadow-popover); font-family: var(--font-ui); opacity: 0; transform: translateY(var(--feedback-enter-y, 6px)) scale(.97); transition: opacity var(--motion-fast) ease-out, transform var(--motion-feedback) ease-out, display var(--motion-feedback) allow-discrete, overlay var(--motion-feedback) allow-discrete; }
.feedback-popover:popover-open { opacity: 1; transform: none; }
@starting-style { .feedback-popover:popover-open { opacity: 0; transform: translateY(var(--feedback-enter-y, 6px)) scale(.97); } }
.feedback-popover-heading { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); padding-left: var(--space-2); }
.feedback-popover-heading h3 { margin: 0; font-size: var(--text-small); font-weight: var(--weight-strong); }
.feedback-reason-list { display: grid; }
.feedback-reason { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); min-height: var(--control-min); padding: var(--space-2); border-radius: var(--radius-small); background: transparent; color: var(--ink); font-size: var(--text-small); font-weight: var(--weight-regular); text-align: left; }
.feedback-reason > span { min-width: 0; overflow-wrap: anywhere; }
.feedback-reason > svg { flex-shrink: 0; width: 18px; height: 18px; opacity: 0; }
.feedback-reason[aria-pressed=true] { background: var(--lavender); color: var(--purple); }
.feedback-reason[aria-pressed=true] > svg { opacity: 1; }
.feedback-reason:focus-visible { outline-offset: -3px; }
.feedback-actions .ha-button { transition: background var(--motion-fast), border-color var(--motion-fast), color var(--motion-fast), transform var(--motion-feedback) ease-out; }
.feedback-actions .ha-button[aria-pressed=true] > svg { animation: feedback-vote-in var(--motion-feedback) ease-out; }
@keyframes feedback-vote-in { from { transform: scale(.8) rotate(-8deg); } to { transform: none; } }
@media (prefers-reduced-motion: reduce) { .feedback-popover, .feedback-actions .ha-button { transition: none; } .feedback-actions .ha-button[aria-pressed=true] > svg { animation: none; } }
@media (hover:hover) { .feedback-reason:hover { background: var(--lavender); color: var(--purple); } }
.feedback-status, .decision-feedback [role='status'] { contain: inline-size; overflow-wrap: anywhere; font-size: var(--text-status); color: var(--muted); margin: var(--space-2) 0; }
.feedback-status:empty { margin: 0; }
.journey-region { margin-top: var(--space-2); border-top: 1px solid var(--border); }

.journey-toggle { display: flex; align-items: center; gap: var(--space-2); width: 100%; min-height: var(--control-min); padding: var(--space-2) 0; border-radius: var(--radius-control); background: transparent; color: var(--ink); font-size: var(--text-small); font-weight: var(--weight-regular); text-align: left; }
.journey-title { flex: 1; min-width: 0; }
.journey-symbol { display: grid; place-items: center; flex: 0 0 18px; color: var(--purple); }
.journey-symbol svg { width: 18px; height: 18px; }
.journey-toggle:active:not(:disabled) { transform: none; }
.journey-toggle > svg { width: 18px; height: 18px; transition: transform var(--motion-theme) ease; }
.journey-toggle[aria-expanded=true] > svg { transform: rotate(180deg); }
.journey-body { padding: var(--space-3) 0 0; }
.journey-panel { padding: var(--space-section); border: 1px solid var(--border); border-radius: var(--radius-surface); background: color-mix(in srgb,var(--lavender) 40%,var(--surface)); }
.journey-track { list-style: none; padding: 0; margin: 0; }
.journey-step { position: relative; display: grid; grid-template-columns: 32px minmax(0,1fr); gap: var(--space-3); padding-bottom: var(--space-section); }
.journey-step:not(:last-child)::before { content: ''; position: absolute; top: 38px; bottom: 6px; left: 15px; width: 2px; border-radius: var(--radius-tight); background: var(--border); }
.journey-step:last-child { padding-bottom: 0; }
.journey-badge { display: grid; place-items: center; width: 32px; height: 32px; border-radius: var(--radius-small); background: var(--lavender); color: var(--purple); font-size: var(--text-caption); font-weight: var(--weight-strong); }
.journey-badge svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.journey-start > .journey-badge { background: var(--coral); color: var(--coral-ink); }
.journey-understanding > .journey-badge { background: var(--mint); color: var(--mint-ink); }
.journey-content { min-width: 0; padding-top: var(--space-1); }
.journey-content h3 { margin: 0 0 var(--space-2); font-size: var(--text-caption); font-weight: var(--weight-strong); color: var(--muted); }
.journey-content p { white-space: pre-wrap; overflow-wrap: anywhere; line-height: var(--leading-reading); }
.journey-answer { margin-top: var(--space-2); padding: var(--space-3) var(--space-3); border-radius: var(--radius-tight) var(--radius-surface) var(--radius-surface) var(--radius-surface); background: var(--soft); }
.journey-label { display: block; margin-bottom: var(--space-1); font-size: var(--text-note); font-weight: var(--weight-strong); color: var(--purple); }

.journey-understanding h3 { color: var(--purple); }
.journey-content h4 { margin: var(--space-4) 0 var(--space-2); color: var(--muted); font-size: var(--text-note); font-weight: var(--weight-strong); }
.journey-criteria { display: flex; flex-wrap: wrap; gap: var(--space-compact); list-style: none; margin: 0; padding: 0; }
.journey-criteria li { padding: var(--space-1) var(--space-2); border-radius: var(--radius-small); background: var(--lavender); color: var(--purple); font-size: var(--text-note); }
.journey-assumptions { margin: 0; padding-left: var(--space-4); display: grid; gap: var(--space-compact); font-size: var(--text-caption); }
.journey-assumptions li::marker { color: var(--purple); }
@media(hover:hover) { button.journey-toggle:hover:not(:disabled) { color: var(--purple); transform: none; } }
@media(max-width:640px) { .journey-panel { padding: var(--space-4); } .journey-step { gap: var(--space-2); } }
.history-list { list-style: none; padding: 0; margin: 0; gap: var(--space-3); }
.history-item { display: flex; gap: var(--space-2); border: 1px solid var(--border); background: color-mix(in srgb,var(--soft) 35%,var(--surface)); border-radius: var(--radius-surface); padding: var(--space-3); transition: background-color var(--motion-fast), border-color var(--motion-fast); }
.history-item.is-current { border-color: color-mix(in srgb,var(--purple) 45%,var(--border)); }
.history-open { display: grid; align-content: start; gap: var(--space-compact); flex: 1; min-width: 0; text-align: left; background: transparent; border-radius: var(--radius-small); padding: var(--space-1) 0; }
.history-item:has(.history-open:focus-visible) { background: var(--lavender); }
@media (hover: hover) { .history-item:has(.history-open:hover:not(:disabled)) { background: var(--lavender); } }
.history-title { display: block; font-size: var(--text-small); font-weight: var(--weight-strong); line-height: var(--leading-body); overflow-wrap: anywhere; }
.history-open .history-title { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.history-meta { display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-3); color: var(--muted); font-size: var(--text-note); line-height: var(--leading-body); }
.history-status { font-weight: var(--weight-strong); }
.history-recommendation { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; color: var(--purple); font-size: var(--text-caption); line-height: var(--leading-body); overflow-wrap: anywhere; }
.history-delete.danger-button { align-self: flex-start; background: transparent; color: var(--muted); }
.history-delete.danger-button:focus-visible { background: var(--danger-soft); color: var(--danger); }
@media (hover: hover) { .history-delete.danger-button:hover:not(:disabled) { background: var(--danger-soft); color: var(--danger); } }
.history-notice { display: flex; align-items: center; gap: var(--space-3); margin-bottom: var(--space-section); }
.history-note { flex: 1; font-size: var(--text-caption); margin: 0; }
.history-notice > .ha-button { flex-shrink: 0; }
.history-actions,.dialog-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--space-section); }
.history-footer { flex-shrink: 0; padding: var(--space-3) var(--dialog-side) var(--dialog-bottom); background: var(--surface); }
.history-footer-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-2); }

.history-warning:empty { display: none; }
.history-confirm .history-actions { margin-top: 0; }

.history-warning { padding: var(--space-3); background: var(--soft); border-radius: var(--radius-control); }
.help-steps { padding-left: var(--space-section); font-size: var(--text-small); display: grid; gap: var(--space-3); }
.status-line { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-4) 0; color: var(--purple); }
.status-spinner { width: 18px; height: 18px; border: 2px solid var(--border); border-top-color: var(--purple); border-radius: var(--radius-circle); animation: spin 1s linear infinite; }
@keyframes spin { to {transform:rotate(360deg);} }
.error-heading { display: flex; gap: var(--space-3); align-items: flex-start; }
.error-heading > svg { width: 1em; height: calc(1em * var(--leading-detail)); flex-shrink: 0; }
.error-region { padding: var(--space-section) 0; }
.error-copy { font-size: var(--text-xl); line-height: var(--leading-detail); letter-spacing: -.015em; font-weight: var(--weight-regular); overflow-wrap: anywhere; }
.crisis-panel h1 { font-size: var(--text-3xl); line-height: var(--leading-heading); margin-bottom: var(--space-4); }
.crisis-panel p { font-size: var(--text-body); line-height: var(--leading-reading); }
.crisis-resources { display: grid; gap: var(--space-3); padding: 0; margin: var(--space-5) 0; list-style: none; }
.crisis-resources a { justify-content: flex-start; width: 100%; }
.crisis-resources p { color: var(--muted); font-size: var(--text-small); }
body[data-crisis=true] main { align-items: start; padding-block: var(--space-5); }
body[data-crisis=true] .app-footer { display: none; }
.error-actions { display: flex; gap: var(--space-2); flex-wrap: wrap; margin-top: var(--space-4); }
.error-region p { margin: var(--space-3) 0; }
.metrics-grid,.usage-details { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: var(--space-3); }
.metrics-grid > div,.usage-details > div { min-width: 0; }
.metrics-grid dt,.usage-details dt,.metric-label { font-size: var(--text-note); color: var(--muted); }
.metrics-grid dd,.usage-details dd { margin: 0; display: grid; gap: var(--space-1); }
.metric-value { display: block; font-size: var(--text-xl); color: var(--ink); }
.metric-note { display: block; color: var(--muted); font-size: var(--text-note); }
.cost-table-wrap { overflow-x: auto; }
.cost-table { width: 100%; font-size: var(--text-note); border-collapse: collapse; }
.cost-table th,.cost-table td { text-align: left; padding: var(--space-2); border-bottom: 1px solid var(--border); }
.usage-balance { display: flex; gap: var(--space-2); align-items: baseline; margin: var(--space-3) 0 var(--space-section); }
.usage-balance strong { font-size: var(--text-dialog-title); }
.usage-countdown { display: block; font-size: var(--text-xl); }
.usage-details time,.usage-details span { display: block; color: var(--muted); font-size: var(--text-caption); }
/* Documentation is the wide, navigable variant of the public information family.
   Geometry: 216px navigation rail, 760px reading column; shared theme/control tokens. */
.information-page.documentation-page main { max-width: none; }
.doc-layout { display: grid; grid-template-columns: 216px minmax(0, 1fr); gap: calc(var(--space-wide) * 2); align-items: start; }
.doc-content { min-width: 0; max-width: 820px; }
.information-page .doc-toc { position: sticky; top: 112px; display: flex; flex-direction: column; flex-wrap: nowrap; gap: var(--space-1); margin: 0; padding-right: var(--space-5); border-right: 1px solid var(--border); max-height: calc(100dvh - 136px); overflow-y: auto; }
.information-page .doc-toc p { color: var(--muted); font-size: var(--text-note); font-weight: var(--weight-strong); margin: 0 0 var(--space-3); line-height: var(--leading-label); }
.doc-toc a { display: flex; align-items: center; min-height: var(--control-min); padding: var(--space-2) var(--space-3); border-radius: var(--radius-small); text-decoration: none; color: var(--muted); line-height: var(--leading-label); font-size: var(--text-small); }
.doc-toc a[aria-current='location'] { background: var(--lavender); color: var(--purple); font-weight: var(--weight-strong); }
.doc-intro { display: flex; flex-direction: column; padding: var(--space-2) 0 var(--space-wide); }
.documentation-page .doc-intro h1 { margin: 0 0 var(--space-section); font-size: var(--text-display); line-height: var(--leading-heading); letter-spacing: -.035em; }
.documentation-page .doc-intro .doc-eyebrow { order: -1; color: var(--purple); font-size: var(--text-small); font-weight: var(--weight-strong); margin-bottom: var(--space-3); }
.documentation-page .doc-intro > p:not(.doc-eyebrow) { font-size: var(--text-lead); color: var(--muted); line-height: var(--leading-reading); margin-bottom: var(--space-5); }
.doc-meta { display: flex; flex-wrap: wrap; gap: var(--space-3) var(--space-section); font-size: var(--text-caption); color: var(--muted); }
.doc-meta a { color: var(--purple); text-underline-offset: var(--space-1); }
.doc-access { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-3); }
.doc-access > div { position: relative; min-width: 0; padding: var(--space-section); border: 1px solid var(--border); border-radius: var(--radius-surface); background: var(--surface); text-decoration: none; }
.documentation-page .doc-access h2 { display: flex; justify-content: space-between; gap: var(--space-2); margin: 0 0 var(--space-3); font-size: var(--text-body); }
.doc-access h2 span { color: var(--purple); }
.doc-access h2 a { display: flex; justify-content: space-between; gap: var(--space-2); width: 100%; text-decoration: none; }
/* Extend the native heading link without wrapping block content in Markdown. */
.doc-access h2 a::after { content: ''; position: absolute; inset: 0; border-radius: var(--radius-surface); outline: inherit; outline-offset: inherit; }
.doc-access h2 a:focus-visible { outline-color: transparent; }
.doc-access h2 a:focus-visible::after { outline-color: var(--focus); }
.documentation-page .doc-access p { margin: 0; color: var(--muted); font-size: var(--text-small); line-height: var(--leading-detail); }
.doc-section { scroll-margin-top: 0; padding-top: calc(var(--space-wide) * 2); }
.documentation-page .doc-section > h2 { margin: 0 0 var(--space-5); padding-bottom: var(--space-4); border-bottom: 1px solid var(--border); font-size: var(--text-2xl); letter-spacing: -.025em; }
.documentation-page .doc-section p { line-height: var(--leading-reading); }
.doc-section h3 { font-size: var(--text-lead); line-height: var(--leading-label); margin: 0 0 var(--space-3); }
.doc-content { color: var(--ink); font-family: var(--font-ui); font-size: var(--text-body); font-weight: var(--weight-regular); line-height: var(--leading-reading); }
.doc-content strong, .doc-content h1, .doc-content h2, .doc-content h3, .doc-content h4, .doc-content h5 { font-weight: var(--weight-strong); }
.doc-content pre { color: var(--ink); font-family: var(--font-code); font-weight: var(--weight-regular); line-height: var(--leading-detail); }
.doc-content code { font-family: var(--font-code); font-size: var(--text-small); overflow-wrap: anywhere; }
.doc-content p code { color: var(--purple); }
.doc-content .copy-box { background: var(--surface); }
.doc-content .copy-box pre { font-size: var(--text-small); }
.doc-content pre code { font-size: inherit; overflow-wrap: normal; }
.doc-clients { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 var(--space-5); }
.doc-clients .help-model { min-width: 0; align-self: start; }
.doc-tool, .doc-operation { padding-block: var(--space-5); scroll-margin-top: var(--space-3); }
.doc-tool + .doc-tool, .doc-operation + .doc-operation { border-top: 1px solid var(--border); }
.doc-tool:first-of-type, .doc-operation:first-of-type { padding-top: 0; }
.doc-tool-heading { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: var(--space-2); margin-bottom: var(--space-3); }
.doc-tool-heading h3 { margin: 0; font-family: var(--font-code); font-size: var(--text-lead); }
.doc-tool-heading a { color: var(--ink); text-decoration: none; overflow-wrap: anywhere; }
.doc-tag { display: inline-block; padding: var(--space-half) var(--space-2); border-radius: var(--radius-tight); background: var(--soft); color: var(--muted); font-size: var(--text-note); font-weight: var(--weight-regular); white-space: nowrap; }
.doc-tool-params, .doc-fields { list-style: none; padding: 0; margin: var(--space-section) 0; }
.documentation-page .doc-tool-params li { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr) minmax(0, 1.2fr); gap: var(--space-3); margin: 0; padding-block: var(--space-3); border-bottom: 1px solid var(--border); font-size: var(--text-caption); line-height: var(--leading-label); }
.doc-tool-params li > :first-child { color: var(--purple); }
.doc-tool-params li > :not(:first-child) { color: var(--muted); font-size: var(--text-caption); }
.doc-tool-return { color: var(--muted); font-size: var(--text-small); }
.doc-endpoint.help-model { padding: 0; border: 1px solid var(--border); border-radius: var(--radius-small); background: var(--surface); }
.doc-endpoint > summary.doc-route { display: flex; align-items: center; gap: var(--space-3); margin: 0; padding: var(--space-3) var(--space-4); border-radius: var(--radius-small); background: var(--soft); min-height: var(--control-min); }
.doc-route > code { flex: 1; min-width: 0; color: var(--ink); font-weight: var(--weight-regular); }
.doc-method, .doc-http-status { color: var(--purple); font-size: var(--text-note); font-weight: var(--weight-strong); }
.doc-endpoint > .doc-endpoint-body { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-5); margin: 0; padding: var(--space-5); }
.doc-io { min-width: 0; }
.doc-io + .doc-io { border-top: 1px solid var(--border); padding-top: var(--space-5); }
.doc-io h4 { margin: 0 0 var(--space-5); font-size: var(--text-lead); }
.doc-io h5 { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--space-2); margin: var(--space-5) 0 var(--space-3); color: var(--muted); font-size: var(--text-small); font-weight: var(--weight-strong); }
.doc-io h5:first-of-type { margin-top: 0; }
.doc-schema-fields { list-style: none; margin: 0 0 var(--space-4); padding: 0; }
.documentation-page .doc-schema-fields > li { margin: 0; padding-block: var(--space-4); line-height: var(--leading-label); }
.doc-schema-heading { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--space-2); }
.doc-schema-heading > code:first-child { color: var(--ink); font-size: var(--text-body-small); font-weight: var(--weight-strong); }
.doc-schema-meta, .doc-schema-meta code, .doc-content .doc-schema-model { color: var(--muted); font-size: var(--text-caption); font-weight: var(--weight-regular); }
.documentation-page .doc-schema-description { margin: var(--space-2) 0 0; color: var(--ink); font-size: var(--text-small); line-height: var(--leading-detail); }
.documentation-page .doc-schema-limits { margin: var(--space-1) 0 0; color: var(--muted); font-size: var(--text-caption); line-height: var(--leading-detail); }
.doc-content .doc-schema-limits code { color: inherit; font-size: inherit; }
.doc-content .doc-schema-format code { color: var(--muted); font-size: var(--text-caption); }
.doc-schema-fields .doc-schema-details { margin-top: var(--space-2); border-top: 0; padding-bottom: 0; }
.doc-schema-details .doc-schema-fields { padding-left: var(--space-3); border-left: 1px solid var(--border); }
.doc-schema-details > summary { gap: var(--space-2); }
.doc-schema-details > summary > :first-child { flex: 1; min-width: 0; }
.doc-schema-details > summary > code { font-weight: var(--weight-regular); }
.doc-schema-format > summary { color: var(--muted); font-size: var(--text-caption); font-weight: var(--weight-regular); }
.doc-content .copy-box-code pre, .doc-content .copy-box-code pre code { white-space: pre-wrap; overflow-wrap: anywhere; }
.doc-content .copy-box-code pre code { color: var(--syntax-text); font-weight: var(--weight-regular); }
.syntax-plain { color: var(--syntax-text); }
.syntax-keyword { color: var(--syntax-keyword); font-weight: var(--weight-strong); }
.syntax-name, .syntax-function { color: var(--syntax-name); font-weight: var(--weight-strong); }
.syntax-string { color: var(--syntax-string); }
.syntax-number { color: var(--syntax-number); }
.syntax-comment { color: var(--syntax-comment); }
.syntax-operator { color: var(--syntax-operator); }
.syntax-error { color: var(--syntax-error); }
.doc-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-5); }
.documentation-page .doc-fields > li { margin: 0; padding-bottom: var(--space-section); border-bottom: 1px solid var(--border); }
.doc-fields > li > div { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--space-2); margin-bottom: var(--space-2); }
.documentation-page .doc-fields p { margin-bottom: var(--space-2); font-size: var(--text-small); }
.doc-field-contract { color: var(--muted); }
.doc-response { margin-bottom: var(--space-5); }
.documentation-page .doc-response-fields { color: var(--muted); font-size: var(--text-caption); }
.doc-steps { padding-left: var(--space-5); }
.doc-steps li::marker { color: var(--purple); font-weight: var(--weight-strong); }
.doc-error-codes { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-bottom: var(--space-section); }
.doc-error-codes a { padding: var(--space-2) var(--space-3); background: var(--soft); border-radius: var(--radius-small); text-decoration: none; }
.doc-callout { border-left: 3px solid var(--purple); padding: var(--space-3) var(--space-section); background: var(--lavender); border-radius: 0 var(--radius-small) var(--radius-small) 0; }
.documentation-page .doc-callout p { margin: 0; font-size: var(--text-small); }
.documentation-page article > p, .documentation-page article > nav { margin-left: calc(216px + var(--space-wide) * 2) /* design-geometry: footer aligned to documentation reading column. */; }
.documentation-page article > p { margin-top: var(--space-wide); }
@media (hover: hover) {
  .doc-toc a:hover, .doc-tool-heading a:hover { color: var(--purple); }
  .doc-access > div:hover { border-color: var(--purple); }
}
@media (max-width: 1000px) {
  .doc-layout { grid-template-columns: 180px minmax(0, 1fr); gap: var(--space-wide); }
  .doc-clients, .doc-access { grid-template-columns: 1fr; }
  .doc-access > div { padding: var(--space-4); }
  .documentation-page article > p, .documentation-page article > nav { margin-left: calc(180px + var(--space-wide)) /* design-geometry: footer aligned to compact documentation rail. */; }
}
@media (max-width: 760px) {
  .documentation-page main { margin-top: var(--space-4); }
  .doc-layout { display: flex; flex-direction: column; gap: var(--space-wide); }
  .information-page .doc-toc { position: static; flex-direction: row; width: 100%; max-height: none; overflow-x: auto; padding: 0 0 var(--space-2); border-right: 0; border-bottom: 1px solid var(--border); }
  .doc-toc > p { display: none; }
  .doc-toc a { flex-shrink: 0; }
  .doc-content { width: 100%; }
  .documentation-page .doc-intro h1 { font-size: var(--text-page-title); }
  .doc-section { padding-top: calc(var(--space-5) * 2); }
  .doc-fields { grid-template-columns: 1fr; gap: var(--space-4); }
  .documentation-page .doc-tool-params li { grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); }
  .doc-tool-params li > span { grid-column: 1 / -1; }
  .doc-tool-heading h3 { font-size: var(--text-body); }
  .documentation-page article > p, .documentation-page article > nav { margin-left: 0; }
}

.information-page main { display: block; min-width: 0; width: 100%; max-width: 760px; margin: var(--space-wide) auto; padding: 0 0 40px /* design-geometry: alignment, reserved icon space or optical scale. */; }
.information-page h1 { margin-bottom: var(--space-5); font-size: var(--text-page-title); overflow-wrap: anywhere; hyphens: auto; }
.information-page h2 { margin: var(--space-wide) 0 var(--space-4); font-size: var(--text-2xl); }
.information-page article p,.information-page article li { margin: 0 0 var(--space-4); line-height: var(--leading-editorial); overflow-wrap: anywhere; }
.information-page .contact-number { white-space: nowrap; }
.information-page pre { max-width: 100%; overflow-x: auto; padding: var(--space-4); margin: 0 0 var(--space-4); background: var(--lavender); border-radius: var(--radius-small); font-size: var(--text-note); line-height: var(--leading-reading); }
.copy-box { min-width: 0; max-width: 100%; margin: 0 0 var(--space-4); padding: var(--space-3) var(--space-4) var(--space-4); border: 1px solid var(--border); border-radius: var(--radius-small); background: var(--lavender); }
.copy-box-heading { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); min-height: var(--control-min); margin-bottom: var(--space-2); color: var(--muted); font-size: var(--text-note); line-height: var(--leading-label); }
.copy-box-heading > span { min-width: 0; overflow-wrap: anywhere; }
.copy-button { display: inline-flex; align-items: center; justify-content: center; gap: var(--space-compact); flex-shrink: 0; min-height: var(--control-min); padding: var(--space-2); border-radius: var(--radius-control); background: transparent; color: var(--purple); font-size: var(--text-note); }
.copy-button svg { width: 18px; height: 18px; flex-shrink: 0; }
.information-page .copy-box pre { margin: 0; padding: 0; background: transparent; border-radius: 0; }
.copy-box-value pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.copy-status:not(.sr-only) { display: block; margin-top: var(--space-3); color: var(--muted); font-size: var(--text-note); }
@media (max-width: 640px) {
  .copy-button { width: var(--control-min); }
  .copy-button > span { display: none; }
}
@media (hover: hover) { .copy-button:hover:not(:disabled) { background: var(--surface); } }
.information-page nav { display: flex; flex-wrap: wrap; gap: var(--space-3); margin-top: var(--space-wide); font-size: var(--text-small); }

@media (max-width:640px) { .idle-region h1 { font-size: var(--text-page-title); } .header-actions { gap:0; } .lang-toggle { width:76px; font-size: var(--text-note); } .brand { font-size: var(--text-brand); } .voice-button { min-width:94px; } .header .history-button { width:40px; } }
@media (max-width:360px) { .idle-region h1 { font-size: var(--text-4xl); } .brand { font-size: var(--text-brand); gap:var(--space-half); } .brand img { width:24px; height:24px; } .lang-toggle { width:76px; } .header .icon-button,.help-button { width:40px; } .header { gap:var(--space-1); } }
@media (forced-colors: active) { button,input,select,textarea,.input-panel,.option-card { border:1px solid ButtonText; } .voice-wave { display:none; } }
@media (forced-colors: active) { .lang-toggle { appearance: auto; padding-right: var(--space-2); } .language-control::after { display: none; } }
.idle-region h1 span { color:var(--purple); }
.back-button > svg { rotate:180deg; }
.input-panel:focus-within:has(.voice-button:focus):not(:has(textarea:focus)) { outline:none; }
.composer-region:has(#composer[hidden]) { margin-top:0; }
.clarification-composer:not(.is-expanded) textarea { padding-right:0; }
@media(max-width:640px) { .result-stage .voice-dock > .dock-slot:has(#new-question),.result-stage #new-question {width:100%;} .header .icon-button,.help-button {width:var(--control-min);} .header .history-button {width:auto;} }

.header { min-height:64px; height:auto; padding-block:var(--space-2); flex-wrap:wrap; }
@media(min-width:641px){.header{--header-fade-start:16px;min-height:88px;padding-block:var(--space-4);}}
@media(max-width:640px){
 .header{flex-wrap:nowrap;}
 body[data-docked=true]:not(.information-page) .shell > main{padding-top:var(--space-2);}
 .clarify-screen .question-context{margin-bottom:var(--space-3);}
}
.priority-card:active { background:var(--lavender); transform:translateY(1px); }
@media(prefers-reduced-motion:reduce) { .priority-card:active {transform:none;} }
button:active:not(:disabled),.priority-card:active { filter:brightness(.94); }
.voice-button:active {transform:none;}
.status-line { min-height:calc(4.5em + 2rem); }


.preference-status { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: var(--space-3); max-width: 600px; margin: 0 auto; padding: var(--space-3) 0; color: var(--muted); font-size: var(--text-small); }
.not-found-page .shell > main { display: grid; place-items: center; padding-block: 40px /* design-geometry: alignment, reserved icon space or optical scale. */; }
.not-found { max-width: 480px; text-align: center; }
.not-found-mascot { display: block; width: 104px; height: 104px; margin: 0 auto var(--space-5); object-fit: contain; }
.not-found-code { color: var(--purple); font-size: var(--text-caption); font-weight: var(--weight-strong); }
.not-found h1 { margin-bottom: var(--space-4); text-wrap: balance; }
.not-found .ha-button { margin-top: var(--space-4); }
#feedback-status:focus-visible { outline: 3px solid var(--focus); outline-offset: 4px; border-radius: var(--radius-control); }
@media (prefers-reduced-motion: no-preference) {
 button:active:not(:disabled):not(.voice-button):not(.journey-toggle):not(.mascot-trigger):not(.priority-card) { transform: translateY(1px); }
}
/* Brand proportions are optical; component text uses the shared type scale. */
@media (max-width: 640px) { :root { --text-brand: 1.625rem; } }
@media (max-width: 360px) { :root { --text-brand: 1.5rem; } }

/* Form groups have a wider rhythm than each label, field and hint. */
.dialog-field { display: grid; gap: var(--space-2); min-width: 0; }
.dialog-form-label { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--space-1) var(--space-compact); font-size: var(--text-small); font-weight: var(--weight-strong); line-height: var(--leading-label); }
.dialog-field-optional { color: var(--muted); font-size: var(--text-caption); font-weight: var(--weight-regular); }
.user-feedback-fields { display: grid; gap: var(--space-section); }
.newsletter-fields input, .user-feedback-fields input, .user-feedback-fields textarea { width: 100%; min-width: 0; min-height: var(--control-prominent); font: inherit; }
/* One field surface and focus treatment across every dialog form. */
#edit-text, .newsletter-fields input, .user-feedback-fields input, .user-feedback-fields textarea { padding: var(--space-3); border: 1px solid var(--floating-border); border-radius: var(--radius-control); background: var(--surface); color: var(--ink); transition: border-color var(--motion-fast); }
#edit-text:focus, .newsletter-fields input:focus, .user-feedback-fields input:focus, .user-feedback-fields textarea:focus { border-color: var(--purple); outline: 2px solid var(--purple); outline-offset: 3px; }
@media (hover: hover) {
  #edit-text:hover:not(:focus), .newsletter-fields input:hover:not(:focus), .user-feedback-fields input:hover:not(:focus), .user-feedback-fields textarea:hover:not(:focus) { border-color: color-mix(in srgb,var(--purple) 45%,var(--border)); }
}
#newsletter-note, .newsletter-status { font-size: var(--text-status); line-height: var(--leading-body); }
#newsletter-text { margin-bottom: var(--space-section); }
#newsletter-note, #user-feedback-note { margin: 0; color: var(--muted); font-size: var(--text-caption); line-height: var(--leading-body); }
.newsletter-status { margin: var(--space-3) 0 0; color: var(--purple); overflow-wrap: anywhere; }
.newsletter-status:empty { margin: 0; }
.error-copy .error-message,
.decision-feedback .feedback-status:not(.sr-only),
.save-status,
#newsletter-dialog:not(.newsletter-success) .newsletter-status,
.user-feedback-dialog:not(.user-feedback-success) .newsletter-status { color: color-mix(in srgb, var(--danger) 60%, var(--muted)); }

#newsletter-privacy, #user-feedback-privacy { margin-right: auto; }
.newsletter-success .newsletter-mascot { animation: newsletter-cheer var(--motion-theme) ease-out; transform: rotate(-8deg); }
@keyframes newsletter-cheer { from { transform: scale(.85) rotate(8deg); } to { transform: scale(1) rotate(-8deg); } }
@media (prefers-reduced-motion: reduce) { .newsletter-success .newsletter-mascot { animation: none; transform: none; } }



.user-feedback-menu { display: none; }
.response-heading { display: flex; align-items: flex-start; gap: var(--space-2); }
.response-heading > h1, .response-heading > .journey-question { flex: 1; min-width: 0; }
.response-actions { display: flex; justify-content: flex-end; }
.response-report { background: transparent; color: var(--ink); }
.response-report-label { display: inline-flex; align-items: center; justify-content: flex-start; gap: var(--space-compact); width: auto; max-width: 100%; min-height: var(--control-min); padding: 0; border-radius: var(--radius-control); font-size: var(--text-note); text-align: left; }
.response-report-label > svg { flex-shrink: 0; width: 16px; height: 16px; }
@media (hover:hover) { .response-report-label:hover:not(:disabled) { background: transparent; color: var(--purple); } }
.user-feedback-response { margin: 0; padding: var(--space-4); border-radius: var(--radius-surface); background: var(--soft); }
#user-feedback-attached { margin: 0 0 var(--space-2); font-size: var(--text-caption); line-height: var(--leading-body); }
.user-feedback-preview { -webkit-line-clamp: 2; margin: 0; font-size: var(--text-small); color: var(--muted); }
.user-feedback-expand { position: static; width: auto; gap: var(--space-1); font-size: var(--text-small); }
.user-feedback-success .user-feedback-mascot { animation: newsletter-cheer var(--motion-theme) ease-out; }
@media (prefers-reduced-motion: reduce) { .user-feedback-success .user-feedback-mascot { animation: none; } }

dialog > .dialog-form .dialog-body { padding-bottom: var(--space-2); }
