:root {
  --bg: #eef3f7;
  --panel: #ffffff;
  --ink: #17283a;
  --muted: #667789;
  --line: #d9e2ea;
  --blue: #1769aa;
  --green: #168a5a;
  --orange: #d97706;
  --red: #c2413c;
  --shadow: 0 14px 34px rgba(24, 48, 72, 0.12);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: Arial, "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
}

button, input, select {
  font-family: inherit;
  font-size: 14px;
}

button { cursor: pointer; }

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  padding: 18px 28px;
  background: #ffffff;
  border-bottom: 1px solid var(--line);
  box-shadow: 0 6px 18px rgba(16, 42, 67, 0.06);
}

.brand {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand-mark {
  width: 64px;
  height: 40px;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--blue);
  border-radius: 4px;
  font-weight: 800;
  letter-spacing: 1px;
}

.brand h1 {
  margin: 0;
  font-size: 24px;
  line-height: 1.25;
}

.brand p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.segmented {
  display: inline-flex;
  background: #edf4fb;
  border: 1px solid #cfe0ef;
  border-radius: 6px;
  padding: 3px;
}

.segmented button {
  border: 0;
  background: transparent;
  color: #385168;
  padding: 8px 12px;
  border-radius: 4px;
  font-weight: 700;
}

.segmented button.active {
  background: var(--blue);
  color: #fff;
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: #385168;
  background: #fff;
  font-weight: 700;
}

.main-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 18px;
  padding: 18px;
  max-width: 1680px;
  margin: 0 auto;
}

.center-stage {
  min-width: 0;
}

.hero-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(380px, 46%);
  gap: 18px;
  align-items: stretch;
  padding: 22px;
  border: 1px solid #cddde9;
  border-radius: 8px;
  background: linear-gradient(135deg, #fff 0%, #f6fbff 100%);
  box-shadow: var(--shadow);
}

.hero-copy span,
.section-title span,
.page-head span,
.drawer-head span {
  display: inline-block;
  color: var(--blue);
  font-weight: 800;
  font-size: 13px;
}

.hero-copy h2 {
  margin: 10px 0;
  max-width: 820px;
  font-size: 30px;
  line-height: 1.25;
}

.hero-copy p {
  margin: 0;
  color: #4f6377;
  line-height: 1.7;
  font-size: 15px;
}

.hero-kpis,
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.hero-kpis {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.kpi {
  min-height: 110px;
  padding: 16px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.kpi span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.kpi strong {
  margin: 8px 0;
  font-size: 25px;
  line-height: 1.1;
  color: var(--ink);
}

.kpi small {
  color: #667789;
  line-height: 1.45;
}

.kpi.good strong { color: var(--green); }
.kpi.warn strong { color: var(--orange); }

.directory-panel,
.page-body,
.side-card,
.panel,
.chart-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.directory-panel {
  margin-top: 18px;
  padding: 18px;
}

.section-title,
.panel-head,
.side-head,
.drawer-head,
.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.section-title h3,
.panel-head h3,
.page-head h2,
.drawer-head h2 {
  margin: 4px 0 0;
}

.section-title h3 {
  font-size: 20px;
}

.directory-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.directory-item {
  text-align: left;
  padding: 14px;
  min-height: 118px;
  background: #f8fbfd;
  border: 1px solid #dce7f0;
  border-radius: 8px;
  color: var(--ink);
}

.directory-item span {
  display: block;
  color: var(--blue);
  font-weight: 800;
  font-size: 12px;
}

.directory-item strong {
  display: block;
  margin: 8px 0 6px;
  font-size: 17px;
}

.directory-item small {
  color: var(--muted);
  line-height: 1.45;
}

.directory-item.active {
  background: #e8f3fc;
  border-color: var(--blue);
  box-shadow: inset 0 0 0 1px var(--blue);
}

.page-body {
  margin-top: 18px;
  padding: 20px;
}

.page-head {
  margin-bottom: 18px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 14px;
}

.page-head h2 {
  font-size: 26px;
}

.page-head p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.two-col {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
  gap: 14px;
  margin-top: 14px;
}

.panel {
  padding: 16px;
  min-width: 0;
}

.panel + .panel { margin-top: 14px; }

.kpi-grid + .panel {
  margin-top: 14px;
}

.panel-head {
  margin-bottom: 12px;
}

.tag {
  display: inline-flex;
  align-items: center;
  padding: 5px 9px;
  border-radius: 5px;
  background: #edf4fb;
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

th, td {
  border-bottom: 1px solid #e3ebf2;
  padding: 10px 9px;
  vertical-align: top;
  text-align: left;
  font-size: 14px;
  line-height: 1.45;
}

th {
  background: #f2f7fb;
  color: #304960;
  font-weight: 800;
  white-space: nowrap;
}

.compact-table {
  min-width: 680px;
}

.compact-table th,
.compact-table td {
  padding: 8px 8px;
  font-size: 13px;
  line-height: 1.5;
}

.quote-boundary-grid .panel {
  border-color: #cfe0ef;
}

.quote-boundary-grid .panel-head h3 {
  color: #173f64;
}

.asset-scope-box {
  display: grid;
  grid-template-columns: minmax(260px, 0.9fr) minmax(0, 1.4fr);
  gap: 14px;
  align-items: stretch;
}

.scope-toggle {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  align-self: start;
}

.scope-toggle button {
  min-height: 48px;
  border: 1px solid #cfe0ef;
  border-radius: 6px;
  background: #f7fbfe;
  color: #385168;
  font-weight: 800;
  line-height: 1.35;
}

.scope-toggle button.active {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}

.scope-result {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.scope-result div {
  padding: 12px;
  border: 1px solid #d9e7f2;
  border-radius: 6px;
  background: #f8fbfd;
}

.scope-result span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.scope-result strong {
  display: block;
  margin-top: 6px;
  color: var(--ink);
  font-size: 18px;
  line-height: 1.2;
}

.asset-scope-box p {
  grid-column: 1 / -1;
  margin: 0;
  padding: 10px 12px;
  border-left: 3px solid var(--blue);
  background: #f5f9fc;
  color: #34495e;
  line-height: 1.55;
  font-size: 13px;
}

td small {
  display: block;
  color: var(--muted);
  margin-top: 3px;
}

.equipment-table {
  min-width: 1520px;
}

.equipment-table td:nth-child(5) {
  min-width: 250px;
}

.model-cell {
  display: grid;
  gap: 6px;
  min-width: 230px;
}

.model-select,
.model-input {
  min-width: 220px;
}

.cell-input {
  width: 100%;
  min-width: 76px;
  border: 1px solid #cfdce8;
  border-radius: 5px;
  padding: 8px;
  background: #fff;
}

.number-input {
  text-align: right;
}

.chart-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 14px;
}

.chart-card {
  padding: 14px;
  min-height: 330px;
}

.chart-card h3 {
  margin: 0 0 4px;
  font-size: 17px;
}

.chart-card p {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.chart-card canvas {
  display: block;
  width: 100%;
  height: 260px;
}

.side-column {
  position: sticky;
  top: 88px;
  align-self: start;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.side-card {
  padding: 16px;
}

.side-head {
  align-items: center;
  margin-bottom: 12px;
}

.side-head span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.side-head strong {
  color: var(--blue);
  font-size: 14px;
}

.mini-list {
  display: grid;
  gap: 8px;
}

.mini-list div {
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  padding-bottom: 8px;
  border-bottom: 1px dashed #d9e2ea;
}

.mini-list div:last-child { border-bottom: 0; }

.mini-list span {
  color: var(--muted);
  font-size: 13px;
}

.mini-list strong {
  font-size: 13px;
  line-height: 1.45;
}

.hint {
  margin: 0 0 12px;
  color: var(--muted);
  line-height: 1.6;
  font-size: 13px;
}

.conclusion-list {
  display: grid;
  gap: 9px;
}

.conclusion-list div {
  border-left: 3px solid var(--blue);
  background: #f5f9fc;
  padding: 9px 10px;
  line-height: 1.55;
  font-size: 13px;
}

.primary-btn,
.ghost-btn,
.icon-btn {
  border-radius: 6px;
  border: 1px solid var(--line);
  padding: 10px 12px;
  font-weight: 800;
}

.primary-btn {
  width: 100%;
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}

.ghost-btn {
  background: #fff;
  color: var(--blue);
  margin-right: 8px;
}

.side-card .ghost-btn {
  width: 100%;
  margin: 0 0 8px;
}

.icon-btn {
  width: 38px;
  height: 38px;
  padding: 0;
  background: #fff;
  font-size: 22px;
}

.clean-list {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 10px;
  color: #34495e;
  line-height: 1.65;
}

.selector-line {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.selector-line label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-weight: 800;
}

.selector-line select {
  width: 100%;
  border: 1px solid #cfdce8;
  border-radius: 6px;
  padding: 10px;
  background: #fff;
}

.quote-editor {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  align-items: end;
}

.quote-editor label {
  display: grid;
  gap: 6px;
  color: #34495e;
  font-weight: 800;
}

.quote-editor .quote-note {
  grid-column: 1 / -1;
  color: var(--muted);
  line-height: 1.55;
  font-size: 13px;
}

.inline-action {
  width: 100%;
  margin: 0;
}

.status {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 5px;
  font-weight: 800;
  font-size: 12px;
  background: #edf4fb;
  color: var(--blue);
}

.status.ok {
  background: #e9f8f0;
  color: var(--green);
}

.status.warn {
  background: #fff7e6;
  color: var(--orange);
}

.status.bad {
  background: #fff1f1;
  color: var(--red);
}

.overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(12, 25, 38, 0.42);
  display: flex;
  justify-content: flex-end;
}

.overlay.hidden {
  display: none;
}

.drawer {
  width: min(960px, 92vw);
  height: 100%;
  overflow-y: auto;
  background: #fff;
  padding: 22px;
  box-shadow: -18px 0 42px rgba(0, 0, 0, 0.2);
}

.drawer-head {
  align-items: center;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.settings-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 16px 0;
}

.summary-tile {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #f8fbfd;
}

.summary-tile span,
.summary-tile small {
  display: block;
  color: var(--muted);
}

.summary-tile strong {
  display: block;
  margin: 6px 0;
  font-size: 24px;
  color: var(--ink);
}

.param-catalog {
  display: grid;
  gap: 16px;
}

.param-group {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

.param-group h3 {
  margin: 0 0 12px;
}

.param-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.param-field {
  display: grid;
  gap: 6px;
}

.param-field span {
  color: #34495e;
  font-weight: 800;
}

.param-field span em {
  margin-left: 6px;
  color: var(--muted);
  font-style: normal;
  font-weight: 500;
}

.param-field input {
  width: 100%;
  border: 1px solid #cfdce8;
  border-radius: 6px;
  padding: 10px;
}

.param-field small {
  color: var(--muted);
  line-height: 1.45;
}

.drawer-actions {
  position: sticky;
  bottom: 0;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
  padding-top: 14px;
  background: #fff;
  border-top: 1px solid var(--line);
}

.drawer-actions .primary-btn,
.drawer-actions .ghost-btn {
  width: auto;
  min-width: 120px;
  margin: 0;
}

@media (max-width: 1280px) {
  .main-grid {
    grid-template-columns: 1fr;
  }
  .side-column {
    position: static;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .topbar,
  .hero-panel,
  .two-col,
  .chart-grid,
  .selector-line,
  .quote-editor,
  .asset-scope-box,
  .scope-result,
  .settings-summary,
  .param-grid,
  .side-column {
    grid-template-columns: 1fr;
  }
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }
  .hero-kpis,
  .kpi-grid,
  .directory-grid {
    grid-template-columns: 1fr;
  }
  .brand h1 {
    font-size: 21px;
  }
  .hero-copy h2 {
    font-size: 24px;
  }
  .main-grid {
    padding: 12px;
  }
}
