:root {
  color-scheme: light;
  --ink: #18221f;
  --muted: #65716c;
  --line: #d7ded8;
  --paper: #f3f6f1;
  --field: #ffffff;
  --accent: #107a57;
  --accent-dark: #095f43;
  --sun: #d39b2a;
  --warn: #9b4d14;
  --shadow: 0 18px 45px rgba(30, 45, 35, .08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  background: var(--paper);
}

button,
input,
select {
  font: inherit;
}

input[readonly] {
  color: #5f6b65;
  background: #e8ece9;
  cursor: default;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 28px;
  background: rgba(255, 255, 255, .94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  font-family: Consolas, "Cascadia Mono", monospace;
  font-size: 12px;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(22px, 3vw, 34px);
  line-height: 1.15;
}

.topbar h1 {
  color: #107a57;
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", sans-serif;
  font-size: 24px;
  font-weight: 700;
  line-height: 1.2;
}

.topbar-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

button {
  border: 0;
  border-radius: 6px;
  padding: 10px 15px;
  color: #fff;
  background: var(--accent);
  cursor: pointer;
  transition: transform .15s ease, background .15s ease;
}

button:hover {
  background: var(--accent-dark);
  transform: translateY(-1px);
}

button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid rgba(211, 155, 42, .35);
  outline-offset: 2px;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(320px, 430px) minmax(0, 1fr);
  gap: 22px;
  padding: 22px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(251, 252, 248, .94);
  box-shadow: var(--shadow);
}

.editor {
  align-self: start;
  max-height: calc(100vh - 112px);
  overflow: auto;
  padding: 16px;
}

.editor section {
  padding: 14px 0 18px;
  border-bottom: 1px solid var(--line);
}

.editor section:first-child {
  padding-top: 0;
}

.editor section:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 12px;
}

.section-title span {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  width: 32px;
  height: 24px;
  border-radius: 0;
  color: #17211e;
  background: transparent;
  font: 700 16px/24px "Microsoft YaHei", "PingFang SC", sans-serif;
}

.section-title h2 {
  margin: 0;
  color: #17211e;
  font-size: 16px;
  line-height: 24px;
}

label {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 13px;
}

input,
select {
  width: 100%;
  border: 1px solid #cbd5ce;
  border-radius: 6px;
  padding: 9px 10px;
  color: var(--ink);
  background: var(--field);
}

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

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

.roof-heading {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
}

.roof-primary-row label {
  margin-bottom: 8px;
}

.roof-config {
  margin: 4px 0 12px;
  padding: 10px;
  border: 1px solid #dbe3dd;
  border-radius: 6px;
  background: #f8faf5;
}

.roof-config strong {
  display: block;
  margin-bottom: 8px;
  font-size: 13px;
}

.roof-config label {
  margin: 0;
  font-size: 12px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.status {
  min-height: 20px;
  margin: -4px 0 12px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.status.error {
  color: var(--warn);
}

.conditional-field[hidden] {
  display: none;
}

.solar-screenshot {
  position: relative;
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  min-height: 265px;
  margin: 16px 0 8px;
  border: 1px solid #b8c5bd;
  overflow: hidden;
  background: #f7f2df;
}

.solar-data-screenshot {
  display: block;
  width: 100%;
  height: auto;
  margin: 16px auto 8px;
  border: 1px solid #b8c5bd;
  background: #fff;
}

.solar-shot-map {
  position: relative;
  min-height: 265px;
  background:
    radial-gradient(circle at 42% 46%, rgba(255,255,255,.18) 0 4px, transparent 5px),
    linear-gradient(35deg, rgba(182, 128, 45, .24), transparent 35%),
    linear-gradient(130deg, rgba(42, 124, 94, .28), transparent 45%),
    repeating-linear-gradient(12deg, rgba(117, 88, 46, .12) 0 3px, transparent 3px 16px),
    #dcc889;
}

.solar-shot-map::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(255,255,255,.18) 1px, transparent 1px),
    linear-gradient(0deg, rgba(255,255,255,.18) 1px, transparent 1px);
  background-size: 36px 36px;
}

.solar-shot-pin {
  position: absolute;
  left: 48%;
  top: 46%;
  width: 18px;
  height: 18px;
  border: 3px solid #fff;
  border-radius: 50%;
  background: #d83b2a;
  box-shadow: 0 0 0 5px rgba(216, 59, 42, .2);
}

.solar-shot-label {
  position: absolute;
  left: calc(48% + 18px);
  top: calc(46% - 4px);
  padding: 4px 7px;
  color: #fff;
  border-radius: 4px;
  background: rgba(24, 34, 31, .74);
  font-size: 12px;
}

.solar-shot-panel {
  padding: 16px;
  background: #fff;
}

.solar-shot-title {
  margin-bottom: 12px;
  color: var(--accent-dark);
  font-weight: 700;
}

.solar-shot-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid #e5ece7;
}

.solar-shot-row span {
  color: var(--muted);
}

.solar-shot-row b {
  text-align: right;
}

.preview-shell {
  min-width: 0;
  overflow: hidden;
}

.preview-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: #ffffff;
}

.preview-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.preview-actions button {
  padding: 7px 11px;
  font-size: 12px;
}

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

.report {
  max-width: 920px;
  min-height: calc(100vh - 170px);
  margin: 0 auto;
  padding: 52px 60px 70px;
  background: var(--paper);
  line-height: 1.75;
}

.report > * {
  content-visibility: auto;
  contain-intrinsic-size: auto 120px;
}

.report.is-full-preview > * {
  content-visibility: visible;
  contain-intrinsic-size: none;
}

.report.is-preparing {
  min-height: 520px;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 14px;
}

.report h2 {
  margin: 34px 0 12px;
  padding-bottom: 7px;
  border-bottom: 2px solid rgba(29, 122, 100, .2);
  color: var(--accent-dark);
  font-size: 24px;
}

.report h3 {
  margin: 24px 0 8px;
  color: #22362f;
  font-size: 18px;
}

.report p {
  margin-bottom: 12px;
  text-align: justify;
}

.report table {
  width: 100%;
  margin: 14px 0 20px;
  border-collapse: collapse;
  font-size: 13px;
  line-height: 1.45;
}

.report th,
.report td {
  border: 1px solid #b8c5bd;
  padding: 7px 8px;
  text-align: center;
}

.report th {
  color: #fff;
  background: var(--accent);
}

.report .doc-image {
  display: block;
  max-width: 100%;
  max-height: 620px;
  object-fit: contain;
  margin: 16px auto 8px;
}

.report .caption {
  color: var(--muted);
  text-align: center;
  font-size: 13px;
}

.summary-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin: 18px 0 24px;
}

.metric {
  padding: 12px;
  border-left: 4px solid var(--sun);
  background: #eef4ec;
}

.metric strong {
  display: block;
  font-size: 20px;
}

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

@media (max-width: 980px) {
  .topbar,
  .workspace {
    padding-left: 14px;
    padding-right: 14px;
  }

  .workspace {
    grid-template-columns: 1fr;
  }

  .editor {
    max-height: none;
  }

  .report {
    padding: 34px 22px 46px;
  }

  .summary-strip {
    grid-template-columns: repeat(2, 1fr);
  }

  .solar-screenshot {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar-actions,
  .topbar-actions button {
    width: 100%;
  }

  .grid.two,
  .summary-strip {
    grid-template-columns: 1fr;
  }
}
