:root {
  --ink: #10213b;
  --muted: #65758c;
  --line: #dfe4ec;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --huawei: #2c5fca;
  --industry: #e17a00;
  --radius: 10px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; overflow-x: hidden; background: var(--bg); }
button, input { font: inherit; }

.topbar {
  min-height: 88px;
  width: 100%;
  padding: 14px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
  box-shadow: 0 2px 10px rgba(20, 38, 60, .04);
}
.back { color: var(--muted); text-decoration: none; font-size: 16px; }
.back::before { content: "<"; margin-right: 12px; color: #69778d; }
.brand { font-size: 24px; font-weight: 800; color: #111d31; display: flex; align-items: center; gap: 10px; }
.bolt { color: var(--huawei); font-size: 26px; }
.market-actions { display: flex; align-items: end; justify-content: flex-end; gap: 12px; flex-wrap: wrap; }
.market-actions label { display: grid; gap: 6px; color: #5d6b63; font-size: 12px; font-weight: 800; }
.market-actions select { min-width: 120px; max-width: 260px; height: 42px; border: 1px solid #d7e0dc; border-radius: 8px; padding: 0 12px; background: #fff; color: #15211f; font-size: 15px; }
.export-button, .fx-button { height: 42px; border: 1px solid #d7e0dc; border-radius: 8px; background: #fff; color: #13211d; padding: 0 18px; font-weight: 800; cursor: pointer; }
.fx-button { min-width: 58px; }

main {
  width: 1440px;
  max-width: calc(100vw - 48px);
  margin: 0 auto;
  padding: 42px 0 28px;
}

.intro { max-width: 1040px; margin-bottom: 30px; }
.tag { display: inline-flex; padding: 4px 12px; border: 1px solid var(--line); border-radius: 999px; background: #fff; color: #17263b; font-size: 14px; font-weight: 700; }
h1 { margin: 19px 0 13px; font-size: 39px; line-height: 1.15; letter-spacing: 0; }
.intro p { margin: 0; color: var(--muted); font-size: 20px; line-height: 1.55; max-width: 1030px; }
.step-guide { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.step-guide span { display: inline-flex; align-items: center; min-height: 30px; padding: 0 12px; border-radius: 7px; background: #eef2f7; color: #66758a; font-size: 14px; }

.compare-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 30px; align-items: start; }
.product-panel { overflow: hidden; border: 1px solid var(--line); border-radius: 11px; background: #fff; min-width: 0; }
.product-panel > header { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 0 30px; min-height: 82px; color: #fff; }
.product-panel.huawei > header { background: var(--huawei); }
.product-panel.industry > header { background: var(--industry); }
.product-panel h2 { margin: 0; font-size: 20px; letter-spacing: 0; }
.lock-button, .save-button, .reset-button { color: #2c3c54; background: #f4f6f9; border: 0; border-radius: 8px; padding: 8px 14px; font-weight: 700; font-size: 14px; cursor: pointer; }
.product-body { padding: 22px 20px 24px; }

.field-grid { display: grid; grid-template-columns: 1fr 1fr; column-gap: 16px; row-gap: 17px; }
.field { min-width: 0; display: grid; gap: 7px; }
.field > span { color: #64748b; font-size: 15px; font-weight: 650; }
.field em { font-style: normal; color: #93a0b2; font-weight: 500; }
.field i, .help-dot { display: inline-flex; align-items: center; justify-content: center; width: 17px; height: 17px; margin-left: 5px; border: 1px solid #aeb9c7; border-radius: 50%; color: #8896a8; font-style: normal; font-size: 12px; cursor: help; vertical-align: 1px; }
.field input { width: 100%; height: 51px; border: 1px solid #d9dee7; border-radius: 8px; outline: 0; background: #f7f8fa; padding: 0 15px; color: #182945; font-size: 16px; }
.field input:focus { border-color: #2d63d8; box-shadow: 0 0 0 3px rgba(45,99,216,.1); background: #fff; }
.field input:disabled { color: #56677f; cursor: not-allowed; background: #f1f4f7; }
.analysis-period-control { display: grid; grid-template-columns: minmax(0, 1fr); gap: 7px; }
.analysis-period-control select { width: 100%; height: 51px; border: 1px solid #d9dee7; border-radius: 8px; outline: 0; background: #f7f8fa; padding: 0 15px; color: #182945; font-size: 16px; }
.analysis-period-control select:focus { border-color: #2d63d8; box-shadow: 0 0 0 3px rgba(45,99,216,.1); background: #fff; }

.installed-metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 18px; }
.product-metric { min-width: 0; padding: 10px; border: 1px solid #e2e7ee; border-radius: 7px; background: #fafbfc; }
.product-metric span { display: block; color: #77869a; font-size: 12px; }
.product-metric strong { display: block; margin-top: 4px; color: #1c2d48; font-size: 14px; overflow-wrap: anywhere; }

.advanced { margin-top: 30px; border: 1px solid #dbe0e7; border-radius: 9px; overflow: hidden; }
.advanced-toggle { width: 100%; padding: 15px 18px; display: flex; align-items: center; justify-content: space-between; gap: 16px; border: 0; background: #fff; color: #5c6b7f; font-weight: 750; font-size: 15px; text-align: left; cursor: pointer; }
.advanced-toggle:disabled { cursor: not-allowed; opacity: .68; }
.switch { display: inline-flex; align-items: center; gap: 7px; color: #718197; font-size: 12px; white-space: nowrap; }
.switch b { position: relative; display: block; width: 30px; height: 17px; border-radius: 999px; background: #cbd4df; }
.switch b::after { position: absolute; top: 3px; left: 3px; width: 11px; height: 11px; border-radius: 50%; background: #fff; content: ""; transition: .15s; }
.switch.on { color: #08785c; }
.switch.on b { background: #16a77a; }
.switch.on b::after { left: 16px; }
.advanced-grid { padding: 4px 18px 18px; }

.project-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; margin-top: 28px; }
.project-panel, .tariff-panel { border: 1px solid var(--line); border-radius: 10px; background: #fff; padding: 24px; min-width: 0; }
.project-panel h2, .tariff-panel h2 { margin: 0 0 20px; font-size: 20px; display: flex; align-items: center; gap: 10px; }
.section-icon, .result-icon, .mini-icon, .title-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: #eef4ff;
  color: var(--huawei);
  font-size: 15px;
  flex: 0 0 auto;
}
.mode-list { display: grid; gap: 10px; }
.mode-option { display: grid; grid-template-columns: 21px 1fr; column-gap: 10px; padding: 12px; border: 1px solid #e0e5eb; border-radius: 8px; background: #fbfcfd; cursor: pointer; }
.mode-option input { position: absolute; opacity: 0; pointer-events: none; }
.mode-option .check { width: 18px; height: 18px; margin-top: 1px; border: 1px solid #aebaca; border-radius: 4px; background: #fff; }
.mode-option.selected { border-color: #7ba1ed; background: #f2f6ff; }
.mode-option.selected .check { background: #2d63d8; border-color: #2d63d8; }
.mode-option.selected .check::after { display: block; margin-left: 5px; color: #fff; font-size: 13px; line-height: 17px; content: "✓"; }
.mode-option strong { font-size: 15px; }
.mode-option small { grid-column: 2; color: #718197; font-size: 12px; line-height: 1.35; }
.empty-note { margin: 0; color: #718197; font-size: 13px; }
.tariff-block + .tariff-block { margin-top: 22px; padding-top: 22px; border-top: 1px solid #e5e9ef; }
.tariff-block h3 { margin: 0 0 14px; color: #5c6b7f; font-size: 15px; text-transform: uppercase; }
.tariff-growth { margin-top: 22px; padding-top: 22px; border-top: 1px solid #e5e9ef; }

.product-compare-table {
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fff;
  overflow: hidden;
}
.product-compare-table > header {
  min-height: 76px;
  padding: 0 28px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  background: linear-gradient(90deg, var(--huawei), #2f6fe0 50%, var(--industry));
  color: #fff;
}
.product-compare-table h2 { margin: 0; font-size: 21px; display: flex; align-items: center; gap: 10px; }
.mini-icon { font-size: 15px; background: rgba(255,255,255,.18); color: #fff; }
.product-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.product-table-wrap, .advanced-table-wrap { padding: 20px; }
.product-table { min-width: 860px; table-layout: fixed; }
.product-table th:first-child { width: 32%; text-align: left; }
.product-table th, .product-table td { vertical-align: middle; }
.product-table th em { display: inline; margin-left: 4px; color: #8a98aa; font-style: normal; font-size: 0.9em; font-weight: 500; }
.product-table input, .product-table select { width: 100%; height: 44px; border: 1px solid #d9dee7; border-radius: 8px; outline: 0; background: #f7f8fa; padding: 0 12px; color: #182945; font-size: 15px; }
.product-table input:focus, .product-table select:focus { border-color: #2d63d8; box-shadow: 0 0 0 3px rgba(45,99,216,.1); background: #fff; }
.product-table input:disabled { background: #eef2f6; color: #66758a; }
.model-cell-control { display: flex; align-items: center; gap: 7px; min-width: 0; }
.model-cell-control .model-select { min-width: 0; flex: 1; }
.model-icon-actions { display: inline-flex; gap: 4px; flex: 0 0 auto; }
.model-icon-button { display: inline-flex; align-items: center; justify-content: center; width: 31px; height: 31px; padding: 0; border: 1px solid #ccd7e6; border-radius: 7px; background: #fff; color: #38506f; cursor: pointer; }
.model-icon-button:hover, .model-icon-button:focus-visible { border-color: #2d63d8; color: #1f55c1; outline: 0; box-shadow: 0 0 0 3px rgba(45,99,216,.12); }
.model-icon-button svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.huawei-head { color: var(--huawei); }
.industry-head { color: var(--industry); }
.computed-row td { background: #fbfcfd; }
.computed-cell { font-weight: 760; color: #17233a; }
.advanced-switches { display: grid; grid-template-columns: 1fr; gap: 12px; padding: 0 20px 20px; }
.advanced-switches .advanced-toggle {
  border: 1px solid #dbe0e7;
  border-radius: 8px;
  background: #fff;
  color: #607086;
  min-height: 48px;
  padding: 0 16px;
}
.advanced-switches .advanced-toggle.active { border-color: #2d63d8; color: #13233b; background: #f2f6ff; }
.advanced-switches .advanced-toggle .switch { margin-left: auto; }

.comparison-separator { display: flex; align-items: center; gap: 10px; margin: 36px 0 18px; padding: 13px 18px; border-left: 5px solid var(--huawei); background: #edf5ff; border-radius: 8px; box-shadow: 0 1px 2px rgba(20,38,60,.04); font-size: 20px; font-weight: 800; }
.comparison-separator span { color: var(--huawei); }
.result-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; margin: 0 0 46px; }
.result-card { min-height: 198px; padding: 27px 34px 20px; border: 1px solid var(--line); border-radius: 11px; background: #fff; box-shadow: 0 2px 3px rgba(20,38,60,.03); }
.result-card h2 { margin: 0 0 20px; font-size: 19px; display: flex; align-items: center; gap: 10px; }
.result-values { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.result-values span { display: block; color: var(--muted); font-size: 15px; }
.result-values strong { display: block; margin-top: 5px; font-size: 31px; letter-spacing: 0; white-space: nowrap; }
.huawei-value, .huawei-text { color: var(--huawei); }
.industry-value { color: var(--industry); }
.result-card p { margin: 20px 0 0; font-size: 15px; }

.tabs { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; padding: 5px; border-radius: 8px; background: #edf0f4; }
.tabs button { height: 43px; border: 1px solid transparent; border-radius: 7px; background: transparent; color: #62728a; font-size: 16px; cursor: pointer; }
.tabs button.active { border-color: #2e64d8; background: #fff; color: #142037; box-shadow: 0 1px 2px rgba(20,38,60,.06); font-weight: 700; }
.analysis-card { margin-top: 12px; padding: 33px 37px 22px; border: 1px solid var(--line); border-radius: 11px; background: #fff; overflow: hidden; }
.analysis-card + .analysis-card { margin-top: 24px; }
.analysis-card h2 { margin: 0 0 32px; font-size: 29px; letter-spacing: 0; display: flex; align-items: center; gap: 12px; }
.title-icon { font-size: 16px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 820px; font-size: 16px; }
th, td { padding: 17px 22px; border-bottom: 1px solid #dfe4eb; text-align: left; white-space: nowrap; }
th { color: #63738b; font-weight: 550; }
td:first-child, th:first-child { padding-left: 20px; }
td:nth-child(n+2), th:nth-child(n+2) { text-align: center; }
tbody tr:last-child td { border-bottom: 0; }
tr.emphasis td { background: #f4f5f7; color: #17233a; font-weight: 760; }
.better { text-align: left !important; }
.better::before { display: inline-block; width: 17px; height: 17px; margin-right: 7px; border-radius: 50%; vertical-align: -3px; content: ""; }
.huawei-dot::before { background: radial-gradient(circle at 30% 30%, #7fc6ff, #2862ce); }
.industry-dot::before { background: radial-gradient(circle at 30% 30%, #ffd985, #e17a00); }
.positive { color: #009c6c; }
.negative { color: #e34343; }
.status { display: inline-flex; align-items: center; gap: 8px; }
.status.both { color: #098a55; }
.status.huawei { color: var(--huawei); }
.status.industry { color: var(--industry); }
.status.recovering { color: #3d4b60; }
.status.offline { color: #8793a4; }

.modal-backdrop { position: fixed; z-index: 100; inset: 0; display: grid; place-items: center; padding: 24px; background: rgba(15, 28, 49, .46); }
.app-modal { width: min(520px, 100%); max-height: min(680px, calc(100svh - 48px)); overflow: auto; border: 1px solid #dfe4ec; border-radius: 12px; background: #fff; box-shadow: 0 22px 60px rgba(0, 0, 0, .28); }
.app-modal > header { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 20px 22px 12px; }
.app-modal h2 { margin: 0; font-size: 20px; }
.app-modal p { margin: 0; padding: 0 22px 16px; color: #65758c; line-height: 1.45; }
.modal-close { width: 32px; height: 32px; border: 0; border-radius: 7px; background: #f1f4f8; color: #33455f; font-size: 22px; cursor: pointer; }
.modal-field { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: center; margin: 0 22px 18px; color: #4d5d72; font-weight: 700; }
.modal-field input { min-width: 0; height: 44px; border: 1px solid #ced8e5; border-radius: 8px; padding: 0 12px; font: inherit; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 22px 22px; border-top: 1px solid #e5eaf1; }
.modal-actions button { min-height: 40px; border-radius: 8px; padding: 0 14px; font-weight: 750; cursor: pointer; }
.modal-actions .primary { border: 1px solid #275fc8; background: #2d63d8; color: #fff; }
.modal-actions .secondary { border: 1px solid #d6dee9; background: #fff; color: #31425b; }

@media (max-width: 1500px) {
  main { width: 1280px; }
}
@media (max-width: 1120px) {
  main { width: auto; max-width: none; padding: 30px 18px; }
  .compare-grid, .project-grid { grid-template-columns: 1fr; }
  .result-cards { grid-template-columns: 1fr; }
  h1 { font-size: 33px; }
  .topbar { align-items: flex-start; flex-direction: column; }
  .market-actions { width: 100%; justify-content: flex-start; }
}
@media (max-width: 800px) {
  .topbar { min-height: 0; max-height: 20svh; overflow: auto; padding: 8px 12px; gap: 7px; }
  .brand { font-size: 18px; line-height: 1.25; }
  .market-actions { display: grid; grid-template-columns: repeat(3, minmax(96px, 1fr)) auto; width: 100%; gap: 6px; }
  .market-actions label { min-width: 0; }
  .market-actions label span { font-size: 10px; }
  .market-actions select, .export-button, .fx-button { width: 100%; height: 34px; font-size: 12px; padding: 0 8px; }
  .export-button { grid-column: span 2; }
  .intro { margin-bottom: 26px; }
  .intro p { font-size: 16px; }
  .step-guide span { font-size: 12px; min-height: 28px; }
  h1 { font-size: 29px; }
  .product-panel > header { min-height: 74px; padding: 0 18px; }
  .product-panel h2 { font-size: 16px; }
  .lock-button, .save-button, .reset-button { font-size: 12px; padding: 6px 8px; }
  .field-grid { grid-template-columns: 1fr; }
  .analysis-period-control { gap: 9px; }
  .installed-metrics { grid-template-columns: 1fr; }
  .result-values strong { font-size: 25px; }
  .tabs { grid-template-columns: 1fr; gap: 2px; }
  .analysis-card { padding: 24px 14px 15px; }
  .analysis-card h2 { font-size: 24px; margin-bottom: 20px; }
  .result-card { min-height: 0; padding: 21px; }
  .project-panel, .tariff-panel { padding: 20px; }
  .product-compare-table > header { align-items: flex-start; flex-direction: column; padding: 18px; }
  .product-table-wrap, .advanced-table-wrap { padding: 12px; }
  .product-table { min-width: 680px; }
  .model-cell-control { flex-wrap: wrap; }
  .model-cell-control .model-select { min-width: 150px; }
  .advanced-switches { grid-template-columns: 1fr; padding: 0 12px 12px; }
  table { min-width: 680px; font-size: 14px; }
  th, td { padding: 13px 12px; }
}
@media (max-width: 520px) {
  main { padding: 24px 12px; }
  .topbar { padding: 7px 10px; }
  .brand { font-size: 16px; }
  .bolt { font-size: 20px; }
  .market-actions { grid-template-columns: repeat(3, minmax(82px, 1fr)); }
  .market-actions select { max-width: none; }
  .product-compare-table > header { padding: 16px 14px; }
  .product-actions { width: 100%; }
  .save-button, .reset-button { width: 100%; justify-content: center; }
  .result-values { grid-template-columns: 1fr; }
  .result-values strong { white-space: normal; }
  .advanced-toggle { align-items: flex-start; flex-direction: column; }
  .advanced-switches .advanced-toggle .switch { margin-left: 0; }
  .modal-backdrop { padding: 14px; }
  .modal-field { grid-template-columns: 1fr; gap: 7px; }
  .modal-actions { flex-wrap: wrap; }
}
