@charset "UTF-8";

:root {
  --primary: #174b3f;
  --primary-hover: #103a31;
  --primary-soft: #dfe8df;
  --accent: #d66b43;
  --accent-soft: #f4d8c9;
  --bg: #f3f0e8;
  --surface: #fcfbf7;
  --surface-muted: #ece9df;
  --border: #dcd8cc;
  --text: #1d2925;
  --text-sub: #68746e;
  --success: #2f7660;
  --warning: #b06a2d;
  --danger: #a94b43;
  --font-display: "Songti SC", "STSong", Georgia, serif;
  --font-body: "Microsoft YaHei", "PingFang SC", sans-serif;
  --font-mono: "Cascadia Mono", Consolas, monospace;
  --sidebar: 216px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --shadow: 0 8px 28px rgba(29, 41, 37, .07);
  --shadow-modal: 0 24px 80px rgba(29, 41, 37, .18);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--text);
  background-color: var(--bg);
  background-image: linear-gradient(rgba(23, 75, 63, .022) 1px, transparent 1px), linear-gradient(90deg, rgba(23, 75, 63, .022) 1px, transparent 1px);
  background-size: 32px 32px;
  font: 14px/1.6 var(--font-body);
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; }
button, a, input, select { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
a { color: inherit; }
button:not(:disabled), select:not(:disabled) { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .48; }
:focus-visible { outline: 3px solid rgba(214, 107, 67, .35); outline-offset: 3px; }
[hidden] { display: none !important; }
.svg-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { width: 18px; height: 18px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.mono { font-family: var(--font-mono); }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 50;
  width: var(--sidebar);
  display: flex;
  flex-direction: column;
  padding: 28px 18px 20px;
  color: #f3f0e8;
  background: var(--primary);
  border-right: 1px solid rgba(255, 255, 255, .08);
}
.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px; }
.brand-mark { display: grid; place-items: center; width: 39px; height: 43px; color: var(--primary); background: #f0eadc; border-radius: 3px 12px 3px 3px; }
.brand-mark .icon { width: 26px; height: 26px; stroke-width: 1.8; }
.brand strong { display: block; font: 28px/1.1 var(--font-display); letter-spacing: .14em; }
.brand div span { display: block; margin-top: 6px; color: rgba(255, 255, 255, .58); font: 8px/1 var(--font-mono); letter-spacing: .17em; }
.sidebar-edition { display: flex; justify-content: space-between; margin: 25px 8px 30px; padding-top: 14px; color: rgba(255, 255, 255, .58); border-top: 1px solid rgba(255, 255, 255, .12); font-size: 10px; letter-spacing: .06em; }
.sidebar-edition span { font-family: var(--font-mono); }
.nav-label { margin: 0 10px 10px; color: rgba(255, 255, 255, .38); font: 9px/1 var(--font-mono); letter-spacing: .18em; }
.nav-label-secondary { margin-top: 30px; }
.main-nav { display: flex; flex-direction: column; gap: 5px; }
.nav-item { display: flex; align-items: center; gap: 11px; width: 100%; min-height: 45px; padding: 0 12px; color: rgba(255, 255, 255, .68); background: transparent; border: 1px solid transparent; border-radius: var(--radius-md); text-align: left; text-decoration: none; transition: color .18s, background .18s, border-color .18s; }
.nav-item:hover { color: #fff; background: rgba(255, 255, 255, .065); }
.nav-item.is-active { color: var(--primary); background: #f0eadc; border-color: rgba(255, 255, 255, .18); font-weight: 700; }
.nav-item .icon { width: 17px; height: 17px; }
.nav-index { margin-left: auto; opacity: .45; font: 10px var(--font-mono); }
.nav-end { margin-left: auto; width: 14px !important; opacity: .45; }
.sidebar-note { margin: auto 7px 22px; padding: 18px 14px; border: 1px solid rgba(255, 255, 255, .13); border-radius: 3px 14px 3px 3px; background: rgba(255, 255, 255, .035); }
.note-index { color: #d9a88e; font: 9px var(--font-mono); letter-spacing: .18em; }
.sidebar-note p { margin: 12px 0 14px; color: rgba(255, 255, 255, .7); font: 14px/1.8 var(--font-display); }
.text-link { display: inline-flex; align-items: center; gap: 6px; padding: 0; color: var(--primary); background: none; border: 0; font-size: 12px; font-weight: 700; }
.text-link:hover { color: var(--accent); }
.text-link .icon { width: 14px; height: 14px; }
.sidebar-note .text-link { color: #e9c4ae; }
.sidebar-status { display: flex; align-items: center; gap: 9px; padding: 14px 7px 0; border-top: 1px solid rgba(255, 255, 255, .12); }
.status-dot { display: inline-block; flex: 0 0 auto; width: 7px; height: 7px; background: #75a990; border-radius: 50%; box-shadow: 0 0 0 4px rgba(117, 169, 144, .12); }
.sidebar-status div { min-width: 0; flex: 1; }
.sidebar-status strong, .sidebar-status span { display: block; }
.sidebar-status strong { color: rgba(255, 255, 255, .8); font-size: 11px; font-weight: 500; }
.sidebar-status div span { margin-top: 2px; color: rgba(255, 255, 255, .4); font-size: 9px; }
.sidebar-status > .icon { width: 15px; color: rgba(255, 255, 255, .35); }

.main-shell { min-height: 100vh; margin-left: var(--sidebar); }
.main-header { display: flex; align-items: center; justify-content: space-between; gap: 28px; max-width: 1680px; margin: 0 auto; padding: 31px 36px 26px; }
.header-copy { display: flex; align-items: center; gap: 14px; min-width: 0; }
.eyebrow, .section-kicker { margin: 0 0 7px; color: var(--accent); font: 9px/1.3 var(--font-mono); letter-spacing: .15em; }
.header-copy h1 { margin: 0; font: 34px/1.25 var(--font-display); letter-spacing: .04em; }
.header-copy p:last-child { margin: 7px 0 0; color: var(--text-sub); font-size: 12px; }
.header-actions { display: flex; align-items: center; gap: 9px; flex: 0 0 auto; }
.snapshot { padding-right: 18px; margin-right: 5px; text-align: right; border-right: 1px solid var(--border); }
.snapshot span, .snapshot strong { display: block; }
.snapshot span { color: var(--text-sub); font-size: 9px; letter-spacing: .1em; }
.snapshot strong { margin-top: 3px; font: 12px var(--font-mono); }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 38px; padding: 0 14px; border: 1px solid transparent; border-radius: var(--radius-md); font-size: 12px; font-weight: 700; white-space: nowrap; transition: background .18s, border-color .18s, color .18s, transform .18s; }
.button:not(:disabled):active { transform: translateY(1px); }
.button .icon { width: 15px; height: 15px; }
.button-primary { color: #fff; background: var(--primary); border-color: var(--primary); }
.button-primary:hover:not(:disabled) { background: var(--primary-hover); border-color: var(--primary-hover); }
.button-secondary { color: var(--text); background: var(--surface); border-color: var(--border); }
.button-secondary:hover:not(:disabled) { color: var(--primary); border-color: #aebbb3; background: #fff; }
.button-full { width: 100%; }
.icon-button { display: inline-grid; place-items: center; flex: 0 0 auto; width: 34px; height: 34px; padding: 0; color: var(--text-sub); background: transparent; border: 1px solid transparent; border-radius: var(--radius-sm); transition: color .18s, background .18s, border-color .18s; }
.icon-button:hover { color: var(--primary); background: var(--surface-muted); border-color: var(--border); }
.mobile-menu { display: none; }
.content-wrap { max-width: 1680px; margin: 0 auto; padding: 0 36px 28px; }
.view { animation: view-in .36s ease both; }
@keyframes view-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

.kpi-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi-card { position: relative; min-width: 0; padding: 19px 22px 17px; overflow: hidden; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); }
.kpi-card::after { content: ""; position: absolute; right: -20px; bottom: -35px; width: 110px; height: 90px; border: 1px solid rgba(23, 75, 63, .06); border-radius: 50%; transform: rotate(-18deg); }
.kpi-primary { color: #fff; background: var(--primary); border-color: var(--primary); }
.kpi-primary::after { border-color: rgba(255, 255, 255, .1); }
.kpi-top { display: flex; align-items: center; justify-content: space-between; color: var(--text-sub); font-size: 11px; letter-spacing: .03em; }
.kpi-top .icon { width: 17px; height: 17px; opacity: .75; }
.kpi-primary .kpi-top { color: rgba(255, 255, 255, .68); }
.kpi-value { display: flex; align-items: baseline; gap: 8px; margin-top: 7px; }
.kpi-value strong { overflow: hidden; text-overflow: ellipsis; font: 40px/1.2 var(--font-display); letter-spacing: -.02em; }
.kpi-value > span { color: var(--text-sub); font-size: 11px; }
.kpi-primary .kpi-value > span { color: rgba(255, 255, 255, .6); }
.kpi-value.kpi-highest strong { font-size: 34px; }
.kpi-card p { position: relative; z-index: 1; margin: 5px 0 0; color: var(--text-sub); font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-primary p { color: rgba(255, 255, 255, .55); }
.kpi-rule { position: absolute; left: 0; bottom: 0; width: 34%; height: 3px; background: var(--accent); }
.panel { min-width: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); }
.panel-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 73px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.panel-header h2 { margin: 0; font: 20px/1.25 var(--font-display); letter-spacing: .02em; }
.panel-header .section-kicker { margin-bottom: 5px; color: var(--text-sub); font-size: 8px; }
.tag { display: inline-flex; align-items: center; min-height: 23px; padding: 0 8px; border-radius: 5px; font-size: 10px; font-weight: 700; white-space: nowrap; }
.tag-green { color: var(--primary); background: var(--primary-soft); }
.small-label { color: var(--text-sub); font-size: 10px; }
.map-context-bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 43px; margin-bottom: 12px; padding: 0 2px; }
.breadcrumb { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; margin: 0; padding: 0; list-style: none; }
.breadcrumb li { display: flex; align-items: center; gap: 4px; color: var(--text-sub); }
.breadcrumb button { padding: 4px 7px; color: var(--text-sub); background: transparent; border: 0; border-radius: 4px; font-size: 12px; }
.breadcrumb button:hover { color: var(--primary); background: var(--surface-muted); }
.breadcrumb li:last-child button { color: var(--primary); font-weight: 700; }
.breadcrumb .icon { width: 12px; height: 12px; opacity: .5; }
.context-note { display: inline-flex; align-items: center; gap: 5px; color: var(--text-sub); font-size: 10px; }
.context-note .icon { width: 13px; height: 13px; }
.workspace-grid { display: grid; grid-template-columns: minmax(0, 1fr) 316px; gap: 14px; align-items: stretch; }
.map-panel { display: flex; flex-direction: column; overflow: hidden; }
.map-header-tools { display: flex; align-items: center; gap: 12px; }
.map-tools { display: flex; padding: 2px; background: var(--surface-muted); border: 1px solid var(--border); border-radius: 7px; }
.map-tools .icon-button { width: 29px; height: 27px; border: 0; border-radius: 4px; }
.map-tools .icon-button:hover { background: var(--surface); }
.map-tools .icon { width: 14px; height: 14px; }
.map-stage { position: relative; flex: 1; min-height: 510px; overflow: hidden; background: radial-gradient(circle at 50% 43%, rgba(223, 232, 223, .55), transparent 58%), linear-gradient(rgba(23, 75, 63, .025) 1px, transparent 1px), linear-gradient(90deg, rgba(23, 75, 63, .025) 1px, transparent 1px), #f8f7f1; background-size: auto, 24px 24px, 24px 24px, auto; }
#map-chart { position: absolute; inset: 0; }
.map-state { position: absolute; inset: 0; z-index: 5; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; color: var(--text-sub); background: rgba(248, 247, 241, .93); text-align: center; }
.map-state strong { color: var(--text); font: 18px var(--font-display); }
.map-state span { font-size: 11px; }
.map-state > .icon { width: 30px; height: 30px; margin-bottom: 5px; color: var(--accent); }
.map-state .button { margin-top: 9px; }
.spinner { display: inline-block; width: 20px; height: 20px; border: 2px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.map-empty { background: rgba(248, 247, 241, .82); }
.map-legend-note { position: absolute; right: 15px; bottom: 13px; z-index: 3; padding: 4px 7px; color: var(--text-sub); background: rgba(252, 251, 247, .78); border-radius: 4px; font-size: 9px; pointer-events: none; }
.map-footer { display: flex; justify-content: space-between; gap: 10px; padding: 10px 18px; color: var(--text-sub); border-top: 1px solid var(--border); font-size: 9px; }
.region-column { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.ranking-panel { display: flex; flex: 1; flex-direction: column; min-height: 0; overflow: hidden; }
.ranking-header { min-height: 73px; padding-right: 16px; }
.ranking-caption { padding: 11px 17px 7px; color: var(--text-sub); font-size: 10px; }
.region-list { flex: 1; min-height: 200px; max-height: 610px; padding: 0 8px 8px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: #c3c7bf transparent; }
.region-row { position: relative; display: grid; grid-template-columns: 25px minmax(0, 1fr) auto; align-items: center; gap: 8px; width: 100%; min-height: 53px; padding: 8px 9px; overflow: hidden; background: transparent; border: 1px solid transparent; border-radius: 7px; text-align: left; transition: background .16s, border-color .16s; }
.region-row:hover { background: var(--surface-muted); }
.region-row.is-selected { background: #fbede5; border-color: #e8bca7; }
.region-rank { position: relative; z-index: 1; color: #929991; font: 10px var(--font-mono); text-align: center; }
.region-rank.top { color: var(--accent); font-weight: 700; }
.region-info { position: relative; z-index: 1; min-width: 0; }
.region-info strong { display: block; overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.region-info span { display: block; margin-top: 1px; color: var(--text-sub); font: 9px var(--font-mono); }
.region-count { position: relative; z-index: 1; text-align: right; }
.region-count strong { display: block; font: 16px var(--font-display); }
.region-count span { display: block; color: var(--text-sub); font-size: 8px; }
.region-bar { position: absolute; left: 0; bottom: 0; height: 2px; background: #a8c2ae; opacity: .65; }
.region-row.is-selected .region-bar { background: var(--accent); }
.ranking-footer { padding: 10px 14px; color: var(--text-sub); background: #f7f5ee; border-top: 1px solid var(--border); font-size: 8px; text-align: center; }
.detail-card { padding: 16px; background: #fbf3eb; border: 1px solid #e5c0ad; border-radius: var(--radius-md); animation: view-in .24s ease both; }
.detail-heading { display: flex; align-items: center; justify-content: space-between; color: var(--accent); font: 8px var(--font-mono); letter-spacing: .16em; }
.detail-heading .icon-button { width: 24px; height: 24px; color: var(--accent); }
.detail-heading .icon { width: 13px; height: 13px; }
.detail-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; margin: 6px 0 13px; }
.detail-title h2 { margin: 0; font: 23px var(--font-display); }
.detail-title p { max-width: 180px; margin: 2px 0 0; overflow: hidden; color: var(--text-sub); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.code-badge { padding: 3px 5px; color: var(--accent); background: rgba(255, 255, 255, .55); border: 1px solid #e5c0ad; border-radius: 4px; font: 9px var(--font-mono); }
.detail-stats { display: grid; grid-template-columns: 1fr 1fr; padding: 11px 0; border-top: 1px solid #ead2c3; border-bottom: 1px solid #ead2c3; }
.detail-stats > div + div { padding-left: 15px; border-left: 1px solid #ead2c3; }
.detail-stats span, .detail-stats strong { display: block; }
.detail-stats span { color: var(--text-sub); font-size: 9px; }
.detail-stats strong { margin-top: 2px; font: 23px var(--font-display); }
.detail-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 10px 0 13px; }
.detail-meta div { min-width: 0; }
.detail-meta dt { color: var(--text-sub); font-size: 8px; }
.detail-meta dd { margin: 2px 0 0; font-size: 11px; font-weight: 700; }
.detail-card .button { min-height: 34px; font-size: 10px; }
.data-footnote { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 13px 2px 0; color: var(--text-sub); font-size: 9px; }
.data-footnote > span { display: inline-flex; align-items: center; gap: 7px; }
.data-footnote .icon { width: 13px; height: 13px; }
.data-footnote a { text-underline-offset: 2px; }

.analysis-intro { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 17px; padding: 22px 24px; color: #fff; background: var(--primary); border-radius: var(--radius-md); }
.analysis-intro h2 { margin: 0; font: 27px var(--font-display); }
.analysis-intro p:last-child { margin: 5px 0 0; color: rgba(255, 255, 255, .6); font-size: 11px; }
.analysis-intro .eyebrow { color: #e6bca4; }
.analysis-intro .button { color: #fff; background: rgba(255, 255, 255, .08); border-color: rgba(255, 255, 255, .2); }
.analysis-grid { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(320px, .8fr); gap: 14px; }
.analysis-panel { min-height: 460px; }
.analysis-bars { display: flex; flex-direction: column; gap: 15px; padding: 22px; }
.analysis-bar-row { display: grid; grid-template-columns: 24px minmax(70px, .45fr) minmax(100px, 1.5fr) 70px; align-items: center; gap: 12px; }
.analysis-bar-row > span:first-child { color: var(--text-sub); font: 10px var(--font-mono); }
.analysis-bar-row button { overflow: hidden; padding: 0; color: var(--text); background: none; border: 0; font-size: 12px; font-weight: 700; text-align: left; text-overflow: ellipsis; white-space: nowrap; }
.analysis-bar-row button:hover { color: var(--accent); }
.bar-track { height: 9px; overflow: hidden; background: var(--surface-muted); border-radius: 3px; }
.bar-fill { height: 100%; background: var(--primary); border-radius: 3px; transform-origin: left; animation: grow .5s ease both; }
.analysis-bar-row:first-child .bar-fill { background: var(--accent); }
@keyframes grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.analysis-bar-value { text-align: right; }
.analysis-bar-value strong { font: 16px var(--font-display); }
.analysis-bar-value span { margin-left: 3px; color: var(--text-sub); font-size: 9px; }
.composition-wrap { display: flex; flex-direction: column; align-items: center; padding: 24px; }
.donut { position: relative; display: grid; place-items: center; width: 188px; height: 188px; margin: 2px auto 22px; background: conic-gradient(var(--surface-muted) 0 100%); border-radius: 50%; }
.donut::after { content: ""; position: absolute; inset: 22px; background: var(--surface); border: 1px solid var(--border); border-radius: 50%; }
.donut > div { position: relative; z-index: 1; text-align: center; }
.donut strong, .donut span { display: block; }
.donut strong { font: 28px var(--font-display); }
.donut span { margin-top: 3px; color: var(--text-sub); font-size: 9px; }
.composition-legend { display: grid; grid-template-columns: 1fr 1fr; gap: 9px 16px; width: 100%; }
.legend-item { display: grid; grid-template-columns: 8px minmax(0, 1fr) auto; align-items: center; gap: 7px; font-size: 10px; }
.legend-swatch { width: 7px; height: 7px; border-radius: 2px; }
.legend-item span:nth-child(2) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.legend-item strong { font: 10px var(--font-mono); }
.insight-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 14px; }
.insight-grid article { padding: 18px 21px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); }
.insight-grid article > span { color: var(--text-sub); font-size: 10px; }
.insight-grid strong { display: block; margin: 4px 0 1px; font: 26px var(--font-display); }
.insight-grid p { margin: 0; color: var(--text-sub); font-size: 10px; }
.empty-inline { padding: 35px 15px; color: var(--text-sub); text-align: center; font-size: 12px; }

.record-summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 14px; }
.record-summary article { position: relative; padding: 14px 18px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); }
.record-summary span { display: block; color: var(--text-sub); font-size: 10px; }
.record-summary strong { display: block; margin-top: 2px; font: 26px var(--font-display); }
.summary-dot { position: absolute; top: 17px; right: 17px; width: 7px; height: 7px; border-radius: 50%; }
.summary-dot.valid { background: var(--success); }
.summary-dot.invalid { background: var(--danger); }
.summary-dot.unmapped { background: var(--warning); }
.filter-panel { display: flex; align-items: flex-end; gap: 10px; margin-bottom: 14px; padding: 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); }
.search-field { position: relative; flex: 1; min-width: 180px; }
.search-field > .icon { position: absolute; top: 50%; left: 12px; width: 16px; height: 16px; color: var(--text-sub); transform: translateY(-50%); pointer-events: none; }
.search-field input { width: 100%; height: 39px; padding: 0 12px 0 37px; color: var(--text); background: #f8f7f1; border: 1px solid var(--border); border-radius: var(--radius-md); outline: none; }
.search-field input:focus { background: #fff; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(23, 75, 63, .08); }
.search-field input::placeholder { color: #929b95; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field > span { color: var(--text-sub); font-size: 9px; }
.field select { min-width: 130px; height: 39px; padding: 0 29px 0 10px; color: var(--text); background: #f8f7f1; border: 1px solid var(--border); border-radius: var(--radius-md); }
.field-small select { min-width: 78px; }
.filter-actions { display: flex; gap: 7px; }
.filter-actions .button { height: 39px; }
.active-filter { display: inline-flex; align-items: center; gap: 5px; margin: -2px 0 12px; padding: 4px 5px 4px 10px; color: var(--primary); background: var(--primary-soft); border-radius: 6px; font-size: 10px; }
.active-filter .icon-button { width: 23px; height: 23px; }
.active-filter .icon { width: 12px; height: 12px; }
.records-panel { overflow: hidden; }
.records-heading > div:last-child { display: flex; align-items: center; gap: 18px; }
.privacy-note { display: inline-flex; align-items: center; gap: 5px; color: var(--text-sub); font-size: 9px; }
.privacy-note .icon { width: 13px; height: 13px; color: var(--success); }
.record-total { font-size: 11px; font-weight: 700; }
.table-scroll { overflow-x: auto; }
.records-table { width: 100%; min-width: 930px; border-collapse: collapse; }
.records-table th { height: 43px; padding: 0 15px; color: var(--text-sub); background: #f5f3ec; border-bottom: 1px solid var(--border); font-size: 9px; font-weight: 500; text-align: left; white-space: nowrap; }
.records-table th button { display: inline-flex; align-items: center; gap: 4px; padding: 0; color: inherit; background: none; border: 0; }
.records-table th button:hover, .records-table th button.is-sorted { color: var(--primary); }
.sort-indicator { display: inline-block; width: 10px; font-family: var(--font-mono); }
.records-table th[aria-sort="ascending"] .sort-indicator::after { content: "↑"; }
.records-table th[aria-sort="descending"] .sort-indicator::after { content: "↓"; }
.records-table th:not([aria-sort]) .sort-indicator::after, .records-table th[aria-sort="none"] .sort-indicator::after { content: "↕"; opacity: .4; }
.records-table td { height: 58px; padding: 8px 15px; border-bottom: 1px solid #ebe8df; font-size: 11px; vertical-align: middle; }
.records-table tbody tr:last-child td { border-bottom: 0; }
.records-table tbody tr:not(.empty-row):hover { background: #faf8f2; }
.person-cell { display: flex; align-items: center; gap: 9px; min-width: 100px; }
.table-avatar { display: grid; place-items: center; width: 30px; height: 30px; color: var(--primary); background: var(--primary-soft); border-radius: 8px 3px 8px 3px; font: 13px var(--font-display); }
.person-cell strong, .person-cell span { display: block; }
.person-cell strong { font-size: 11px; }
.person-cell span { color: var(--text-sub); font: 8px var(--font-mono); }
.id-cell { font: 11px var(--font-mono); letter-spacing: .02em; white-space: nowrap; }
.address-code { display: block; margin-top: 1px; color: var(--text-sub); font: 8px var(--font-mono); }
.status-badge { display: inline-flex; align-items: center; min-height: 22px; padding: 0 7px; border-radius: 5px; font-size: 9px; font-weight: 700; white-space: nowrap; }
.status-valid { color: var(--success); background: #e3eee7; }
.status-invalid { color: var(--danger); background: #f5e4e1; }
.status-unmapped { color: var(--warning); background: #f5eadb; }
.row-detail-button { display: inline-flex; align-items: center; gap: 3px; padding: 5px 7px; color: var(--primary); background: transparent; border: 0; border-radius: 5px; font-size: 10px; font-weight: 700; }
.row-detail-button:hover { background: var(--primary-soft); }
.row-detail-button .icon { width: 12px; height: 12px; }
.table-state { height: 230px !important; color: var(--text-sub); text-align: center; }
.table-state .spinner { margin-right: 8px; vertical-align: middle; }
.table-footer { display: flex; align-items: center; justify-content: space-between; gap: 15px; min-height: 60px; padding: 10px 16px; color: var(--text-sub); background: #faf8f2; border-top: 1px solid var(--border); font-size: 10px; }
.pagination { display: flex; align-items: center; gap: 12px; }
.pagination .button { min-height: 31px; padding: 0 10px; font-size: 10px; }
.pagination > span { min-width: 52px; font: 10px var(--font-mono); text-align: center; }

.modal { width: min(760px, calc(100% - 32px)); max-height: calc(100dvh - 50px); padding: 0; overflow: hidden; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-modal); }
.modal::backdrop, .record-drawer::backdrop { background: rgba(17, 36, 30, .48); backdrop-filter: blur(3px); }
.modal[open] { display: flex; flex-direction: column; animation: modal-in .22s ease both; }
@keyframes modal-in { from { opacity: 0; transform: translateY(12px) scale(.985); } to { opacity: 1; transform: translateY(0) scale(1); } }
.modal-header, .drawer-header { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 21px 24px; border-bottom: 1px solid var(--border); }
.modal-header h2, .drawer-header h2 { margin: 0; font: 25px var(--font-display); }
.modal-body { padding: 22px 24px; overflow-y: auto; }
.modal-lead { margin: 0 0 20px; color: var(--text-sub); font-size: 12px; line-height: 1.8; }
.rule-flow { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.rule-flow article { position: relative; padding: 16px; background: #f5f3ec; border: 1px solid var(--border); border-radius: var(--radius-md); }
.rule-flow article > span { position: absolute; top: 10px; right: 12px; color: #c0c4bc; font: 10px var(--font-mono); }
.rule-flow .icon { color: var(--accent); }
.rule-flow h3 { margin: 12px 0 5px; font: 17px var(--font-display); }
.rule-flow p { margin: 0; color: var(--text-sub); font-size: 10px; line-height: 1.7; }
.code-example { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin: 14px 0; padding: 14px 17px; color: #fff; background: var(--primary); border-radius: var(--radius-md); }
.code-example span, .code-example code, .code-example strong { display: block; }
.code-example span { margin-bottom: 4px; color: rgba(255, 255, 255, .55); font-size: 8px; }
.code-example code { color: #f2d4c2; font: 15px var(--font-mono); letter-spacing: .06em; }
.code-example strong { font-size: 12px; }
.rule-notes { padding: 2px 3px 12px; }
.rule-notes h3, .drawer-section h3 { margin: 0 0 8px; font: 17px var(--font-display); }
.rule-notes ul { margin: 0; padding-left: 18px; color: var(--text-sub); font-size: 10px; line-height: 1.9; }
.rule-notes strong { color: var(--text); }
.sql-note { padding: 14px 17px; background: #f0eee7; border-left: 3px solid var(--accent); border-radius: 0 8px 8px 0; }
.sql-note > span { color: var(--text-sub); font-size: 9px; }
.sql-note pre { margin: 8px 0; overflow-x: auto; }
.sql-note code { color: var(--primary); font: 11px/1.7 var(--font-mono); }
.sql-note p { margin: 0; color: var(--text-sub); font-size: 9px; }
.rule-counts { display: flex; align-items: center; gap: 12px; margin-top: 14px; color: var(--text-sub); font-size: 10px; }
.rule-counts strong { color: var(--success); }
.modal-footer { display: flex; justify-content: flex-end; padding: 14px 24px; background: #f7f5ee; border-top: 1px solid var(--border); }

.record-drawer { position: fixed; inset: 0 0 0 auto; width: min(450px, 100%); max-width: 100%; height: 100dvh; max-height: none; margin: 0; padding: 0; overflow: hidden; color: var(--text); background: var(--surface); border: 0; box-shadow: var(--shadow-modal); }
.record-drawer[open] { display: flex; flex-direction: column; animation: drawer-in .24s ease both; }
@keyframes drawer-in { from { transform: translateX(30px); opacity: .5; } to { transform: translateX(0); opacity: 1; } }
.drawer-body { flex: 1; padding: 22px; overflow-y: auto; }
.person-identity { display: flex; align-items: center; gap: 12px; padding-bottom: 20px; border-bottom: 1px solid var(--border); }
.person-avatar { display: grid; place-items: center; width: 48px; height: 52px; color: #fff; background: var(--primary); border-radius: 6px 17px 6px 6px; font: 23px var(--font-display); }
.person-identity > div { flex: 1; min-width: 0; }
.person-identity h3 { margin: 0; font: 22px var(--font-display); }
.person-identity p { margin: 2px 0 0; color: var(--text-sub); font: 9px var(--font-mono); }
.drawer-section { padding: 22px 0; border-bottom: 1px solid var(--border); }
.id-number-box { padding: 13px 14px; background: #f2f0e8; border: 1px solid var(--border); border-radius: var(--radius-md); }
.id-number-box > span { display: block; color: var(--text-sub); font-size: 8px; }
.id-number-box code { display: block; margin: 6px 0 10px; overflow-wrap: anywhere; color: var(--primary); font: 16px/1.5 var(--font-mono); letter-spacing: .04em; }
.id-number-box > div { display: flex; gap: 18px; }
.id-number-box .text-link { font-size: 9px; }
.drawer-list { margin: 15px 0 0; }
.drawer-list > div { display: flex; justify-content: space-between; gap: 20px; padding: 7px 0; font-size: 11px; }
.drawer-list dt { flex: 0 0 auto; color: var(--text-sub); }
.drawer-list dd { margin: 0; text-align: right; }
.drawer-explanation { margin: 12px 0 0; padding: 10px 12px; color: var(--text-sub); background: #f4f2eb; border-radius: 6px; font-size: 9px; line-height: 1.7; }
.drawer-footer { display: flex; align-items: center; justify-content: center; gap: 6px; padding: 15px; color: var(--text-sub); background: #f4f2eb; border-top: 1px solid var(--border); font-size: 9px; }
.drawer-footer .icon { width: 13px; height: 13px; color: var(--success); }

.toast-region { position: fixed; right: 24px; bottom: 24px; z-index: 200; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; pointer-events: none; }
.toast { display: flex; align-items: center; gap: 9px; max-width: min(360px, calc(100vw - 32px)); padding: 12px 15px; color: #fff; background: var(--primary); border: 1px solid rgba(255, 255, 255, .15); border-radius: var(--radius-md); box-shadow: var(--shadow); font-size: 11px; animation: view-in .2s ease both; }
.toast.error { background: var(--danger); }
.toast .icon { width: 15px; height: 15px; }
.nav-scrim { display: none; }

.role-switch { display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 8px; color: var(--primary); background: var(--primary-soft); border: 1px solid #c7d4c9; border-radius: var(--radius-md); }
.role-switch .icon { width: 14px; height: 14px; }
.role-switch select { max-width: 100px; color: var(--primary); background: transparent; border: 0; outline: 0; font-size: 11px; font-weight: 700; }
.header-actions { flex-wrap: wrap; justify-content: flex-end; }
.tag-orange { color: #9c4e2f; background: var(--accent-soft); }
.panel-actions { display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.panel-actions .button { min-height: 32px; padding: 0 10px; font-size: 10px; }
.field input { width: 100%; min-height: 39px; padding: 8px 11px; color: var(--text); background: #f8f7f1; border: 1px solid var(--border); border-radius: var(--radius-md); outline: none; }
.field input:focus { background: #fff; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(23, 75, 63, .08); }
.field input[readonly] { color: var(--text-sub); background: var(--surface-muted); }

.insights-hero, .governance-hero { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 16px; padding: 24px 26px; color: #fff; background: var(--primary); border-radius: 3px 18px 3px 3px; }
.insights-hero h2, .governance-hero h2 { margin: 0; font: 28px/1.25 var(--font-display); letter-spacing: .03em; }
.insights-hero p:last-child, .governance-hero p:last-child { margin: 7px 0 0; color: rgba(255,255,255,.62); font-size: 11px; }
.insights-hero .eyebrow, .governance-hero .eyebrow { color: #e6bca4; }
.insight-region-field { min-width: 260px; }
.insight-region-field > span { color: rgba(255,255,255,.58); }
.insight-region-field select { width: 100%; color: #fff; background: rgba(255,255,255,.09); border-color: rgba(255,255,255,.22); }
.insight-region-field option { color: var(--text); background: var(--surface); }
.tab-list { display: flex; gap: 5px; margin-bottom: 14px; padding: 5px; background: var(--surface-muted); border: 1px solid var(--border); border-radius: var(--radius-md); width: fit-content; }
.tab-list button { min-width: 112px; min-height: 36px; padding: 0 16px; color: var(--text-sub); background: transparent; border: 0; border-radius: 7px; font-size: 11px; font-weight: 700; }
.tab-list button:hover { color: var(--primary); }
.tab-list button.is-active { color: #fff; background: var(--primary); box-shadow: 0 3px 9px rgba(23,75,63,.13); }
.insight-tab-panel { animation: view-in .25s ease both; }
.metric-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.metric-strip article { position: relative; padding: 17px 19px; overflow: hidden; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); }
.metric-strip article::after { content: ""; position: absolute; right: 0; bottom: 0; width: 34px; height: 3px; background: var(--accent); }
.metric-strip article > span { display: block; color: var(--text-sub); font-size: 10px; }
.metric-strip article > strong { display: inline-block; margin-top: 4px; font: 29px/1.25 var(--font-display); }
.metric-strip article > small { margin-left: 7px; color: var(--text-sub); font-size: 9px; }
.demographics-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(280px, .75fr); gap: 14px; }
.pyramid-heading { display: grid; grid-template-columns: 1fr 100px 1fr; gap: 14px; padding: 17px 24px 6px; color: var(--text-sub); font-size: 9px; text-align: center; }
.age-pyramid { display: flex; flex-direction: column; gap: 11px; padding: 12px 24px 22px; }
.pyramid-row { display: grid; grid-template-columns: minmax(0,1fr) 100px minmax(0,1fr); align-items: center; gap: 14px; min-height: 32px; }
.pyramid-row > strong { color: var(--text-sub); font-size: 10px; font-weight: 500; text-align: center; }
.pyramid-bar { position: relative; display: flex; align-items: center; gap: 7px; height: 23px; }
.pyramid-bar.male { justify-content: flex-end; }
.pyramid-bar.female { flex-direction: row-reverse; justify-content: flex-end; }
.pyramid-bar i { display: block; width: 0; height: 100%; min-width: 2px; background: var(--primary); border-radius: 3px; transform-origin: right; animation: grow .45s ease both; }
.pyramid-bar.female i { background: var(--accent); transform-origin: left; }
.pyramid-bar span { min-width: 26px; color: var(--text-sub); font: 9px var(--font-mono); }
.chart-footnote { padding: 11px 20px; color: var(--text-sub); background: #f7f5ee; border-top: 1px solid var(--border); font-size: 9px; }
.gender-panel { display: flex; flex-direction: column; }
.gender-donut { position: relative; display: grid; place-items: center; width: 176px; height: 176px; margin: 27px auto 18px; background: conic-gradient(var(--surface-muted) 0 100%); border-radius: 50%; }
.gender-donut::after { content: ""; position: absolute; inset: 22px; background: var(--surface); border: 1px solid var(--border); border-radius: 50%; }
.gender-donut > div { position: relative; z-index: 1; text-align: center; }
.gender-donut strong, .gender-donut span { display: block; }
.gender-donut strong { font: 28px var(--font-display); }
.gender-donut span { color: var(--text-sub); font-size: 9px; }
.gender-legend { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 0 25px 20px; }
.gender-legend > div { padding: 10px; background: #f5f3ec; border-radius: 7px; }
.gender-legend span, .gender-legend strong { display: block; }
.gender-legend span { color: var(--text-sub); font-size: 9px; }
.gender-legend strong { margin-top: 2px; font: 16px var(--font-display); }
.gender-legend i { display: inline-block; width: 7px; height: 7px; margin-right: 5px; border-radius: 50%; }
.editorial-note { margin: auto 18px 18px; padding: 13px 14px; background: #f3eee5; border-left: 2px solid var(--accent); }
.editorial-note span { color: var(--accent); font: 8px var(--font-mono); letter-spacing: .14em; }
.editorial-note p { margin: 5px 0 0; color: var(--text-sub); font-size: 9px; line-height: 1.7; }

.compare-form { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 14px; padding: 18px 20px; }
.compare-form h3 { margin: 0; font: 19px var(--font-display); }
.compare-selects { display: flex; align-items: flex-end; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.compare-selects .field select { min-width: 118px; max-width: 150px; }
.comparison-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.comparison-grid.count-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.comparison-grid.count-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.compare-card { position: relative; padding: 19px; overflow: hidden; background: var(--surface); border: 1px solid var(--border); border-top: 3px solid var(--primary); border-radius: var(--radius-md); }
.compare-card:nth-child(2) { border-top-color: var(--accent); }
.compare-card:nth-child(3) { border-top-color: #71917c; }
.compare-card:nth-child(4) { border-top-color: #c39864; }
.compare-card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.compare-card-header h3 { margin: 0; font: 21px var(--font-display); }
.compare-card-header code { color: var(--text-sub); font: 9px var(--font-mono); }
.compare-total { margin: 17px 0 13px; }
.compare-total strong { font: 34px var(--font-display); }
.compare-total span { margin-left: 5px; color: var(--text-sub); font-size: 10px; }
.compare-total-bar { height: 4px; margin: -5px 0 15px; overflow: hidden; background: var(--surface-muted); border-radius: 3px; }
.compare-total-bar i { display: block; height: 100%; background: var(--primary); }
.compare-card dl { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 0; }
.compare-card dt { color: var(--text-sub); font-size: 8px; }
.compare-card dd { margin: 2px 0 0; font-size: 12px; font-weight: 700; }
.comparison-table { margin-top: 14px; overflow: hidden; }
.comparison-table .panel-header { min-height: 62px; }
.compact-table { width: 100%; border-collapse: collapse; }
.compact-table th { padding: 11px 14px; color: var(--text-sub); background: #f5f3ec; border-bottom: 1px solid var(--border); font-size: 9px; font-weight: 500; text-align: left; white-space: nowrap; }
.compact-table td { padding: 11px 14px; border-bottom: 1px solid #ebe8df; font-size: 10px; vertical-align: middle; }
.compact-table tbody tr:last-child td { border-bottom: 0; }
.compact-table tbody tr:hover { background: #faf8f2; }
.trend-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin: 8px 2px 15px; }
.trend-heading h2 { margin: 0; font: 25px var(--font-display); }
.trend-heading p:last-child { margin: 5px 0 0; color: var(--text-sub); font-size: 10px; }
.trend-metrics { display: flex; gap: 12px; margin-bottom: 14px; }
.trend-metrics article { min-width: 210px; padding: 15px 18px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); }
.trend-metrics span { display: block; color: var(--text-sub); font-size: 9px; }
.trend-metrics strong { font: 27px var(--font-display); }
.trend-metrics small { margin-left: 5px; color: var(--text-sub); font-size: 9px; }
.trend-panel { overflow: hidden; }
.trend-chart { height: 370px; }
.snapshot-grid { display: grid; grid-template-columns: repeat(6, 1fr); border-top: 1px solid var(--border); }
.snapshot-point { padding: 13px 16px; border-right: 1px solid var(--border); }
.snapshot-point:last-child { border-right: 0; background: var(--primary-soft); }
.snapshot-point span, .snapshot-point strong, .snapshot-point small { display: block; }
.snapshot-point span { color: var(--text-sub); font: 9px var(--font-mono); }
.snapshot-point strong { margin-top: 3px; font: 20px var(--font-display); }
.snapshot-point small { color: var(--text-sub); font-size: 8px; }

.governance-hero { background: #233f38; }
.governance-hero .button { color: #fff; background: rgba(255,255,255,.07); border-color: rgba(255,255,255,.2); }
.governance-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(260px, .65fr); gap: 14px; margin-bottom: 14px; }
.import-panel { overflow: hidden; }
.import-body { padding: 18px 20px 20px; }
.dropzone { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 145px; padding: 20px; color: var(--text-sub); background: #f6f4ed; border: 1px dashed #aebbb3; border-radius: var(--radius-md); text-align: center; transition: background .18s, border-color .18s; cursor: pointer; }
.dropzone:hover, .dropzone.is-dragging { background: var(--primary-soft); border-color: var(--primary); }
.dropzone > .icon { width: 28px; height: 28px; margin-bottom: 9px; color: var(--primary); }
.dropzone strong { color: var(--text); font: 17px var(--font-display); }
.dropzone span { margin-top: 4px; font-size: 9px; }
.mapping-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 14px 0; }
.mapping-row .field select { width: 100%; }
.import-preview-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 15px 0 9px; }
.import-preview-heading strong, .import-preview-heading span { display: block; }
.import-preview-heading strong { font: 16px var(--font-display); }
.import-preview-heading span { color: var(--text-sub); font-size: 9px; }
.import-preview-wrap { max-height: 300px; overflow: auto; border: 1px solid var(--border); border-radius: 8px; }
.import-preview-wrap .compact-table { min-width: 590px; }
.import-preview-wrap th { position: sticky; top: 0; z-index: 1; }
.import-preview-wrap .table-state { height: 110px !important; }
.import-status { display: inline-flex; padding: 3px 7px; border-radius: 4px; font-size: 9px; font-weight: 700; }
.import-status.valid { color: var(--success); background: #e3eee7; }
.import-status.warning { color: var(--warning); background: #f5eadb; }
.import-status.error { color: var(--danger); background: #f5e4e1; }
.quality-guide { padding: 22px; background: #f5f2e9; }
.quality-guide h2 { margin: 0 0 17px; font: 22px var(--font-display); }
.quality-guide ol { display: flex; flex-direction: column; gap: 16px; margin: 0; padding: 0; list-style: none; }
.quality-guide li { display: flex; gap: 11px; }
.quality-guide li > span { display: grid; place-items: center; flex: 0 0 auto; width: 27px; height: 27px; color: var(--accent); border: 1px solid #d5b7a4; border-radius: 50%; font: 9px var(--font-mono); }
.quality-guide li strong { font-size: 11px; }
.quality-guide li p { margin: 2px 0 0; color: var(--text-sub); font-size: 9px; }
.quality-privacy { display: flex; gap: 7px; margin: 21px 0 0; padding-top: 15px; color: var(--text-sub); border-top: 1px solid var(--border); font-size: 9px; }
.quality-privacy .icon { width: 14px; height: 14px; color: var(--primary); }
.exception-panel, .audit-panel { margin-bottom: 14px; overflow: hidden; }
.exception-table { min-width: 900px; }
.exception-reason { display: block; margin-top: 4px; color: var(--text-sub); font-size: 8px; }
.audit-panel .compact-table { min-width: 760px; }
.audit-action { color: var(--primary); font-weight: 700; }
.audit-role { display: inline-flex; padding: 2px 6px; color: var(--text-sub); background: var(--surface-muted); border-radius: 4px; font-size: 8px; }
.empty-table { height: 100px !important; }

.views-layout { display: grid; grid-template-columns: minmax(220px, .75fr) minmax(300px, 1.25fr); gap: 16px; }
.save-view-card { padding: 18px; background: #f4f1e8; border: 1px solid var(--border); border-radius: var(--radius-md); }
.save-view-card h3, .saved-view-section h3, .share-card h3 { margin: 0; font: 18px var(--font-display); }
.save-view-card > p:not(.section-kicker) { min-height: 38px; margin: 7px 0 14px; color: var(--text-sub); font-size: 10px; }
.save-view-card form { display: flex; flex-direction: column; gap: 11px; }
.save-view-card > small { display: block; margin-top: 10px; color: var(--text-sub); font-size: 8px; }
.section-inline-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 9px; }
.saved-views-list { display: flex; flex-direction: column; gap: 8px; max-height: 270px; overflow-y: auto; }
.saved-view-item { display: flex; align-items: center; gap: 8px; padding: 9px 10px; background: #f8f6f0; border: 1px solid var(--border); border-radius: 8px; }
.saved-view-apply { flex: 1; min-width: 0; padding: 0; background: none; border: 0; text-align: left; }
.saved-view-apply strong, .saved-view-apply span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.saved-view-apply strong { font-size: 11px; }
.saved-view-apply span { margin-top: 2px; color: var(--text-sub); font-size: 8px; }
.saved-view-apply:hover strong { color: var(--accent); }
.saved-view-item .icon-button { width: 27px; height: 27px; }
.saved-view-item .icon { width: 13px; height: 13px; }
.share-card { margin-top: 16px; padding: 17px 18px; border: 1px solid var(--border); border-radius: var(--radius-md); }
.share-card p:not(.section-kicker) { margin: 4px 0 12px; color: var(--text-sub); font-size: 9px; }
.share-controls { display: flex; gap: 8px; }
.share-controls label { flex: 1; }
.share-controls input { width: 100%; height: 38px; padding: 0 10px; color: var(--text-sub); background: #f8f7f1; border: 1px solid var(--border); border-radius: 8px; font: 9px var(--font-mono); }
.report-cover { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 22px; color: #fff; background: var(--primary); border-radius: 3px 14px 3px 3px; }
.report-cover > div:first-child > span { color: #dfb69e; font: 8px var(--font-mono); letter-spacing: .13em; }
.report-cover h3 { margin: 8px 0 2px; font: 30px var(--font-display); }
.report-cover p { margin: 0; color: rgba(255,255,255,.58); font-size: 9px; }
.report-cover > div:last-child { text-align: right; }
.report-cover strong, .report-cover > div:last-child span { display: block; }
.report-cover strong { font: 38px var(--font-display); }
.report-cover > div:last-child span { color: rgba(255,255,255,.58); font-size: 8px; }
.report-preview-grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: 14px; margin-top: 14px; }
.report-map-preview { min-height: 230px; overflow: hidden; background: #f5f3ec; border: 1px solid var(--border); border-radius: var(--radius-md); }
.report-map-preview img { display: block; width: 100%; height: 100%; min-height: 230px; object-fit: contain; }
.report-meta { margin: 0; padding: 12px 16px; background: #f7f5ee; border: 1px solid var(--border); border-radius: var(--radius-md); }
.report-meta > div { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 10px; }
.report-meta > div:last-child { border-bottom: 0; }
.report-meta dt { color: var(--text-sub); }
.report-meta dd { margin: 0; text-align: right; font-weight: 700; }
.report-note { margin: 14px 0 0; font-size: 10px; }
.report-actions { gap: 8px; }
.auth-body { display: flex; align-items: flex-start; gap: 17px; }
.auth-icon { display: grid; place-items: center; flex: 0 0 auto; width: 52px; height: 56px; color: #fff; background: var(--primary); border-radius: 5px 16px 5px 5px; }
.auth-icon .icon { width: 24px; height: 24px; }
.auth-body h3 { margin: 0; font: 21px var(--font-display); }
.auth-body p { margin: 8px 0 12px; color: var(--text-sub); font-size: 11px; line-height: 1.8; }
.auth-boundary { display: inline-flex; padding: 4px 8px; color: var(--accent); background: var(--accent-soft); border-radius: 4px; font-size: 9px; }
.auth-modal { width: min(540px, calc(100% - 32px)); }
.correction-modal { width: min(570px, calc(100% - 32px)); }
.correction-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 13px; }
#correction-form .modal-body > .field { margin-top: 13px; }
.form-help { margin: 14px 0 0; padding: 10px 12px; color: var(--text-sub); background: #f3f1e9; border-radius: 6px; font-size: 9px; }
.print-report { display: none; }

@media (min-width: 1500px) {
  :root { --sidebar: 232px; }
  .sidebar { padding-left: 22px; padding-right: 22px; }
  .workspace-grid { grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; }
  .map-stage { min-height: 580px; }
  .region-list { max-height: 680px; }
}

@media (max-width: 1180px) {
  .main-header, .content-wrap { padding-left: 24px; padding-right: 24px; }
  .snapshot { display: none; }
  .workspace-grid { grid-template-columns: minmax(0, 1fr) 280px; }
  .map-stage { min-height: 480px; }
  .analysis-grid { grid-template-columns: 1fr; }
  .analysis-panel { min-height: auto; }
  .composition-wrap { flex-direction: row; gap: 28px; }
  .composition-legend { grid-template-columns: 1fr; }
  .filter-panel { flex-wrap: wrap; }
  .search-field { flex-basis: 100%; }
  .filter-actions { margin-left: auto; }
}

@media (max-width: 960px) {
  :root { --sidebar: 216px; }
  .sidebar { transform: translateX(-100%); transition: transform .22s ease; box-shadow: var(--shadow-modal); }
  .sidebar.is-open { transform: translateX(0); }
  .nav-scrim { position: fixed; inset: 0; z-index: 45; display: block; width: 100%; height: 100%; padding: 0; background: rgba(17, 36, 30, .42); border: 0; }
  .main-shell { margin-left: 0; }
  .mobile-menu { display: inline-grid; }
  .main-header { padding-top: 23px; }
  .workspace-grid { grid-template-columns: minmax(0, 1fr) 290px; }
}

@media (max-width: 760px) {
  .main-header { align-items: flex-start; padding: 18px 16px 20px; }
  .header-copy h1 { font-size: 29px; }
  .header-copy p:last-child { max-width: 300px; }
  .header-actions { gap: 6px; }
  .header-actions .button { width: 38px; padding: 0; font-size: 0; }
  .header-actions .button .icon { width: 17px; height: 17px; }
  .content-wrap { padding: 0 16px 22px; }
  .kpi-grid { gap: 9px; }
  .kpi-card { padding: 15px; }
  .kpi-value strong { font-size: 30px; }
  .kpi-value.kpi-highest strong { font-size: 25px; }
  .kpi-card p { white-space: normal; }
  .workspace-grid { grid-template-columns: 1fr; }
  .map-stage { min-height: 440px; }
  .region-list { max-height: 390px; }
  .region-column { display: grid; grid-template-columns: 1fr; }
  .context-note { display: none; }
  .data-footnote { align-items: flex-start; flex-direction: column; gap: 5px; }
  .record-summary { grid-template-columns: repeat(2, 1fr); gap: 9px; }
  .filter-panel { align-items: flex-end; }
  .field { flex: 1; }
  .field select { width: 100%; min-width: 110px; }
  .filter-actions { width: 100%; margin-left: 0; }
  .filter-actions .button { flex: 1; }
  .records-heading { align-items: flex-start; }
  .records-heading > div:last-child { align-items: flex-end; flex-direction: column; gap: 3px; }
  .rule-flow { grid-template-columns: 1fr; }
  .code-example { align-items: flex-start; flex-direction: column; gap: 12px; }
  .insight-grid { grid-template-columns: 1fr; gap: 9px; }
  .analysis-intro { align-items: flex-start; padding: 18px; }
  .analysis-intro h2 { font-size: 23px; }
  .analysis-intro .button { width: 38px; padding: 0; font-size: 0; }
  .composition-wrap { flex-direction: column; }
  .composition-legend { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 520px) {
  .main-header { flex-direction: column; gap: 13px; }
  .header-actions { align-self: flex-end; margin-top: -48px; }
  #header-rules { display: none; }
  .header-copy p:last-child { max-width: calc(100vw - 90px); font-size: 10px; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .kpi-primary { grid-column: 1 / -1; }
  .kpi-card { min-height: 118px; }
  .kpi-value strong { font-size: 33px; }
  .panel-header { padding: 14px 15px; }
  .map-header-tools { gap: 5px; }
  .map-header-tools > .tag { display: none; }
  .map-stage { min-height: 370px; }
  .map-legend-note { display: none; }
  .map-footer { font-size: 8px; }
  .analysis-bar-row { grid-template-columns: 18px minmax(65px, .6fr) 1fr 52px; gap: 7px; }
  .analysis-bars { padding: 18px 13px; }
  .filter-panel .field { flex-basis: calc(50% - 6px); }
  .filter-panel .field-small { flex-basis: calc(50% - 6px); }
  .table-footer { align-items: flex-start; flex-direction: column; }
  .pagination { align-self: stretch; justify-content: space-between; }
  .modal-header, .drawer-header { padding: 17px; }
  .modal-body, .drawer-body { padding: 17px; }
  .code-example code { font-size: 12px; }
  .rule-counts { flex-wrap: wrap; }
  .toast-region { right: 16px; bottom: 16px; }
}

@media (max-width: 1350px) {
  .global-action { display: none; }
  .compare-form { align-items: flex-start; flex-direction: column; }
  .compare-selects { justify-content: flex-start; width: 100%; }
  .comparison-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .comparison-grid.count-3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
}

@media (max-width: 1180px) {
  .role-switch { order: -1; }
  .demographics-grid, .governance-grid { grid-template-columns: 1fr; }
  .quality-guide ol { display: grid; grid-template-columns: 1fr 1fr; }
  .comparison-grid.count-3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
}

@media (max-width: 960px) {
  .header-actions { max-width: 480px; }
  .comparison-grid.count-3 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .snapshot-grid { grid-template-columns: repeat(3, 1fr); }
  .snapshot-point:nth-child(3) { border-right: 0; }
  .snapshot-point:nth-child(-n+3) { border-bottom: 1px solid var(--border); }
}

@media (max-width: 760px) {
  .role-switch { height: 38px; }
  .role-switch select { width: 38px; color: transparent; }
  .role-switch option { color: var(--text); }
  .insights-hero, .governance-hero { align-items: flex-start; flex-direction: column; padding: 19px; }
  .insights-hero h2, .governance-hero h2 { font-size: 23px; }
  .insight-region-field { width: 100%; min-width: 0; }
  .tab-list { width: 100%; }
  .tab-list button { flex: 1; min-width: 0; padding: 0 8px; }
  .metric-strip { grid-template-columns: repeat(2, 1fr); gap: 9px; }
  .pyramid-heading, .pyramid-row { grid-template-columns: minmax(0,1fr) 75px minmax(0,1fr); gap: 7px; }
  .age-pyramid { padding-left: 13px; padding-right: 13px; }
  .pyramid-heading { padding-left: 13px; padding-right: 13px; }
  .compare-selects .field { flex-basis: calc(50% - 5px); }
  .compare-selects .field select { max-width: none; }
  .compare-selects > .button { width: 100%; }
  .comparison-grid, .comparison-grid.count-2, .comparison-grid.count-3 { grid-template-columns: 1fr; }
  .trend-chart { height: 310px; }
  .mapping-row { grid-template-columns: 1fr; }
  .quality-guide ol { grid-template-columns: 1fr; }
  .views-layout, .report-preview-grid { grid-template-columns: 1fr; }
  .share-controls { flex-wrap: wrap; }
  .share-controls label { order: -1; flex-basis: 100%; }
  .report-cover { align-items: flex-start; }
  .panel-actions { justify-content: flex-start; }
}

@media (max-width: 520px) {
  .role-switch { padding: 0 6px; }
  .metric-strip article { padding: 14px; }
  .metric-strip article > strong { font-size: 25px; }
  .pyramid-row > strong { font-size: 8px; }
  .pyramid-bar span { min-width: 20px; font-size: 8px; }
  .trend-heading { flex-direction: column; }
  .trend-metrics { display: grid; grid-template-columns: 1fr 1fr; }
  .trend-metrics article { min-width: 0; }
  .snapshot-grid { grid-template-columns: repeat(2, 1fr); }
  .snapshot-point:nth-child(3) { border-right: 1px solid var(--border); }
  .snapshot-point:nth-child(2n) { border-right: 0; }
  .snapshot-point:nth-child(-n+4) { border-bottom: 1px solid var(--border); }
  .governance-hero .button { width: 100%; }
  .correction-grid { grid-template-columns: 1fr; }
  .report-cover { flex-direction: column; }
  .report-cover > div:last-child { text-align: left; }
  .report-actions { flex-direction: column; }
  .report-actions .button { width: 100%; }
  .auth-body { flex-direction: column; }
}

@media print {
  @page { size: A4; margin: 14mm; }
  body { color: #1d2925; background: #fff; font-size: 10pt; }
  .sidebar, .main-shell, dialog, .toast-region, .nav-scrim { display: none !important; }
  .print-report { display: block !important; font-family: "Microsoft YaHei", "PingFang SC", sans-serif; }
  .print-report-header { display: flex; align-items: flex-end; justify-content: space-between; padding-bottom: 14px; border-bottom: 2px solid #174b3f; }
  .print-report-header h1 { margin: 4px 0 0; font: 28pt Georgia, serif; }
  .print-report-header p { margin: 0; color: #68746e; font-size: 8pt; }
  .print-report-header > span { color: #174b3f; font: 9pt monospace; }
  .print-summary { display: grid; grid-template-columns: repeat(4,1fr); gap: 8px; margin: 16px 0; }
  .print-summary article { padding: 11px; background: #f3f0e8; border: 1px solid #dcd8cc; }
  .print-summary span, .print-summary strong { display: block; }
  .print-summary span { color: #68746e; font-size: 8pt; }
  .print-summary strong { margin-top: 4px; font: 17pt Georgia, serif; }
  .print-map { width: 100%; max-height: 105mm; object-fit: contain; border: 1px solid #dcd8cc; }
  .print-report h2 { margin: 18px 0 8px; font: 15pt Georgia, serif; }
  .print-report table { width: 100%; border-collapse: collapse; page-break-inside: avoid; }
  .print-report th, .print-report td { padding: 7px 9px; border: 1px solid #dcd8cc; font-size: 8pt; text-align: left; }
  .print-report th { background: #f3f0e8; }
  .print-note { margin-top: 14px; padding-top: 9px; color: #68746e; border-top: 1px solid #dcd8cc; font-size: 7pt; line-height: 1.7; }
}

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