:root {
  color-scheme: light;
  --ink: #172b24; --muted: #596a62; --green: #1b5947; --rail: #153b32;
  --soft: #e7f0e9; --canvas: #f3f5f2; --paper: #fff; --line: #dce4dc;
  --warning: #754219; --error: #9b3530;
  font: 14px/1.55 "Inter", "Microsoft YaHei UI", "PingFang SC", "Noto Sans CJK SC", system-ui, sans-serif;
  color: var(--ink); background: var(--canvas);
}
*, *::after, *::before { box-sizing: border-box; }
body { margin: 0; }
button, input, select, textarea { font: inherit; }
a { color: var(--green); text-decoration: none; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
button { color: inherit; cursor: pointer; }
button:disabled { opacity: .56; cursor: default; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid #287d68; outline-offset: 3px; }
.skip { position: fixed; z-index: 20; left: 16px; top: -60px; background: white; padding: 12px; }
.skip:focus { top: 10px; }
.topbar {
  position: sticky; top: 0; z-index: 5; min-height: 77px; background: var(--paper);
  border-bottom: 1px solid var(--line); padding: 13px clamp(20px, 3.2vw, 50px) 13px 23px;
  display: flex; align-items: center; justify-content: space-between; gap: 18px;
}
.identity { display: flex; align-items: center; gap: 12px; color: var(--ink); white-space: nowrap; }
.identity strong { display: block; font-weight: 760; font-size: 19px; letter-spacing: .06em; line-height: 1.2; }
.identity small { display: block; font-size: 11px; color: var(--muted); margin-top: 5px; }
.brand-icon { width: 43px; height: 43px; border-radius: 8px; background: var(--rail); position: relative; display: flex; align-items: flex-end; gap: 3px; justify-content: center; padding-bottom: 10px; }
.brand-icon::after { content: ""; position: absolute; bottom: 9px; left: 9px; right: 9px; height: 1px; background: #cfdfca; }
.brand-icon i { width: 6px; height: 13px; border: 1px solid #cfdfca; border-bottom: none; }
.brand-icon i:nth-child(2) { height: 21px; }
.brand-icon i:nth-child(3) { height: 17px; }
.header-tools, .save-control, .date-control { display: flex; align-items: center; gap: 12px; }
.date-control { white-space: nowrap; font-size: 12px; color: var(--muted); gap: 8px; }
.date-control input { width: 145px; }
.save-status { color: var(--muted); font-size: 12px; min-width: 8em; }
.save-status[data-state="saved"] { color: var(--green); }
.save-status[data-state="dirty"], .save-status[data-state="pending"] { color: var(--warning); }
.save-status[data-state="error"] { color: var(--error); max-width: 300px; }
.button { display: inline-flex; justify-content: center; align-items: center; gap: 7px; font-weight: 650; white-space: nowrap; min-height: 36px; padding: 7px 12px; border: 1px solid var(--line); background: var(--paper); color: var(--ink); border-radius: 6px; }
.button:hover { background: #f0f5f0; }
.button.primary { color: white; background: var(--green); border-color: var(--green); }
.button.primary:hover { background: #123f32; }
.button.danger { color: var(--error); }
.button.small { min-height: 30px; font-size: 12px; padding: 4px 9px; }
.return-link { color: var(--green); }
.frame { display: grid; grid-template-columns: 220px minmax(0, 1fr); min-height: calc(100vh - 77px); }
.rail { background: var(--rail); padding: 27px 15px 24px; display: flex; flex-direction: column; gap: 34px; position: sticky; top: 77px; height: calc(100dvh - 77px); overflow: auto; color: #eaf2ec; }
.nav-items { display: grid; gap: 5px; }
.nav-items button, .data-tools button, .data-tools a { display: flex; align-items: center; width: 100%; gap: 11px; text-align: left; border: none; color: #d6e5da; border-radius: 5px; padding: 10px 11px; background: transparent; font-size: 13px; }
.nav-items button span { font: 11px ui-monospace, monospace; color: #a7c2b2; }
.nav-items button:hover, .data-tools button:hover, .data-tools a:hover { background: #244e40; }
.nav-items button[aria-current="page"] { background: #356052; color: #fff; font-weight: 700; box-shadow: inset 2px 0 #bed3aa; }
.nav-items button[aria-current="page"] span { color: #d3ebca; }
.rail :focus-visible { outline-color: #d5e7ca; }
.data-tools { margin-top: auto; border-top: 1px solid #437063; padding-top: 14px; }
.tool-heading { color: #bfd3c7; display: block; padding: 0 11px 7px; font-size: 12px; }
.data-tools button, .data-tools a { padding-block: 7px; gap: 8px; }
.data-tools button span, .data-tools a span { color: #bcd3bd; width: 13px; }
#workspace { outline: none; min-width: 0; }
.page { padding: 26px clamp(20px, 3vw, 48px) 50px; max-width: 1640px; margin-inline: auto; }
.page-heading { margin-bottom: 20px; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(27px, 3.2vw, 36px); line-height: 1.22; letter-spacing: -.03em; font-weight: 760; }
h2 { font-size: 21px; line-height: 1.35; font-weight: 730; }
h3 { font-size: 16px; font-weight: 720; }
.page-heading p, .description, .muted { color: var(--muted); }
.page-heading p { margin-top: 6px; }
.buildings-grid { display: grid; grid-template-columns: minmax(226px, 286px) minmax(0, 1fr); gap: 18px; align-items: start; }
.catalog, .panel, .comparison, .placeholder-page { background: var(--paper); border: 1px solid var(--line); border-radius: 8px; }
.catalog { position: sticky; top: 94px; min-width: 0; overflow: hidden; }
.catalog-controls { padding: 14px 16px 12px; border-bottom: 1px solid var(--line); }
.catalog-heading { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-bottom: 11px; }
.small-stat { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.filters { display: grid; gap: 8px; }
input, select, textarea { width: 100%; display: block; min-height: 37px; color: var(--ink); background: #fff; border: 1px solid #cbd8cf; border-radius: 5px; padding: 7px 9px; }
input::placeholder, textarea::placeholder { color: #63736b; opacity: 1; }
input[type="checkbox"] { width: 16px; height: 16px; min-height: auto; margin: 0; accent-color: var(--green); }
textarea { min-height: 68px; resize: vertical; }
input[readonly], input:disabled, textarea[readonly], select:disabled { color: #4c6055; background: #f2f5f1; }
.building-list { max-height: min(540px, calc(100dvh - 320px)); min-height: 115px; overflow: auto; padding: 4px 6px 7px; }
.building-row { width: 100%; display: grid; grid-template-columns: 44px minmax(0, 1fr); border: 0; padding: 10px; text-align: left; border-radius: 5px; background: transparent; gap: 10px; margin: 2px 0; }
.building-row:hover { background: #f0f5ef; }
.building-row[aria-pressed="true"] { background: var(--soft); box-shadow: inset 3px 0 #2c6a54; }
.building-number { display: grid; place-items: center; width: 41px; height: 37px; border-radius: 5px; background: #f0f3ee; font-weight: 720; color: var(--green); font-size: 16px; line-height: 1; }
.building-row[aria-pressed="true"] .building-number { background: #d7e7d8; }
.building-data, .building-title { min-width: 0; }
.building-title { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.building-title strong { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.building-title small, .building-status { color: var(--muted); font-size: 11px; }
.building-status { display: flex; align-items: center; justify-content: space-between; margin: 2px 0 4px; }
.bar { height: 3px; width: 100%; background: #dce6db; border-radius: 2px; overflow: hidden; }
.bar span { background: #4c8067; display: block; height: 100%; }
.building-flags { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; }
.building-flags .badge { font-size: 10px; margin-top: 5px; }
.panel { min-width: 0; }
.panel-head { padding: 18px 20px; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line); }
.panel-head .eyeline { color: var(--muted); font-size: 12px; display: flex; align-items: center; gap: 8px; margin-bottom: 3px; }
.panel-head .description { padding-top: 5px; font-size: 13px; }
.panel-body { padding: 15px 20px 21px; }
.panel-body + .panel-body { border-top: 1px solid var(--line); }
.panel-actions, .actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.badge { font-size: 11px; line-height: 1.35; color: #265842; background: #e6efe6; padding: 3px 6px; display: inline-flex; align-items: center; white-space: nowrap; border-radius: 4px; }
.badge.warning { color: var(--warning); background: #f7ede0; }
.badge.neutral { color: #52645b; background: #edf1ee; }
.badge.subject { background: #d8e8d5; color: #234f36; }
.empty { padding: 17px 15px; background: #f6f8f5; border: 1px dashed #cfdccf; border-radius: 6px; color: var(--muted); }
.empty strong { color: var(--ink); display: block; font-size: 14px; margin-bottom: 2px; }
.empty .button { margin-top: 10px; }
.meta-line { display: flex; flex-wrap: wrap; gap: 7px 16px; margin: 0 0 10px; font-size: 12px; color: var(--muted); }
.section-title { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 7px; align-items: center; margin-bottom: 11px; }
.section-title small { font-size: 12px; color: var(--muted); }
.form-group { margin: 0 0 9px; border: 1px solid var(--line); border-radius: 6px; }
.form-group summary { background: #f6f8f5; border-radius: 5px; font-weight: 680; padding: 9px 11px; cursor: pointer; }
.form-group[open] summary { border-radius: 5px 5px 0 0; border-bottom: 1px solid var(--line); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; padding: 12px; }
.form-grid.flat { padding: 0; }
.field { min-width: 0; display: grid; align-content: start; gap: 5px; }
.field.wide { grid-column: 1 / -1; }
.field-label { font-weight: 610; font-size: 12px; }
.field-note, .hint { color: var(--muted); font-size: 12px; }
.field-value { display: block; min-height: 29px; border-bottom: 1px solid var(--line); padding: 2px 0 4px; white-space: pre-wrap; overflow-wrap: anywhere; }
.field-value.missing, .missing { color: #6d7b73; }
.reuse { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 11px; }
.record-toolbar { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 10px; margin-bottom: 11px; }
.record-toolbar .selection { display: grid; gap: 4px; font-size: 12px; }
.record-head { padding-bottom: 12px; border-bottom: 1px solid var(--line); margin-bottom: 12px; }
.record-head .section-title { margin-bottom: 6px; }
.external-selector { max-width: 320px; }
.source-list { display: grid; gap: 8px; padding: 12px; }
.source-list label { display: grid; gap: 4px; font-size: 12px; }
.source-list output { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13px; }
.summary-grid { display: grid; grid-template-columns: 1.45fr 1fr 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.summary-cell { background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 11px 14px; min-width: 0; }
.summary-cell small, .summary-cell strong { display: block; }
.summary-cell small { color: var(--muted); }
.summary-cell strong { margin-top: 4px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.callout { border-left: 3px solid #c29151; background: #faf0e4; color: #704623; padding: 8px 11px; border-radius: 3px; margin: 0 0 12px; }
.comparison { overflow: hidden; margin-top: 16px; }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; font-size: 13px; }
th, td { border-bottom: 1px solid var(--line); padding: 8px 11px; vertical-align: top; }
thead th { background: #edf3ed; font-weight: 680; white-space: nowrap; }
tbody tr:last-child > * { border-bottom: 0; }
.compare th, .compare td { min-width: 165px; overflow-wrap: anywhere; }
.compare td { white-space: pre-wrap; }
.compare thead th { white-space: normal; }
.compare tr > :first-child { min-width: 170px; position: sticky; left: 0; z-index: 1; background: #f4f7f3; }
.compare .different { background: #f6efe2; }
.compare .missing { background: #f5f6f4; border-left: 1px dotted var(--line); }
.compare-head-title { display: block; font-size: 12px; margin-bottom: 6px; }
.records-editor { margin-top: 15px; }
.parameter-group { margin-top: 14px; }
.parameter-row { padding: 12px 16px; border-top: 1px solid var(--line); display: grid; grid-template-columns: minmax(150px, .85fr) minmax(0, 1.65fr); gap: 10px 22px; }
.parameter-row .form-grid { padding: 0; }
.parameter-row .hint { margin-top: 5px; }
.loading, .placeholder-page { padding: 25px; }
.loading p, .placeholder-page p { color: var(--muted); margin: 6px 0 11px; }
.placeholder-page { border-top: 3px solid #3b7057; min-height: 160px; max-width: 780px; }
.notice { position: fixed; z-index: 8; right: 20px; bottom: 18px; background: #1a3d33; color: white; max-width: min(480px, calc(100vw - 40px)); padding: 10px 14px; border-radius: 5px; box-shadow: 0 3px 14px #132e222a; }
.notice[data-error="true"] { background: #76312e; }
dialog { width: min(950px, calc(100% - 28px)); max-height: calc(100dvh - 40px); padding: 0; border: 1px solid var(--line); border-radius: 9px; color: var(--ink); }
dialog::backdrop { background: #12292190; }
.dialog-head, .dialog-foot { position: sticky; z-index: 2; background: white; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 13px 16px; }
.dialog-head { top: 0; border-bottom: 1px solid var(--line); }
.dialog-foot { bottom: 0; border-top: 1px solid var(--line); justify-content: flex-end; }
.dialog-body { padding: 14px 16px; }
.dialog-body > * + * { margin-top: 12px; }
.preview-table { border: 1px solid var(--line); border-radius: 5px; overflow: auto; }
.preview-table select { min-width: 130px; }
.preview-value { overflow-wrap: anywhere; max-width: 230px; display: inline-block; }
.preview-fields { min-width: 190px; margin: 7px 0 0; font-size: 12px; }
.preview-fields dt { font-weight: 650; }
.preview-fields dd { margin: 0 0 5px; white-space: pre-wrap; overflow-wrap: anywhere; }
.preview-columns { columns: 2; padding-inline-start: 22px; color: var(--muted); }
.import-issues { margin: 3px 0 0; padding-left: 17px; max-height: 105px; overflow: auto; color: var(--warning); font-size: 12px; }
.import-options { display: grid; grid-template-columns: minmax(190px, 280px) 1fr; gap: 12px; align-items: end; }
.check { display: flex; gap: 6px; align-items: center; }
.import-result { color: var(--error); min-width: 0; margin-right: auto; overflow-wrap: anywhere; }
@media (max-width: 1120px) {
  .frame { grid-template-columns: 185px minmax(0, 1fr); }
  .rail { padding-inline: 10px; }
  .buildings-grid { grid-template-columns: minmax(190px, 232px) minmax(0, 1fr); gap: 12px; }
  .topbar { padding-right: 16px; gap: 10px; }
  .header-tools { gap: 8px; }
  .save-control { gap: 8px; }
  .date-control { display: grid; gap: 0; }
}
@media (max-width: 850px) {
  .topbar { position: relative; flex-wrap: wrap; }
  .frame { grid-template-columns: 155px minmax(0, 1fr); }
  .rail { top: 0; height: 100dvh; }
  .nav-items button, .data-tools a, .data-tools button { padding-inline: 5px; gap: 6px; font-size: 12px; }
  .buildings-grid { grid-template-columns: minmax(0, 1fr); }
  .catalog { position: static; }
  .building-list { min-height: 100px; max-height: 235px; display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
  .page { padding-inline: 14px; }
  .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
  .topbar { padding: 11px; }
  .frame { display: block; }
  .rail { position: static; height: auto; padding: 9px; gap: 7px; }
  .nav-items, .data-tools { display: flex; flex-wrap: wrap; gap: 3px; }
  .nav-items button, .data-tools button, .data-tools a { width: auto; padding: 6px; }
  .tool-heading { display: none; }
  .data-tools { padding-top: 4px; }
  .header-tools { flex-wrap: wrap; }
  .page { padding: 17px 10px 26px; }
  .panel-head, .panel-body { padding-inline: 11px; }
  .form-grid, .parameter-row, .import-options { grid-template-columns: 1fr; }
}
