:root {
  --ink: #102a43;
  --ink-soft: #486581;
  --muted: #829ab1;
  --line: #d9e2ec;
  --line-strong: #bcccdc;
  --paper: #ffffff;
  --canvas: #f4f7f9;
  --navy: #102a43;
  --navy-2: #173f5f;
  --blue: #3e8fbd;
  --blue-soft: #e7f2f8;
  --mint: #dff2e5;
  --mint-strong: #2f855a;
  --amber: #fff4cf;
  --amber-strong: #b7791f;
  --red-soft: #fff0ef;
  --red: #c53030;
  --shadow-sm: 0 2px 10px rgba(16, 42, 67, .06);
  --shadow: 0 12px 34px rgba(16, 42, 67, .08);
  --radius: 16px;
  --radius-sm: 10px;
  font-family: "Avenir Next", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--canvas);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body { margin: 0; min-width: 1080px; background: var(--canvas); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

.app-shell { min-height: 100vh; }

.topbar {
  height: 74px;
  padding: 0 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, .96);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 30;
  backdrop-filter: blur(14px);
}

.brand-lockup, .topbar-meta, .local-badge, .user-badge, .brand-mark, .nav-item, .toolbar, .button-row, .status-line, .card-heading, .metric-line, .table-summary, .section-heading, .section-heading-actions, .field-row, .chip-row, .notice-line, .summary-stat, .empty-state, .filter-row { display: flex; align-items: center; }
.brand-lockup { gap: 12px; }
.brand-mark { width: 32px; height: 32px; gap: 3px; align-items: flex-end; justify-content: center; }
.brand-mark span { display: block; width: 7px; border-radius: 3px 3px 1px 1px; background: var(--blue); }
.brand-mark span:nth-child(1) { height: 17px; opacity: .7; }
.brand-mark span:nth-child(2) { height: 25px; background: var(--navy-2); }
.brand-mark span:nth-child(3) { height: 21px; opacity: .85; }
.eyebrow { color: var(--blue); font-size: 9px; line-height: 1; letter-spacing: 1.5px; font-weight: 800; }
.brand-name { margin-top: 4px; color: var(--navy); font-size: 17px; font-weight: 800; letter-spacing: .5px; }
.topbar-meta { gap: 10px; }
.local-badge { gap: 7px; color: var(--ink-soft); font-size: 12px; padding: 8px 11px; border: 1px solid var(--line); border-radius: 999px; background: #fbfdfe; }
.local-badge i { width: 7px; height: 7px; border-radius: 50%; background: #35a66a; box-shadow: 0 0 0 3px #dff3e7; }
.user-badge { color: var(--ink-soft); font-size: 11px; }
.icon-button { width: 34px; height: 34px; border: 1px solid var(--line); color: var(--ink-soft); background: var(--paper); border-radius: 9px; font-size: 18px; line-height: 1; transition: .18s ease; }
.icon-button:hover { color: var(--navy); border-color: var(--blue); background: var(--blue-soft); transform: translateY(-1px); }

.workspace { display: flex; min-height: calc(100vh - 74px); }
.sidebar { width: 218px; padding: 28px 15px 18px; border-right: 1px solid var(--line); background: #fbfcfd; display: flex; flex-direction: column; flex: 0 0 218px; }
.sidebar-caption { color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: 1.1px; padding: 0 13px 11px; }
.nav-list { display: grid; gap: 5px; }
.nav-item { width: 100%; gap: 11px; padding: 12px 12px; border: 0; border-radius: 8px; color: var(--ink-soft); background: transparent; text-align: left; text-decoration: none; font-size: 13px; transition: .18s ease; }
.nav-item:hover { color: var(--navy); background: #eef5f8; }
.nav-item.active { color: var(--navy); background: #e1eff5; box-shadow: inset 3px 0 var(--blue); font-weight: 800; }
.nav-icon { width: 19px; color: var(--blue); font-size: 18px; line-height: 1; text-align: center; }
.nav-item em { margin-left: auto; color: #9fb3c8; font-style: normal; font-size: 10px; letter-spacing: .6px; }
.sidebar-bottom { margin-top: auto; }
.mini-tip { margin: 15px 5px 18px; padding: 13px 12px; display: flex; gap: 9px; border-radius: 12px; background: #f1f6f7; border: 1px solid #e0eaed; }
.tip-icon { color: #c58b2c; font-size: 16px; }
.mini-tip strong { font-size: 11px; color: var(--navy); }
.mini-tip p { margin: 5px 0 0; color: var(--muted); font-size: 10px; line-height: 1.55; }
.reset-link { padding: 0 11px; color: var(--ink-soft); border: 0; background: transparent; font-size: 11px; }
.reset-link:hover { color: var(--red); }
.version-line { margin-top: 11px; padding: 0 11px; color: #a3b2bf; font-size: 10px; }

.main-content { min-width: 0; max-width: 1440px; flex: 1; padding: 34px 42px 70px; }
.page-head { max-width: 1180px; margin: 0 auto 22px; display: flex; justify-content: space-between; align-items: flex-end; gap: 25px; }
.page-kicker { color: var(--blue); font-size: 11px; font-weight: 800; letter-spacing: 1.35px; text-transform: uppercase; }
.page-title { margin: 7px 0 0; color: var(--navy); font-size: 29px; line-height: 1.15; letter-spacing: -.8px; }
.page-subtitle { max-width: 670px; margin: 9px 0 0; color: var(--muted); font-size: 13px; line-height: 1.55; }
.page-actions { display: flex; gap: 8px; align-items: center; }

.button { padding: 9px 14px; border: 1px solid var(--line-strong); border-radius: 9px; background: var(--paper); color: var(--ink-soft); font-size: 12px; font-weight: 700; transition: .18s ease; }
.button:hover { border-color: var(--blue); color: var(--navy); transform: translateY(-1px); }
.button.primary { border-color: var(--navy-2); background: var(--navy-2); color: white; }
.button.primary:hover { background: var(--navy); }
.button.ghost { border-color: transparent; background: transparent; }
.button.danger { color: var(--red); border-color: transparent; background: transparent; }
.button.danger:hover { background: var(--red-soft); }
.button.tiny { padding: 6px 9px; font-size: 11px; }

.hero-card { position: relative; overflow: hidden; padding: 25px 27px 22px; border-radius: 20px; background: linear-gradient(135deg, #102a43 0%, #173f5f 55%, #1d627e 100%); color: #fff; box-shadow: var(--shadow); }
.hero-card::after { content: ""; width: 260px; height: 260px; position: absolute; right: -88px; top: -108px; border: 1px solid rgba(255,255,255,.15); border-radius: 50%; box-shadow: 0 0 0 24px rgba(255,255,255,.035), 0 0 0 48px rgba(255,255,255,.025); }
.hero-card .page-kicker { color: #96d3e8; }
.hero-card h2 { max-width: 570px; margin: 8px 0 7px; font-size: 25px; line-height: 1.25; letter-spacing: -.5px; }
.hero-card p { max-width: 650px; margin: 0; color: #c9dae5; font-size: 12px; line-height: 1.6; }
.hero-stats { margin-top: 22px; display: flex; gap: 10px; flex-wrap: wrap; }
.summary-stat { min-width: 144px; gap: 10px; padding: 10px 12px; border: 1px solid rgba(255,255,255,.16); border-radius: 10px; background: rgba(255,255,255,.08); }
.summary-stat b { font-size: 16px; }
.summary-stat span { color: #b8d0de; font-size: 10px; }

.quote-grid { display: grid; grid-template-columns: minmax(420px, .93fr) minmax(520px, 1.2fr); gap: 18px; margin-top: 18px; }
.stack { display: grid; gap: 18px; align-content: start; }
.card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); box-shadow: var(--shadow-sm); }
.card-pad { padding: 19px 20px; }
.card-heading { justify-content: space-between; margin-bottom: 15px; gap: 12px; }
.card-heading h3 { margin: 0; color: var(--navy); font-size: 15px; }
.card-heading p { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.section-label { color: var(--blue); font-size: 10px; font-weight: 800; letter-spacing: 1px; }
.field-list { display: grid; gap: 8px; }
.field-row { min-height: 42px; justify-content: space-between; gap: 16px; padding: 6px 9px; border: 1px solid #edf1f4; border-radius: 9px; background: #fbfcfd; }
.field-row label { min-width: 120px; color: var(--ink-soft); font-size: 12px; font-weight: 700; }
.field-row input, .field-row select { width: 190px; min-width: 0; padding: 8px 10px; border: 1px solid var(--line); border-radius: 7px; outline: none; color: var(--navy); background: var(--amber); text-align: right; font-size: 12px; transition: .18s ease; }
.field-row textarea { width: 100%; min-height: 72px; resize: vertical; padding: 9px 10px; border: 1px solid var(--line); border-radius: 7px; outline: none; color: var(--navy); background: var(--amber); font-size: 12px; }
.field-row.quote-note-row { align-items: flex-start; flex-direction: column; }
.quote-save-row { justify-content: flex-end; margin-top: 13px; }
.field-row input:focus, .field-row select:focus, .table-control:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(62, 143, 189, .13); }
.field-row select { appearance: auto; }
.field-row .unit { width: 30px; margin-left: -42px; color: var(--muted); font-size: 10px; pointer-events: none; }
.field-row.has-unit { padding-right: 8px; }
.field-hint { margin: 8px 4px 0; color: var(--muted); font-size: 10px; line-height: 1.5; }
.process-list { display: grid; gap: 7px; }
.process-row { display: grid; grid-template-columns: 1fr 142px; gap: 10px; align-items: center; min-height: 38px; padding: 0 9px; border: 1px solid #edf1f4; border-radius: 9px; background: #fbfcfd; }
.process-row label { color: var(--ink-soft); font-size: 12px; font-weight: 700; }
.process-row select { width: 100%; padding: 7px 8px; border: 1px solid var(--line); border-radius: 7px; outline: none; color: var(--navy); background: var(--amber); text-align: right; font-size: 12px; }
.process-section { padding-top: 13px; margin-top: 14px; border-top: 1px dashed var(--line); }

.status-card { padding: 15px 17px; border-radius: 13px; border: 1px solid #cbe4d3; background: var(--mint); }
.status-card.warn { border-color: #f0d3a4; background: #fff8e9; }
.status-card.error { border-color: #f0c5c2; background: var(--red-soft); }
.status-line { gap: 9px; color: var(--mint-strong); font-size: 12px; font-weight: 800; }
.status-card.warn .status-line { color: var(--amber-strong); }
.status-card.error .status-line { color: var(--red); }
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 4px rgba(47,133,90,.12); }
.status-card.warn .status-dot { box-shadow: 0 0 0 4px rgba(183,121,31,.12); }
.status-card.error .status-dot { box-shadow: 0 0 0 4px rgba(197,48,48,.12); }
.status-detail { margin: 7px 0 0 18px; color: var(--ink-soft); font-size: 11px; line-height: 1.5; }
.status-detail strong { color: var(--red); }
.status-mini { margin-top: 10px; display: flex; gap: 8px; flex-wrap: wrap; }
.scheme-status { padding: 5px 8px; border: 1px solid rgba(47,133,90,.15); border-radius: 999px; color: var(--mint-strong); background: rgba(255,255,255,.5); font-size: 10px; }
.scheme-status.off { color: var(--red); border-color: rgba(197,48,48,.14); }

.scheme-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.scheme-card { overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: var(--paper); box-shadow: var(--shadow-sm); }
.scheme-card.recommended { border-color: #aed4e4; box-shadow: 0 8px 24px rgba(62, 143, 189, .13); }
.scheme-head { padding: 15px 17px 13px; color: white; background: var(--navy-2); }
.scheme-head .section-label { color: #aed8e8; }
.scheme-head h3 { margin: 6px 0 0; color: white; font-size: 14px; }
.scheme-head p { margin: 5px 0 0; color: #c5d9e4; font-size: 10px; }
.scheme-body { padding: 11px 16px 14px; }
.metric-line { min-height: 31px; justify-content: space-between; gap: 12px; border-bottom: 1px solid #f0f3f5; }
.metric-line:last-child { border-bottom: 0; }
.metric-line span { color: var(--ink-soft); font-size: 11px; }
.metric-line strong { color: var(--navy); font-size: 12px; text-align: right; }
.metric-line.total { margin: 8px -5px 0; padding: 5px 5px; border-radius: 7px; background: var(--blue-soft); }
.metric-line.total span, .metric-line.total strong { color: var(--navy); font-weight: 800; }
.metric-line.unit strong { color: var(--blue); font-size: 16px; }
.metric-line.state { margin-top: 5px; border-bottom: 0; }
.state-pill { padding: 4px 8px; border-radius: 999px; color: var(--mint-strong); background: var(--mint); font-size: 10px; }
.state-pill.off { color: var(--red); background: var(--red-soft); }
.compare-card { margin-top: 14px; padding: 14px 17px; border: 1px solid #cae6d1; border-radius: 13px; background: linear-gradient(90deg, #eff9f1, #f8fcf8); }
.compare-card .section-label { color: var(--mint-strong); }
.compare-main { margin-top: 4px; color: #23633f; font-size: 13px; font-weight: 800; }
.compare-sub { margin-top: 4px; color: var(--ink-soft); font-size: 11px; }

.wide-card { max-width: 1180px; margin: 18px auto 0; }
.section-heading { justify-content: space-between; gap: 15px; padding: 17px 19px; border-bottom: 1px solid var(--line); }
.section-heading h3 { margin: 0; color: var(--navy); font-size: 15px; }
.section-heading p { margin: 5px 0 0; color: var(--muted); font-size: 11px; }
.section-heading-actions { gap: 8px; }
.table-summary { justify-content: space-between; padding: 11px 19px; background: #fbfcfd; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 11px; }
.table-summary strong { color: var(--navy); }
.table-scroll { overflow: auto; }
.data-table { width: 100%; min-width: 1050px; border-collapse: separate; border-spacing: 0; font-size: 11px; }
.data-table th { position: sticky; top: 0; z-index: 1; padding: 11px 10px; color: #fff; background: #5a7e9d; border-right: 1px solid rgba(255,255,255,.25); font-size: 10px; text-align: left; white-space: nowrap; }
.data-table td { padding: 8px 10px; border-bottom: 1px solid #edf1f4; color: var(--ink-soft); vertical-align: middle; white-space: nowrap; }
.data-table tr:hover td { background: #fbfdfe; }
.data-table td:first-child, .data-table th:first-child { padding-left: 16px; }
.data-table input, .data-table select { width: 100%; min-width: 75px; padding: 6px 7px; border: 1px solid transparent; border-radius: 6px; outline: none; color: var(--navy); background: #fff9e6; font-size: 11px; }
.data-table input:hover, .data-table select:hover { border-color: #f1d58c; }
.data-table input:focus, .data-table select:focus { border-color: var(--blue); background: #fff; }
.data-table .readonly { color: var(--ink); font-weight: 700; background: #edf5f8; }
.data-table .num { width: 86px; text-align: right; }
.data-table .id-cell { color: var(--muted); font-weight: 800; letter-spacing: .4px; }
.data-table .derived { color: var(--blue); font-weight: 700; }
.data-table .note-cell { min-width: 150px; }
.table-footnote { padding: 12px 19px 15px; color: var(--muted); font-size: 10px; line-height: 1.6; }
.status-select.enabled { color: var(--mint-strong); background: #e9f7ed; }
.status-select.disabled { color: var(--amber-strong); background: #fff6dd; }
.status-select.missing { color: var(--red); background: var(--red-soft); }

.params-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(340px, .9fr); gap: 18px; }
.param-table { min-width: 0; }
.param-table th:nth-child(2), .param-table td:nth-child(2) { width: 140px; }
.param-table th:nth-child(3), .param-table td:nth-child(3) { width: 80px; }
.param-table th:nth-child(4), .param-table td:nth-child(4) { width: 42%; }
.info-panel { padding: 19px 20px; border: 1px solid #d9e9ef; border-radius: var(--radius); background: linear-gradient(145deg, #eaf5f8, #f6fbfc); }
.info-panel h3 { margin: 0 0 10px; color: var(--navy); font-size: 14px; }
.info-panel p, .info-panel li { color: var(--ink-soft); font-size: 11px; line-height: 1.65; }
.info-panel ul { padding-left: 18px; margin: 10px 0 0; }
.formula-box { margin-top: 15px; padding: 12px; border: 1px dashed #b9d7e3; border-radius: 9px; color: var(--navy-2); background: rgba(255,255,255,.64); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 10px; line-height: 1.7; }

.backend-layout { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 18px; }
.audit-list { display: grid; gap: 9px; }
.audit-item { padding: 11px 12px; border-radius: 10px; background: #f8fafb; border: 1px solid #edf1f4; }
.audit-item .label { color: var(--muted); font-size: 10px; }
.audit-item .value { margin-top: 4px; color: var(--navy); font-size: 13px; font-weight: 800; }
.candidate-card { min-width: 0; }
.candidate-table { min-width: 840px; }
.candidate-card .table-scroll { max-height: 65vh; overflow: auto; }
.candidate-table th { position: sticky; top: 0; z-index: 2; }
.candidate-table .best-row td { color: var(--navy); background: #eaf7ee; font-weight: 800; }
.candidate-table .best-row:hover td { background: #e2f2e7; }
.direction-badge { padding: 3px 7px; border-radius: 999px; color: var(--blue); background: var(--blue-soft); font-size: 10px; }
.small-note { color: var(--muted); font-size: 10px; line-height: 1.5; }

.notice-line { gap: 8px; padding: 10px 12px; border-radius: 9px; color: var(--ink-soft); background: #f8fafb; font-size: 11px; }
.notice-line .notice-icon { color: var(--blue); }
.filter-row { justify-content: space-between; gap: 10px; padding: 11px 15px; border-bottom: 1px solid var(--line); }
.filter-row label { color: var(--muted); font-size: 11px; }
.filter-row select { padding: 6px 8px; border: 1px solid var(--line); border-radius: 7px; color: var(--ink-soft); background: white; font-size: 11px; }

.empty-state { min-height: 120px; justify-content: center; color: var(--muted); font-size: 12px; }
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 100; max-width: 360px; padding: 11px 15px; border: 1px solid #cbe4d3; border-radius: 10px; color: #23633f; background: #eff9f1; box-shadow: var(--shadow); font-size: 12px; opacity: 0; transform: translateY(8px); pointer-events: none; transition: .22s ease; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { color: var(--red); border-color: #f0c5c2; background: var(--red-soft); }

@media (max-width: 1180px) {
  body { min-width: 960px; }
  .main-content { padding-left: 25px; padding-right: 25px; }
  .quote-grid { grid-template-columns: minmax(360px, .85fr) minmax(500px, 1.15fr); }
}

@media (max-width: 980px) {
  body { min-width: 760px; }
  .sidebar { width: 76px; flex-basis: 76px; padding-left: 10px; padding-right: 10px; }
  .sidebar-caption, .nav-item span:not(.nav-icon), .nav-item em, .mini-tip, .reset-link, .version-line { display: none; }
  .nav-item { justify-content: center; padding: 14px 8px; }
  .main-content { padding: 28px 18px 50px; }
  .quote-grid, .params-grid, .backend-layout { grid-template-columns: 1fr; }
  .page-head { align-items: flex-start; flex-direction: column; }
}
