/* Bundled so the site reads the same on a machine without a Chinese face
   installed. Noto Sans SC's whole simplified-Chinese file per weight (about
   1.1MB each, 7333 Chinese characters plus Latin; from @fontsource/noto-sans-sc
   5.3.1, OFL), so text nobody can list in advance (an AI answer, a job name
   someone types) displays in it too. A few symbols it lacks (arrows, check
   marks, math signs) fall through to the system faces listed after it. To
   change the face, copy the package's files/noto-sans-sc-chinese-simplified-
   <weight>-normal.woff2 over these two. */
@font-face { font-family: "Noto Sans SC"; src: url("/fonts/NotoSansSC-Regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Noto Sans SC"; src: url("/fonts/NotoSansSC-Medium.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Sansation"; src: url("/fonts/Sansation-Regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }

:root {
  color-scheme: dark;
  --paper: #111212;
  --surface: #1b1c1c;
  --surface-2: #242525;
  --ink: #f1f1ee;
  --muted: #b2b4b3;
  --quiet: #969a99;
  --line: #363838;
  --strong-line: #474949;
  --blue: #e1e3e1;
  --blue-soft: rgba(241, 241, 238, .07);
  --button: #e7e7e3;
  --button-text: #161717;
  --success: #91c3a5;
  --pending: #d4bb75;
  --danger: #e39a94;
  --accent: #75cdca;
  --danger-soft: rgba(227, 154, 148, .09);
  --inverse-surface: #0d0e0e;
  --inverse-ink: #f1f1ee;
  --inverse-muted: #969999;
  --header: 88px;
  --sidebar: 240px;
  --panel-radius: 9px;
  --page-gutter: clamp(48px, 5vw, 96px);
  --display: "Sansation", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-family: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #111212;
    --surface: #1b1c1c;
    --surface-2: #242525;
    --ink: #f1f1ee;
    --muted: #b2b4b3;
    --quiet: #969a99;
    --line: #363838;
    --strong-line: #474949;
    --blue: #e1e3e1;
    --blue-soft: rgba(241, 241, 238, .07);
    --button: #e7e7e3;
    --button-text: #161717;
    --success: #91c3a5;
    --pending: #d4bb75;
    --danger: #e39a94;
    --accent: #75cdca;
    --danger-soft: rgba(227, 154, 148, .09);
    --inverse-surface: #0d0e0e;
    --inverse-ink: #f1f1ee;
    --inverse-muted: #969999;
  }
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--paper); color: var(--ink); scroll-behavior: smooth; }
body { margin: 0; overflow-x: hidden; background: var(--paper); letter-spacing: .01em; }
html:not([data-copy-state="ready"]) body > :not(#copy-bootstrap-error) { visibility: hidden; }
.copy-bootstrap-error { min-height: 100vh; padding: 48px; display: grid; place-items: center; color: var(--danger); font: 700 14px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .08em; }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; color: inherit; }
button { border-radius: 8px; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible {
  outline: 3px solid var(--accent); outline-offset: 3px;
}
[tabindex="-1"]:focus { outline: 0; }
[hidden] { display: none !important; }
.skip-link { position: fixed; z-index: 1000; top: 8px; left: 8px; padding: 12px 16px; transform: translateY(-160%); background: var(--ink); color: var(--paper); }
.skip-link:focus { transform: none; }

.site-header { position: sticky; z-index: 20; top: 0; min-height: var(--header); padding: 0; display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); align-items: stretch; border-bottom: 1px solid var(--line); background: rgba(17, 18, 18, .96); backdrop-filter: blur(14px); }
.brand { padding: 0 30px; display: flex; align-items: center; gap: 14px; min-height: 44px; border-right: 1px solid var(--line); }
.brand-mark { width: 32px; height: 35px; object-fit: contain; }
.brand-word { width: 146px; height: auto; }
/* Three tracks with the nav in the middle: the two outer tracks share the
   remaining width equally, so the nav stays at the same place whether the
   session links on the right are shown or not. */
.navigation-shell { min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: stretch; }
.primary-nav { grid-column: 2; display: flex; }
.session-navigation { grid-column: 3; justify-self: end; }
.primary-nav > a { position: relative; min-width: 118px; min-height: var(--header); padding: 0 20px; border: 0; display: grid; place-items: center; background: transparent; color: var(--muted); cursor: pointer; font-size: 14px; }
.primary-nav > a:hover, .primary-nav [aria-current="page"] { background: transparent; color: var(--ink); }
.primary-nav [aria-current="page"]::after { content: ""; position: absolute; inset: auto 28px 20px; height: 1px; background: var(--ink); }

/* Configuration pages (reference page 7): breadcrumb, a heading with the
   method tag, a main panel beside an aside of stacked panels, a bottom bar.
   Generic on purpose; every compute configuration page uses these. */
.config-page { padding-top: 28px; }
.config-heading { margin: 26px 0 30px; display: flex; align-items: start; justify-content: space-between; gap: 32px; }
.config-heading h1 { margin: 0; font-size: clamp(34px, 3.2vw, 48px); line-height: 1.12; font-weight: 600; letter-spacing: -.03em; }
.config-heading .lead { margin: 18px 0 8px; }
.config-method { padding-top: 12px; color: var(--muted); font: 18px/1.2 var(--display); letter-spacing: .04em; }
.config-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(300px, 1fr); gap: 24px; align-items: start; }
.config-aside { min-width: 0; display: grid; gap: 20px; align-content: start; }
.config-panel { min-width: 0; padding: clamp(20px, 2.2vw, 32px); border: 1px solid var(--strong-line); border-radius: var(--panel-radius); background: var(--surface); }
.config-panel h2 { margin: 0 0 22px; font-size: 20px; font-weight: 520; }
.config-caption { margin: 12px 0 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.config-wide { width: 100%; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px 24px; align-items: start; }
.divider { height: 1px; margin: 30px 0; background: var(--line); }
.upload-box { margin-bottom: 24px; padding: 16px 18px; display: grid; gap: 6px; border: 1px dashed var(--quiet); border-radius: 7px; background: var(--paper); }
.upload-box > strong { font-weight: 520; overflow-wrap: anywhere; }
.upload-meta { color: var(--muted); font-size: 12px; }
.upload-controls { margin: 0 0 8px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: end; }
.upload-box .field input[type="file"] { padding: 10px; font-size: 12px; }
.upload-help { color: var(--quiet); font-size: 11px; line-height: 1.55; }
.upload-box .field-error:empty { display: none; }
.config-page .segmented { margin-bottom: 18px; padding: 3px; display: inline-flex; gap: 3px; border: 1px solid var(--quiet); border-radius: 7px; }
.config-page .segmented button { padding: 9px 22px; border: 0; border-radius: 4px; background: transparent; color: var(--muted); font-size: 14px; cursor: pointer; }
.config-page .segmented button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.config-page details { margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--line); }
.config-page .field > span { font-weight: 400; line-height: 1.4; }
.config-page summary { cursor: pointer; color: var(--ink); font-size: 14px; }
.config-page details[open] > summary { margin-bottom: 22px; }
.config-page .check-field { min-height: 76px; padding: 12px 14px; align-items: start; border-color: var(--strong-line); border-radius: 7px; }
.config-page .check-field > span { display: grid; gap: 5px; }
.config-page .check-field strong { color: var(--ink); font-size: 12px; font-weight: 500; }
.config-page .check-field small { color: var(--quiet); font-size: 11px; line-height: 1.5; }
.config-page .check-field:has(input:disabled) { opacity: .55; }
.molecule-view { width: 100%; height: 220px; display: block; }
.molecule-viewport { position: relative; width: 100%; height: clamp(260px, 24vw, 330px); overflow: hidden; border: 1px solid #52676445; border-radius: 8px; background: radial-gradient(ellipse at 50% 42%, #29373655, #11191b30 75%); }
.molecule-viewport:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.molecule-canvas, .molecule-fallback, .molecule-labels { position: absolute; inset: 0; width: 100%; height: 100%; }
.molecule-fallback .molecule-view { height: 100%; }
.molecule-preview[data-renderer="webgl"] .molecule-fallback { display: none; }
.molecule-preview:not([data-renderer="webgl"]) .molecule-canvas, .molecule-preview:not([data-renderer="webgl"]) .molecule-labels { display: none; }
.molecule-preview[data-renderer="webgl"] .molecule-viewport { cursor: grab; }
.molecule-preview[data-renderer="webgl"] .molecule-viewport:active { cursor: grabbing; }
.molecule-labels { z-index: 1; pointer-events: none; overflow: hidden; }
.molecule-labels > span { position: absolute; left: 0; top: 0; color: #fff; font: 11px/1.2 var(--display); text-shadow: 0 1px 3px #000, 0 0 4px #000; }
.molecule-labels > span.selected { color: #b9f6df; font-weight: 700; }
.molecule-hint { margin: 12px 0; color: var(--quiet); font-size: 10px; line-height: 1.6; }
.molecule-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.molecule-toolbar label { flex: 1 1 160px; min-width: 0; }
.molecule-toolbar select { width: 100%; min-width: 0; min-height: 38px; padding: 6px 10px; border: 1px solid var(--strong-line); border-radius: 6px; background: var(--paper); font-size: 12px; }
.molecule-toolbar .button { min-width: 0; min-height: 38px; padding: 6px 12px; font-size: 12px; }
.molecule-legend { margin-top: 14px; display: flex; flex-wrap: wrap; gap: 10px 14px; font-size: 11px; color: var(--muted); }
.molecule-legend > span { display: inline-flex; align-items: center; gap: 6px; }
.molecule-legend > span::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--atom-color); }
.molecule-information { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); }
.molecule-information strong { color: var(--muted); font-size: 11px; font-weight: 400; }
.molecule-information p { margin: 8px 0 0; color: var(--ink); font: 12px/1.8 var(--display); overflow-wrap: anywhere; }
.checks { display: grid; gap: 10px; color: var(--accent); font-size: 13px; line-height: 1.55; }
.checks [data-ok="false"] { color: var(--danger); }
.config-result { color: var(--muted); font-size: 13px; line-height: 1.7; }
.config-result p { margin: 16px 0 0; }
.config-result[data-state="error"] p { color: var(--danger); }
.config-result .config-result-title { color: var(--accent); }
.config-facts { margin: 14px 0 0; display: grid; }
.config-facts div { padding: 9px 0; display: flex; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--line); }
.config-facts dt { flex: 0 0 auto; color: var(--muted); font-size: 12px; }
.config-facts dd { margin: 0; text-align: right; overflow-wrap: anywhere; font: 12px/1.5 ui-monospace, monospace; color: var(--ink); }
.source-note { color: var(--quiet); font-size: 11px; line-height: 1.6; }
.config-bottom { margin-top: 26px; padding-top: 26px; display: flex; align-items: center; justify-content: space-between; gap: 20px; border-top: 1px solid var(--line); }
.config-bottom .save-indicator { min-height: 0; padding: 0; border: 0; background: transparent; }


.form-grid > .config-wide { grid-column: 1 / -1; }
.config-formula { margin: -8px 0 10px; }
.config-caption + .form-grid { margin-top: 22px; }
.config-formula code { color: var(--muted); font: 13px/1.4 ui-monospace, monospace; }
.config-page .ticker-fieldset { margin: 0; }
.config-page .ticker-fieldset legend { padding: 0; font-weight: 400; }
.config-page .ticker-fieldset > p { margin-top: 8px; }
.config-page .config-facts { margin-top: 0; }
.config-page .config-result .config-facts { margin-top: 14px; }
.config-result .checks { margin-top: 14px; }
.config-aside .config-caption { margin-top: 14px; }
.config-page .save-indicator { min-width: 0; }

.frontier-cards.sqd-result-grid { grid-template-columns: minmax(350px, .78fr) minmax(0, 1.52fr); }
.result-panel.sqd-result-panel .result-intro { padding-block: clamp(28px, 3vw, 40px); }
.sqd-energy-summary { min-width: 0; padding: clamp(28px, 4vw, 48px); border-right: 1px solid var(--strong-line); background: var(--blue-soft); }
.sqd-primary-energy { margin: 34px 0 44px; display: grid; gap: 8px; }
.sqd-primary-energy strong { white-space: nowrap; font: 500 clamp(34px, 3.3vw, 44px)/1 ui-monospace, monospace; letter-spacing: -.045em; }
.sqd-primary-energy span { color: var(--muted); font: 11px/1 ui-monospace, monospace; }
.sqd-energy-summary dl { margin: 0; border-top: 1px solid var(--strong-line); }
.sqd-energy-summary dl div { padding: 14px 0; display: flex; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--line); }
.sqd-energy-summary dt { color: var(--muted); font-size: 10px; }
.sqd-energy-summary dd { margin: 0; text-align: right; font: 11px/1.4 ui-monospace, monospace; }
.sqd-diagnostic { min-width: 0; padding: clamp(28px, 4vw, 46px); }
.sqd-diagnostic-heading h3 { margin: 0; font-size: clamp(24px, 3vw, 34px); font-weight: 560; }
.forecast-readout-heading { margin-top: 28px; }
.result-note { margin: 0 0 18px; color: var(--muted); font-size: 13px; line-height: 1.8; }
.config-intro { font-size: 13px; line-height: 1.8; }
.config-intro + .config-intro { margin-top: 10px; }
.forecast-dataset-notes { margin-top: 12px; }
.forecast-dataset-notes .config-caption { margin-top: 8px; }
.sqd-energy-figure { margin: 28px 0 30px; }
.sqd-chart { width: 100%; height: auto; min-height: 250px; display: block; overflow: visible; }
.sqd-chart text { fill: var(--muted); font: 10px/1 ui-monospace, monospace; }
.sqd-chart .sqd-axis-tick line { stroke: var(--line); stroke-width: 1; vector-effect: non-scaling-stroke; }
.sqd-chart .sqd-axis { stroke: var(--strong-line); stroke-width: 1; vector-effect: non-scaling-stroke; }
.sqd-chart .sqd-energy-line { fill: none; stroke: var(--blue); stroke-width: 2.5; vector-effect: non-scaling-stroke; }
.sqd-chart circle { fill: var(--surface); stroke: var(--blue); stroke-width: 2; vector-effect: non-scaling-stroke; }
.sqd-chart .sqd-axis-label { fill: var(--ink); font-size: 11px; }
/* The Ext-SQD energy curve: exact lines, method points, a legend in the same colours. */
.extsqd-chart path { fill: none; stroke-width: 2; vector-effect: non-scaling-stroke; }
.extsqd-chart .extsqd-exact-ground { stroke: var(--ink); }
.extsqd-chart .extsqd-exact-target { stroke: var(--ink); stroke-dasharray: 6 5; }
.extsqd-chart circle.extsqd-sqd-ground { fill: var(--surface); stroke: var(--pending); }
.extsqd-chart circle.extsqd-ext-ground { fill: var(--accent); stroke: var(--accent); }
.extsqd-chart circle.extsqd-ext-target { fill: var(--surface); stroke: var(--accent); }
.extsqd-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.extsqd-legend span::before { content: ""; display: inline-block; width: 14px; height: 0; margin-right: 6px; vertical-align: middle; border-top: 2px solid var(--ink); }
.extsqd-legend .extsqd-legend-exact-target::before { border-top-style: dashed; }
.extsqd-legend .extsqd-legend-sqd-ground::before { width: 8px; height: 8px; border: 2px solid var(--pending); border-radius: 50%; }
.extsqd-legend .extsqd-legend-ext-ground::before { width: 8px; height: 8px; border: 2px solid var(--accent); border-radius: 50%; background: var(--accent); }
.extsqd-legend .extsqd-legend-ext-target::before { width: 8px; height: 8px; border: 2px solid var(--accent); border-radius: 50%; }
.extsqd-table { overflow-x: auto; }
.spectral-chart path { fill: none; stroke-width: 1.6; vector-effect: non-scaling-stroke; }
.spectral-chart .spectral-hole { stroke: var(--pending); }
.spectral-chart .spectral-particle { stroke: var(--accent); }
.spectral-chart .spectral-hf { stroke: var(--ink); stroke-dasharray: 5 5; stroke-width: 1; vector-effect: non-scaling-stroke; }
.spectral-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.spectral-legend span::before { content: ""; display: inline-block; width: 14px; height: 0; margin-right: 6px; vertical-align: middle; border-top: 2px solid var(--accent); }
.spectral-legend .spectral-legend-hole::before { border-top-color: var(--pending); }
.spectral-legend .spectral-legend-hf::before { border-top: 1px dashed var(--ink); }
.spectral-part-heading { margin-top: 28px; }
.spectral-table { overflow-x: auto; }
.sqd-energy-figure figcaption { max-width: 780px; margin-top: 12px; color: var(--muted); font-size: 11px; line-height: 1.65; }
.sqd-no-history { padding: 30px; border: 1px solid var(--line); color: var(--muted); }
.sqd-history-table { overflow-x: auto; }
.sqd-history-table table { width: 100%; border-collapse: collapse; font-size: 12px; text-align: left; }
.sqd-history-table caption { padding: 11px 0; text-align: left; color: var(--muted); line-height: 1.5; }
.sqd-history-table th, .sqd-history-table td { padding: 10px 8px; border-top: 1px solid var(--line); }
.sqd-history-table th { color: var(--quiet); font-size: 10px; font-weight: 500; }
/* The EWF result reuses the SQD layout; the SQD fragment row stands out. */
.ewf-fragment-sentence { margin: 28px 0 0; font-size: 13px; line-height: 1.75; }
.sqd-history-table tr[data-solver="SQD"] td { background: var(--blue-soft); color: var(--ink); font-weight: 600; }
.ewf-sampling { margin-top: 30px; }
.ewf-sampling h4 { margin: 0; font-size: 15px; font-weight: 520; }
.session-navigation { padding-right: clamp(20px, 2.6vw, 42px); display: flex; align-items: stretch; border-left: 1px solid var(--line); }
.session-navigation a, .session-navigation button { min-height: var(--header); padding: 0 14px; border: 0; display: flex; align-items: center; background: transparent; color: var(--muted); cursor: pointer; font-size: 12px; }
.session-navigation a:hover, .session-navigation button:hover, .session-navigation [aria-current="page"] { background: transparent; color: var(--ink); }
.session-navigation [data-nav="account"] { gap: 8px; }
.menu-button { display: none; }

/* The sidebar exists only inside the application centre (body.has-sidebar,
   set per view by app.js); the current domain is a light row with dark text. */
.app-sidebar { position: fixed; z-index: 12; inset: var(--header) auto 0 0; width: var(--sidebar); padding: 36px 18px 30px; border-right: 1px solid var(--line); display: none; flex-direction: column; background: var(--paper); }
.has-sidebar .app-sidebar { display: flex; }
.sidebar-nav { display: grid; gap: 8px; }
.sidebar-label { margin: 0 14px 18px; color: var(--quiet); font-size: 10px; letter-spacing: .08em; }
.sidebar-nav a { min-height: 52px; padding: 0 14px; border-radius: 6px; display: grid; grid-template-columns: 44px 1fr; align-items: center; color: var(--muted); }
.sidebar-nav a:hover, .sidebar-nav a:focus-visible { background: var(--surface); color: var(--ink); }
.sidebar-nav a[aria-current="location"] { background: var(--ink); color: var(--paper); }
.sidebar-nav a[aria-current="location"] span { color: var(--strong-line); }
.sidebar-nav a span { color: var(--quiet); font: 9px/1.2 var(--display); }
.sidebar-nav a strong { font-size: 13px; font-weight: 450; }
.has-sidebar main, .has-sidebar .site-footer { margin-left: var(--sidebar); }

.view { width: min(1480px, calc(100% - var(--page-gutter))); margin-inline: auto; }
.page-view, .record-state { min-height: calc(100vh - 184px); padding: 42px 0 96px; }
.eyebrow { margin: 0 0 12px; color: var(--quiet); font: 11px/1.2 var(--display); letter-spacing: .13em; }
.lead { max-width: 760px; color: var(--muted); font-size: 15px; line-height: 1.8; }
.hero h1, .hero-copy p, .boundary-card { white-space: pre-line; }
.availability { font: normal 11px/1.3 var(--display); letter-spacing: .04em; }
.availability.available { color: var(--accent); }
.availability.unavailable { color: var(--pending); }
.button { min-height: 46px; padding: 0 21px; border: 1px solid var(--strong-line); border-radius: 999px; display: inline-flex; align-items: center; justify-content: center; gap: 24px; background: transparent; cursor: pointer; }
.button.primary { min-width: 190px; border-color: var(--button); justify-content: space-between; background: var(--button); color: var(--button-text); }
.button.secondary:hover, .button.text:hover { border-color: var(--muted); background: var(--surface-2); }
.button.primary:hover { filter: brightness(1.08); }
.button:disabled { opacity: .52; cursor: wait; }
.button.text { min-height: 46px; border-color: transparent; color: var(--ink); }
.button-row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 26px; }
.back-link { display: inline-flex; min-height: 44px; align-items: center; margin-bottom: 24px; color: var(--muted); font-size: 12px; }
.back-link:hover { color: var(--blue); }
.visually-hidden { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; }

.auth-form { margin-top: 26px; display: grid; gap: 22px; }
.auth-form .button, .account-form .button { width: 100%; }
.compact-page-heading { min-height: 190px; }
.account-form { width: 100%; margin-top: 28px; padding: clamp(28px, 3vw, 42px); display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: start; gap: 22px; border: 1px solid var(--strong-line); border-radius: var(--panel-radius); background: var(--surface); }
#password-feedback { grid-column: 1 / -1; }
#password-form > .button { grid-column: 3; }
.form-feedback { margin: 0; padding: 14px 16px; border-left: 4px solid var(--danger); background: var(--danger-soft); color: var(--danger); font-size: 12px; line-height: 1.6; }
.form-feedback[data-success="true"] { border-color: var(--success); background: color-mix(in srgb, var(--success) 8%, transparent); color: var(--success); }
.admin-create { margin-top: 34px; padding: clamp(24px, 4vw, 42px); border: 1px solid var(--strong-line); border-radius: var(--panel-radius); background: var(--surface); }
.admin-create h2 { margin: 0; font-size: clamp(24px, 3vw, 34px); }
.admin-create-form { margin-top: 28px; display: grid; grid-template-columns: 1fr 1fr auto auto; align-items: end; gap: 18px; }
.check-field { min-height: 48px; padding: 0 12px; border: 1px solid var(--line); display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 12px; }
.check-field input { accent-color: var(--blue); }
.user-list { overflow: hidden; border: 1px solid var(--strong-line); border-radius: var(--panel-radius); background: var(--surface); }
.user-row { min-height: 112px; padding: 18px 20px; display: grid; grid-template-columns: minmax(180px, 1fr) auto minmax(340px, .9fr); align-items: center; gap: 18px; border-bottom: 1px solid var(--line); }
.user-row:last-child { border-bottom: 0; }
.user-identity { display: grid; gap: 8px; }
.user-identity strong { font-size: 16px; }
.user-identity span { color: var(--muted); font-size: 12px; }
.password-reset-form { display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 10px; }

/* The landing scene is below the copy and navigation. Only the background
   catches camera gestures; application links keep their normal hit targets. */
.view.landing-view { position: relative; isolation: isolate; display: flex; flex-direction: column; width: 100%; min-height: 100svh; background: #0b0f11; }
.landing-view::after { content: ""; position: absolute; z-index: 1; inset: 0; pointer-events: none; background: radial-gradient(ellipse at 50% 44%, #060a0dc9 0%, #060a0d66 28%, transparent 61%), linear-gradient(0deg, #0b0f11f5 0%, transparent 26%); }
.landing .site-header { position: fixed; left: 0; right: 0; background: #0b0f114d; border-bottom-color: #6f87841f; backdrop-filter: blur(8px); }
.landing .site-footer, .authenticated.landing .site-footer { padding-inline: 7vw; }
.hero { position: relative; z-index: 2; flex: 1 0 auto; min-height: 620px; padding: 150px 7vw 108px; display: grid; place-items: center; pointer-events: none; }
.hero-copy { width: min(100%, 860px); text-align: center; }
.hero .eyebrow { display: flex; align-items: center; justify-content: center; gap: 14px; font-size: 10px; letter-spacing: .2em; color: #a0b0ab; }
.hero .eyebrow::before { content: ""; width: 28px; height: 1px; background: #899c9c; }
.hero .eyebrow::after { content: ""; width: 28px; height: 1px; background: #899c9c; }
.hero h1 { max-width: 860px; margin: 30px auto 24px; font-size: clamp(48px, 5.3vw, 78px); font-weight: 400; line-height: 1.24; letter-spacing: -.025em; text-shadow: 0 3px 30px #02050566; }
.hero-copy p:not(.eyebrow) { max-width: 480px; margin: 0 auto 30px; color: #b6c0bc; font-size: 14px; line-height: 1.9; }
.hero-copy a { pointer-events: auto; }
.hero .button.primary { min-height: 56px; min-width: 204px; padding: 8px 11px 8px 25px; border-color: #9dbab454; background: linear-gradient(115deg, #729e962e, #192629a6); color: #e5eeea; box-shadow: inset 0 1px 0 #d7f3e112, 0 8px 28px #02080840; backdrop-filter: blur(12px); font-size: 14px; letter-spacing: .06em; transition: border-color .2s ease, background .2s ease, box-shadow .2s ease, transform .2s ease; }
.hero .button.primary > span:last-child { width: 34px; height: 34px; display: grid; place-items: center; border: 1px solid #abc5bd33; border-radius: 50%; background: #a1c4b510; color: #c7e4db; font-size: 17px; transition: background .2s ease, transform .2s ease; }
.hero .button.primary:hover { border-color: #beded29c; background: linear-gradient(115deg, #80b2a943, #25393bbd); box-shadow: inset 0 1px 0 #d7f3e124, 0 10px 32px #02080866; filter: none; transform: translateY(-2px); }
.hero .button.primary:hover > span:last-child { background: #b2dacc21; transform: rotate(45deg); }
.orbital-art { position: absolute; z-index: 0; inset: 0; width: 100%; height: 100%; margin: 0; overflow: hidden; }
.orbital-art[data-renderer="webgl"] { cursor: grab; }
.orbital-art[data-interacting="true"] { cursor: grabbing; }
.orbital-art:focus-visible { outline: 1px solid #91b0a9; outline-offset: -5px; }
.home-orbit-fallback, .home-orbit-canvas { position: absolute; inset: 0; display: block; width: 100%; height: 100%; pointer-events: none; }
/* The static picture shows only when the 3D scene cannot run; while the scene
   loads the area stays empty, and the scene fades in. */
.home-orbit-fallback { object-fit: contain; opacity: 0; }
.home-orbit-canvas { opacity: 0; transition: opacity .6s ease; }
.orbital-art[data-renderer="fallback"] .home-orbit-fallback { opacity: 1; }
.orbital-art[data-renderer="webgl"] .home-orbit-canvas { opacity: 1; }
.orbit-nodes { position: absolute; z-index: 3; inset: 0; pointer-events: none; }
.orbit-connector { position: absolute; z-index: 0; inset: 0; width: 100%; height: 100%; overflow: hidden; pointer-events: none; }
.orbit-connector path { fill: none; stroke: #a5c7bb85; stroke-width: 1; vector-effect: non-scaling-stroke; }
.orbit-node { position: absolute; z-index: 1; left: 0; top: 0; width: 44px; height: 44px; min-height: 0; padding: 0; display: grid; place-items: center; border: 0; border-radius: 50%; background: transparent; pointer-events: auto; touch-action: pan-y; cursor: pointer; }
.orbit-node > span { width: 25px; height: 25px; border: 1px solid #d4e7df5c; border-radius: 50%; box-shadow: 0 0 12px #a2ccc61a; transition: width .18s, height .18s, border-color .18s, box-shadow .18s; }
.orbit-node:hover > span, .orbit-node:focus-visible > span, .orbit-node[aria-expanded="true"] > span { width: 34px; height: 34px; border-color: #e0f4ebd9; box-shadow: 0 0 22px #a2ccc647, inset 0 0 10px #a2ccc61a; }
.orbit-card { position: absolute; z-index: 2; width: min(280px, calc(100% - 32px)); padding: 24px; border: 1px solid #b9d2c947; border-radius: 10px; background: linear-gradient(135deg, #1e2a2bef, #0d1518f5); box-shadow: 0 18px 70px #0008, inset 0 1px 0 #d7f3e112; backdrop-filter: blur(18px); pointer-events: auto; }
.orbit-card .eyebrow { margin: 0 0 12px; color: #9aafa9; font-size: 9px; letter-spacing: .14em; }
.orbit-card h2 { margin: 0; font-size: 24px; font-weight: 450; letter-spacing: .02em; }
.orbit-card > p:not(.eyebrow) { margin: 14px 0 20px; color: #b7c3bf; font-size: 13px; line-height: 1.8; }
.orbit-card > a { min-height: 40px; display: flex; align-items: center; justify-content: space-between; gap: 16px; border-top: 1px solid #a5c5b929; padding-top: 12px; font-size: 12px; color: #e5eeea; }
.orbit-card > a:hover { color: #a4e4d6; }
.orbit-card-close { position: absolute; right: 12px; top: 8px; min-height: 30px; padding: 4px 8px; border: 0; background: transparent; color: #a0b3ac; font-size: 10px; cursor: pointer; }
.orbit-card-close:hover { color: #fff; }
.orbit-hint { position: absolute; bottom: 24px; left: 50%; transform: translateX(-50%); margin: 0; display: flex; align-items: center; gap: 9px; color: #9cacaa; font-size: 10px; letter-spacing: .04em; white-space: nowrap; }
@media (prefers-reduced-motion: reduce) {
  .hero .button, .hero .button.primary > span:last-child, .orbit-node > span, .home-orbit-fallback, .home-orbit-canvas, .domain-card, .direction-entry, .direction-entry strong > span:last-child { transition: none; }
  .hero .button.primary:hover, .hero .button.primary:hover > span:last-child, .domain-card:hover, a.direction-entry:hover strong > span:last-child { transform: none; }
}
.home-directions { position: relative; z-index: 2; margin: 0 7vw; padding: 18px 0 24px; border-top: 1px solid #6f878440; display: grid; grid-template-columns: repeat(5, 1fr); gap: 0; }
.direction-entry { position: relative; min-width: 0; padding: 12px 22px; display: flex; flex-direction: column; align-items: start; gap: 12px; border-right: 1px solid #36383899; transition: background .2s; }
.direction-entry:first-child { padding-left: 0; }
.direction-entry:last-child { padding-right: 0; border-right: 0; }
.direction-entry .eyebrow { margin: 0; color: #8f9c98; font-size: 10px; letter-spacing: .1em; }
.direction-entry strong { font-size: 17px; font-weight: 500; }
.direction-entry strong > span:last-child { display: inline-block; margin-left: 9px; color: #889b95; transition: color .2s, transform .2s; }
a.direction-entry:hover strong, a.direction-entry:focus-visible strong { color: #fff; }
a.direction-entry:hover strong > span:last-child, a.direction-entry:focus-visible strong > span:last-child { color: #fff; transform: translate(2px, -2px); }
.direction-badge { padding: 4px 10px; border-radius: 4px; background: var(--surface-2); color: var(--muted); font-size: 12px; white-space: nowrap; }
.login-panel { width: min(440px, calc(100% - 32px)); margin: auto; padding: clamp(26px, 4vw, 38px); border: 1px solid var(--strong-line); border-radius: var(--panel-radius); background: var(--surface); color: var(--ink); }
.login-panel::backdrop { background: rgba(6, 7, 7, .66); backdrop-filter: blur(4px); }
.login-panel-heading { display: flex; justify-content: space-between; align-items: start; gap: 16px; }
.login-panel-heading h2 { margin: 0; font-size: 28px; font-weight: 560; letter-spacing: -.03em; }
.login-panel-heading .button { min-height: 38px; margin: -8px -14px 0 0; padding: 0 14px; color: var(--muted); }
.login-panel-note { margin: 14px 0 0; color: var(--muted); font-size: 13px; line-height: 1.7; }

/* Case page: the breadcrumb, a switcher when the problem has several cases,
   then the generated article, left-aligned under the breadcrumb. */
#case-article .case-article { width: min(880px, 100%); margin-inline: 0; padding: 20px 0 72px; }

/* AI assistant: a compact work surface with persistent conversations, chat,
   and the single computation proposal owned by the selected conversation. */
.ai-workspace { padding-top: 24px; }
.ai-page-heading { min-height: 108px; padding-bottom: 22px; display: flex; align-items: end; justify-content: space-between; gap: 32px; border-bottom: 1px solid var(--line); }
.ai-page-heading h1 { margin: 0; font-size: 34px; line-height: 1.15; font-weight: 600; letter-spacing: 0; }
.ai-page-heading .lead { margin: 10px 0 0; font-size: 13px; line-height: 1.65; }
.ai-status { min-height: 38px; padding: 8px 10px; display: flex; align-items: center; gap: 9px; border: 1px solid var(--strong-line); border-radius: 6px; background: var(--surface); color: var(--muted); font-size: 12px; }
.ai-status-dot { width: 7px; height: 7px; flex: 0 0 auto; border-radius: 50%; background: var(--pending); box-shadow: 0 0 0 3px color-mix(in srgb, var(--pending) 13%, transparent); }
.ai-status[data-state="ready"] .ai-status-dot { background: var(--success); box-shadow: 0 0 0 3px color-mix(in srgb, var(--success) 13%, transparent); }
.ai-status[data-state="error"] .ai-status-dot { background: var(--danger); box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 13%, transparent); }
.ai-status[data-state="loading"] .ai-status-dot { animation: pulse 1.1s ease-in-out infinite; }
.ai-status button { min-height: 26px; padding: 0 8px; border: 0; border-left: 1px solid var(--line); border-radius: 0; background: transparent; color: var(--ink); cursor: pointer; font-size: 11px; }
.ai-layout { height: calc(100vh - var(--header) - 176px); min-height: 460px; margin-top: 18px; display: grid; grid-template-columns: 230px minmax(460px, 1fr) minmax(290px, 340px); overflow: hidden; border: 1px solid var(--strong-line); border-radius: var(--panel-radius); background: var(--paper); }
.ai-conversation-panel { min-width: 0; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; border-right: 1px solid var(--line); background: var(--surface); }
.ai-panel-heading { min-height: 74px; padding: 14px 14px 12px; display: flex; align-items: center; justify-content: space-between; gap: 10px; border-bottom: 1px solid var(--line); }
.ai-panel-heading .eyebrow { margin: 0 0 4px; font-size: 9px; letter-spacing: 0; }
.ai-panel-heading h2 { margin: 0; font-size: 16px; font-weight: 560; }
.ai-new-conversation { min-height: 34px; padding: 0 10px; border: 1px solid var(--strong-line); border-radius: 5px; background: transparent; color: var(--ink); cursor: pointer; font-size: 12px; white-space: nowrap; }
.ai-new-conversation:hover { border-color: var(--muted); background: var(--surface-2); }
.ai-conversation-list { min-height: 0; padding: 8px; overflow-y: auto; }
.ai-conversation-row { width: 100%; min-height: 58px; border-radius: 5px; display: grid; grid-template-columns: minmax(0, 1fr) 32px; align-items: center; gap: 2px; background: transparent; color: var(--muted); }
.ai-conversation-row:hover { background: var(--surface-2); color: var(--ink); }
.ai-conversation-row[data-current="true"] { background: var(--blue-soft); color: var(--ink); box-shadow: inset 2px 0 var(--accent); }
.ai-conversation-select { min-width: 0; min-height: 58px; padding: 10px; border: 0; display: grid; gap: 5px; background: transparent; color: inherit; cursor: pointer; text-align: left; }
.ai-conversation-select strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; font-weight: 500; }
.ai-conversation-select time { color: var(--quiet); font-size: 10px; }
.ai-conversation-remove { width: 28px; height: 28px; padding: 0; border: 0; border-radius: 4px; background: transparent; color: var(--quiet); cursor: pointer; font-size: 18px; line-height: 1; }
.ai-conversation-remove:not(:disabled):hover, .ai-conversation-remove:not(:disabled):focus-visible { background: var(--danger-soft); color: var(--danger); }
.ai-list-state { margin: 0; padding: 18px 10px; color: var(--quiet); font-size: 12px; line-height: 1.6; }
.ai-conversation-footer { min-height: 52px; padding: 8px; border-top: 1px solid var(--line); }
.ai-delete-conversation { width: 100%; min-height: 36px; padding: 0 10px; border: 0; border-radius: 5px; background: transparent; color: var(--quiet); cursor: pointer; font-size: 11px; text-align: left; }
.ai-delete-conversation:not(:disabled):hover { background: var(--danger-soft); color: var(--danger); }
.ai-workspace button:disabled { cursor: not-allowed; }
.ai-chat { min-width: 0; min-height: 0; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; background: var(--paper); }
.ai-chat-toolbar { min-height: 74px; padding: 14px 22px 12px; display: flex; align-items: center; border-bottom: 1px solid var(--line); }
.ai-chat-toolbar h2 { max-width: min(100%, 520px); margin: 4px 0 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 17px; font-weight: 560; }
.ai-chat-toolbar .eyebrow { margin: 0; font-size: 9px; letter-spacing: 0; }
.ai-messages { min-height: 0; padding: 26px 24px; overflow-y: auto; scroll-behavior: smooth; }
.ai-messages .empty-state { min-height: 100%; padding: 18px 0; border-bottom: 0; display: grid; place-content: center; justify-items: start; }
.ai-prompt-suggestions { max-width: 520px; margin-top: 22px; display: flex; flex-wrap: wrap; gap: 8px; }
.ai-prompt-suggestions button { min-height: 36px; padding: 0 12px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface); color: var(--muted); cursor: pointer; font-size: 12px; text-align: left; }
.ai-prompt-suggestions button:not(:disabled):hover { border-color: var(--accent); color: var(--ink); }
.ai-message { width: min(88%, 700px); margin-bottom: 22px; }
.ai-message.user { margin-left: auto; padding: 13px 15px; border: 1px solid var(--strong-line); border-radius: 7px; background: var(--surface); }
.ai-message.assistant { padding: 2px 0 2px 16px; border-left: 2px solid var(--accent); }
.ai-message.interpretation { padding: 14px 16px; border: 1px solid var(--strong-line); border-left: 3px solid var(--success); border-radius: 7px; background: var(--surface); }
.ai-message.interpretation .ai-message-role { color: var(--success); font-weight: 600; }
.ai-message.interpretation.failed { border-left-color: var(--danger); }
.ai-result-summary { width: min(88%, 700px); }
.ai-result-summary-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; }
.ai-result-summary-heading .ai-message-role { margin-bottom: 10px; }
.ai-result-summary-heading strong { min-width: 0; overflow-wrap: anywhere; font: 600 14px/1.4 var(--display); }
.ai-result-summary-footer { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.ai-result-summary-footer span { color: var(--success); font-size: 11px; }
.ai-result-summary-footer .ai-job-link { margin: 0; }
.ai-message.optimistic { animation: assistant-message-in 160ms ease-out; }
.ai-message.pending { color: var(--muted); opacity: .78; }
.ai-message.pending .ai-message-content { animation: pulse 1.1s ease-in-out infinite; }
.ai-message.streaming .ai-message-content::after { content: ""; width: 2px; height: 1em; margin-left: 3px; display: inline-block; vertical-align: -.12em; background: var(--accent); animation: pulse .8s ease-in-out infinite; }
.ai-message.failed { color: var(--danger); border-left-color: var(--danger); }
.ai-message-role { display: block; margin-bottom: 6px; color: var(--quiet); font-size: 10px; }
.ai-message-content { max-width: 100%; overflow-x: auto; line-height: 1.75; overflow-wrap: anywhere; }
.ai-message.user .ai-message-content { white-space: pre-wrap; }
.ai-message-content > :first-child { margin-top: 0; }
.ai-message-content > :last-child { margin-bottom: 0; }
.ai-message-content p { margin: 0 0 12px; }
.ai-message-content h1, .ai-message-content h2, .ai-message-content h3, .ai-message-content h4 { margin: 20px 0 8px; color: var(--ink); font-family: var(--display); font-weight: 600; line-height: 1.45; letter-spacing: 0; }
.ai-message-content h1 { font-size: 19px; }
.ai-message-content h2 { font-size: 17px; }
.ai-message-content h3, .ai-message-content h4 { font-size: 15px; }
.ai-message-content ul, .ai-message-content ol { margin: 8px 0 14px; padding-left: 22px; }
.ai-message-content li { margin: 4px 0; }
.ai-message-content code { padding: 2px 5px; border: 1px solid var(--line); border-radius: 4px; background: var(--surface); color: var(--ink); font: .9em/1.5 ui-monospace, monospace; }
.ai-message-content pre { margin: 10px 0 14px; padding: 12px 14px; overflow: auto; border: 1px solid var(--line); border-radius: 5px; background: var(--surface); }
.ai-message-content pre code { padding: 0; border: 0; background: transparent; white-space: pre; }
.ai-message-content table { width: max-content; min-width: min(100%, 440px); max-width: 100%; margin: 10px 0 16px; border-collapse: collapse; font-size: 12px; }
.ai-message-content th, .ai-message-content td { padding: 8px 10px; border: 1px solid var(--strong-line); text-align: left; vertical-align: top; }
.ai-message-content th { background: var(--surface); color: var(--ink); font-weight: 600; }
.ai-message-content blockquote { margin: 10px 0 14px; padding: 2px 0 2px 12px; border-left: 2px solid var(--strong-line); color: var(--muted); }
.ai-message-content hr { margin: 18px 0; border: 0; border-top: 1px solid var(--line); }
.ai-message-content a { color: var(--accent); text-underline-offset: 3px; }
@keyframes assistant-message-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
.ai-computation-inline { width: min(88%, 700px); margin: 4px 0 24px; padding: 16px; border: 1px solid var(--strong-line); border-left: 3px solid var(--pending); border-radius: 7px; background: var(--surface); }
.ai-computation-inline[data-state="ready"], .ai-computation-inline[data-state="succeeded"] { border-left-color: var(--success); }
.ai-computation-inline[data-state="failed"] { border-left-color: var(--danger); }
.ai-computation-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; }
.ai-computation-heading span, .ai-computation-status span { color: var(--quiet); font-size: 10px; }
.ai-computation-heading strong { min-width: 0; overflow-wrap: anywhere; font: 600 15px/1.4 var(--display); }
.ai-computation-inline dl { margin: 14px 0; border-top: 1px solid var(--line); }
.ai-computation-inline dl div { padding: 8px 0; display: grid; grid-template-columns: minmax(90px, .7fr) minmax(0, 1.3fr); gap: 14px; border-bottom: 1px solid var(--line); }
.ai-computation-inline dt { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.ai-computation-inline dd { margin: 0; text-align: right; font: 12px/1.5 ui-monospace, monospace; overflow-wrap: anywhere; }
.ai-computation-inline .button { width: 100%; }
.ai-computation-status { margin-top: 14px; padding: 10px 0; display: flex; align-items: center; justify-content: space-between; gap: 16px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.ai-computation-result { margin-top: 14px; }
.ai-computation-result > strong { font-size: 12px; }
.ai-computation-result pre { max-height: 260px; margin: 8px 0 0; padding: 12px; overflow: auto; border: 1px solid var(--line); border-radius: 5px; background: var(--paper); color: var(--ink); white-space: pre-wrap; font: 12px/1.6 ui-monospace, monospace; }
.ai-computation-error { margin: 14px 0 0; color: var(--danger); line-height: 1.6; }
.ai-computation-inline .ai-job-link { margin-top: 14px; }
.composer { padding: 13px 16px 12px; border: 0; border-top: 1px solid var(--strong-line); border-radius: 0; background: var(--surface); }
.composer textarea { width: 100%; min-height: 48px; max-height: 150px; padding: 0; border: 0; background: transparent; color: var(--ink); font: inherit; line-height: 1.65; resize: none; }
.composer textarea:focus { outline: 0; }
.composer textarea:disabled::placeholder { color: var(--quiet); }
.composer-actions { margin-top: 8px; display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.ai-note { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
#ai-send { min-width: 112px; min-height: 38px; padding-inline: 14px; border-radius: 6px; gap: 18px; }
.ai-draft { min-width: 0; min-height: 0; padding: 12px 18px 22px; overflow-y: auto; border-left: 1px solid var(--line); background: var(--surface); }
.ai-draft .section-heading.compact { min-height: 62px; margin: 0; border-bottom: 1px solid var(--line); }
.ai-draft .section-heading.compact h2 { font-size: 17px; }
.ai-draft .empty-state { min-height: 0; padding: 22px 0; border-bottom: 0; }
.ai-proposal { padding: 4px 0 2px; }
.ai-proposal-process { margin: 0 0 16px; font: 600 18px/1.4 var(--display); overflow-wrap: anywhere; }
.ai-parameters { margin: 0 0 20px; border-top: 1px solid var(--line); }
.ai-parameters div { padding: 10px 0; display: grid; grid-template-columns: minmax(90px, .7fr) minmax(0, 1.3fr); gap: 14px; border-bottom: 1px solid var(--line); }
.ai-parameters dt { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.ai-parameters dd { margin: 0; text-align: right; font: 12px/1.5 ui-monospace, monospace; overflow-wrap: anywhere; }
.ai-proposal .button { width: 100%; }
.ai-job-link { margin-top: 12px; display: inline-flex; color: var(--accent); font-size: 13px; }
.ai-result { margin: 18px 0 0; padding-top: 16px; border-top: 1px solid var(--line); }
.ai-result pre { margin: 8px 0 0; max-height: 240px; overflow: auto; white-space: pre-wrap; font: 12px/1.6 ui-monospace, monospace; }
.assistant-admin { display: grid; gap: 24px; }
.assistant-admin-heading { display: flex; align-items: end; justify-content: space-between; gap: 24px; }
.assistant-admin-detail { margin: 0; color: var(--muted); font-size: 13px; text-align: right; }
.assistant-config-form { display: grid; gap: 20px; padding-top: 22px; border-top: 1px solid var(--line); }
.assistant-config-fields { display: grid; grid-template-columns: minmax(260px, 1.15fr) minmax(220px, .85fr) minmax(300px, 1fr); gap: 18px; }
.assistant-model-control { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.assistant-model-control .button { min-height: 48px; white-space: nowrap; }
.assistant-admin-actions { display: flex; justify-content: flex-end; gap: 10px; }
.assistant-admin .form-feedback { width: 100%; }

@keyframes pulse { 0%, 100% { opacity: .42; } 50% { opacity: 1; } }

.page-heading { min-height: 214px; padding-bottom: 36px; display: flex; align-items: end; justify-content: space-between; gap: 40px; border-bottom: 1px solid var(--line); }
.page-heading h1, .brief-intro h1, .job-header h1 { margin: 0; font-size: clamp(38px, 3.8vw, 56px); line-height: 1.08; font-weight: 600; letter-spacing: -.035em; }
.boundary-card { padding: 18px 22px; border: 1px solid var(--strong-line); border-radius: 8px; color: var(--muted); font: 12px/1.8 ui-monospace, monospace; }

/* Application centre, first level: one card per domain, the illustration in
   the card's top right corner (the reference design's composition). */
.catalogue-view .page-heading { min-height: 202px; align-items: center; }
.domain-grid { margin-top: 32px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; }
.domain-card { position: relative; min-height: 285px; padding: 28px; display: flex; flex-direction: column; overflow: hidden; border: 1px solid var(--strong-line); border-radius: var(--panel-radius); background: var(--surface); transition: border-color .2s, transform .2s; }
.domain-card:hover { border-color: var(--quiet); transform: translateY(-2px); }
.domain-card .eyebrow { margin: 0; font-size: 11.5px; }
.domain-card h2 { max-width: calc(100% - 200px); margin: 60px 0 10px; font-size: clamp(25px, 2.5vw, 29px); font-weight: 520; letter-spacing: -.02em; }
.domain-card p:not(.eyebrow) { max-width: 420px; margin: 0 0 22px; color: var(--muted); font-size: 14px; line-height: 1.75; }
.domain-visual { width: 180px; height: 125px; opacity: .7; }
.domain-card .domain-visual { position: absolute; top: 35px; right: 20px; }
.domain-scene { pointer-events: none; }
.domain-scene > svg { display: block; width: 100%; height: 100%; }
.domain-scene[data-renderer="webgl"] > svg { visibility: hidden; }
.domain-scenes-canvas { position: fixed; z-index: 5; inset: 0; display: block; width: 100%; height: 100%; opacity: .78; pointer-events: none; }
.card-bottom { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.domain-count { color: var(--muted); font-size: 12px; white-space: nowrap; }
.coming-soon { margin-top: 24px; padding: 28px; display: flex; align-items: center; justify-content: space-between; gap: 20px; border: 1px solid var(--strong-line); border-radius: var(--panel-radius); background: var(--surface); }
.coming-soon h2 { margin: 0; font-size: 20px; font-weight: 500; }
.coming-soon span { color: var(--muted); font: 12px/1.2 var(--display); letter-spacing: .08em; }

/* Second level: the domain page, one row per problem, its case beside it. */
.breadcrumb { margin-bottom: 8px; color: var(--muted); font-size: 12px; }
.breadcrumb a { color: inherit; }
.breadcrumb a:hover { color: var(--blue); }
.breadcrumb span::before { content: "/"; margin: 0 8px; }
.domain-view .page-heading { min-height: 0; padding: 24px 0 30px; }
.domain-english { margin: 14px 0 0; color: var(--muted); font: 12px/1.5 var(--display); letter-spacing: .13em; }
.paired-header { margin: 26px 0 16px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; color: var(--muted); font-size: 12.5px; }
.application-row { margin-bottom: 20px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.application-row .panel { min-height: 205px; padding: 24px; display: flex; flex-direction: column; border: 1px solid var(--strong-line); border-radius: var(--panel-radius); background: var(--surface); }
.panel-top { display: flex; align-items: start; justify-content: space-between; gap: 16px; }
.application-row h2, .application-row h3 { margin: 0 0 16px; font-size: 21px; font-weight: 520; line-height: 1.3; }
.application-row p { margin: 0 0 22px; color: var(--muted); font-size: 14px; line-height: 1.7; }
.badge { padding: 4px 10px; border-radius: 4px; background: var(--surface-2); color: var(--muted); font-size: 12px; white-space: nowrap; }
.application-row .problem-status { margin: -6px 0 16px; font: normal 11px/1.3 var(--display); letter-spacing: .04em; }
.actions { margin-top: auto; display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.button.pending { border-style: dashed; color: var(--pending); cursor: default; }
.application-row .case-panel { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 20px; }
.case-panel .domain-visual { align-self: center; width: 110px; height: 135px; border-radius: 6px; background: var(--surface-2); }
.case-copy { display: flex; flex-direction: column; }
.case-label { margin-bottom: 8px; color: var(--muted); font-size: 12px; }
.case-empty { align-self: center; margin: 0; color: var(--quiet); font-size: 13px; }

/* 计算简介页: header, four facts, one button per process, recent drafts. */
#brief-view { padding-top: 28px; }
#brief-view > .back-link { margin-bottom: 16px; }
.brief-intro { min-height: 300px; padding-bottom: 40px; display: grid; justify-items: start; align-content: end; border-bottom: 1px solid var(--strong-line); }
.brief-intro h1 { margin-top: 22px; }
.brief-actions { padding: 30px 0; display: grid; gap: 14px; }
.brief-buttons { display: flex; flex-wrap: wrap; gap: 12px; }
.brief-actions small { color: var(--muted); line-height: 1.6; }
.facts-strip { display: grid; border-bottom: 1px solid var(--strong-line); }
.facts-strip { grid-template-columns: repeat(4, 1fr); }
.facts-strip div { min-width: 0; padding: 20px 22px; display: grid; gap: 9px; border-right: 1px solid var(--line); }
.facts-strip div:last-child { border-right: 0; }
.facts-strip small { color: var(--quiet); font-size: 10px; }
.facts-strip b { font-size: 13px; overflow-wrap: anywhere; }
.recent-section, .frozen-input { margin-top: 76px; border-top: 1px solid var(--strong-line); }
.section-heading { min-height: 112px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.section-heading h2 { margin: 0; font-size: clamp(25px, 3vw, 38px); font-weight: 600; }
.section-heading.compact { min-height: 52px; margin-bottom: 10px; }
.section-heading.compact h2 { font-size: 24px; }
.record-list { border-top: 1px solid var(--strong-line); }
.record-row { min-height: 92px; padding: 16px 4px; display: grid; grid-template-columns: 170px minmax(0, 1fr) 150px auto; align-items: center; gap: 22px; border-bottom: 1px solid var(--line); }
.draft-row { display: flex; gap: 12px; padding: 0 4px; }
.draft-row-link { min-height: 92px; padding: 16px 0; display: grid; grid-template-columns: 170px minmax(0, 1fr) 150px auto; align-items: center; gap: 22px; flex: 1; color: inherit; }
.draft-row-link:hover, .draft-row-link:focus-visible { background: var(--blue-soft); }
.draft-row-link > span:last-child { font-size: 16px; }
.draft-delete { min-height: 44px; padding-inline: 10px; border-color: transparent; color: var(--quiet); align-self: center; flex: 0 0 auto; font-size: 11px; text-decoration: underline; text-underline-offset: 4px; }
.draft-delete:hover, .draft-delete:focus-visible { color: var(--danger); }
.record-row:hover { background: var(--surface); }
.record-row time, .record-row code { color: var(--quiet); font: 11px/1.4 ui-monospace, monospace; overflow-wrap: anywhere; }
.record-row strong { font-size: 14px; }
.record-row p { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.empty-state, .list-error, .loading-list { min-height: 120px; padding: 28px 4px; border-bottom: 1px solid var(--strong-line); color: var(--muted); font-size: 13px; line-height: 1.7; }
.list-error { color: var(--danger); }
.loading-list::before { content: ""; display: inline-block; width: 10px; height: 10px; margin-right: 12px; border: 2px solid var(--blue); border-top-color: transparent; animation: spin 1s linear infinite; }

.jobs-heading { min-height: 188px; }
.jobs-heading-actions { display: flex; align-items: center; gap: 10px; }
.jobs-heading-actions .button { min-width: 130px; }
.jobs-overview { margin: 0; display: grid; grid-template-columns: repeat(3, 1fr); overflow: hidden; border: 1px solid var(--strong-line); border-radius: var(--panel-radius); background: var(--surface); }
.platform-load { margin: 12px 0 0; color: var(--muted); font-size: 14px; }
.platform-load a { margin-left: 4px; white-space: nowrap; }
.jobs-overview div { min-height: 104px; padding: 20px 24px; display: grid; align-content: space-between; border-right: 1px solid var(--line); }
.jobs-overview div:last-child { border-right: 0; }
.jobs-overview dt { color: var(--quiet); font-size: 10px; letter-spacing: .07em; }
.jobs-overview dd { margin: 0; font: 500 30px/1 ui-monospace, monospace; }
.jobs-overview[data-state="loading"] dd, .jobs-overview[data-state="partial"] dd, .jobs-overview[data-state="error"] dd { color: var(--muted); }
.job-group { margin-top: 34px; }
.job-group .section-heading.compact { margin: 0; border-bottom: 1px solid var(--strong-line); }
.job-group-count { color: var(--quiet); font: 13px/1 var(--display); }
#jobs-view .jobs-drafts { margin-top: 48px; }


.job-header { min-height: 150px; display: flex; align-items: end; justify-content: space-between; gap: 32px; }
.record-id, .record-time { color: var(--muted); font-size: 11px; }
.record-id code { font: inherit; overflow-wrap: anywhere; }
.source-banner { margin-bottom: 18px; padding: 16px 18px; border-left: 4px solid var(--blue); background: var(--blue-soft); font-size: 13px; }
/* The admin's QPU notices: no backend usable yet, and the fake backend's test values. */
.qpu-admin-notice { margin: 24px 0 0; padding: 14px 18px; border-left: 4px solid var(--pending); background: var(--blue-soft); font-size: 13px; }
.qpu-test-mode { padding: 12px 16px; border-left: 4px solid var(--accent); background: var(--blue-soft); font-size: 13px; }
.source-banner a { color: var(--blue); text-decoration: underline; }
.save-indicator { min-width: 220px; min-height: 66px; padding: 13px 16px; border: 1px solid var(--strong-line); display: flex; align-items: center; gap: 13px; background: var(--surface); }
.save-dot { width: 9px; height: 9px; flex: 0 0 auto; background: var(--success); }
.save-indicator[data-state="dirty"] .save-dot, .save-indicator[data-state="saving"] .save-dot { background: var(--pending); }
.save-indicator[data-state="error"] .save-dot { background: var(--danger); }
.save-indicator div { display: grid; gap: 5px; }
.save-indicator small { color: var(--quiet); font-size: 10px; }
.save-indicator strong { font: 12px/1.2 ui-monospace, monospace; }
.save-indicator button { min-height: 44px; margin-left: auto; padding: 0 12px; border: 1px solid var(--danger); background: transparent; color: var(--danger); cursor: pointer; }
.validation-summary { margin-bottom: 18px; padding: 20px 24px; border: 1px solid var(--danger); background: var(--danger-soft); }
.validation-summary ul { margin: 10px 0 0; padding-left: 20px; }
.validation-summary a { color: var(--danger); text-decoration: underline; }
.field { display: grid; gap: 8px; }
.field > span, .ticker-fieldset legend { color: var(--muted); font-size: 12px; font-weight: 600; }
.field input, .field select { width: 100%; min-height: 48px; padding: 11px 13px; border: 1px solid var(--strong-line); border-radius: 7px; background: var(--paper); outline: 0; }
.field input:focus, .field select:focus { border-color: var(--blue); box-shadow: inset 4px 0 0 var(--blue); }
.field [aria-invalid="true"] { border-color: var(--danger); box-shadow: inset 4px 0 0 var(--danger); }
.field small, .ticker-fieldset > p { margin: 0; color: var(--quiet); font-size: 11px; line-height: 1.55; }
.field-error { min-height: 16px; color: var(--danger); font-size: 11px; font-style: normal; }
.ticker-fieldset { margin: 0; padding: 0; border: 0; }
.ticker-options { margin-top: 10px; display: grid; grid-template-columns: repeat(7, 1fr); border: 1px solid var(--strong-line); }
.ticker-option { min-height: 52px; display: flex; align-items: center; justify-content: center; gap: 7px; border-right: 1px solid var(--line); cursor: pointer; font: 11px/1 monospace; }
.ticker-option:last-child { border-right: 0; }
.ticker-option:has(input:checked) { box-shadow: inset 0 -4px 0 var(--blue); background: var(--blue-soft); }
.ticker-option input { accent-color: var(--blue); }
.facts-grid { margin: 0; display: grid; border: 1px solid var(--strong-line); }
.facts-grid div { min-width: 0; padding: 18px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.facts-grid div:last-child { border-right: 0; }
.facts-grid dt { color: var(--quiet); font-size: 10px; }
.facts-grid dd { margin: 8px 0 0; overflow-wrap: anywhere; font: 12px/1.55 ui-monospace, monospace; }

.filters { min-height: 72px; display: flex; align-items: end; gap: 0; border-bottom: 1px solid var(--strong-line); }
.filters button { min-height: 46px; padding: 0 22px; border: 1px solid var(--line); border-radius: 999px; background: transparent; cursor: pointer; }
.filters button.selected { border-color: var(--button); background: var(--button); color: var(--button-text); }
.status-pill { justify-self: start; padding: 6px 10px; border: 1px solid currentColor; border-radius: 999px; font-size: 11px; }
.execution-limits, .execution-notice { margin: 18px 0; padding: 20px; border: 1px solid var(--line); border-radius: 8px; overflow-wrap: anywhere; }
.execution-limits h3, .execution-notice h3 { font-size: 15px; margin: 0 0 12px; }
.execution-limits ul, .execution-notice ul { margin: 12px 0; padding-left: 22px; line-height: 1.8; }
.execution-limits a { display: inline-block; margin-right: 16px; font-size: 13px; }
.execution-notice { border-color: var(--pending); }
.execution-actions { margin: 24px 0; padding: 20px; border-top: 1px solid var(--line); color: var(--muted); }
.execution-actions h2 { margin: 0 0 12px; font-size: 16px; }
.execution-actions p { max-width: 900px; font-size: 13px; line-height: 1.8; }
.execution-actions small { display: block; margin-top: 10px; font-size: 12px; }
.status-pending, .status-queued { color: var(--pending); }.status-running { color: var(--blue); }.status-succeeded { color: var(--success); }.status-failed { color: var(--danger); }

.job-header { min-height: 188px; margin-top: 18px; padding: clamp(26px, 3.5vw, 48px); border: 1px solid var(--strong-line); border-radius: var(--panel-radius); background: var(--surface); }
.job-header h1 { font-size: clamp(38px, 4.2vw, 58px); }
.job-status { min-width: 156px; padding: 13px 18px; border: 1px solid currentColor; border-radius: 999px; text-align: center; font-size: 13px; }
.job-status[data-status="pending"], .job-status[data-status="queued"] { color: var(--pending); }.job-status[data-status="running"] { color: var(--blue); }.job-status[data-status="succeeded"] { color: var(--success); }.job-status[data-status="failed"] { color: var(--danger); }
.progress-panel { min-height: 122px; margin-top: 14px; padding: 24px; border: 1px solid var(--strong-line); border-radius: 9px; display: flex; align-items: center; gap: 20px; background: var(--surface); }
.progress-mark { width: 15px; height: 15px; border: 2px solid var(--blue); border-top-color: transparent; animation: spin 1s linear infinite; }
.progress-panel[data-paused="true"] .progress-mark { animation: none; border-color: var(--pending); border-top-color: var(--pending); }
.job-status[data-status="cancelled"], .status-cancelled { color: var(--muted); }
@keyframes spin { to { transform: rotate(360deg); } }
.progress-panel p { margin: 6px 0 0; color: var(--muted); font-size: 12px; }
.failure-panel { margin-top: 18px; padding: clamp(30px, 6vw, 72px); border: 1px solid var(--danger); background: var(--danger-soft); }
.failure-panel h2 { margin: 0; font-size: clamp(30px, 4vw, 46px); }
.failure-panel > p { max-width: 780px; line-height: 1.75; }
.failure-panel small { display: block; margin-top: 20px; color: var(--muted); }
.result-panel { margin-top: 18px; overflow: hidden; border: 1px solid var(--strong-line); border-radius: 9px; background: var(--surface); }
.result-intro { padding: clamp(28px, 4vw, 50px); display: grid; grid-template-columns: 1fr 1fr; align-items: end; gap: 42px; border-bottom: 1px solid var(--strong-line); }
.result-intro h2 { margin: 0; font-size: clamp(31px, 4vw, 50px); }
.result-intro > p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.8; }
/* As many columns as fit, so any number of risk levels lays out evenly. */
.frontier-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.frontier-card { min-width: 0; padding: 24px 18px; border-right: 1px solid var(--line); }
.frontier-card:last-child { border-right: 0; }
.frontier-card.turning { box-shadow: inset 0 4px 0 var(--blue); background: var(--blue-soft); }
.frontier-q { color: var(--quiet); font: 11px/1 monospace; }
.frontier-card h3 { min-height: 52px; margin: 20px 0; font-size: 14px; line-height: 1.6; }
.metric { padding: 10px 0; border-top: 1px solid var(--line); display: flex; justify-content: space-between; gap: 8px; }
.metric span { color: var(--muted); font-size: 10px; }.metric strong { font: 11px/1 monospace; }
.turn-label { margin-top: 16px; color: var(--blue); font-size: 10px; }
/* The grid result: one card across the row, facts on the left and the
   topology drawing on the right. Red has a PMU, green is seen, grey is not. */
.frontier-card.grid-card { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(260px, .8fr) minmax(0, 1.4fr); gap: 28px; align-items: start; padding: 24px 28px; }
.grid-figure { margin: 0; min-width: 0; }
.grid-drawing { width: 100%; max-height: 460px; display: block; }
.grid-drawing line { stroke: #a5a7a7; stroke-width: 1.5; }
.grid-node circle { stroke: var(--paper); stroke-width: 1.5; }
.grid-node[data-state="pmu"] circle { fill: #d9534f; }.grid-node[data-state="seen"] circle { fill: #5cb87a; }.grid-node[data-state="unseen"] circle { fill: #6b7272; }
.grid-node text { fill: var(--muted); font: 11px/1 ui-monospace, monospace; }
.grid-legend { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 6px 18px; color: var(--muted); font-size: 11px; }
.grid-legend-item::before { content: ""; display: inline-block; width: 10px; height: 10px; margin-right: 6px; border-radius: 50%; vertical-align: -1px; }
.grid-legend-item[data-state="pmu"]::before { background: #d9534f; }.grid-legend-item[data-state="seen"]::before { background: #5cb87a; }.grid-legend-item[data-state="unseen"]::before { background: #6b7272; }
.grid-no-drawing { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.7; }
.provenance { padding: 24px 28px; border-top: 1px solid var(--strong-line); display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; background: var(--inverse-surface); color: var(--inverse-ink); }
.provenance div { min-width: 0; display: grid; gap: 7px; }.provenance span { color: var(--inverse-muted); font-size: 10px; }.provenance code, .provenance strong { overflow-wrap: anywhere; font: 11px/1.5 monospace; }
.frozen-input > p { color: var(--muted); line-height: 1.7; }
.facts-grid { grid-template-columns: repeat(5, 1fr); }

.state-panel { min-height: 360px; padding: clamp(32px, 6vw, 76px); border: 1px solid var(--strong-line); border-radius: var(--panel-radius); display: grid; grid-template-columns: 18px minmax(0, 900px); gap: 28px; align-content: center; background: var(--surface); }
.state-mark { width: 15px; height: 15px; margin-top: 5px; border: 2px solid var(--blue); border-top-color: transparent; animation: spin 1s linear infinite; }
.record-state:not([data-state="loading"]) .state-mark { border: 0; background: var(--danger); animation: none; }
.state-panel h1 { margin: 0; font-size: clamp(34px, 5vw, 58px); }
.state-panel p:not(.eyebrow) { color: var(--muted); line-height: 1.8; }
.state-panel .button-row { padding-top: 22px; border-top: 1px solid var(--line); }
.global-error { position: fixed; z-index: 100; right: 20px; bottom: 20px; width: min(440px, calc(100% - 40px)); padding: 17px 19px; border: 1px solid var(--danger); background: var(--surface); color: var(--danger); font-size: 13px; }
.site-footer { min-height: 88px; padding: 0 clamp(28px, 4vw, 60px); border-top: 1px solid var(--strong-line); display: flex; align-items: center; justify-content: space-between; gap: 20px; color: var(--quiet); font-size: 11px; }
.footer-brand { margin-left: auto; font: 10px/1.2 var(--display); letter-spacing: .12em; }
.authenticated .site-footer { padding-inline: max(48px, calc((100% - 1480px) / 2)); }

/* Shared surfaces use one restrained corner treatment. Pills remain fully
   rounded because their silhouette carries control and status meaning. */
.account-form, .admin-create,
.boundary-card,
.progress-panel, .result-panel, .state-panel { border-radius: var(--panel-radius); }

@media (min-width: 1800px) {
  .ai-workspace { width: 86vw; }
  .ai-page-heading h1 { font-size: 40px; }
  .ai-page-heading .lead { font-size: 14px; }
  .ai-layout { grid-template-columns: 280px minmax(640px, 1fr) minmax(360px, 430px); }
  .ai-panel-heading, .ai-chat-toolbar { min-height: 82px; }
}

@media (max-width: 1180px) {
  .ai-layout { height: auto; max-height: none; grid-template-columns: 220px minmax(0, 1fr); }
  .ai-conversation-panel, .ai-chat { min-height: 500px; }
  .ai-draft { grid-column: 1 / -1; min-height: 220px; border-top: 1px solid var(--line); border-left: 0; }
}

@media (max-width: 1024px) {
  .has-sidebar .app-sidebar { display: none; }
  .has-sidebar main, .has-sidebar .site-footer { margin-left: 0; }
  .site-header { padding-inline: 24px; grid-template-columns: auto 1fr; }
  .brand { padding: 0; border-right: 0; }
  .navigation-shell { grid-column: 1 / -1; grid-template-columns: 1fr auto; border-top: 1px solid var(--line); }
  .primary-nav { grid-column: 1; justify-self: start; }
  .session-navigation { grid-column: 2; }
  .primary-nav > a { min-height: 50px; }
  .session-navigation { padding-right: 0; }
  .session-navigation a, .session-navigation button { min-height: 50px; }
  .view { width: min(1120px, calc(100% - 80px)); }
  .authenticated .site-footer { padding-inline: clamp(28px, 4vw, 60px); }
  .brand-word { width: 130px; }
  .hero { min-height: 650px; padding: 180px 6vw 100px; }
  .hero h1 { font-size: clamp(48px, 6vw, 60px); }
  .home-directions { grid-template-columns: repeat(3, 1fr); row-gap: 30px; }
  .ai-layout { grid-template-columns: 210px minmax(0, 1fr); }
  .config-grid { grid-template-columns: minmax(0, 1fr); }
  .ticker-options { grid-template-columns: repeat(4, 1fr); }
  .ticker-option { border-bottom: 1px solid var(--line); }
  .frontier-cards { grid-template-columns: repeat(2, 1fr); }
  .frontier-card.grid-card { grid-template-columns: minmax(0, 1fr); }
  .frontier-card { border-bottom: 1px solid var(--line); }
  .facts-grid { grid-template-columns: repeat(2, 1fr); }
  .provenance { grid-template-columns: 1fr 1fr; }
  .frontier-cards.sqd-result-grid { grid-template-columns: 1fr; }
  .sqd-energy-summary { border-right: 0; border-bottom: 1px solid var(--strong-line); }
  .admin-create-form { grid-template-columns: 1fr 1fr; }
  .assistant-config-fields { grid-template-columns: 1fr; }
  .user-row { grid-template-columns: 1fr auto; }.password-reset-form { grid-column: 1 / -1; }
  .domain-card { padding: 22px; }
  .domain-card .domain-visual { width: 120px; height: 84px; right: 10px; }
  .domain-card h2 { max-width: calc(100% - 130px); }
  .paired-header { display: none; }
  .application-row { grid-template-columns: minmax(0, 1fr); }
  .application-row .panel { min-height: 0; }
  .application-row .case-panel { grid-template-columns: 90px minmax(0, 1fr); }
  .case-panel .domain-visual { width: 90px; height: 110px; }
}

@media (max-width: 700px) {
  .site-header { min-height: 62px; grid-template-columns: 1fr auto; padding-inline: 14px; }
  .brand { min-height: 62px; }
  .menu-button { align-self: center; min-width: 72px; min-height: 44px; border: 1px solid var(--strong-line); display: block; background: transparent; }
  .navigation-shell { grid-column: 1 / -1; display: block; }
  .navigation-shell:not(.open) { display: none; }
  /* Block-level boxes honour justify-self too, so the wide layouts' start/end
     would shrink the stacked menus; stretch them back to full rows. */
  .primary-nav { display: grid; justify-self: stretch; }
  .session-navigation { display: grid; justify-self: stretch; border-top: 1px solid var(--strong-line); }
  .session-navigation a, .session-navigation button { width: 100%; min-height: 52px; border-left: 0; border-bottom: 1px solid var(--line); justify-content: flex-start; }
  .primary-nav > a { width: 100%; min-height: 52px; justify-items: start; border-bottom: 1px solid var(--line); }
  /* Menu rows: the current page is a light row, not the top bar's underline. */
  .primary-nav > a, .session-navigation a { border-radius: 6px; }
  .primary-nav > a:hover, .session-navigation a:hover { background: var(--surface); }
  .primary-nav [aria-current="page"], .session-navigation [aria-current="page"] { background: var(--ink); color: var(--paper); border-bottom-color: transparent; }
  .primary-nav [aria-current="page"]::after { display: none; }
  .view { width: calc(100% - 24px); }
  .page-view, .record-state { padding-top: 24px; }
  .brand-word { width: 108px; }
  .hero { min-height: max(590px, calc(100svh - 275px)); padding: 118px 22px 88px; }
  .hero h1 { margin: 24px auto 22px; font-size: clamp(40px, 9vw, 54px); }
  .hero .eyebrow { gap: 10px; font-size: 9px; }
  .hero-copy p:not(.eyebrow) { max-width: 340px; margin-bottom: 26px; font-size: 13px; }
  .landing-view::after { background: radial-gradient(ellipse at 50% 35%, #060a0dbb 5%, #060a0d55 38%, transparent 70%), linear-gradient(0deg, #0b0f11 0%, transparent 52%); }
  .orbit-hint { bottom: 24px; font-size: 9px; }
  .home-directions { margin: 0 22px; padding: 16px 0 24px; grid-template-columns: 1fr 1fr; gap: 0; }
  .direction-entry, .direction-entry:first-child, .direction-entry:last-child { padding: 16px 0; border-right: 0; }
  .direction-entry:nth-child(even) { padding-left: 18px; }
  .direction-entry:nth-child(n+3) { border-top: 1px solid #36383899; }
  .direction-entry strong { font-size: 16px; }
  .landing .site-footer, .authenticated.landing .site-footer { padding-inline: 22px; }
  .ai-page-heading { min-height: 0; align-items: start; flex-direction: column; gap: 18px; }
  .ai-status { width: 100%; }
  .ai-layout { grid-template-columns: minmax(0, 1fr); overflow: visible; }
  .ai-conversation-panel { min-height: 250px; max-height: 330px; border-right: 0; border-bottom: 1px solid var(--line); }
  .ai-chat { min-height: 610px; }
  .ai-draft { grid-column: 1; }
  .composer-actions { align-items: stretch; flex-direction: column; }
  .composer-actions .button { width: 100%; }
  .ai-chat-toolbar { padding-inline: 16px; }
  .ai-messages { padding-inline: 16px; }
  .ai-message { width: 94%; }
  .ai-computation-inline { width: 94%; }
  .page-heading, .job-header { min-height: 0; align-items: start; flex-direction: column; }
  .page-heading { padding: 34px 0; }.boundary-card { align-self: stretch; }
  .jobs-heading { padding-top: 20px; }
  .jobs-heading-actions { width: 100%; display: grid; grid-template-columns: 1fr; }
  .jobs-heading-actions .button { width: 100%; }
  .jobs-overview { grid-template-columns: 1fr; }
  .jobs-overview div { min-height: 72px; grid-template-columns: 1fr auto; align-items: center; border-right: 0; border-bottom: 1px solid var(--line); }
  .jobs-overview div:last-child { border-bottom: 0; }
  .domain-grid { grid-template-columns: minmax(0, 1fr); }
  .domain-card h2 { max-width: none; margin-top: 65px; }
  .domain-card .domain-visual { width: 150px; height: 104px; right: 16px; top: 44px; }
  .card-bottom { align-items: start; flex-direction: column; }
  .coming-soon { padding: 22px; align-items: start; flex-direction: column; gap: 9px; }
  .coming-soon h2 { font-size: 18px; }
  .application-row .case-panel { grid-template-columns: minmax(0, 1fr); }
  .case-panel .domain-visual { display: none; }
  .actions .button { flex: 1 1 auto; }
  .brief-intro { min-height: 0; padding: 38px 0; }
  .brief-buttons { display: grid; }
  .brief-buttons .button { width: 100%; }
  .facts-strip { grid-template-columns: 1fr 1fr; }.facts-strip div { border-bottom: 1px solid var(--line); }
  .config-heading { margin: 18px 0 24px; flex-direction: column; gap: 4px; }
  .config-method { padding-top: 0; order: -1; font-size: 14px; }
  .upload-controls { grid-template-columns: minmax(0, 1fr); }
  .config-bottom { display: grid; grid-template-columns: minmax(0, 1fr); }
  .config-bottom .button { width: 100%; }
  .sqd-energy-summary, .sqd-diagnostic { padding: 28px 18px; }
  .sqd-primary-energy strong { font-size: 35px; }
  .sqd-chart { min-width: 0; min-height: 0; }
  .sqd-energy-figure { overflow: visible; }
  .account-form { grid-template-columns: minmax(0, 1fr); padding: 24px 18px; }
  #password-form > .button { grid-column: 1; }
  .admin-create-form, .user-row, .password-reset-form { grid-template-columns: 1fr; }
  .assistant-admin-heading { align-items: start; flex-direction: column; gap: 10px; }
  .assistant-admin-detail { text-align: left; }
  .assistant-config-fields { grid-template-columns: 1fr; }
  .assistant-admin-actions { display: grid; grid-template-columns: 1fr; }
  .user-row { padding: 20px 16px; }
  .user-row > .button, .password-reset-form .button { width: 100%; }
  #admin-view .recent-section .section-heading { align-items: stretch; flex-direction: column; justify-content: center; }
  #admin-view .recent-section .section-heading .button { width: 100%; }
  .state-panel { min-height: 320px; padding: 28px 20px; grid-template-columns: 14px minmax(0, 1fr); gap: 16px; }
  .state-panel .button-row { display: grid; grid-template-columns: 1fr; }
  .state-panel .button { width: 100%; }
  .job-header { padding: 20px 0 28px; display: flex; }
  .save-indicator, .job-status { width: 100%; }
  .section-heading { min-height: 92px; }.section-heading.compact { display: grid; }
  .job-group .section-heading.compact, .ai-draft .section-heading.compact { display: flex; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .ticker-options { grid-template-columns: 1fr 1fr; }
  .record-row { grid-template-columns: 1fr auto; gap: 10px; }.record-row time { grid-column: 1 / -1; }.record-row > span:last-child { display: none; }
  .draft-row { padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 0; }.draft-row-link { width: 100%; padding: 16px 4px 10px; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; }.draft-row-link time { grid-column: 1 / -1; }.draft-row-link > div { min-width: 0; }.draft-row-link > span:last-child { display: none; }.draft-delete { min-width: 0; margin: -4px 0 8px; padding-inline: 8px; justify-self: end; }
  .job-header { width: 100%; padding: 24px 20px; }
  .job-header .job-status { margin-top: 8px; }
  .frozen-input .section-heading { align-items: stretch; flex-direction: column; }
  .frozen-input .section-heading .button { width: 100%; }
  .filters { overflow-x: auto; }.filters button { flex: 0 0 auto; padding-inline: 16px; }
  .result-intro, .frontier-cards, .provenance, .facts-grid { grid-template-columns: 1fr; }
  .frontier-card, .facts-grid div { border-right: 0; }
  .site-footer { padding-block: 20px; align-items: start; flex-direction: column; }
  .footer-brand { margin-left: 0; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

.execution-controls { margin-bottom: 24px; }
.execution-config-link { margin-top: 16px; }
.account-sections { margin: 24px 0; display: flex; flex-wrap: wrap; gap: 12px; }
#password-form, #guodun-admin { scroll-margin-top: calc(var(--header) + 24px); }
.execution-controls .form-grid { max-width: 720px; }
#guodun-admin { margin-top: 32px; }
.execution-confirmation { margin: 24px 0; padding: 28px; border: 1px solid var(--line); background: var(--surface, #fff); }
.execution-confirmation .facts-grid { margin: 20px 0; }
.execution-consent { display: flex; align-items: flex-start; gap: 10px; margin: 20px 0; cursor: pointer; }
.execution-consent input { margin-top: 4px; }

/* Single-point portfolio result: the result card beside the risk-return chart of every combination. */
.frontier-cards.single-result { grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); }
.frontier-card.risk-return h3 { min-height: 0; margin: 0 0 4px; }
.frontier-card.risk-return p { margin: 0; color: var(--muted); font-size: 13px; }
.rr-chart { width: 100%; height: auto; display: block; margin-top: 8px; }
.rr-chart text { fill: var(--muted); font: 12px/1 ui-monospace, monospace; }
.rr-chart .rr-axis { stroke: var(--strong-line); stroke-width: 1; }
.rr-chart .rr-dot { fill: var(--line); }
.rr-chart .rr-pick { fill: var(--accent); }
.rr-chart .rr-pick-label { fill: var(--ink); font: 600 12px/1 var(--display, sans-serif); }
@media (max-width: 900px) { .frontier-cards.single-result { grid-template-columns: minmax(0, 1fr); } }
/* QUBO result charts across the whole row: the frontier above its cards, the molecule
   ranking and the PMU coverage curve below their wide card. */
.frontier-card.wide-chart { grid-column: 1 / -1; border-right: 0; padding: 24px 28px; }
.frontier-card.wide-chart:first-child { border-bottom: 1px solid var(--line); }
.frontier-card + .frontier-card.wide-chart { border-top: 1px solid var(--line); }
.frontier-card.wide-chart .rr-chart { max-width: 720px; }
.frontier-card.wide-chart .chart-note { margin-top: 8px; max-width: 720px; color: var(--ink); line-height: 1.7; }
.frontier-card.wide-chart p:not(.chart-note) { max-width: 720px; line-height: 1.7; }
.rr-chart .rr-grid { stroke: var(--line); stroke-width: 1; }
.rr-chart .rr-path { fill: none; stroke: var(--muted); stroke-width: 1.5; stroke-dasharray: 5 4; }
.rr-chart .rr-front { stroke: var(--ink); stroke-width: 1; }
.rr-chart .rr-bar { fill: var(--strong-line); }
.rr-chart .rr-tie { fill: color-mix(in srgb, var(--accent) 40%, var(--surface)); }
.rr-chart .rr-mark { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 4 4; }
.rr-chart .rr-line { fill: none; stroke: var(--muted); stroke-width: 1.5; }
.rr-chart .rr-node { fill: var(--muted); }
.rr-chart .rr-ring { fill: none; stroke: var(--success); stroke-width: 2; }
.rr-chart .rr-value { paint-order: stroke; stroke: var(--surface); stroke-width: 4px; stroke-linejoin: round; }
@media (max-width: 700px) { .frontier-card.wide-chart { padding: 22px 16px; } }

/* The portfolio data block: the upload field on its own row under the dataset choice; a file button in the site's style. */
.upload-controls.stacked { grid-template-columns: minmax(0, 1fr); align-items: start; }
.field input[type="file"] { padding: 8px 10px; color: var(--muted); }
.field input[type="file"]::file-selector-button { margin-right: 12px; padding: 7px 14px; border: 1px solid var(--strong-line); border-radius: 999px; background: var(--surface); color: var(--ink); font: inherit; cursor: pointer; }
.field input[type="file"]::file-selector-button:hover { border-color: var(--ink); }
.field-error.hint { color: var(--muted); }
/* QAOA run-time estimate: a calm note, not an error; submit stays allowed. */
.qaoa-time-warning { margin: 14px 0 0; padding: 12px 16px; border-left: 4px solid var(--pending); background: var(--blue-soft); color: var(--ink); font-size: 13px; line-height: 1.7; }

/* QAOA single point: the comparison with the exact classical optimum, and one line on the samples. */
.quantum-check { margin-top: 16px; width: fit-content; padding: 2px 12px; border: 1px solid currentColor; border-radius: 999px; font-size: 13px; font-weight: 600; }
.quantum-check.match { color: var(--success); }
.quantum-check.miss { color: var(--danger); }
