@charset "UTF-8";
/* UI67 Clean + Friendly: warm white, charcoal type and restrained berry actions.
   Adapted for a Chinese decision tool; no marketing layout or remote fonts. */
:root {
  --bg: #faf8f7;
  --paper: #fff;
  --surface-soft: #f5e7ed;
  --ink: #29262a;
  --muted: #6f6670;
  --line: #e7dde2;
  --control-line: #8d7e88;
  --action-hover: #803250;
  --product-tint: #f0e3e9;
  --product-cap: #806574;
  --chart-grid: #91818c;
  --accent: #9c3f63;
  --action: #9c3f63;
  --danger: #963a32;
  --danger-bg: #fcece7;
  --warning: #7a5200;
  --warning-bg: #fff4d6;
  --success: #42613d;
  --success-bg: #ecf1e4;
  --chart-a: #9c3f63;
  --chart-b: #466c60;
  --chart-concern: #8a631c;
  --chart-unknown: #716974;
  --radius: 12px;
  /* Compatibility aliases for existing data and form components. */
  --green: var(--action);
  --mint: var(--surface-soft);
  --amber: var(--warning);
  --rose: var(--danger);
  --purple: #766180;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 16px;
  line-height: 1.7;
  color: var(--ink);
  background: var(--bg);
  font-variant-numeric: tabular-nums;
  color-scheme: light;
}
* { box-sizing: border-box; }
body { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button, a, input, select, textarea, summary { touch-action: manipulation; }
button { cursor: pointer; }
button, input, select, textarea { max-width: 100%; }
button {
  min-height: 44px;
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: 8px;
  padding: 9px 16px;
  font-size: 14px;
  line-height: 1.6;
  transition: background-color 150ms ease, border-color 150ms ease;
}
button:hover { border-color: var(--action); background-color: var(--bg); }
button:active { background-color: var(--surface-soft); }
button:disabled { opacity: 1; color: #766e76; background: #eee9ed; border-color: #d9cfd6; cursor: not-allowed; }
:focus-visible { outline: 3px solid var(--action); outline-offset: 3px; }
a { color: var(--action); text-underline-offset: 4px; overflow-wrap: anywhere; }
a:hover { text-decoration-thickness: 2px; }
h1, h2, h3, p { margin-top: 0; }
h1 { font-family: "Songti SC", "STSong", serif; font-size: 32px; line-height: 1.35; margin-bottom: 10px; font-weight: 700; letter-spacing: 0; }
h2 { font-size: 22px; line-height: 1.45; font-weight: 650; margin-bottom: 16px; }
h3 { font-size: 18px; line-height: 1.5; font-weight: 650; margin-bottom: 12px; }
p { line-height: 1.75; margin-bottom: 16px; }
small, .muted { font-size: 14px; color: var(--muted); }
small { line-height: 1.65; }
strong { font-weight: 650; }
img, svg { max-width: 100%; }
.app-shell { display: grid; grid-template-columns: 208px minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 28px 16px 20px; border-right: 1px solid var(--line); display: flex; flex-direction: column; background: var(--bg); }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-family: "Songti SC", "STSong", serif; font-size: 21px; font-weight: 700; line-height: 1.4; }
.brand small { display: none; }
.brandmark { display: grid; place-items: center; width: 36px; height: 36px; flex: 0 0 auto; background: var(--action); color: var(--paper); border-radius: 8px; font: 600 20px/1 -apple-system, BlinkMacSystemFont, "PingFang SC", sans-serif; }
.mode-label { font-size: 14px; color: var(--muted); margin: 18px 0 28px; }
.mode-label i { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); margin-right: 7px; }
.sidebar nav { display: grid; gap: 6px; }
.sidebar nav button { text-align: left; display: flex; align-items: center; gap: 10px; background: transparent; border: 1px solid transparent; padding: 12px; color: var(--muted); min-width: 0; font-size: 14px; }
.sidebar nav button svg { width: 20px; height: 20px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; }
.sidebar nav button:hover { background: var(--surface-soft); color: var(--ink); }
.sidebar nav button.active { background: var(--surface-soft); color: var(--action); box-shadow: inset 3px 0 var(--action); font-weight: 650; }
.sidebar-bottom { margin-top: auto; padding-top: 24px; }
.sidebar-bottom p { font-size: 14px; line-height: 1.7; margin: 20px 0 0; color: var(--muted); }
.profile-chip { display: flex; align-items: center; gap: 8px; width: 100%; padding: 12px 0; background: transparent; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; text-align: left; font-size: 14px; }
.profile-chip > span:nth-child(2) { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.avatar { display: grid; place-items: center; width: 30px; height: 30px; flex: 0 0 auto; background: var(--surface-soft); border: 1px solid var(--line); border-radius: 50%; font-size: 14px; }
.topbar { min-height: 64px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 8px 32px; color: var(--muted); font-size: 14px; background: var(--bg); }
.topbar > div { display: flex; gap: 12px; align-items: center; min-width: 0; }
.topbar .mobile-brand { display: none; }
.topbar .mobile-settings { display: none; }
.topbar .text-button { white-space: nowrap; }
.pill, .tag { display: inline-block; border: 1px solid var(--line); border-radius: 5px; padding: 4px 8px; font-size: 14px; background: var(--bg); line-height: 1.6; overflow-wrap: anywhere; }
.pill { background: transparent; }
.workspace { min-width: 0; }
main { max-width: 1280px; margin: auto; padding: 32px; min-height: calc(100vh - 136px); }
footer { padding: 8px 32px 24px; font-size: 14px; line-height: 1.7; color: var(--muted); }
.page-head { display: flex; justify-content: space-between; gap: 24px; align-items: center; margin-bottom: 24px; }
.page-head > div { min-width: 0; }
.page-head .actions:empty { display: none; }
.eyebrow { font-size: 14px; color: var(--muted); margin-bottom: 8px; line-height: 1.6; }
.eyebrow:empty { display: none; }
.subtitle { color: var(--muted); font-size: 16px; max-width: 76ch; margin-bottom: 0; }
.primary { background: var(--action); border-color: var(--action); color: var(--paper); }
.primary:hover, .primary:active { color: var(--paper); background: var(--action-hover); border-color: var(--action-hover); }
.secondary { background: var(--surface-soft); border-color: var(--line); color: var(--ink); }
.danger { color: var(--danger); }
.text-button { background: transparent; border-color: transparent; color: var(--action); padding: 8px 10px; font-size: 14px; }
.text-button.danger { color: var(--danger); }
.text-button:hover { background: var(--surface-soft); border-color: transparent; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.actions > * { flex-shrink: 0; }
.panel { min-width: 0; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; margin-bottom: 24px; }
.panel-title { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 20px; }
.panel-title h2, .panel-title h3 { margin: 0; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
/* Kept for pre-existing templates; compact prompt replaces decorative hero. */
.hero, .profile-prompt { display: flex; justify-content: space-between; align-items: center; gap: 24px; padding: 20px 24px; background: var(--surface-soft); border: 1px solid var(--line); border-radius: 8px; margin-bottom: 24px; }
.hero h2, .profile-prompt h2, .profile-prompt h3 { font-size: 18px; margin-bottom: 8px; }
.hero .actions { margin-top: 12px; }
.hero-art { display: none; }
.profile-prompt p { margin-bottom: 0; }
.profile-prompt .actions { flex-shrink: 0; }
.bottle { width: 58px; height: 100px; background: #fffafa; border: 1px solid var(--control-line); border-radius: 8px; position: relative; flex-shrink: 0; }
.bottle::before { content: ""; position: absolute; top: -17px; width: 30px; height: 17px; background: var(--product-cap); left: 13px; border-radius: 4px 4px 0 0; }
.bottle::after { content: "演示"; position: absolute; top: 35px; width: 100%; text-align: center; font-size: 14px; color: var(--muted); }
.bottle.alt { width: 70px; height: 82px; background: var(--product-tint); }
.bottle.alt::before { width: 70px; left: -1px; background: var(--product-cap); }
.bottle.alt::after { top: 26px; }
.empty { padding: 32px 24px; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: 8px; }
.empty h3 { color: var(--ink); margin: 8px 0 12px; }
.empty p { max-width: 58ch; margin-left: auto; margin-right: auto; }
.entry-card { padding: 20px 0; border-top: 1px solid var(--line); background: transparent; }
.entry-card p { font-size: 14px; color: var(--muted); margin-bottom: 8px; }
.metric { font-size: 28px; line-height: 1.4; }
.metric svg { width: 40px; height: 40px; fill: none; stroke: currentColor; stroke-width: 1.5; }
.records-toolbar { display: flex; gap: 16px; align-items: end; margin-bottom: 8px; }
.records-toolbar .field { flex: 1; margin-bottom: 0; }
.record-list { min-width: 0; }
.record { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 16px; align-items: center; padding: 20px 0; border-bottom: 1px solid var(--line); }
.record:last-child { border-bottom: 0; }
.record h3 { margin: 0 0 6px; overflow-wrap: anywhere; }
.record p { margin: 0; font-size: 14px; color: var(--muted); overflow-wrap: anywhere; }
.record-icon svg { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.record-icon { display: grid; place-items: center; height: 44px; background: var(--surface-soft); border-radius: 8px; color: var(--action); font-size: 20px; }
.status { display: inline-block; padding: 4px 9px; border-radius: 5px; font-size: 14px; background: var(--surface-soft); color: var(--ink); line-height: 1.6; }
.status.avoid, .notice.error { background: var(--danger-bg); color: var(--danger); }
.status.pending, .status.insufficient, .status.hold, .notice.warn { background: var(--warning-bg); color: var(--warning); }
.status.success, .notice.success { background: var(--success-bg); color: var(--success); }
.notice { padding: 16px; background: var(--surface-soft); border-radius: 8px; margin: 16px 0; font-size: 14px; line-height: 1.8; overflow-wrap: anywhere; }
.notice p:last-child { margin-bottom: 0; }
.notice .actions { margin-top: 12px; }
.field { display: block; min-width: 0; margin-bottom: 20px; font-size: 14px; }
.field > span { display: block; margin-bottom: 8px; font-weight: 600; }
.field input, .field select, .field textarea { width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid var(--control-line); border-radius: 8px; background: var(--paper); font-size: 16px; }
.field textarea { resize: vertical; min-height: 120px; line-height: 1.7; }
.field small { display: block; line-height: 1.65; margin-top: 8px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; margin: 12px 0; padding: 8px 0; line-height: 1.7; min-height: 44px; }
.check input { margin: 4px 0 0; width: 18px; height: 18px; flex-shrink: 0; accent-color: var(--action); }
.tabs { display: flex; gap: 4px; padding: 4px; background: var(--surface-soft); border-radius: 8px; margin-bottom: 24px; }
.tabs button { flex: 1; border: 1px solid transparent; background: transparent; }
.tabs button.active { background: var(--paper); border-color: var(--line); font-weight: 600; }
.upload { display: block; border: 1px dashed var(--control-line); background: var(--bg); border-radius: 8px; padding: 24px; text-align: center; font-size: 16px; line-height: 1.7; }
.upload input { display: block; max-width: 100%; min-height: 44px; margin: 16px auto 0; font-size: 14px; }
.upload input::file-selector-button { min-height: 44px; margin-right: 8px; padding: 8px 12px; color: var(--ink); background: var(--paper); border: 1px solid var(--line); border-radius: 8px; }
.image-preview { display: flex; gap: 12px; flex-wrap: wrap; margin: 16px 0; }
.image-preview > div { display: flex; flex-direction: column; align-items: start; }
.image-preview img { height: 110px; width: 110px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.steps { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin: 0 0 24px; font-size: 14px; color: var(--muted); }
.steps b { color: var(--action); }
.ingredient-tags { display: flex; gap: 8px; flex-wrap: wrap; margin: 16px 0; }
.ingredient-tags span { padding: 6px 10px; background: var(--surface-soft); border-radius: 5px; font-size: 14px; overflow-wrap: anywhere; }
.analysis-summary { display: grid; grid-template-columns: minmax(0, 1fr) 160px; gap: 24px; }
.analysis-summary h2 { font-size: 24px; }
.result-facts { background: var(--bg); border-left: 1px solid var(--line); padding: 24px; font-size: 14px; color: var(--muted); }
.result-facts > strong { display: block; font-size: 40px; line-height: 1.5; color: var(--ink); margin: 12px 0; }
.result-facts > strong small { margin-left: 6px; }
.result-facts p { margin-bottom: 0; font-size: 14px; }
.list { padding-left: 22px; line-height: 1.9; font-size: 16px; overflow-wrap: anywhere; }
.list li + li { margin-top: 6px; }
.table-wrap { max-width: 100%; overflow: auto; overscroll-behavior-inline: contain; }
table { border-collapse: collapse; width: 100%; font-size: 14px; text-align: left; }
th { font-weight: 600; color: var(--muted); background: var(--bg); }
th, td { padding: 14px; border-bottom: 1px solid var(--line); vertical-align: top; line-height: 1.7; overflow-wrap: anywhere; }
td small { display: block; margin-top: 4px; }
.bar { display: flex; height: 16px; border-radius: 4px; overflow: hidden; background: var(--surface-soft); margin: 16px 0; }
.legend { display: flex; gap: 16px; font-size: 14px; flex-wrap: wrap; }
.dot { display: inline-block; height: 9px; width: 9px; border-radius: 50%; background: var(--action); margin-right: 7px; }
.product-card { display: grid; grid-template-columns: 84px minmax(0, 1fr); gap: 20px; padding: 24px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); min-width: 0; }
.product-art { background: var(--surface-soft); border-radius: 8px; min-height: 140px; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.product-art .bottle { transform: scale(.8); margin-top: 16px; }
.product-card h3 { margin: 4px 0 8px; overflow-wrap: anywhere; }
.product-card p { font-size: 14px; color: var(--muted); margin: 10px 0; }
.product-card .price { font-size: 18px; color: var(--ink); }
.product-card .actions button { padding: 8px 10px; font-size: 14px; }
/* Full-width comparison: product descriptions never consume radar width. */
.compare-layout { display: flex; flex-direction: column; gap: 16px; align-items: stretch; min-width: 0; }
.compare-meta { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; padding: 0; }
.compare-meta .comparison-item { padding: 8px 0 12px; border-bottom: 1px solid var(--line); min-width: 0; }
.compare-panel > .grid2 .field { margin-bottom: 8px; }
.compare-meta .chart-key { margin: 0 0 6px; line-height: 1.6; }
.comparison-item h3 { font-size: 18px; margin: 0 0 8px; overflow-wrap: anywhere; }
.comparison-item p { margin: 4px 0; font-size: 14px; overflow-wrap: anywhere; }
.radar-wrap { width: 100%; max-width: 800px; min-width: 0; margin: 0 auto; }
.radar { width: 100%; height: auto; max-height: none; min-height: 0; display: block; overflow: visible; }
.radar text { font-size: 16px; fill: var(--muted); }
.radar .value { font-size: 14px; font-weight: 600; fill: var(--ink); }
.radar .chart-a { color: var(--chart-a); }
.radar .chart-b { color: var(--chart-b); }
.chart-heading { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin: 0; }
.chart-heading h3 { margin-bottom: 0; }
.chart-key { display: flex; align-items: center; gap: 16px 24px; flex-wrap: wrap; font-size: 14px; margin: 12px 0; }
.chart-key > span { display: inline-flex; align-items: center; gap: 8px; }
.chart-key .chart-a::before, .chart-key .chart-b::before { content: ""; width: 24px; height: 0; border-top: 3px solid var(--chart-a); }
.chart-key .chart-b::before { border-top-color: var(--chart-b); border-top-style: dashed; }
.source-summary summary { min-height: 44px; padding: 12px 0; cursor: pointer; color: var(--action); }
.source-summary article { border-top: 1px solid var(--line); padding: 16px 0; }
.source-summary article p { margin: 8px 0; }
.source-summary { font-size: 14px; color: var(--muted); line-height: 1.8; overflow-wrap: anywhere; }
.axis-options { display: flex; gap: 4px 16px; flex-wrap: wrap; margin-top: 16px; }
.axis-options label { min-height: 44px; padding: 8px 0; font-size: 14px; display: flex; align-items: center; gap: 8px; cursor: pointer; }
.axis-options input { width: 18px; height: 18px; margin: 0; accent-color: var(--action); }
.chat-layout { display: grid; grid-template-columns: minmax(0, 1fr) 240px; gap: 24px; align-items: start; }
.chat-layout > .panel { display: flex; flex-direction: column; }
.messages { min-height: 320px; max-height: 560px; overflow: auto; display: flex; flex-direction: column; gap: 16px; padding: 4px; scroll-padding-block: 16px; }
.message { border: 1px solid var(--line); background: var(--bg); padding: 16px 20px; border-radius: 4px 12px 12px 12px; max-width: 94%; line-height: 1.85; font-size: 16px; white-space: pre-wrap; overflow-wrap: anywhere; }
.message.user { background: var(--surface-soft); align-self: flex-end; border-color: transparent; border-radius: 12px 4px 12px 12px; }
.message-label { font-size: 14px; color: var(--muted); display: block; margin-bottom: 8px; }
.chat-form { display: flex; gap: 8px; border-top: 1px solid var(--line); padding-top: 16px; margin-top: 20px; }
.chat-form input { flex: 1; min-width: 0; min-height: 44px; padding: 11px 12px; border: 1px solid var(--control-line); border-radius: 8px; font-size: 16px; }
.suggestions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.suggestions button { font-size: 14px; padding: 8px 10px; text-align: left; }
.chat-aside .field { margin-bottom: 8px; }
.mobile-context { margin-bottom: 16px; }
.mobile-context summary { min-height: 44px; padding: 8px 0; cursor: pointer; font-size: 14px; font-weight: 600; }
.scenario { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 16px; margin-top: 16px; }
.scenario svg { display: block; width: 100%; max-height: 150px; }
.scenario small { font-size: 14px; line-height: 1.65; display: block; }
.divider { border: 0; border-top: 1px solid var(--line); margin: 24px 0; }
.feedback-card { padding: 20px 0; border-bottom: 1px solid var(--line); font-size: 16px; }
.feedback-card:last-child { border-bottom: 0; }
.feedback-card p { white-space: pre-wrap; overflow-wrap: anywhere; margin: 12px 0; }
.feedback-card strong { font-weight: 650; }
.tagrow { display: flex; gap: 6px; flex-wrap: wrap; }
dialog { border: 1px solid var(--line); border-radius: 12px; padding: 28px; width: min(760px, calc(100vw - 40px)); max-height: 90dvh; overflow: auto; color: var(--ink); background: var(--bg); }
dialog::backdrop { background: #29262a80; }
.dialog-head { display: flex; align-items: start; justify-content: space-between; gap: 20px; }
.dialog-head > div { min-width: 0; }
.dialog-head h2 { margin: 0 0 12px; }
.dialog-head button { width: 44px; min-width: 44px; border: 0; background: transparent; padding: 4px; font-size: 26px; line-height: 1; }
.dialog-foot { position: sticky; bottom: -28px; margin: 24px -28px -28px; padding: 16px 28px; background: var(--bg); border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; z-index: 1; }
.dialog-foot button { min-height: 44px; }
#toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); border-radius: 8px; background: var(--ink); color: var(--paper); padding: 14px 20px; max-width: min(90%, 640px); display: none; z-index: 100; font-size: 14px; line-height: 1.7; overflow-wrap: anywhere; }
.skip { position: absolute; left: -1000px; top: 8px; }
.skip:focus { left: 8px; z-index: 100; background: var(--paper); padding: 12px 16px; }
.hide { display: none !important; }
.inline { display: inline; }
.source-links { display: flex; gap: 12px 20px; flex-wrap: wrap; font-size: 14px; }
.source-links a { display: inline-block; padding-block: 8px; min-height: 44px; }
.section-note { font-size: 14px; line-height: 1.75; color: var(--muted); margin-top: 16px; overflow-wrap: anywhere; }
.warning-banner { background: var(--warning-bg); color: var(--warning); padding: 16px 20px; border-radius: 8px; margin-bottom: 24px; font-size: 14px; line-height: 1.75; overflow-wrap: anywhere; }
.value-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 20px 0; }
.value-list div { padding: 16px; background: var(--bg); border-radius: 8px; font-size: 14px; }
.value-list b { display: block; font-size: 24px; font-weight: 600; margin-top: 6px; }
.meta { font-size: 14px; color: var(--muted); line-height: 1.8; overflow-wrap: anywhere; }
.confirm-list { font-size: 16px; line-height: 1.9; white-space: pre-wrap; }
.full { width: 100%; }
/* The library appends its own baseline CSS at run time. Increased specificity
   keeps its source labels and controls at the same readable project scale. */
#content .bsl { color: var(--ink); font-size: 16px; }
#content .bsl h1 { font-size: 32px; }
#content .bsl h2 { font-size: 22px; }
#content .bsl h3 { font-size: 18px; }
#content .bsl .bsl-intro { font-size: 16px; }
#content .bsl .bsl-boundary { font-size: 14px; border-left-color: var(--action); background: var(--surface-soft); }
#content .bsl .bsl-field, #content .bsl .bsl-status, #content .bsl .bsl-inci,
#content .bsl .bsl-tag, #content .bsl .bsl-description, #content .bsl .bsl-description strong,
#content .bsl .bsl-source, #content .bsl .bsl-source p, #content .bsl .bsl-review,
#content .bsl .bsl-pagination, #content .bsl .bsl-formula, #content .bsl .bsl-survey-card > p,
#content .bsl .bsl-observation, #content .bsl .bsl-notes, #content .bsl .bsl-privacy { font-size: 14px; }
#content .bsl .bsl-button, #content .bsl .bsl-token, #content .bsl .bsl-tab { min-height: 44px; font-size: 14px; line-height: 1.6; }
#content .bsl .bsl-field input, #content .bsl .bsl-field select { min-height: 44px; font-size: 16px; border-color: var(--control-line); }
#content .bsl .bsl-source summary, #content .bsl .bsl-notes summary { min-height: 44px; padding: 8px 0; }
#content .bsl .bsl-tab[aria-selected=true] { color: var(--action); border-bottom-color: var(--action); }
#content .bsl .bsl-card, #content .bsl .bsl-survey-card { padding: 24px; }
#content .bsl .bsl-grid { gap: 20px; }
#content .bsl .bsl-card h3 { margin-bottom: 8px; }
#content .bsl .bsl-observation { gap: 6px 12px; }
#content .bsl .bsl-observation progress { height: 8px; accent-color: var(--action); }
#content .bsl .bsl-review { color: var(--warning); background: var(--warning-bg); border-color: #d8bb7a; }
#content .bsl .bsl-notes { overflow-wrap: anywhere; }
#content .bsl button:focus-visible, #content .bsl input:focus-visible,
#content .bsl select:focus-visible, #content .bsl summary:focus-visible { outline: 3px solid var(--action); outline-offset: 3px; }
@media (max-width: 1099px) and (min-width: 721px) {
  .app-shell { grid-template-columns: 184px minmax(0, 1fr); }
  .sidebar { padding: 24px 12px; }
  .brand { font-size: 19px; gap: 8px; }
  .brandmark { width: 32px; height: 34px; }
  .topbar { padding-inline: 24px; }
  main { padding: 28px 24px; }
  footer { padding-inline: 24px; }
  .grid3 { grid-template-columns: 1fr; }
  .grid2 { gap: 16px; }
  .chat-layout { grid-template-columns: minmax(0, 1fr) 208px; gap: 16px; }
  .product-card { grid-template-columns: 1fr; }
  .product-card .product-art { display: none; }
  .record { grid-template-columns: 40px minmax(0, 1fr); }
  .record > .actions { grid-column: 2; }
  .pill { display: none; }
  .radar text { font-size: 20px; }
  .radar .value { font-size: 18px; }
}
@media (max-width: 720px) {
  .app-shell { display: block; }
  .sidebar { position: fixed; top: auto; bottom: 0; left: 0; width: 100%; height: auto; padding: 0; border-right: 0; border-top: 1px solid var(--line); background: var(--bg); z-index: 30; }
  .sidebar > .brand, .sidebar > .mode-label, .sidebar-bottom { display: none; }
  .sidebar nav { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0; padding: 6px 4px max(6px, env(safe-area-inset-bottom)); }
  .sidebar nav button { display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 3px; padding: 6px 2px; min-height: 56px; border-radius: 5px; font-size: 14px; line-height: 1.5; text-align: center; white-space: normal; }
  .sidebar nav button span { display: block; font-size: 14px; line-height: 1.5; white-space: nowrap; }
  .sidebar nav button svg { width: 20px; height: 20px; }
  .sidebar nav button.active { background: var(--surface-soft); box-shadow: none; color: var(--action); }
  .topbar { position: sticky; top: 0; z-index: 20; min-height: 64px; padding: 8px 16px; gap: 8px; font-size: 14px; }
  .topbar > div { gap: 4px; }
  #breadcrumb { display: none; }
  .topbar .mobile-brand { display: flex; align-items: center; gap: 8px; font-family: "Songti SC", "STSong", serif; font-size: 18px; font-weight: 700; color: var(--ink); white-space: nowrap; }
  .topbar .mobile-brand .brandmark { width: 30px; height: 32px; font-size: 18px; }
  .topbar .mobile-settings { display: inline-flex; }
  .topbar .text-button { padding-inline: 6px; }
  .pill { display: none; }
  main { padding: 24px 16px; min-height: calc(100dvh - 190px); }
  footer { padding: 8px 16px calc(92px + env(safe-area-inset-bottom)); font-size: 14px; }
  h1 { font-size: 26px; }
  h2 { font-size: 20px; }
  h3 { font-size: 18px; }
  .page-head { align-items: flex-start; flex-wrap: wrap; gap: 16px; margin-bottom: 24px; }
  .page-head .actions { width: 100%; }
  .subtitle { font-size: 16px; }
  .panel { padding: 16px; border-radius: 10px; }
  .panel-title { align-items: flex-start; flex-wrap: wrap; gap: 8px; }
  .grid2, .grid3 { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .hero, .profile-prompt { flex-direction: column; align-items: stretch; gap: 16px; padding: 16px; }
  .hero h2 { font-size: 20px; }
  .hero .actions { margin-top: 16px; }
  .entry-card { padding: 16px 0; }
  .records-toolbar { align-items: stretch; flex-wrap: wrap; }
  .records-toolbar .field { flex-basis: 100%; }
  .record { grid-template-columns: 36px minmax(0, 1fr); gap: 12px; padding: 20px 0; }
  .record > .actions { grid-column: 2; gap: 4px 8px; }
  .record-icon { height: 36px; font-size: 18px; }
  .record p { font-size: 14px; }
  .compare-panel > .grid2 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .compare-panel > .grid2 .field { margin-bottom: 8px; }
  .compare-layout { gap: 12px; }
  .compare-meta { gap: 16px; }
  .compare-meta .comparison-item { padding: 4px 0 12px; }
  .compare-panel > .grid2 .field { margin-bottom: 8px; }
.compare-meta .chart-key { margin: 0 0 6px; line-height: 1.6; }
.comparison-item h3 { font-size: 16px; }
  .comparison-item p { font-size: 14px; }
  .radar-wrap { width: calc(100% + 32px); max-width: none; margin-inline: -16px; }
  .radar { min-height: 0; max-height: none; width: 100%; height: auto; }
  .radar text { font-size: 24px; }
  .radar .value { font-size: 24px; }
  .axis-options { gap: 0 16px; margin-top: 12px; }
  .axis-options label { font-size: 14px; }
  .chat-layout { display: flex; flex-direction: column; gap: 16px; }
  .chat-layout > .panel, .chat-layout > aside { width: 100%; }
  .chat-aside { order: -1; }
  .chat-aside .panel { padding: 16px; margin-bottom: 0; }
  .chat-aside .scenario { display: none; }
  .chat-aside h3 { font-size: 16px; margin: 0 0 8px; }
  .chat-aside p { font-size: 14px; margin-bottom: 12px; }
  .messages { max-height: 58dvh; min-height: 260px; gap: 12px; padding: 0; }
  .message { font-size: 16px; max-width: 96%; padding: 14px 16px; }
  .message-label { font-size: 14px; }
  .chat-form { position: static; background: var(--paper); padding-top: 12px; padding-bottom: 8px; }
  .chat-form button { padding-inline: 12px; }
  .suggestions { gap: 8px; }
  .analysis-summary { grid-template-columns: minmax(0, 1fr); }
  .analysis-summary > .product-art { display: none; }
  .result-facts { border-left: 0; border-top: 1px solid var(--line); padding: 16px 0 0; }
  .result-facts > strong { font-size: 28px; margin: 4px 0; }
  .analysis-summary h2 { font-size: 22px; }
  .table-wrap { margin-inline: 0; }
  table { min-width: 460px; }
  th, td { padding: 12px; font-size: 14px; }
  .product-card { grid-template-columns: 64px minmax(0, 1fr); padding: 16px; gap: 16px; }
  .product-art { min-height: 120px; }
  .product-art .bottle { transform: scale(.65); }
  .product-card .actions { grid-column: 1/-1; }
  .product-card .actions button { min-height: 44px; }
  .steps { font-size: 14px; gap: 6px 10px; }
  .steps > span:empty { display: none; }
  .value-list { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .value-list div { padding: 12px 16px; }
  .value-list b { display: inline; margin-left: 10px; font-size: 22px; }
  .source-links { display: block; }
  .source-links a { display: block; }
  .empty { padding: 24px 16px; }
  dialog { position: fixed; inset: 0; width: 100%; height: 100dvh; max-width: 100%; max-height: 100dvh; margin: 0; padding: 20px 16px; border: 0; border-radius: 0; }
  .dialog-head { gap: 12px; }
  .dialog-head h2 { font-size: 22px; }
  .dialog-foot { bottom: -20px; margin: 24px -16px -20px; padding: 12px 16px max(12px, env(safe-area-inset-bottom)); }
  #toast { bottom: calc(88px + env(safe-area-inset-bottom)); max-width: calc(100% - 32px); }
  #content .bsl h1 { font-size: 26px; }
  #content .bsl h2 { font-size: 20px; }
  #content .bsl .bsl-grid, #content .bsl .bsl-survey-grid { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  #content .bsl .bsl-tab { padding-inline: 8px; font-size: 14px; }
  #content .bsl .bsl-card, #content .bsl .bsl-survey-card { padding: 16px; }
  #content .bsl .bsl-observation { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  #content .bsl .bsl-observation span { color: var(--muted); }
  #content .bsl .bsl-observation progress { grid-column: 1; }
}
@media (max-width: 360px) {
  .sidebar nav button span { white-space: normal; }
  .sidebar nav button { min-height: 77px; }
  .radar text, .radar .value { font-size: 30px; }
  footer { padding-bottom: calc(112px + env(safe-area-inset-bottom)); }
  #toast { bottom: calc(108px + env(safe-area-inset-bottom)); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0s !important; animation-duration: 0s !important; scroll-behavior: auto !important; }
}
@media (forced-colors: active) {
  button, input, select, textarea, .panel, .status { border: 1px solid CanvasText; }
  .sidebar nav button.active { outline: 2px solid Highlight; }
  .radar { forced-color-adjust: none; }
}

/* The mobile dialogue starts with the conversation, with context available on demand. */
.chat-context summary { cursor:pointer; font-size:18px; font-weight:650; line-height:1.6; min-height:44px; display:list-item; list-style-position:inside; }
.chat-context summary small { font-size:14px; color:var(--muted); font-weight:400; }
.chat-context[open] summary { margin-bottom:12px; }
@media(max-width:720px) {
  .chat-context summary { font-size:16px; }
  .chat-context:not([open]) { padding-block:10px; }
  .compare-meta .comparison-item { padding-bottom:8px; }
  .comparison-item h3 { margin-bottom:4px; }
}

.education-image { margin:16px 0 0; max-width:100%; }
.education-image img { display:block; width:100%; max-width:560px; height:auto; border:1px solid var(--line); border-radius:8px; }
.education-image figcaption { font-size:14px; line-height:1.7; margin-top:12px; }
.education-image figcaption p { margin:8px 0; font-size:14px; }

/* Scoped medication demo; reuses current interface tokens, never radar scoring. */
.medication-group { min-width:0; }
.medication-group legend { font-size:20px; font-weight:650; padding:0 8px; }
.medication-group .grid2 { align-items:start; }
.medication-run { margin:0 0 24px; }
.medication-result { margin-top:20px; }
.medication-entry { margin-top:24px; }
.medication-entry .medication-result { border:0; border-top:1px solid var(--line); border-radius:0; box-shadow:none; padding:20px 0 0; }
.medication-candidate { display:flex; align-items:center; gap:24px; }
.medication-candidate > div { min-width:0; }
.medication-illustration { margin:0 0 16px; max-width:180px; flex:0 0 160px; }
.medication-illustration svg { display:block; width:150px; }
.medication-illustration figcaption { font-size:14px; line-height:1.65; }
.medication-label summary { cursor:pointer; font-size:18px; font-weight:650; min-height:44px; }
.medication-label[open] summary { margin-bottom:20px; }
.medication-label dt { font-weight:650; }
.medication-label dd { margin:4px 0 16px; overflow-wrap:anywhere; }
.medication-hash { overflow-wrap:anywhere; }
#medication-output, .medication-result[role=status] { scroll-margin-top:88px; }
@media(max-width:720px) {
  .medication-group legend { font-size:18px; }
  .medication-candidate { align-items:flex-start; flex-direction:column; gap:8px; }
  .medication-illustration { flex:auto; }
  .medication-candidate h3 { overflow-wrap:anywhere; }
}

/* Necessary non-text boundaries and chart grids retain contrast on light surfaces. */
button:not(.text-button):not(.profile-chip):not(.primary),
.tabs button.active, .upload input::file-selector-button { border-color:var(--control-line); }
.sidebar nav button { border-color:transparent !important; }
.radar .radar-grid, .radar > line { stroke:var(--chart-grid); }
.medication-name-placeholder { background:var(--surface-soft); border:1px solid var(--line); border-radius:8px; padding:12px 16px; color:var(--ink); overflow-wrap:anywhere; }
.medication-name-placeholder strong, .medication-name-placeholder span, .medication-name-placeholder small { display:block; }
.medication-name-placeholder small { margin-top:4px; }
