:root {
  --ink: #16202a;
  --muted: #66717d;
  --line: #d9e0e5;
  --line-strong: #b8c4cc;
  --surface: #ffffff;
  --surface-soft: #f5f7f8;
  --nav: #182d3b;
  --nav-soft: #243f4f;
  --teal: #0e7182;
  --teal-soft: #e6f2f3;
  --red: #b74738;
  --red-soft: #faece8;
  --green: #39785b;
  --green-soft: #e8f3ed;
  --amber: #996d19;
  --amber-soft: #fff4d9;
  --shadow: 0 14px 36px rgba(17, 31, 43, 0.14);
  font-family: Inter, "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  color: var(--ink);
  background: var(--surface-soft);
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: var(--surface-soft); }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .58; }
.hidden { display: none !important; }
.mobile-only { display: none !important; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 248px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; background: var(--nav); color: #f5f9fb; display: flex; flex-direction: column; padding: 20px 14px; z-index: 20; }
.brand { display: flex; align-items: center; gap: 11px; padding: 4px 8px 22px; border-bottom: 1px solid rgba(255,255,255,.12); }
.brand-mark { width: 38px; height: 38px; display: grid; place-items: center; background: #f2f7f8; color: var(--nav); font-weight: 800; font-size: 18px; border-radius: 6px; }
.brand strong, .brand span { display: block; }
.brand strong { font-size: 13px; line-height: 1.25; }
.brand span { margin-top: 3px; font-size: 11px; color: #afc2cc; }
.nav-list { display: grid; gap: 4px; padding-top: 20px; }
.nav-item { width: 100%; height: 42px; border: 0; background: transparent; color: #c7d3d9; display: grid; grid-template-columns: 22px 1fr auto; align-items: center; text-align: left; gap: 10px; padding: 0 10px; border-radius: 6px; }
.nav-item:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-item.active { background: var(--nav-soft); color: #fff; box-shadow: inset 3px 0 0 #62b8c4; }
.nav-item svg { width: 18px; height: 18px; }
.nav-item b { min-width: 25px; height: 20px; padding: 0 6px; display: grid; place-items: center; border-radius: 10px; background: rgba(255,255,255,.1); font-size: 11px; }
.sidebar-footer { margin-top: auto; display: grid; gap: 8px; padding: 16px 8px 2px; border-top: 1px solid rgba(255,255,255,.12); }
.sidebar-footer label { font-size: 11px; color: #aebfc8; }
.sidebar-footer input { width: 100%; height: 36px; border: 1px solid rgba(255,255,255,.17); color: #fff; background: rgba(255,255,255,.07); padding: 0 10px; border-radius: 4px; outline: none; }
.sidebar-footer .quiet-button { color: #d8e3e8; border-color: rgba(255,255,255,.17); }

.main-content { min-width: 0; }
.topbar { height: 60px; display: flex; align-items: center; gap: 12px; padding: 0 26px; background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 15; }
.breadcrumb { display: flex; gap: 8px; align-items: center; font-size: 13px; color: var(--muted); }
.breadcrumb b { color: #b4bdc4; }
.breadcrumb strong { color: var(--ink); }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.service-state { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.service-state svg { width: 9px; height: 9px; fill: currentColor; }
.service-state.ok { color: var(--green); }
.service-state.error { color: var(--red); }

.view { display: none; padding: 24px 28px 42px; max-width: 1680px; margin: 0 auto; }
.view.active { display: block; }
.science-banner { position: relative; height: 200px; overflow: hidden; border-radius: 6px; background: #dfe7ea; }
.science-banner img { width: 100%; height: 100%; object-fit: cover; object-position: center; display: block; }
.science-banner::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(18,42,55,.88) 0%, rgba(18,42,55,.65) 43%, rgba(18,42,55,.08) 78%); }
.banner-overlay { position: absolute; inset: 0 auto 0 0; z-index: 1; width: min(700px, 72%); display: flex; flex-direction: column; justify-content: center; padding: 24px 34px; color: #fff; }
.banner-overlay p, .section-heading p { margin: 0 0 7px; font-size: 11px; font-weight: 800; letter-spacing: .12em; color: #78c5cf; }
.banner-overlay h1 { margin: 0 0 10px; font-size: clamp(24px, 2.3vw, 38px); line-height: 1.18; letter-spacing: 0; max-width: 650px; }
.banner-overlay span { max-width: 610px; font-size: 14px; line-height: 1.65; color: #d8e7eb; }

.metric-strip { display: grid; grid-template-columns: repeat(5, minmax(130px, 1fr)); background: var(--surface); border: 1px solid var(--line); border-top: 0; }
.metric-strip div { min-height: 82px; padding: 16px 20px; border-right: 1px solid var(--line); }
.metric-strip div:last-child { border-right: 0; }
.metric-strip span, .metric-strip strong { display: block; }
.metric-strip span { font-size: 12px; color: var(--muted); }
.metric-strip strong { margin-top: 5px; font-size: 24px; letter-spacing: 0; }

.toolbar, .review-toolbar { display: flex; align-items: center; gap: 9px; margin-top: 22px; padding: 10px; background: var(--surface); border: 1px solid var(--line); }
.search-field { min-width: 260px; max-width: 460px; flex: 1; display: flex; align-items: center; gap: 8px; height: 38px; border: 1px solid var(--line-strong); padding: 0 10px; background: #fff; }
.search-field:focus-within { border-color: var(--teal); box-shadow: 0 0 0 2px rgba(14,113,130,.12); }
.search-field svg { width: 17px; color: var(--muted); }
.search-field input { width: 100%; border: 0; outline: 0; }
select, input, textarea { border: 1px solid var(--line-strong); background: #fff; color: var(--ink); border-radius: 4px; outline: none; }
select:focus, input:focus, textarea:focus { border-color: var(--teal); box-shadow: 0 0 0 2px rgba(14,113,130,.12); }
.toolbar select { height: 38px; padding: 0 30px 0 10px; }
.toolbar-spacer { flex: 1; }

.icon-button { width: 38px; height: 38px; border: 1px solid var(--line); background: #fff; color: var(--ink); display: inline-grid; place-items: center; border-radius: 4px; flex: none; }
.icon-button:hover { border-color: var(--teal); color: var(--teal); background: var(--teal-soft); }
.icon-button svg { width: 17px; height: 17px; }
.command-button, .primary-button, .quiet-button { min-height: 38px; border-radius: 4px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 0 14px; font-weight: 700; font-size: 13px; text-decoration: none; }
.command-button, .primary-button { border: 1px solid var(--teal); background: var(--teal); color: #fff; }
.command-button:hover, .primary-button:hover { background: #095f6e; }
.quiet-button { border: 1px solid var(--line-strong); background: transparent; color: var(--ink); }
.quiet-button:hover { background: var(--surface-soft); border-color: #8b9aa4; }
.quiet-button svg, .command-button svg, .primary-button svg { width: 16px; height: 16px; }
.link-button { white-space: nowrap; }

.table-wrap { overflow: auto; background: var(--surface); border: 1px solid var(--line); border-top: 0; }
.data-table { width: 100%; border-collapse: collapse; table-layout: fixed; min-width: 930px; }
.data-table th { height: 42px; padding: 0 12px; background: #eef2f4; border-bottom: 1px solid var(--line-strong); text-align: left; font-size: 11px; color: #53616c; text-transform: uppercase; }
.data-table td { padding: 12px; border-bottom: 1px solid var(--line); font-size: 13px; vertical-align: middle; }
.data-table tbody tr:hover { background: #f8fbfc; }
.data-table tr:last-child td { border-bottom: 0; }
.col-index { width: 64px; text-align: center !important; }
.col-actions { width: 54px; }
.data-table th:nth-child(2) { width: 36%; }
.data-table th:nth-child(3) { width: 84px; }
.data-table th:nth-child(4) { width: 100px; }
.data-table th:nth-child(5) { width: 70px; }
.data-table th:nth-child(6), .data-table th:nth-child(7) { width: 96px; }
.document-cell { display: grid; gap: 4px; }
.document-cell button { padding: 0; border: 0; background: none; text-align: left; font-weight: 700; color: var(--ink); line-height: 1.35; }
.document-cell button:hover { color: var(--teal); }
.document-cell span { color: var(--muted); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge { display: inline-flex; min-height: 22px; align-items: center; padding: 2px 7px; border-radius: 3px; background: #edf1f3; color: #4d5a63; font-size: 11px; font-weight: 700; }
.badge.green { background: var(--green-soft); color: var(--green); }
.badge.amber { background: var(--amber-soft); color: var(--amber); }
.badge.red { background: var(--red-soft); color: var(--red); }
.badge.teal { background: var(--teal-soft); color: var(--teal); }
.pagination { display: flex; justify-content: flex-end; align-items: center; gap: 7px; padding: 12px 0; }
.pagination span { margin-right: 8px; font-size: 12px; color: var(--muted); }
.empty-state { min-height: 260px; display: grid; place-items: center; align-content: center; gap: 8px; color: var(--muted); }
.empty-state svg { width: 32px; height: 32px; }

.section-heading { min-height: 90px; display: flex; align-items: flex-start; justify-content: space-between; gap: 30px; border-bottom: 1px solid var(--line); margin-bottom: 24px; }
.section-heading h1 { margin: 0; font-size: 27px; letter-spacing: 0; }
.section-heading > span { max-width: 480px; font-size: 13px; color: var(--muted); line-height: 1.65; text-align: right; }
.upload-layout, .settings-grid { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(310px, .75fr); gap: 24px; align-items: start; }
.drop-zone { min-height: 286px; border: 1px dashed #91a4ae; background: var(--surface); display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 28px; cursor: pointer; border-radius: 6px; }
.drop-zone:hover, .drop-zone.dragging { border-color: var(--teal); background: #f2f9fa; }
.drop-zone input { display: none; }
.drop-zone svg { width: 38px; height: 38px; color: var(--teal); }
.drop-zone strong { margin-top: 14px; font-size: 17px; }
.drop-zone span { margin-top: 6px; font-size: 12px; color: var(--muted); }
.drop-zone em { margin-top: 18px; min-height: 36px; display: inline-flex; align-items: center; padding: 0 14px; background: var(--teal-soft); color: var(--teal); border: 1px solid #a9d1d6; border-radius: 4px; font-style: normal; font-weight: 700; font-size: 13px; }
.selected-files { display: grid; gap: 6px; margin-top: 10px; }
.selected-file { display: grid; grid-template-columns: 20px 1fr auto; gap: 8px; align-items: center; min-height: 38px; padding: 6px 10px; background: #fff; border: 1px solid var(--line); font-size: 12px; }
.selected-file svg { width: 16px; color: var(--muted); }
.selected-file span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.selected-file b { color: var(--muted); font-weight: 500; }
.form-panel, .security-panel { background: var(--surface); border: 1px solid var(--line); padding: 20px; display: grid; gap: 16px; border-radius: 6px; }
.panel-title { display: flex; align-items: center; gap: 8px; min-height: 28px; border-bottom: 1px solid var(--line); padding-bottom: 12px; }
.panel-title svg { width: 18px; color: var(--teal); }
.form-panel label { display: grid; gap: 7px; font-size: 12px; font-weight: 700; }
.form-panel input, .form-panel select, .form-panel textarea { min-height: 40px; padding: 8px 10px; font-weight: 400; }
.checkbox-row { grid-template-columns: 18px 1fr !important; align-items: center; }
.checkbox-row input { width: 16px; min-height: 16px !important; box-shadow: none; }
.progress-block { display: grid; gap: 8px; }
.progress-block div { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }
progress { width: 100%; height: 8px; accent-color: var(--teal); }
.section-band { min-height: 52px; margin-top: 28px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; }
.upload-list { background: #fff; }
.upload-row { width: 100%; min-height: 62px; display: grid; grid-template-columns: 34px minmax(0,1fr) auto; align-items: center; gap: 12px; padding: 8px 12px; border: 0; border-bottom: 1px solid var(--line); background: #fff; text-align: left; }
.upload-row > svg { width: 19px; color: var(--teal); }
.upload-row strong, .upload-row span { display: block; }
.upload-row strong { font-size: 13px; }
.upload-row span { margin-top: 3px; color: var(--muted); font-size: 11px; }

.review-toolbar { justify-content: space-between; margin-top: 0; margin-bottom: 12px; }
.segmented { display: flex; border: 1px solid var(--line-strong); border-radius: 4px; overflow: hidden; }
.segmented button { height: 36px; border: 0; border-right: 1px solid var(--line-strong); background: #fff; color: var(--muted); padding: 0 14px; }
.segmented button:last-child { border-right: 0; }
.segmented button.active { background: var(--nav); color: #fff; }
.review-list { display: grid; gap: 10px; }
.review-item { background: #fff; border: 1px solid var(--line); display: grid; grid-template-columns: minmax(0,1fr) 220px; }
.review-main { padding: 14px 16px; min-width: 0; }
.review-source { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; padding: 10px 16px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 11px; }
.review-source > span { flex: none; padding: 3px 6px; background: var(--teal-soft); color: var(--teal); border-radius: 3px; font-weight: 700; }
.review-source button { min-width: 0; border: 0; background: none; padding: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; color: var(--ink); cursor: pointer; }
.review-main > div { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.review-main > div small { color: var(--muted); }
.review-payload { width: 100%; min-height: 150px; margin-top: 10px; padding: 10px; resize: vertical; border: 1px solid var(--line); background: #fbfcfc; font: 11px/1.5 Consolas, monospace; }
.review-main h3 { margin: 8px 0 6px; font-size: 14px; }
.review-evidence { margin: 8px 0 0; padding: 10px 12px; background: #f7f9fa; border-left: 3px solid #aac1ca; color: #46535d; font-size: 12px; line-height: 1.55; white-space: pre-wrap; }
.payload-preview { margin: 8px 0 0; font-family: Consolas, monospace; font-size: 11px; color: #34434e; white-space: pre-wrap; overflow-wrap: anywhere; }
.review-actions { border-left: 1px solid var(--line); padding: 12px; display: grid; align-content: center; gap: 8px; }
.review-actions .button-row { justify-content: flex-end; }

.settings-panel { max-width: 680px; }
.password-field { display: grid; grid-template-columns: 1fr 40px; }
.password-field input { border-radius: 4px 0 0 4px; }
.password-field button { border-radius: 0 4px 4px 0; height: 40px; }
.button-row { display: flex; gap: 8px; flex-wrap: wrap; }
.inline-result { padding: 10px 12px; border: 1px solid var(--line); background: var(--surface-soft); font-size: 12px; line-height: 1.5; white-space: pre-wrap; }
.inline-result.success { background: var(--green-soft); color: var(--green); border-color: #b9d8c7; }
.inline-result.error { background: var(--red-soft); color: var(--red); border-color: #e6bbb4; }
.security-panel ul { margin: 0; padding-left: 20px; display: grid; gap: 12px; color: #45535c; font-size: 13px; line-height: 1.55; }
.provider-note { padding: 14px; background: var(--teal-soft); border-left: 3px solid var(--teal); }
.provider-note strong, .provider-note span { display: block; }
.provider-note span { margin-top: 6px; color: #43555c; font-size: 12px; line-height: 1.55; }

.route-layout { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(320px, .9fr); gap: 22px; align-items: start; }
.route-form textarea { min-height: 84px; resize: vertical; line-height: 1.55; }
.route-context { background: var(--surface); border: 1px solid var(--line); padding: 20px; display: grid; gap: 16px; border-radius: 6px; }
.context-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; }
.context-grid > div { min-height: 74px; border: 1px solid var(--line); background: #fbfcfc; padding: 12px; display: grid; align-content: center; gap: 4px; }
.context-grid span { font-size: 12px; color: var(--muted); }
.context-grid strong { font-size: 21px; }
.context-list { grid-column: span 2; align-content: start !important; }
.context-list strong { font-size: 13px; margin-bottom: 6px; }
.context-list span, .context-list b { font-size: 12px; display: inline-flex; margin-right: 7px; margin-bottom: 6px; }
.context-list span { padding: 3px 6px; border-radius: 3px; background: var(--teal-soft); color: var(--teal); }
.route-results { margin-top: 24px; display: grid; gap: 16px; }
.route-card-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 16px; }
.route-card { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 18px; display: grid; gap: 14px; }
.route-card header { display: flex; gap: 10px; align-items: flex-start; border-bottom: 1px solid var(--line); padding-bottom: 12px; }
.route-card header svg { width: 22px; color: var(--teal); margin-top: 2px; }
.route-card header span { font-size: 11px; color: var(--teal); font-weight: 800; letter-spacing: .08em; }
.route-card h2 { margin: 3px 0 0; font-size: 18px; line-height: 1.35; }
.route-detail-grid { display: grid; grid-template-columns: 120px 1fr; border-top: 1px solid var(--line); }
.route-detail-grid span, .route-detail-grid b { padding: 8px; border-bottom: 1px solid var(--line); font-size: 12px; }
.route-detail-grid span { color: var(--muted); background: #f7f9fa; }
.route-detail-grid b { overflow-wrap: anywhere; }
.route-block { display: grid; gap: 6px; }
.route-block strong { font-size: 13px; }
.route-block ul, .route-card ol, .route-card ul { margin: 0; padding-left: 20px; color: #40505a; font-size: 12px; line-height: 1.6; }
.route-block p { margin: 0; color: var(--muted); font-size: 12px; }
.synthesis-gate { border-left: 4px solid var(--teal); }
.route-card details summary { cursor: pointer; color: var(--teal); font-weight: 700; font-size: 12px; }
.reparse-panel { background: var(--surface); border: 1px solid var(--line); padding: 18px; display: grid; grid-template-columns: minmax(0,1fr) 320px; gap: 18px; align-items: start; }
.reparse-status { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 10px; }
.reparse-status > div { border: 1px solid var(--line); background: #fbfcfc; padding: 12px; display: grid; gap: 5px; align-content: center; min-height: 70px; }
.reparse-status span { color: var(--muted); font-size: 12px; }
.reparse-status strong { font-size: 18px; }
.reparse-progress, .reparse-current { grid-column: 1 / -1; }
.reparse-progress progress { margin: 4px 0; }
.reparse-current span { overflow-wrap: anywhere; color: var(--ink); }
.reparse-controls { display: grid; gap: 12px; padding: 14px; border: 1px solid var(--line); background: #f7f9fa; }
.reparse-controls label { display: grid; gap: 7px; font-size: 12px; font-weight: 700; }
.reparse-controls input[type="number"] { min-height: 38px; padding: 7px 9px; }

.drawer-backdrop { position: fixed; inset: 0; background: rgba(14,24,31,.35); z-index: 40; }
.document-drawer { position: fixed; top: 0; right: 0; width: min(760px, 94vw); height: 100vh; background: #fff; z-index: 45; box-shadow: var(--shadow); transform: translateX(101%); transition: transform .22s ease; display: grid; grid-template-rows: auto 1fr; }
.document-drawer.open { transform: translateX(0); }
.drawer-header { min-height: 84px; display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.drawer-header span { font-size: 11px; font-weight: 800; color: var(--teal); text-transform: uppercase; }
.drawer-header h2 { margin: 5px 0 0; font-size: 19px; line-height: 1.3; }
.drawer-content { overflow: auto; padding: 18px 20px 40px; }
.detail-actions { display: flex; gap: 8px; flex-wrap: wrap; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.detail-grid { display: grid; grid-template-columns: 150px 1fr; margin: 18px 0; border-top: 1px solid var(--line); }
.detail-grid > span, .detail-grid > b { margin: 0; padding: 9px 8px; border-bottom: 1px solid var(--line); font-size: 12px; }
.detail-grid > span { color: var(--muted); background: #f7f9fa; }
.detail-grid > b { overflow-wrap: anywhere; }
.records-heading { display: flex; align-items: center; justify-content: space-between; margin: 24px 0 10px; }
.records-heading h3 { margin: 0; font-size: 15px; }
.record-row { border-top: 1px solid var(--line); padding: 12px 0; }
.record-row header { display: flex; align-items: center; gap: 8px; }
.record-row pre { margin: 8px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; background: #f7f9fa; padding: 9px; font-size: 11px; font-family: Consolas, monospace; }
.record-row blockquote { margin: 8px 0 0; padding-left: 10px; border-left: 3px solid #bdd0d6; color: #56636c; font-size: 12px; }
.ai-run-panel { margin-top: 14px; padding: 14px; background: #f5f9fa; border: 1px solid #cbdde2; display: grid; gap: 10px; }
.ai-run-panel label { font-size: 12px; display: grid; gap: 6px; }
.ai-run-panel textarea { min-height: 74px; padding: 8px; resize: vertical; }
.job-status { padding: 10px; background: var(--amber-soft); color: var(--amber); font-size: 12px; }

dialog { border: 0; border-radius: 6px; box-shadow: var(--shadow); padding: 0; width: min(430px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(15,27,35,.45); }
.dialog-form { padding: 20px; display: grid; gap: 14px; }
.dialog-form p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.dialog-form label { display: grid; gap: 6px; font-size: 12px; font-weight: 700; }
.dialog-form input { min-height: 40px; padding: 8px; }
.toast-region { position: fixed; right: 20px; bottom: 20px; z-index: 100; display: grid; gap: 8px; width: min(390px, calc(100vw - 40px)); }
.toast { padding: 12px 14px; border-radius: 5px; background: var(--nav); color: #fff; box-shadow: var(--shadow); font-size: 12px; line-height: 1.45; animation: toast-in .18s ease; }
.toast.error { background: #8e3429; }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } }

@media (max-width: 1050px) {
  .app-shell { grid-template-columns: 78px minmax(0, 1fr); }
  .sidebar { padding: 16px 9px; }
  .brand { justify-content: center; padding: 2px 0 18px; }
  .brand > div:last-child, .nav-item span, .nav-item b, .sidebar-footer label, .sidebar-footer input, .sidebar-footer span { display: none; }
  .nav-item { grid-template-columns: 1fr; justify-items: center; padding: 0; }
  .sidebar-footer { justify-items: center; padding: 14px 0 0; }
  .sidebar-footer .quiet-button { width: 42px; padding: 0; }
  .upload-layout, .settings-grid, .route-layout, .reparse-panel { grid-template-columns: 1fr; }
  .route-card-grid { grid-template-columns: 1fr; }
  .reparse-status { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .metric-strip { grid-template-columns: repeat(3, 1fr); }
  .metric-strip div:nth-child(3) { border-right: 0; }
  .metric-strip div:nth-child(n+4) { border-top: 1px solid var(--line); }
}

@media (max-width: 720px) {
  .mobile-only { display: inline-grid !important; }
  .app-shell { display: block; }
  .sidebar { position: fixed; left: 0; transform: translateX(-102%); width: 248px; height: 100vh; transition: transform .2s ease; }
  .nav-open .sidebar { transform: translateX(0); }
  .sidebar .brand { justify-content: flex-start; padding: 4px 8px 20px; }
  .sidebar .brand > div:last-child, .sidebar .nav-item span, .sidebar .nav-item b, .sidebar .sidebar-footer label, .sidebar .sidebar-footer input, .sidebar .sidebar-footer span { display: block; }
  .sidebar .nav-item { grid-template-columns: 22px 1fr auto; justify-items: stretch; padding: 0 10px; }
  .sidebar .sidebar-footer { justify-items: stretch; padding: 16px 8px 2px; }
  .sidebar .sidebar-footer .quiet-button { width: 100%; padding: 0 14px; }
  .topbar { height: 56px; padding: 0 12px; }
  .breadcrumb span, .breadcrumb b, .service-state { display: none; }
  .topbar-actions { gap: 6px; }
  .command-button { width: 38px; padding: 0; font-size: 0; }
  .view { padding: 16px 12px 32px; }
  .science-banner { height: 245px; }
  .banner-overlay { width: 100%; padding: 20px; }
  .banner-overlay h1 { font-size: 26px; }
  .metric-strip { grid-template-columns: repeat(2, 1fr); }
  .metric-strip div { border-top: 1px solid var(--line); }
  .metric-strip div:first-child, .metric-strip div:nth-child(2) { border-top: 0; }
  .metric-strip div:nth-child(even) { border-right: 0; }
  .toolbar { flex-wrap: wrap; }
  .search-field { max-width: none; min-width: 100%; }
  .toolbar select { flex: 1; min-width: 140px; }
  .toolbar-spacer { display: none; }
  .link-button { flex: 1; }
  .section-heading { display: block; min-height: 0; padding-bottom: 16px; }
  .section-heading h1 { font-size: 23px; }
  .section-heading > span { display: block; margin-top: 10px; text-align: left; }
  .review-item { grid-template-columns: 1fr; }
  .review-actions { border-left: 0; border-top: 1px solid var(--line); }
  .context-grid { grid-template-columns: 1fr; }
  .context-list { grid-column: span 1; }
  .route-detail-grid { grid-template-columns: 100px 1fr; }
  .reparse-status { grid-template-columns: 1fr; }
  .segmented { width: 100%; overflow-x: auto; }
  .segmented button { flex: none; }
  .upload-row { grid-template-columns: 28px minmax(0,1fr) 42px; }
  .upload-row > .upload-meta, .upload-row > .upload-status { display: none; }
  .detail-grid { grid-template-columns: 110px 1fr; }
}
