:root {
  color-scheme: light;
  --ink: #18221f;
  --muted: #68756f;
  --soft: #8a9691;
  --line: #dde3e0;
  --line-strong: #cbd4d0;
  --surface: #ffffff;
  --surface-subtle: #f4f6f5;
  --surface-green: #edf5f1;
  --green: #155f49;
  --green-dark: #104737;
  --green-pale: #dcece5;
  --blue: #3567a6;
  --blue-pale: #eaf0f8;
  --teal: #287d7a;
  --teal-pale: #e7f3f2;
  --gold: #c48b2c;
  --gold-pale: #fbf4e6;
  --orange: #bd5c32;
  --orange-pale: #f9ece5;
  --red: #b94343;
  --red-pale: #faeaea;
  --shadow: 0 12px 34px rgba(24, 34, 31, 0.1);
  font-family: Inter, "Microsoft YaHei", "PingFang SC", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body { margin: 0; color: var(--ink); background: var(--surface-subtle); font-size: 14px; letter-spacing: 0; }
button, input, select, textarea { color: inherit; font: inherit; letter-spacing: 0; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.5; }
button:focus-visible, [role="button"]:focus-visible { outline: 3px solid rgba(21, 95, 73, 0.24); outline-offset: 2px; }
input, select, textarea { width: 100%; border: 1px solid var(--line-strong); border-radius: 6px; outline: none; background: var(--surface); }
input, select { min-height: 40px; padding: 0 11px; }
textarea { padding: 10px 11px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(21, 95, 73, 0.12); }
input[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--red); }
[hidden] { display: none !important; }
.eyebrow { color: var(--green); font-size: 11px; font-weight: 700; text-transform: uppercase; }
.button { display: inline-flex; min-height: 40px; align-items: center; justify-content: center; gap: 7px; padding: 0 14px; border: 1px solid transparent; border-radius: 6px; font-weight: 650; white-space: nowrap; }
.button svg, .icon-button svg, .link-button svg { width: 17px; height: 17px; stroke-width: 1.8; }
.button.primary { color: white; background: var(--green); }
.button.primary:hover { background: var(--green-dark); }
.button.primary.danger-action { background: var(--red); }
.button.primary.danger-action:hover { background: #933838; }
.button.secondary { border-color: var(--line-strong); background: white; }
.button.secondary:hover { border-color: var(--green); color: var(--green); }
.button.danger-outline { border-color: #e1baba; color: var(--red); }
.button.danger-outline:hover { border-color: var(--red); color: var(--red); background: var(--red-pale); }
.button.ghost { color: var(--muted); background: transparent; }
.button.compact { min-height: 36px; padding: 0 11px; }
.button.wide { width: 100%; }
.icon-button { display: inline-grid; width: 38px; height: 38px; flex: 0 0 38px; place-items: center; padding: 0; border: 1px solid var(--line); border-radius: 6px; background: white; }
.icon-button:hover { border-color: var(--green); color: var(--green); }
.icon-button.danger:hover { border-color: var(--red); color: var(--red); background: var(--red-pale); }
.link-button { display: inline-flex; align-items: center; gap: 5px; padding: 3px; border: 0; color: var(--green); background: none; font-size: 12px; }

.login-screen { display: grid; min-height: 100vh; place-items: center; padding: 24px; background: radial-gradient(circle at 50% 0, #f7faf8 0, #e9eeeb 62%); }
.login-panel { width: min(100%, 410px); padding: 36px; border: 1px solid var(--line); border-radius: 10px; background: white; box-shadow: var(--shadow); }
.brand-mark { display: grid; width: 38px; height: 38px; flex: 0 0 38px; place-items: center; border-radius: 7px; color: white; background: var(--green); }
.brand-mark svg { width: 22px; height: 22px; }
.brand-mark.large { width: 52px; height: 52px; margin-bottom: 22px; }
.login-panel h1 { margin: 5px 0 8px; font-size: 26px; line-height: 1.2; }
.auth-heading { margin: 24px 0 5px; font-size: 16px; }
.login-subtitle { margin: 0 0 22px; color: var(--muted); font-size: 12px; line-height: 1.6; }
.login-panel form { display: grid; gap: 15px; }
.login-panel label, .action-body label { display: grid; gap: 7px; }
.login-panel label > span, .action-body label > span { color: var(--muted); font-size: 12px; font-weight: 650; }
.form-message { min-height: 18px; margin: -3px 0 0; color: var(--red); font-size: 12px; }
.form-message.success { color: var(--green); }
.field-help { color: var(--soft); font-size: 10px; line-height: 1.45; }
.auth-switch { display: flex; align-items: center; justify-content: center; gap: 3px; margin: 20px 0 0; color: var(--muted); font-size: 12px; }
.auth-switch .link-button { font-weight: 700; }
.password-strength { display: grid; align-items: center; gap: 5px; margin-top: -8px; grid-template-columns: repeat(4, 1fr) auto; }
.password-strength span { height: 4px; border-radius: 999px; background: var(--line); transition: background 160ms ease; }
.password-strength b { min-width: 45px; margin-left: 3px; color: var(--soft); font-size: 10px; font-weight: 650; text-align: right; }
.password-strength[data-level="1"] span:nth-child(-n + 1) { background: var(--red); }
.password-strength[data-level="2"] span:nth-child(-n + 2) { background: var(--gold); }
.password-strength[data-level="3"] span:nth-child(-n + 3) { background: var(--teal); }
.password-strength[data-level="4"] span { background: var(--green); }
.password-strength[data-level="1"] b { color: var(--red); }
.password-strength[data-level="2"] b { color: #986811; }
.password-strength[data-level="3"] b, .password-strength[data-level="4"] b { color: var(--green); }

.app-shell { min-height: 100vh; }
.topbar { position: sticky; z-index: 20; top: 0; display: flex; min-height: 64px; align-items: center; justify-content: space-between; padding: 0 20px; border-bottom: 1px solid var(--line); background: rgba(255, 255, 255, 0.97); }
.brand, .topbar-actions { display: flex; align-items: center; gap: 10px; }
.brand > div:last-child { display: grid; gap: 1px; }
.brand strong { font-size: 16px; }
.brand span { color: var(--muted); font-size: 10px; }
.topbar-actions { gap: 8px; }
.connection-state { display: inline-flex; align-items: center; gap: 7px; padding: 7px 9px; border-radius: 5px; color: var(--green); background: var(--surface-green); font-size: 11px; font-weight: 700; }
.connection-state b { width: 7px; height: 7px; border-radius: 50%; background: #22a06b; box-shadow: 0 0 0 3px rgba(34, 160, 107, 0.14); }
.actor-name { max-width: 120px; overflow: hidden; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }

.workspace { display: grid; min-height: calc(100vh - 64px); grid-template-columns: 310px minmax(0, 1fr); }
.record-sidebar { position: sticky; top: 64px; height: calc(100vh - 64px); overflow: hidden; border-right: 1px solid var(--line); background: white; }
.sidebar-head { display: flex; align-items: flex-end; justify-content: space-between; padding: 22px 18px 16px; }
.sidebar-head h2 { margin: 4px 0 0; font-size: 21px; }
.record-tools { display: grid; gap: 9px; padding: 0 18px 14px; grid-template-columns: minmax(0, 1fr) 102px; }
.search-field { position: relative; }
.search-field svg { position: absolute; top: 12px; left: 11px; width: 16px; height: 16px; color: var(--soft); pointer-events: none; }
.search-field input { padding-left: 35px; }
.record-tools select { padding-right: 7px; font-size: 12px; }
.record-summary { display: flex; align-items: center; justify-content: space-between; padding: 10px 18px; border-block: 1px solid var(--line); color: var(--muted); font-size: 11px; }
.record-list { height: calc(100vh - 226px); overflow: auto; padding: 8px; }
.record-card { width: 100%; padding: 13px 11px; border: 1px solid transparent; border-radius: 6px; text-align: left; background: transparent; }
.record-card:hover { background: var(--surface-subtle); }
.record-card.active { border-color: #a9c9bd; background: var(--surface-green); }
.record-card + .record-card { margin-top: 4px; }
.record-card-head, .record-card-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.record-card-head strong { overflow: hidden; font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.record-card p { margin: 7px 0; color: var(--muted); font-size: 11px; }
.record-card-foot { color: var(--soft); font-size: 10px; }
.record-card-metrics { display: grid; margin-top: 9px; grid-template-columns: repeat(3, 1fr); }
.record-card-metrics span { display: grid; gap: 2px; }
.record-card-metrics span + span { padding-left: 8px; border-left: 1px solid var(--line); }
.record-card-metrics b { color: var(--ink); font-size: 13px; }
.record-card-metrics small { color: var(--soft); font-size: 9px; }
.list-empty { display: grid; min-height: 220px; place-content: center; gap: 8px; color: var(--muted); text-align: center; }
.list-empty svg { width: 30px; height: 30px; margin: auto; color: var(--line-strong); }

.main-content { min-width: 0; background: var(--surface-subtle); }
.empty-view { display: grid; min-height: calc(100vh - 64px); place-content: center; justify-items: center; padding: 30px; text-align: center; }
.empty-visual { display: grid; width: 72px; height: 72px; place-items: center; border: 1px solid var(--line); border-radius: 8px; color: var(--green); background: white; }
.empty-visual svg { width: 34px; height: 34px; }
.empty-view h2 { margin: 20px 0 5px; font-size: 21px; }
.empty-view p { margin: 0 0 20px; color: var(--muted); }
.report-view { min-height: calc(100vh - 64px); background: white; }
.report-head { display: flex; min-height: 104px; align-items: center; justify-content: space-between; gap: 20px; padding: 22px 26px; border-bottom: 1px solid var(--line); }
.report-identity { display: flex; min-width: 0; align-items: center; gap: 13px; }
.report-avatar { display: grid; width: 50px; height: 50px; flex: 0 0 50px; place-items: center; border-radius: 8px; color: var(--green); background: var(--green-pale); font-size: 20px; font-weight: 800; }
.title-row { display: flex; min-width: 0; align-items: center; gap: 9px; }
.title-row h1 { overflow: hidden; margin: 0; font-size: 23px; text-overflow: ellipsis; white-space: nowrap; }
.report-identity p { margin: 6px 0 0; color: var(--muted); font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 10px; }
.separator { padding: 0 5px; color: var(--line-strong); }
.status-badge { display: inline-flex; min-height: 24px; align-items: center; padding: 0 8px; border-radius: 5px; font-size: 10px; font-weight: 800; white-space: nowrap; }
.status-pending { color: #91511f; background: var(--orange-pale); }
.status-reviewed { color: var(--blue); background: var(--blue-pale); }
.status-archived { color: var(--green); background: var(--surface-green); }
.report-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 7px; }
.profile-band { padding: 14px 26px; border-bottom: 1px solid var(--line); background: #fafbfa; }
.profile-band dl { display: grid; max-width: 1000px; margin: 0; grid-template-columns: repeat(5, minmax(0, 1fr)); }
.profile-band dl > div { min-width: 0; padding: 0 18px; }
.profile-band dl > div:first-child { padding-left: 0; }
.profile-band dl > div + div { border-left: 1px solid var(--line); }
dt { color: var(--muted); font-size: 10px; }
dd { margin: 5px 0 0; font-weight: 700; }
.metric-band { display: grid; padding: 0 26px; border-bottom: 1px solid var(--line); grid-template-columns: repeat(4, minmax(0, 1fr)); }
.metric { position: relative; display: grid; min-height: 105px; align-content: center; justify-items: center; padding: 10px; text-align: center; }
.metric + .metric::before { position: absolute; top: 25px; bottom: 25px; left: 0; width: 1px; background: var(--line); content: ""; }
.metric span { color: var(--muted); font-size: 10px; }
.metric strong { margin: 7px 0 3px; font-size: 23px; line-height: 1; }
.metric small { color: var(--soft); font-size: 9px; }
.metric.accent strong { color: var(--orange); }
.metric.positive strong { color: var(--green); }

.interpretation-band { padding: 18px 26px; border-bottom: 1px solid var(--line); background: #f7faf8; }
.interpretation-grid { display: grid; overflow: hidden; border: 1px solid #d7e3de; border-radius: 8px; background: white; grid-template-columns: 1.35fr repeat(3, minmax(0, 1fr)); }
.interpretation-card { min-width: 0; padding: 15px 16px; }
.interpretation-card + .interpretation-card { border-left: 1px solid var(--line); }
.interpretation-card > span { color: var(--muted); font-size: 10px; }
.interpretation-card > strong { display: block; margin: 7px 0 6px; font-size: 17px; line-height: 1.25; }
.interpretation-card p { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.55; }
.interpretation-card.conclusion { background: linear-gradient(135deg, #edf6f2, #f8fbf9); }
.interpretation-card.conclusion > strong { color: var(--green-dark); font-size: 19px; }

.evidence-grid { display: grid; border-bottom: 1px solid var(--line); grid-template-columns: minmax(360px, 0.82fr) minmax(560px, 1.18fr); }
.evidence-grid > .report-section + .report-section { border-top: 0; border-left: 1px solid var(--line); }
.bone-image-section { min-width: 0; }
.bone-image-frame { position: relative; display: grid; width: 100%; height: clamp(360px, 55vh, 620px); overflow: hidden; place-items: center; border: 1px solid #25312d; border-radius: 7px; background: #101614; }
.bone-image-frame img { position: absolute; inset: 0; display: block; width: 100%; height: 100%; object-fit: contain; }
.bone-image-empty { display: grid; place-items: center; gap: 8px; color: #aeb8b4; font-size: 11px; }
.bone-image-empty svg { width: 30px; height: 30px; color: #66736e; }
.image-caption { margin: 10px 0 0; color: var(--muted); font-size: 10px; line-height: 1.55; }

.report-grid { display: grid; border-bottom: 1px solid var(--line); grid-template-columns: minmax(340px, 0.75fr) minmax(520px, 1.25fr); }
.report-section { padding: 24px 26px; }
.report-grid .report-section + .report-section { border-left: 1px solid var(--line); }
.report-section + .report-section:not(.chart-section) { border-top: 1px solid var(--line); }
.evidence-grid > .report-section + .report-section { border-top: 0; }
.section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 17px; }
.section-heading h2 { margin: 4px 0 0; font-size: 17px; }
.section-meta { color: var(--muted); font-size: 10px; }
.scenario-grid { display: grid; gap: 9px; grid-template-columns: 1fr; }
.scenario-card { padding: 14px; border: 1px solid var(--line); border-radius: 7px; background: #fbfcfb; }
.scenario-card.scenario-natural { border-color: #d8b5a5; background: #fbf4f1; }
.scenario-card.scenario-conservative { border-color: #b9d0c6; background: #f2f8f5; }
.scenario-card.scenario-actual, .scenario-card.featured { border-color: #9ec9c6; background: var(--teal-pale); }
.scenario-card.scenario-optimistic { border-style: dashed; border-color: #dbb66f; background: var(--gold-pale); }
.scenario-card header { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.scenario-card header span { font-size: 11px; font-weight: 700; }
.scenario-card header b { color: var(--muted); font-size: 10px; }
.scenario-card > strong { display: block; margin: 12px 0 4px; font-size: 24px; }
.scenario-card > strong small { color: var(--muted); font-size: 11px; }
.scenario-card > p { min-height: 31px; margin: 7px 0 0; color: var(--muted); font-size: 9px; line-height: 1.5; }
.scenario-card dl { display: grid; margin: 12px 0 0; gap: 7px; grid-template-columns: repeat(2, 1fr); }
.scenario-card dl div { display: grid; gap: 2px; }
.scenario-card dd { font-size: 11px; }
.chart-wrap { position: relative; width: 100%; height: 315px; min-height: 315px; }
.chart-wrap canvas { width: 100%; height: 100%; }
.chart-legend { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 14px; margin-top: 8px; color: var(--muted); font-size: 9px; }
.legend-item { display: inline-flex; align-items: center; gap: 5px; }
.legend-line { width: 18px; height: 3px; border-radius: 3px; }
.legend-ref-p25 { background: #c4d4e7; }
.legend-ref-p50 { background: #91add0; }
.legend-ref-p75 { background: #6f93bf; }
.legend-ref-p90 { background: #4e77ad; }
.legend-scenario-natural { background: #bd5c32; }
.legend-scenario-conservative { background: #155f49; }
.legend-scenario-actual { background: #287d7a; }
.legend-scenario-optimistic { border: 1px dashed #c48b2c; background: transparent; }
.limit-note { display: flex; align-items: flex-start; gap: 7px; margin: 14px 0 0; color: var(--muted); font-size: 10px; line-height: 1.6; }
.limit-note svg { width: 15px; height: 15px; flex: 0 0 15px; color: var(--orange); }
.verified-label { display: inline-flex; align-items: center; gap: 5px; color: var(--green); font-size: 10px; font-weight: 700; }
.verified-label svg { width: 15px; height: 15px; }
.bone-data-grid { display: grid; overflow: hidden; border: 1px solid var(--line); border-radius: 7px; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.bone-data-grid > div { display: grid; min-height: 72px; place-content: center; text-align: center; }
.bone-data-grid > div + div { border-left: 1px solid var(--line); }
.bone-data-grid span { color: var(--muted); font-size: 10px; }
.bone-data-grid span b { display: inline-block; margin-right: 4px; color: var(--green); font-size: 8px; }
.bone-data-grid strong { margin-top: 6px; font-size: 16px; }
.bone-data-grid small { margin-top: 4px; color: var(--soft); font-size: 8px; }
.detail-list { display: grid; margin: 18px 0 0; gap: 14px 0; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.detail-list > div { min-width: 0; padding-right: 20px; }
.detail-list dd { overflow-wrap: anywhere; font-size: 12px; }
.evidence-note { display: flex; align-items: flex-start; gap: 8px; margin-top: 18px; padding: 12px; border: 1px solid #d7e3de; border-radius: 7px; color: var(--muted); background: #f7faf8; font-size: 10px; line-height: 1.6; }
.evidence-note svg { width: 16px; height: 16px; flex: 0 0 16px; color: var(--green); }
.method-flow { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); }
.method-flow article { position: relative; display: flex; min-width: 0; gap: 10px; padding: 0 18px; }
.method-flow article:first-child { padding-left: 0; }
.method-flow article + article::before { position: absolute; top: 5px; bottom: 5px; left: 0; width: 1px; background: var(--line); content: ""; }
.method-flow article > b { display: grid; width: 25px; height: 25px; flex: 0 0 25px; place-items: center; border-radius: 50%; color: white; background: var(--green); font-size: 10px; }
.method-flow article strong { display: block; font-size: 11px; }
.method-flow article p { margin: 5px 0 0; color: var(--muted); font-size: 9px; line-height: 1.55; }
.review-grid { display: grid; gap: 18px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.review-record { min-height: 78px; padding-left: 13px; border-left: 3px solid var(--line-strong); }
.review-record.complete { border-color: var(--green); }
.review-record h3 { margin: 0 0 7px; font-size: 13px; }
.review-record p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.6; white-space: pre-wrap; }
.review-record small { display: block; margin-top: 7px; color: var(--soft); font-size: 9px; }
.table-scroll { overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: 11px; }
th, td { padding: 11px 12px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
th { color: var(--muted); background: var(--surface-subtle); font-size: 10px; font-weight: 700; }
.immutable { color: var(--green); }
.report-footer { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; padding: 22px 26px 28px; color: var(--muted); font-size: 9px; line-height: 1.7; }
.report-footer p { max-width: 850px; margin: 0; }
.report-footer span { white-space: nowrap; }

dialog { width: calc(100% - 32px); padding: 0; border: 0; border-radius: 8px; color: var(--ink); box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(20, 30, 27, 0.5); backdrop-filter: blur(2px); }
.editor-dialog { max-width: 1040px; }
.editor-dialog form, .action-dialog form { display: flex; max-height: min(90vh, 860px); flex-direction: column; }
.dialog-head { display: flex; min-height: 72px; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.dialog-head h2 { margin: 4px 0 0; font-size: 19px; }
.step-tabs { display: grid; border-bottom: 1px solid var(--line); background: #fafbfa; grid-template-columns: repeat(3, 1fr); }
.step-tabs button { display: flex; min-height: 54px; align-items: center; justify-content: center; gap: 8px; border: 0; border-bottom: 2px solid transparent; color: var(--muted); background: transparent; font-weight: 700; }
.step-tabs button span { display: grid; width: 22px; height: 22px; place-items: center; border: 1px solid var(--line-strong); border-radius: 50%; font-size: 10px; }
.step-tabs button.active { border-bottom-color: var(--green); color: var(--green); }
.step-tabs button.active span { border-color: var(--green); color: white; background: var(--green); }
.dialog-body { overflow: auto; padding: 23px 24px 28px; }
.form-section-heading { display: flex; align-items: center; justify-content: space-between; margin: 0 0 13px; }
.form-section-heading:not(:first-child) { margin-top: 26px; }
.form-section-heading h3 { margin: 0; font-size: 14px; }
.form-section-heading > span { color: var(--muted); font-size: 10px; }
.form-grid { display: grid; gap: 14px; }
.form-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.form-grid label, .bone-form-grid label { display: grid; min-width: 0; align-content: start; gap: 7px; }
.form-grid label > span, .bone-form-grid label > span, .gender-control legend { color: var(--muted); font-size: 11px; font-weight: 650; }
.bone-upload-row { display: grid; min-height: 238px; gap: 16px; grid-template-columns: minmax(280px, 1.35fr) minmax(220px, 0.65fr); }
.bone-upload-zone { display: grid; min-height: 238px; overflow: hidden; place-items: center; border: 1px dashed var(--line-strong); border-radius: 7px; outline: 0; background: #f7f9f8; cursor: pointer; }
.bone-upload-zone:hover, .bone-upload-zone:focus-visible, .bone-upload-zone.dragging { border-color: var(--green); background: var(--surface-green); }
.bone-upload-zone.has-image { border-style: solid; border-color: #25312d; background: #101614; }
.bone-upload-zone img { width: 100%; height: 238px; object-fit: contain; }
.bone-upload-empty { display: grid; place-items: center; gap: 6px; color: var(--muted); }
.bone-upload-empty svg { width: 28px; height: 28px; color: var(--green); }
.bone-upload-empty strong { color: var(--ink); font-size: 13px; }
.bone-upload-empty span { font-size: 10px; }
.bone-upload-actions { display: flex; min-width: 0; flex-direction: column; justify-content: center; gap: 7px; }
.bone-upload-actions > strong { overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.bone-upload-actions > span { color: var(--muted); font-size: 10px; }
.bone-upload-actions > div { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 9px; }
.gender-control { display: grid; margin: 0; padding: 0; border: 0; grid-template-columns: repeat(2, 1fr); gap: 6px; }
.gender-control legend { margin-bottom: 7px; }
.gender-control label { position: relative; }
.gender-control input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.gender-control label span { display: grid; min-height: 40px; place-items: center; border: 1px solid var(--line-strong); border-radius: 6px; }
.gender-control input:checked + span { border-color: var(--green); color: var(--green); background: var(--surface-green); font-weight: 700; }
.unit-input { position: relative; }
.unit-input input { padding-right: 40px; }
.unit-input b { position: absolute; top: 13px; right: 10px; color: var(--soft); font-size: 10px; pointer-events: none; }
.bone-form-grid { display: grid; gap: 12px; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.manual-metrics { margin-top: 24px; padding-top: 22px; border-top: 1px solid var(--line); }
.confirm-field { display: flex; align-items: flex-start; gap: 10px; margin-top: 24px; padding: 14px; border: 1px solid #bdd4cb; border-radius: 7px; background: var(--surface-green); }
.confirm-field input { width: 18px; min-height: 18px; flex: 0 0 18px; margin: 1px 0 0; accent-color: var(--green); }
.confirm-field span { color: var(--muted); font-size: 11px; line-height: 1.55; }
.confirm-field b { display: block; margin-bottom: 2px; color: var(--ink); font-size: 12px; }
.text-fields { margin-top: 14px; }
.preview-strip { display: grid; overflow: hidden; margin: 24px 0 14px; border: 1px solid var(--line); border-radius: 7px; grid-template-columns: repeat(4, 1fr); }
.preview-strip div { display: grid; min-height: 80px; place-content: center; gap: 6px; text-align: center; }
.preview-strip div + div { border-left: 1px solid var(--line); }
.preview-strip span { color: var(--muted); font-size: 10px; }
.preview-strip strong { font-size: 18px; }
.dialog-footer { display: flex; min-height: 72px; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px; border-top: 1px solid var(--line); background: #fafbfa; }
.dialog-footer > div { display: flex; gap: 8px; }
.action-dialog { max-width: 510px; }
.action-body { padding: 22px 20px; }
.action-body p { margin: 10px 0 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.password-body { display: grid; gap: 14px; }
.password-body .field-help { margin-top: -8px; }
.password-body .reset-target { margin: 0; padding: 10px 11px; border-radius: 6px; color: var(--muted); background: var(--surface-subtle); }
.password-body .reset-target strong { color: var(--ink); }
.users-dialog { max-width: 760px; }
.users-dialog-layout { display: flex; max-height: min(88vh, 760px); flex-direction: column; }
.users-toolbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); background: #fafbfa; }
.users-toolbar label { display: grid; width: min(220px, 100%); gap: 6px; }
.users-toolbar label > span { color: var(--muted); font-size: 10px; font-weight: 700; }
.users-summary { display: flex; justify-content: space-between; gap: 12px; padding: 10px 20px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 10px; }
.users-list { min-height: 180px; overflow: auto; padding: 8px 12px; }
.user-card { display: grid; min-width: 0; align-items: center; gap: 12px; padding: 13px 8px; grid-template-columns: 40px minmax(0, 1fr) auto; }
.user-card + .user-card { border-top: 1px solid var(--line); }
.user-avatar { display: grid; width: 40px; height: 40px; place-items: center; border-radius: 8px; color: var(--green); background: var(--surface-green); font-size: 15px; font-weight: 800; }
.user-main { min-width: 0; }
.user-name-line { display: flex; min-width: 0; align-items: center; flex-wrap: wrap; gap: 6px; }
.user-name-line strong { overflow: hidden; max-width: 240px; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.user-main p { display: flex; min-width: 0; flex-wrap: wrap; gap: 5px 12px; margin: 6px 0 0; color: var(--muted); font-size: 10px; }
.user-main p span:first-child { overflow: hidden; max-width: 190px; text-overflow: ellipsis; white-space: nowrap; }
.user-actions { display: flex; align-items: center; gap: 6px; }
.user-status, .self-label { display: inline-flex; min-height: 20px; align-items: center; padding: 0 6px; border-radius: 4px; font-size: 9px; font-weight: 800; }
.user-status.status-active { color: var(--green); background: var(--surface-green); }
.user-status.status-disabled { color: var(--red); background: var(--red-pale); }
.user-status.status-pending, .user-status.status-pending_approval { color: #986811; background: var(--gold-pale); }
.self-label { color: var(--blue); background: var(--blue-pale); }
.users-empty { display: grid; min-height: 180px; place-content: center; justify-items: center; gap: 9px; color: var(--muted); font-size: 11px; text-align: center; }
.users-empty svg { width: 26px; height: 26px; color: var(--line-strong); }
.users-empty.error { color: var(--red); }
.users-foot { display: flex; align-items: center; gap: 8px; padding: 13px 20px; border-top: 1px solid var(--line); color: var(--muted); background: #fafbfa; font-size: 10px; line-height: 1.45; }
.users-foot svg { width: 16px; height: 16px; flex: 0 0 16px; color: var(--green); }
.toast { position: fixed; z-index: 100; right: 20px; bottom: 20px; max-width: min(360px, calc(100vw - 40px)); padding: 12px 15px; border-radius: 6px; color: white; background: #26332f; box-shadow: var(--shadow); font-size: 12px; opacity: 0; transform: translateY(14px); pointer-events: none; transition: 180ms ease; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { background: #8f3434; }
.mobile-only { display: none; }

.pdf-sheet-host { position: fixed; z-index: -1; top: 0; left: -20000px; width: 1120px; height: 1584px; overflow: hidden; pointer-events: none; }
.pdf-sheet { width: 1120px; height: 1584px; overflow: hidden; padding: 32px 34px 30px; color: #17221e; background: white; font-family: Inter, "Microsoft YaHei", "PingFang SC", sans-serif; letter-spacing: 0; }
.pdf-sheet, .pdf-sheet * { box-sizing: border-box; }
.pdf-sheet-content { width: 100%; transform-origin: top left; }
.pdf-sheet-content.pdf-scale-98 { transform: scale(0.98); }
.pdf-sheet-content.pdf-scale-95 { transform: scale(0.95); }
.pdf-sheet-content.pdf-scale-92 { transform: scale(0.92); }
.pdf-sheet-content.pdf-scale-88 { transform: scale(0.88); }
.pdf-sheet-content.pdf-scale-84 { transform: scale(0.84); }
.pdf-sheet-content.pdf-scale-80 { transform: scale(0.8); }
.pdf-sheet-content.pdf-scale-75 { transform: scale(0.75); }
.pdf-sheet-content.pdf-scale-70 { transform: scale(0.7); }
.pdf-sheet-content.pdf-scale-65 { transform: scale(0.65); }
.pdf-sheet-content.pdf-scale-60 { transform: scale(0.6); }
.pdf-header { display: flex; min-height: 72px; align-items: flex-start; justify-content: space-between; gap: 24px; padding-bottom: 13px; border-bottom: 2px solid #173f34; }
.pdf-brand { display: flex; align-items: center; gap: 13px; }
.pdf-brand-mark { display: grid; width: 44px; height: 44px; place-items: center; border-radius: 6px; color: white; background: #173f34; font-size: 20px; font-weight: 800; }
.pdf-title h1 { margin: 0; font-size: 25px; line-height: 1.15; }
.pdf-title p { margin: 6px 0 0; color: #68766f; font-size: 10px; }
.pdf-header-meta { display: grid; justify-items: end; gap: 5px; color: #68766f; font-size: 10px; }
.pdf-status { display: inline-flex; min-height: 24px; align-items: center; padding: 0 9px; border-radius: 4px; color: #173f34; background: #e7f2ed; font-weight: 800; }
.pdf-status.pending { color: #87571e; background: #fbf1df; }
.pdf-metrics { display: grid; overflow: hidden; margin-top: 12px; border: 1px solid #d7dfdb; border-radius: 6px; grid-template-columns: repeat(6, minmax(0, 1fr)); }
.pdf-metric { position: relative; display: grid; min-height: 76px; place-content: center; padding: 7px; text-align: center; }
.pdf-metric + .pdf-metric { border-left: 1px solid #d7dfdb; }
.pdf-metric strong { display: block; margin: 6px 0 3px; color: #173f34; font-size: 15px; line-height: 1; }
.pdf-metric small { color: #8a958f; font-size: 7px; }
.pdf-conclusion-grid { display: grid; overflow: hidden; margin-top: 10px; border: 1px solid #cbded6; border-radius: 6px; background: #f7fbf9; grid-template-columns: 1.15fr 0.85fr 1fr; }
.pdf-conclusion-grid article { min-width: 0; padding: 10px 12px; }
.pdf-conclusion-grid article + article { border-left: 1px solid #d7e5df; }
.pdf-conclusion-grid span { color: #748079; font-size: 8px; }
.pdf-conclusion-grid strong { display: block; margin: 4px 0; color: #173f34; font-size: 13px; }
.pdf-conclusion-grid p { margin: 0; color: #68766f; font-size: 7px; line-height: 1.45; }
.pdf-body { display: grid; margin-top: 13px; gap: 13px; grid-template-columns: 315px minmax(0, 1fr); }
.pdf-image-column, .pdf-data-column { display: grid; align-content: start; gap: 13px; }
.pdf-panel { overflow: hidden; border: 1px solid #d7dfdb; border-radius: 6px; background: white; }
.pdf-panel-heading { display: flex; min-height: 34px; align-items: center; justify-content: space-between; gap: 10px; padding: 7px 10px; border-bottom: 1px solid #d7dfdb; background: #f4f7f5; }
.pdf-panel-heading strong { font-size: 11px; }
.pdf-panel-heading span { color: #738078; font-size: 8px; }
.pdf-xray { display: grid; height: 560px; place-items: center; background: #0f1513; }
.pdf-xray img { width: 100%; height: 100%; object-fit: contain; }
.pdf-xray-empty { color: #9ca8a3; font-size: 11px; }
.pdf-image-note, .pdf-chart-note { margin: 0; padding: 6px 9px; border-top: 1px solid #d7dfdb; color: #6f7b75; background: #fafcfa; font-size: 7px; line-height: 1.45; }
.pdf-source-grid { display: grid; padding: 9px 10px; gap: 8px 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.pdf-source-grid div, .pdf-detail-grid div { min-width: 0; }
.pdf-source-grid span, .pdf-detail-grid span, .pdf-bone-grid span, .pdf-metric span { display: block; color: #748079; font-size: 8px; }
.pdf-source-grid b, .pdf-detail-grid b { display: block; overflow-wrap: anywhere; margin-top: 3px; font-size: 9px; line-height: 1.35; }
.pdf-scenario-grid { display: grid; padding: 9px; gap: 7px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.pdf-scenario-grid.scenario-count-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.pdf-scenario { padding: 8px; border: 1px solid #dbe2df; border-radius: 4px; background: #fafbfa; }
.pdf-scenario.scenario-natural { border-color: #d8b5a5; background: #fbf4f1; }
.pdf-scenario.scenario-conservative { border-color: #a9c8bb; background: #f1f8f5; }
.pdf-scenario.featured, .pdf-scenario.scenario-actual { border-color: #94c4c0; background: #eaf6f5; }
.pdf-scenario.scenario-optimistic { border-style: dashed; border-color: #d5ad61; background: #fcf6e9; }
.pdf-scenario header { display: flex; justify-content: space-between; gap: 6px; color: #68766f; font-size: 8px; }
.pdf-scenario > strong { display: block; margin: 7px 0 4px; font-size: 17px; }
.pdf-scenario > p { min-height: 28px; margin: 0 0 5px; color: #68766f; font-size: 7px; line-height: 1.4; }
.pdf-scenario footer { display: flex; justify-content: space-between; gap: 6px; color: #68766f; font-size: 7px; }
.pdf-chart { height: 274px; padding: 4px 7px 7px; }
.pdf-chart img { width: 100%; height: 100%; object-fit: contain; }
.pdf-bone-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.pdf-bone-grid div { min-height: 55px; display: grid; place-content: center; text-align: center; }
.pdf-bone-grid div + div { border-left: 1px solid #d7dfdb; }
.pdf-bone-grid span b { display: inline-block; margin-right: 3px; color: #173f34; font-size: 7px; }
.pdf-bone-grid strong { margin-top: 5px; font-size: 12px; }
.pdf-bone-grid small { margin-top: 3px; color: #87928d; font-size: 6px; }
.pdf-method-flow { display: flex; align-items: center; justify-content: space-between; gap: 5px; padding: 10px; }
.pdf-method-flow span { display: inline-flex; min-width: 0; align-items: center; gap: 4px; color: #3d4c46; font-size: 7px; white-space: nowrap; }
.pdf-method-flow span b { display: grid; width: 18px; height: 18px; flex: 0 0 18px; place-items: center; border-radius: 50%; color: white; background: #173f34; font-size: 7px; }
.pdf-method-flow i { color: #98a49e; font-style: normal; font-size: 8px; }
.pdf-detail-review-grid { display: grid; gap: 13px; grid-template-columns: 1fr; }
.pdf-detail-grid { display: grid; padding: 9px 10px; gap: 7px 12px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.pdf-detail-grid .wide { grid-column: span 3; }
.pdf-detail-grid .full { grid-column: 1 / -1; }
.pdf-review { display: grid; padding: 9px 10px; gap: 8px; }
.pdf-review article { padding-left: 8px; border-left: 2px solid #aac7bb; }
.pdf-review strong { display: block; font-size: 9px; }
.pdf-review p { margin: 3px 0 0; color: #68766f; font-size: 7px; line-height: 1.35; white-space: pre-wrap; overflow-wrap: anywhere; }
.pdf-version-line { padding: 8px 10px; color: #68766f; font-size: 7px; line-height: 1.45; }
.pdf-footer { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-top: 12px; padding-top: 8px; border-top: 1px solid #d7dfdb; color: #68766f; font-size: 7px; line-height: 1.45; }
.pdf-footer p { max-width: 1160px; margin: 0; }
.pdf-footer span { white-space: nowrap; }

@media (max-width: 1080px) {
  .workspace { grid-template-columns: 280px minmax(0, 1fr); }
  .report-head { align-items: flex-start; flex-direction: column; }
  .report-actions { justify-content: flex-start; }
  .profile-band dl { grid-template-columns: repeat(3, 1fr); gap: 12px 0; }
  .profile-band dl > div:nth-child(4) { padding-left: 0; border-left: 0; }
  .metric-band { grid-template-columns: repeat(2, 1fr); }
  .metric:nth-child(3)::before { display: none; }
  .metric:nth-child(n + 3) { border-top: 1px solid var(--line); }
  .interpretation-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .interpretation-card:nth-child(odd) { border-left: 0; }
  .interpretation-card:nth-child(n + 3) { border-top: 1px solid var(--line); }
  .evidence-grid { grid-template-columns: 1fr; }
  .evidence-grid > .report-section + .report-section { border-top: 1px solid var(--line); border-left: 0; }
  .report-grid { grid-template-columns: 1fr; }
  .report-grid .report-section + .report-section { border-top: 1px solid var(--line); border-left: 0; }
}

@media (max-width: 780px) {
  .topbar { min-height: 58px; padding: 0 12px; }
  .brand-mark { width: 34px; height: 34px; flex-basis: 34px; }
  .brand > div:last-child span, .actor-name { display: none; }
  .connection-state { padding: 6px; font-size: 0; }
  .mobile-only { display: inline-grid; }
  .workspace { min-height: calc(100vh - 58px); grid-template-columns: 1fr; }
  .record-sidebar { position: fixed; z-index: 30; top: 58px; bottom: 0; left: 0; width: min(88vw, 330px); height: auto; box-shadow: var(--shadow); transform: translateX(-105%); transition: transform 180ms ease; }
  .record-sidebar.open { transform: translateX(0); }
  .record-list { height: calc(100vh - 220px); }
  .empty-view { min-height: calc(100vh - 58px); }
  .report-view { min-height: calc(100vh - 58px); }
  .report-head { padding: 18px 15px; }
  .report-identity { align-items: flex-start; }
  .title-row { align-items: flex-start; flex-direction: column; gap: 5px; }
  .title-row h1 { max-width: 65vw; font-size: 21px; }
  .report-actions { width: 100%; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .report-actions .icon-button { width: 100%; }
  .profile-band, .metric-band, .report-section, .report-footer { padding-inline: 15px; }
  .interpretation-band { padding-inline: 15px; }
  .profile-band dl { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .profile-band dl > div { padding: 0 12px; }
  .profile-band dl > div:nth-child(odd) { padding-left: 0; border-left: 0; }
  .metric-band { grid-template-columns: repeat(2, 1fr); }
  .metric:nth-child(odd)::before { display: none; }
  .metric:nth-child(even)::before { display: block; }
  .metric { min-height: 92px; }
  .metric strong { font-size: 20px; }
  .scenario-grid { grid-template-columns: 1fr; }
  .chart-wrap { height: 280px; min-height: 280px; }
  .bone-data-grid { grid-template-columns: repeat(2, 1fr); }
  .bone-data-grid > div { border-bottom: 1px solid var(--line); }
  .bone-data-grid > div:nth-child(odd) { border-left: 0; }
  .bone-data-grid > div:last-child { grid-column: 1 / -1; border-bottom: 0; border-left: 0; }
  .detail-list { grid-template-columns: repeat(2, 1fr); }
  .method-flow { grid-template-columns: 1fr; gap: 13px; }
  .method-flow article { padding: 0; }
  .method-flow article + article::before { display: none; }
  .review-grid { grid-template-columns: 1fr; }
  .report-footer { align-items: flex-start; flex-direction: column; }
  .form-grid.three, .form-grid.four, .form-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bone-upload-row { grid-template-columns: 1fr; }
  .bone-upload-actions { align-items: flex-start; }
  .bone-form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .preview-strip { grid-template-columns: repeat(2, 1fr); }
  .preview-strip div:nth-child(3) { border-top: 1px solid var(--line); border-left: 0; }
  .preview-strip div:nth-child(4) { border-top: 1px solid var(--line); }
  .dialog-footer { align-items: stretch; flex-direction: column; }
  .dialog-footer > div { display: grid; grid-template-columns: repeat(2, 1fr); }
  .dialog-footer .button { width: 100%; }
  .dialog-body { padding: 20px 16px; }
}

@media (max-width: 480px) {
  .login-screen { align-items: start; padding: 14px; }
  .login-panel { margin-block: 8px; padding: 24px 20px; }
  .brand-mark.large { width: 46px; height: 46px; margin-bottom: 16px; }
  .auth-heading { margin-top: 19px; }
  .users-dialog { width: calc(100% - 20px); }
  .users-toolbar { align-items: stretch; flex-direction: column; padding: 13px 14px; }
  .users-toolbar label { width: 100%; }
  .users-toolbar .button { width: 100%; }
  .users-summary { padding-inline: 14px; }
  .users-summary span:last-child { display: none; }
  .users-list { padding-inline: 9px; }
  .user-card { align-items: start; gap: 10px; padding-block: 12px; grid-template-columns: 36px minmax(0, 1fr); }
  .user-avatar { width: 36px; height: 36px; }
  .user-actions { display: grid; width: 100%; grid-column: 1 / -1; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .user-actions .button { width: 100%; min-height: 36px; }
  .user-actions .button:only-child { grid-column: 1 / -1; }
  .users-foot { padding-inline: 14px; }
  .report-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid.three, .form-grid.four, .form-grid.two { grid-template-columns: 1fr; }
  .interpretation-grid { grid-template-columns: 1fr; }
  .interpretation-card + .interpretation-card { border-top: 1px solid var(--line); border-left: 0; }
  .step-tabs button { min-height: 50px; font-size: 11px; }
  .step-tabs button span { display: none; }
}

@media print {
  @page { size: A3 portrait; margin: 8mm; }
  body { background: white; font-size: 10pt; }
  .topbar, .record-sidebar, .report-actions, .toast, dialog { display: none !important; }
  .workspace { display: block; min-height: 0; }
  .main-content, .report-view { min-height: 0; background: white; }
  .report-head { min-height: 0; padding: 0 0 12px; break-after: avoid; }
  .report-avatar { width: 42px; height: 42px; flex-basis: 42px; }
  .title-row h1 { font-size: 18pt; }
  .profile-band, .metric-band, .report-section, .report-footer { padding-inline: 0; }
  .profile-band { padding-block: 10px; }
  .metric-band { grid-template-columns: repeat(4, 1fr); }
  .metric { min-height: 76px; }
  .metric strong { font-size: 16pt; }
  .report-grid { grid-template-columns: 0.8fr 1.2fr; }
  .report-grid .report-section + .report-section { padding-left: 16px; border-top: 0; border-left: 1px solid var(--line); }
  .report-grid .report-section:first-child { padding-right: 16px; }
  .report-section { padding-block: 15px; break-inside: avoid; }
  .scenario-card { padding: 9px; }
  .scenario-card > strong { font-size: 16pt; }
  .chart-wrap { height: 230px; min-height: 230px; }
  .limit-note { font-size: 7pt; }
  .data-section { break-before: auto; }
  .report-footer { font-size: 7pt; }
}
