:root {
  color-scheme: light;
  --bg: #f5f2ec;
  --surface: #ffffff;
  --surface-strong: #f9faf7;
  --ink: #1e2521;
  --muted: #667168;
  --line: #dfe5dc;
  --accent: #0f766e;
  --accent-strong: #0b5f59;
  --accent-soft: #d9f0ec;
  --danger: #b42318;
  --danger-soft: #ffe4df;
  --shadow: 0 18px 45px rgba(43, 54, 48, 0.08);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(15, 118, 110, 0.16), rgba(255, 255, 255, 0) 42%),
    var(--bg);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 32px;
  padding: 36px clamp(18px, 4vw, 54px) 24px;
}

.app-header h1,
.section-heading h2,
.panel-heading h2 {
  margin: 0;
  letter-spacing: 0;
}

.app-header h1 {
  max-width: 900px;
  font-size: clamp(32px, 4vw, 58px);
  line-height: 1;
}

.lead {
  max-width: 820px;
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.55;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.header-actions,
.section-heading,
.panel-heading,
.property-header,
.units-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.header-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
  min-width: 320px;
}

.button,
.icon-button {
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--surface);
  box-shadow: none;
}

.button {
  min-height: 42px;
  padding: 0 16px;
  font-weight: 750;
}

.button.primary {
  border-color: var(--accent);
  color: #ffffff;
  background: var(--accent);
}

.button:hover,
.icon-button:hover,
.scenario-item:hover {
  border-color: var(--accent);
}

.button.danger,
.icon-button.danger {
  border-color: var(--danger-soft);
  color: var(--danger);
}

.button.small {
  min-height: 34px;
  padding: 0 12px;
  font-size: 13px;
}

.button.full {
  width: 100%;
}

.icon-button {
  display: inline-grid;
  width: 38px;
  height: 38px;
  place-items: center;
  flex: 0 0 auto;
  font-size: 22px;
  font-weight: 700;
}

.app-shell {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 22px;
  padding: 0 clamp(18px, 4vw, 54px) 42px;
}

.scenario-panel,
.editor-band,
.metric-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
}

.scenario-panel {
  position: sticky;
  top: 18px;
  align-self: start;
  padding: 18px;
}

.scenario-list {
  display: grid;
  gap: 10px;
  margin: 18px 0;
}

.scenario-item {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  text-align: left;
  background: var(--surface);
}

.scenario-item.active {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.scenario-item strong,
.scenario-item span {
  display: block;
}

.scenario-item span {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
}

.template-box {
  display: grid;
  gap: 10px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.workspace {
  display: grid;
  gap: 22px;
  min-width: 0;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(130px, 1fr));
  gap: 12px;
}

.metric-card {
  min-height: 112px;
  padding: 16px;
}

.metric-card span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.metric-card strong {
  display: block;
  margin-top: 12px;
  font-size: clamp(22px, 2.1vw, 32px);
  line-height: 1.1;
}

.editor-band {
  padding: 20px;
}

.section-heading {
  margin-bottom: 18px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 14px;
}

.field {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.field.compact {
  min-width: min(360px, 100%);
}

.field input,
.field select,
.template-box select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 11px;
  color: var(--ink);
  background: var(--surface-strong);
}

.field input:focus,
.field select:focus,
.template-box select:focus {
  outline: 3px solid rgba(15, 118, 110, 0.18);
  border-color: var(--accent);
}

.properties {
  display: grid;
  gap: 16px;
}

.property-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: var(--surface-strong);
}

.property-header {
  margin-bottom: 16px;
}

.title-field {
  flex: 1;
}

.units-header {
  margin: 18px 0 10px;
}

.units-header h3 {
  margin: 0;
  font-size: 16px;
}

.units {
  display: grid;
  gap: 10px;
}

.unit-row {
  display: grid;
  grid-template-columns: 1.2fr 0.9fr 0.9fr repeat(3, 1fr) 38px;
  gap: 10px;
  align-items: end;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #ffffff;
}

.analysis-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
  gap: 22px;
}

.breakdown {
  display: grid;
  gap: 10px;
}

.breakdown-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid var(--line);
  padding: 10px 0;
}

.breakdown-row span:first-child {
  color: var(--muted);
}

.breakdown-row strong {
  text-align: right;
}

.table-wrap {
  overflow-x: auto;
}

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

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 12px 8px;
  text-align: right;
  white-space: nowrap;
}

th:first-child,
td:first-child {
  text-align: left;
}

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.deploy-notes {
  color: var(--muted);
  line-height: 1.55;
}

.deploy-notes p {
  margin: 0 0 12px;
}

.deploy-notes ul {
  margin: 0;
  padding-left: 20px;
}

.empty {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 18px;
  color: var(--muted);
  background: var(--surface-strong);
}

@media (max-width: 1220px) {
  .summary-grid {
    grid-template-columns: repeat(3, minmax(150px, 1fr));
  }

  .form-grid {
    grid-template-columns: repeat(2, minmax(150px, 1fr));
  }

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

@media (max-width: 860px) {
  .app-header {
    display: grid;
    align-items: start;
  }

  .header-actions {
    justify-content: flex-start;
    min-width: 0;
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .scenario-panel {
    position: static;
  }

  .unit-row {
    grid-template-columns: 1fr;
  }

  .unit-row .icon-button {
    justify-self: start;
  }
}

@media (max-width: 620px) {
  .app-header {
    padding-top: 24px;
  }

  .app-header h1 {
    font-size: 32px;
  }

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

  .section-heading {
    align-items: flex-start;
    flex-direction: column;
  }
}
