:root {
  color-scheme: light;
  --bg: #f5f6f3;
  --surface: #ffffff;
  --surface-soft: #f8faf8;
  --line: #d7ded8;
  --line-strong: #b9c7bd;
  --text: #1f2d2b;
  --muted: #64736d;
  --teal: #0f766e;
  --teal-dark: #0b5f59;
  --blue: #245f9f;
  --rust: #b64a35;
  --amber: #b7791f;
  --green: #24754f;
  --shadow: 0 14px 36px rgba(31, 45, 43, 0.11);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--text);
  background:
    linear-gradient(180deg, rgba(15, 118, 110, 0.08), transparent 280px),
    var(--bg);
  font-family:
    "Microsoft YaHei UI", "Microsoft YaHei", "PingFang SC", "Segoe UI",
    Arial, sans-serif;
  letter-spacing: 0;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  min-height: 86px;
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto auto;
  align-items: center;
  gap: 18px;
  padding: 16px clamp(16px, 3vw, 32px);
  border-bottom: 1px solid rgba(31, 45, 43, 0.12);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(18px);
  position: sticky;
  top: 0;
  z-index: 6;
}

.brand-block h1,
.panel-heading h2,
.output-console h2,
.dialog-heading h2 {
  margin: 0;
  font-size: clamp(21px, 2vw, 30px);
  line-height: 1.16;
}

.brand-block span {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--teal-dark);
  font-size: 12px;
  text-transform: uppercase;
  font-weight: 800;
}

.fee-badge {
  display: grid;
  gap: 2px;
  min-width: 168px;
  padding: 10px 12px;
  border: 1px solid rgba(183, 121, 31, 0.38);
  border-radius: 8px;
  background: #fff8e8;
}

.fee-badge span {
  color: #735116;
  font-size: 12px;
  font-weight: 800;
}

.fee-badge strong {
  color: #7f351e;
  font-size: 21px;
}

.topbar-actions,
.plan-actions,
.dialog-heading,
menu {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.primary-button,
.secondary-button,
.icon-button,
.tab-button,
.entry-button {
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: 6px;
  transition:
    transform 0.16s ease,
    border-color 0.16s ease,
    background 0.16s ease,
    color 0.16s ease;
}

.primary-button {
  padding: 0 18px;
  color: #fff;
  background: var(--teal);
  font-weight: 800;
  box-shadow: 0 8px 18px rgba(15, 118, 110, 0.22);
}

.secondary-button {
  padding: 0 15px;
  color: var(--teal-dark);
  background: #fff;
  border-color: rgba(15, 118, 110, 0.32);
  font-weight: 800;
}

.icon-button {
  width: 42px;
  padding: 0;
  color: var(--text);
  background: #fff;
  border-color: var(--line);
  font-weight: 800;
}

.primary-button:hover,
.secondary-button:hover,
.icon-button:hover,
.tab-button:hover,
.entry-button:hover {
  transform: translateY(-1px);
}

.workspace {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(340px, 440px) minmax(0, 1fr);
  gap: 18px;
  padding: 18px;
}

.input-panel,
.output-panel,
.output-console,
.side-summary {
  border: 1px solid rgba(31, 45, 43, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}

.input-panel {
  align-self: start;
  max-height: calc(100vh - 122px);
  overflow: auto;
}

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

.panel-heading,
.output-console {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
}

.panel-heading {
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 2;
  background: rgba(255, 255, 255, 0.96);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 9px;
  border: 1px solid rgba(36, 95, 159, 0.28);
  border-radius: 6px;
  color: #194a7d;
  background: #edf5ff;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.entry-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 14px 16px 0;
}

.entry-button {
  color: var(--muted);
  background: #fff;
  border-color: var(--line);
  font-weight: 900;
}

.entry-button.active {
  color: #fff;
  background: var(--teal-dark);
  border-color: var(--teal-dark);
}

.form-stack {
  display: grid;
  gap: 14px;
  padding: 16px;
}

.form-section {
  display: none;
  gap: 14px;
}

.form-section.active {
  display: grid;
}

fieldset {
  margin: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

legend {
  padding: 0 6px;
  color: var(--text);
  font-weight: 900;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

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

fieldset > label + label,
fieldset > label + .field-grid,
.field-grid + label {
  margin-top: 12px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #c7d0c9;
  border-radius: 6px;
  color: var(--text);
  background: #fff;
  outline: none;
}

input,
select {
  min-height: 40px;
  padding: 0 10px;
}

textarea {
  resize: vertical;
  min-height: 84px;
  padding: 10px;
  line-height: 1.55;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.field-note {
  color: #7c8781;
  font-size: 12px;
  font-weight: 600;
}

.upload-zone {
  min-height: 112px;
  display: grid;
  place-items: center;
  gap: 7px;
  padding: 18px;
  text-align: center;
  border: 1px dashed rgba(15, 118, 110, 0.45);
  border-radius: 8px;
  color: var(--teal-dark);
  background: #eef8f5;
}

.upload-zone span {
  max-width: 360px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.upload-zone input {
  display: none;
}

.upload-zone.is-dragging {
  background: #e0f2ef;
  border-color: var(--teal);
}

.file-list,
.compact-list,
.notice-list {
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.file-list li,
.compact-list li,
.notice-list li {
  display: grid;
  gap: 3px;
  padding: 9px 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.file-list li {
  grid-template-columns: minmax(0, 1fr) auto;
}

.file-list strong,
.compact-list strong {
  color: var(--text);
}

.check-row {
  display: flex;
  grid-template-columns: none;
  align-items: center;
  gap: 8px;
}

.check-row input {
  width: 18px;
  min-height: 18px;
}

.provider-box {
  border-color: rgba(36, 95, 159, 0.32);
  background: #f3f8ff;
}

.service-rule {
  display: grid;
  gap: 6px;
  padding: 13px;
  border: 1px solid rgba(183, 121, 31, 0.34);
  border-radius: 8px;
  background: #fff8e8;
  color: #725017;
  font-size: 13px;
  line-height: 1.55;
}

.service-rule strong {
  color: #7f351e;
  font-size: 18px;
}

.metric-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  padding: 14px 16px 0;
}

.metric-strip div {
  min-height: 78px;
  display: grid;
  align-content: center;
  gap: 6px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.metric-strip span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.metric-strip strong {
  color: var(--text);
  font-size: clamp(17px, 1.5vw, 23px);
  line-height: 1.12;
}

.tabs {
  padding: 0 16px 12px;
}

.tab-button {
  padding: 0 16px;
  color: #fff;
  background: var(--text);
  border-color: var(--text);
  font-weight: 900;
}

.tab-panel {
  padding: 0 16px;
}

.plan-actions {
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.split-view {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 330px);
  gap: 14px;
}

.document-preview {
  min-width: 0;
  display: grid;
  gap: 16px;
  padding: clamp(18px, 2vw, 28px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.side-summary {
  align-self: start;
  display: grid;
  gap: 16px;
  padding: 16px;
  position: sticky;
  top: 112px;
  box-shadow: none;
}

.side-summary section + section {
  padding-top: 2px;
}

.side-summary h3,
.proposal-section h3 {
  margin: 0 0 10px;
  color: var(--text);
  font-size: 18px;
  line-height: 1.25;
}

.doc-header {
  padding-bottom: 16px;
  border-bottom: 2px solid var(--text);
}

.doc-header h2 {
  margin: 0;
  font-size: clamp(24px, 3vw, 38px);
  line-height: 1.12;
}

.doc-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.doc-meta span {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  background: var(--surface-soft);
  font-size: 12px;
  font-weight: 800;
}

.proposal-section {
  display: grid;
  gap: 10px;
}

.proposal-section p {
  margin: 0;
  color: #42504b;
  line-height: 1.75;
}

.privacy-banner {
  display: grid;
  gap: 5px;
  padding: 13px;
  border-left: 4px solid var(--blue);
  background: #f1f7ff;
  color: #1d4a78;
  line-height: 1.55;
}

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

.scheme-card,
.case-card,
.contact-grid article {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.scheme-card {
  display: grid;
  gap: 12px;
  padding: 13px;
}

.scheme-card.balanced,
.scheme-card.modulePressurized {
  border-color: rgba(15, 118, 110, 0.45);
  background: #f0faf7;
}

.scheme-card.premium,
.scheme-card.bigPressurized {
  border-color: rgba(36, 95, 159, 0.35);
  background: #f3f8ff;
}

.scheme-heading {
  display: grid;
  gap: 5px;
}

.scheme-heading span {
  width: fit-content;
  padding: 4px 7px;
  border-radius: 5px;
  color: #fff;
  background: var(--teal);
  font-size: 12px;
  font-weight: 900;
}

.scheme-card.economy .scheme-heading span {
  background: var(--amber);
}

.scheme-card.premium .scheme-heading span {
  background: var(--blue);
}

.scheme-card.bigPressurized .scheme-heading span {
  background: var(--blue);
}

.scheme-card.modulePressurized .scheme-heading span {
  background: var(--teal);
}

.scheme-card.openAtmospheric .scheme-heading span {
  background: var(--amber);
}

.scheme-heading h4 {
  margin: 0;
  font-size: 17px;
}

.scheme-facts {
  display: grid;
  gap: 8px;
  margin: 0;
}

.scheme-facts div {
  display: grid;
  gap: 2px;
}

.scheme-facts dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.scheme-facts dd {
  margin: 0;
  line-height: 1.45;
}

.pros-cons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.pros-cons strong {
  display: block;
  margin-bottom: 5px;
}

.pros-cons ul {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

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

.contact-grid article {
  display: grid;
  gap: 6px;
  padding: 12px;
}

.contact-grid span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

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

.calc-grid div {
  display: grid;
  gap: 5px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.calc-grid span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.calc-grid strong {
  font-size: 20px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 13px;
}

.data-table th,
.data-table td {
  padding: 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  line-height: 1.45;
}

.data-table th {
  color: var(--text);
  background: #eef4f2;
  font-weight: 900;
}

.data-table tfoot td {
  color: var(--text);
  background: #fff8e8;
  font-weight: 900;
}

.a3-sheet {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 2px solid var(--text);
  background: #fff;
  aspect-ratio: 1.414 / 1;
  min-height: 360px;
}

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

.drawing-card {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.drawing-card > strong {
  font-size: 17px;
}

.drawing-card > span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.drawing-card.a3-preview {
  background: #fff;
}

.sheet-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--text);
}

.sheet-title strong {
  font-size: 16px;
}

.sheet-title span,
.sheet-notes {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.sheet-notes p {
  margin: 0 0 4px;
  color: var(--muted);
}

.system-svg {
  width: 100%;
  max-height: 360px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
}

.svg-surface {
  fill: #f6faf8;
  stroke: #cbd8d0;
  stroke-width: 2;
}

.svg-equip rect {
  fill: #fff;
  stroke: var(--teal);
  stroke-width: 2;
}

.svg-equip text,
.pipe-label {
  fill: var(--text);
  font-size: 18px;
  font-weight: 800;
}

.svg-tank {
  fill: #f3c78e;
  stroke: #8e4f31;
  stroke-width: 3;
}

.svg-tank-top {
  fill: #ffe1ad;
  stroke: #8e4f31;
  stroke-width: 3;
}

.svg-dark {
  fill: #54351f;
  font-size: 18px;
  font-weight: 900;
}

.svg-caption {
  fill: #52615c;
  font-size: 16px;
  font-weight: 800;
}

.zone {
  fill: #ffffff;
  stroke: #cbd8d0;
  stroke-width: 2;
}

.equipment-zone {
  fill: #f0faf7;
}

.building-zone {
  fill: #f3f8ff;
}

.zone-title {
  fill: var(--text);
  font-size: 18px;
  font-weight: 900;
}

.layout-block {
  fill: #ffffff;
  stroke: var(--teal);
  stroke-width: 2;
}

.layout-block.source {
  stroke: var(--rust);
}

.layout-block.tank {
  fill: #ffe1ad;
  stroke: #8e4f31;
}

.layout-block.pump {
  stroke: var(--blue);
}

.construction-svg text {
  fill: var(--text);
  font-size: 16px;
  font-weight: 800;
}

.pipe {
  fill: none;
  stroke-width: 7;
  stroke-linecap: round;
}

.pipe.hot {
  stroke: var(--rust);
}

.pipe.return {
  stroke: var(--amber);
  stroke-dasharray: 12 9;
}

.pipe.cold {
  stroke: var(--blue);
}

.pipe.signal {
  stroke: #697987;
  stroke-width: 3;
  stroke-dasharray: 7 7;
}

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

.case-card {
  overflow: hidden;
}

.case-card img {
  display: block;
  width: 100%;
  height: 130px;
  object-fit: cover;
  background: #e7ece8;
}

.case-card div {
  display: grid;
  gap: 5px;
  padding: 10px;
}

.case-card span {
  color: var(--teal-dark);
  font-size: 12px;
  font-weight: 900;
}

.case-card p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.motion-layout {
  display: grid;
  grid-template-columns: minmax(260px, 0.82fr) 1fr;
  gap: 14px;
}

.motion-preview {
  display: grid;
  gap: 10px;
  min-height: 240px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f4f8f7;
}

.motion-preview strong {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.motion-scene {
  position: relative;
  min-height: 180px;
  overflow: hidden;
  border-radius: 8px;
  background:
    linear-gradient(#eaf4f7 0 54%, #dfe9e1 54% 100%);
}

.heatpump-unit,
.motion-tank,
.motion-building {
  position: absolute;
  border: 2px solid rgba(31, 45, 43, 0.34);
  background: #fff;
}

.heatpump-unit {
  left: 28px;
  bottom: 42px;
  width: 88px;
  height: 58px;
  border-radius: 7px;
}

.heatpump-unit span {
  display: block;
  width: 22px;
  height: 22px;
  margin: 16px auto;
  border: 3px solid var(--teal);
  border-radius: 50%;
  animation: spin 2.8s linear infinite;
}

.motion-tank {
  left: 150px;
  bottom: 38px;
  width: 54px;
  height: 110px;
  border-radius: 24px;
  background: linear-gradient(#ffe1ad, #d77b52);
}

.motion-building {
  right: 26px;
  bottom: 38px;
  width: 86px;
  height: 92px;
  border-radius: 6px 6px 0 0;
  background: repeating-linear-gradient(90deg, #fff, #fff 15px, #e6eef2 15px, #e6eef2 25px);
}

.motion-pipe {
  position: absolute;
  height: 8px;
  border-radius: 999px;
  background: var(--rust);
}

.motion-pipe.pipe-a {
  left: 112px;
  right: 116px;
  bottom: 96px;
}

.motion-pipe.pipe-b {
  left: 176px;
  right: 112px;
  bottom: 66px;
  background: var(--amber);
}

.flow-dot {
  position: absolute;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--rust);
  animation: flow 3.8s ease-in-out infinite;
}

.dot-one {
  left: 118px;
  bottom: 94px;
}

.dot-two {
  left: 205px;
  bottom: 64px;
  animation-delay: 0.8s;
}

.dot-three {
  left: 160px;
  bottom: 94px;
  animation-delay: 1.4s;
}

.script-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.script-columns article {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.script-columns h4 {
  margin: 0 0 8px;
}

.script-columns p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

.risk {
  color: #9b2f21 !important;
}

.complaint-button {
  position: fixed;
  right: 18px;
  bottom: 18px;
  min-height: 42px;
  padding: 0 15px;
  border: 1px solid rgba(182, 74, 53, 0.35);
  border-radius: 6px;
  color: #fff;
  background: var(--rust);
  font-weight: 900;
  box-shadow: 0 10px 22px rgba(182, 74, 53, 0.22);
  z-index: 7;
}

.complaint-dialog {
  width: min(520px, calc(100vw - 32px));
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.complaint-dialog::backdrop {
  background: rgba(31, 45, 43, 0.38);
}

.complaint-dialog form {
  display: grid;
  gap: 14px;
}

.dialog-heading {
  justify-content: space-between;
}

menu {
  margin: 0;
  padding: 0;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  max-width: min(520px, calc(100vw - 36px));
  padding: 10px 14px;
  border-radius: 8px;
  color: #fff;
  background: rgba(31, 45, 43, 0.92);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 10px);
  transition:
    opacity 0.2s ease,
    transform 0.2s ease;
  z-index: 9;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes flow {
  0% {
    transform: translateX(0);
    opacity: 0.25;
  }
  45% {
    opacity: 1;
  }
  100% {
    transform: translateX(180px);
    opacity: 0.25;
  }
}

@media (max-width: 1180px) {
  .workspace,
  .split-view,
  .motion-layout {
    grid-template-columns: 1fr;
  }

  .input-panel {
    max-height: none;
  }

  .side-summary {
    position: static;
  }

  .scheme-grid,
  .case-strip,
  .contact-grid,
  .drawing-set {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .topbar {
    grid-template-columns: 1fr;
    position: static;
  }

  .topbar-actions {
    justify-content: stretch;
  }

  .topbar-actions button,
  .plan-actions button {
    flex: 1;
  }

  .workspace {
    padding: 10px;
  }

  .field-grid,
  .metric-strip,
  .calc-grid,
  .script-columns,
  .pros-cons {
    grid-template-columns: 1fr;
  }

  .metric-strip {
    padding: 10px;
  }

  .tab-panel {
    padding: 0 10px;
  }

  .document-preview {
    padding: 14px;
  }

  .a3-sheet {
    aspect-ratio: auto;
  }
}

@media print {
  body {
    background: #fff;
  }

  .topbar,
  .input-panel,
  .metric-strip,
  .output-console,
  .tabs,
  .plan-actions,
  .side-summary,
  .complaint-button,
  .toast {
    display: none !important;
  }

  .workspace,
  .split-view {
    display: block;
    padding: 0;
  }

  .output-panel,
  .document-preview {
    border: 0;
    box-shadow: none;
    padding: 0;
  }

  .proposal-section,
  .scheme-card,
  .a3-sheet {
    break-inside: avoid;
  }
}
