:root {
  --ink: #17211b;
  --muted: #5b675f;
  --surface: #f7f6f1;
  --panel: #ffffff;
  --line: #d9ded7;
  --field: #edf1ec;
  --green: #2f6f52;
  --green-strong: #174d36;
  --amber: #c7772d;
  --blue: #2d6f9f;
  --red: #a4443d;
  --roof: #8f4f2d;
  --shadow: 0 16px 32px rgba(23, 33, 27, 0.1);
}

* { box-sizing: border-box; }

html { color-scheme: light; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--surface);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.45;
}

a { color: inherit; }

button, input, select {
  font: inherit;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  min-height: 4rem;
  padding: 0.75rem clamp(1rem, 3vw, 2rem);
  border-bottom: 1px solid rgba(23, 33, 27, 0.1);
  background: rgba(247, 246, 241, 0.94);
  backdrop-filter: blur(12px);
}

.brand {
  display: flex;
  gap: 0.7rem;
  align-items: center;
  min-width: max-content;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 8px;
  background: var(--green-strong);
  color: #fff;
  font-weight: 900;
}

.brand strong,
.brand span {
  display: block;
}

.brand span {
  color: var(--muted);
  font-size: 0.78rem;
}

.nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  justify-content: flex-end;
}

.nav-links a {
  border-radius: 8px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 750;
  padding: 0.48rem 0.65rem;
  text-decoration: none;
}

.nav-links a:hover {
  background: #fff;
  color: var(--ink);
}

.shell {
  width: min(1220px, calc(100% - 2rem));
  margin: 0 auto;
}

.workspace {
  display: grid;
  gap: 1rem;
  padding: 1rem 0 2rem;
}

.command-bar {
  display: grid;
  grid-template-columns: minmax(15rem, 1fr) minmax(17rem, 0.75fr) auto auto;
  gap: 0.75rem;
  align-items: end;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 0.8rem;
  box-shadow: var(--shadow);
}

.field {
  display: grid;
  gap: 0.32rem;
}

.field span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.field input,
.field select {
  width: 100%;
  min-width: 0;
  min-height: 2.7rem;
  border: 1px solid rgba(23, 33, 27, 0.14);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 0.55rem 0.7rem;
}

.button {
  display: inline-flex;
  gap: 0.45rem;
  align-items: center;
  justify-content: center;
  min-height: 2.7rem;
  border: 1px solid rgba(23, 77, 54, 0.22);
  border-radius: 8px;
  background: var(--green-strong);
  color: #fff;
  cursor: pointer;
  font-weight: 850;
  padding: 0.56rem 0.9rem;
  text-decoration: none;
  white-space: nowrap;
}

.button.secondary {
  background: #fff;
  color: var(--green-strong);
}

.status-line {
  min-height: 2.7rem;
  border: 1px solid rgba(23, 33, 27, 0.12);
  border-radius: 8px;
  background: var(--field);
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 750;
  padding: 0.65rem 0.75rem;
}

.status-line--ready {
  border-color: rgba(47, 111, 82, 0.24);
  background: rgba(47, 111, 82, 0.1);
  color: var(--green-strong);
}

.status-line--warning {
  border-color: rgba(199, 119, 45, 0.28);
  background: rgba(199, 119, 45, 0.12);
  color: #70400e;
}

.status-line--error {
  border-color: rgba(164, 68, 61, 0.25);
  background: rgba(164, 68, 61, 0.1);
  color: var(--red);
}

.tool-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(21rem, 0.42fr);
  gap: 1rem;
  min-height: 42rem;
}

.panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.map-panel {
  overflow: hidden;
  display: grid;
  grid-template-rows: auto minmax(24rem, 1fr) auto;
}

.panel-heading {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  align-items: start;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  padding: 1rem;
}

.panel-heading h1,
.panel-heading h2,
.panel-heading h3 {
  margin: 0;
  font-size: clamp(1.25rem, 2vw, 1.72rem);
  line-height: 1.08;
}

.panel-heading p {
  max-width: 72ch;
  margin: 0.35rem 0 0;
  color: var(--muted);
}

.eyebrow {
  color: var(--amber);
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.pill {
  border: 1px solid rgba(47, 111, 82, 0.18);
  border-radius: 999px;
  background: rgba(47, 111, 82, 0.09);
  color: var(--green-strong);
  font-size: 0.76rem;
  font-weight: 850;
  padding: 0.28rem 0.5rem;
}

.aerial-canvas {
  position: relative;
  min-height: 31rem;
  overflow: hidden;
  background:
    linear-gradient(95deg, rgba(255,255,255,0.18) 0 9%, transparent 9% 100%),
    radial-gradient(circle at 20% 30%, rgba(63, 107, 70, 0.28), transparent 16%),
    radial-gradient(circle at 76% 66%, rgba(63, 107, 70, 0.26), transparent 18%),
    linear-gradient(32deg, transparent 0 42%, rgba(200, 198, 177, 0.9) 42% 48%, transparent 48% 100%),
    linear-gradient(132deg, transparent 0 51%, rgba(208, 205, 188, 0.95) 51% 56%, transparent 56% 100%),
    repeating-linear-gradient(0deg, rgba(39, 86, 48, 0.16) 0 2px, transparent 2px 52px),
    repeating-linear-gradient(90deg, rgba(55, 70, 58, 0.12) 0 1px, transparent 1px 48px),
    #8f9b76;
}

.aerial-canvas::before {
  content: "";
  position: absolute;
  inset: 8% 10% 12% 7%;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(245, 242, 225, 0.5), rgba(219, 219, 191, 0.24)),
    repeating-linear-gradient(90deg, rgba(255,255,255,0.18) 0 2px, transparent 2px 32px);
  transform: rotate(-9deg);
  opacity: 0.8;
}

.roof-overlay {
  position: absolute;
  inset: 6% 6% 8%;
  width: 88%;
  height: 86%;
}

.roof-plane {
  fill: rgba(143, 79, 45, 0.76);
  stroke: rgba(255, 255, 255, 0.92);
  stroke-width: 3;
}

.roof-plane.secondary {
  fill: rgba(118, 69, 45, 0.72);
}

.measure-line {
  fill: none;
  stroke: #ffe08a;
  stroke-dasharray: 8 7;
  stroke-width: 3;
}

.scale-box {
  position: absolute;
  left: 1rem;
  bottom: 1rem;
  display: grid;
  gap: 0.2rem;
  min-width: 9rem;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  padding: 0.6rem;
}

.scale-line {
  width: 6.4rem;
  border-top: 4px solid var(--ink);
}

.canvas-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  border-top: 1px solid var(--line);
  padding: 0.75rem 1rem;
}

.tool-chip {
  border: 1px solid rgba(23, 33, 27, 0.12);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  padding: 0.33rem 0.55rem;
}

.results-panel {
  display: grid;
  align-content: start;
  overflow: hidden;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.6rem;
  padding: 1rem;
}

.metric {
  min-width: 0;
  border: 1px solid rgba(23, 33, 27, 0.1);
  border-radius: 8px;
  background: #fbfcf8;
  padding: 0.7rem;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 850;
  text-transform: uppercase;
}

.metric strong {
  display: block;
  margin-top: 0.2rem;
  color: var(--ink);
  font-size: clamp(1.2rem, 2vw, 1.75rem);
  line-height: 1.05;
}

.estimate-total {
  grid-column: 1 / -1;
  background: rgba(47, 111, 82, 0.08);
}

.side-section {
  display: grid;
  gap: 0.5rem;
  border-top: 1px solid var(--line);
  padding: 1rem;
}

.side-section h3 {
  margin: 0;
  font-size: 1rem;
}

.side-section p {
  margin: 0;
  color: var(--muted);
}

.report-code {
  max-height: 16rem;
  overflow: auto;
  border-radius: 8px;
  background: #111713;
  color: #e9f4eb;
  font-size: 0.8rem;
  padding: 0.85rem;
}

.section {
  padding: clamp(1.5rem, 4vw, 3rem) 0;
}

.section-header {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: end;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.section-header h2 {
  max-width: 17ch;
  margin: 0.2rem 0 0;
  font-size: clamp(2rem, 5vw, 3.6rem);
  line-height: 1;
}

.section-header p {
  max-width: 68ch;
  margin: 0;
  color: var(--muted);
}

.feature-grid,
.architecture-grid {
  display: grid;
  gap: 1rem;
}

.feature-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.feature-card {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 1rem;
  box-shadow: var(--shadow);
}

.feature-card span {
  color: var(--amber);
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
}

.feature-card strong {
  display: block;
  margin-top: 0.35rem;
  font-size: 1.1rem;
}

.feature-card p {
  margin: 0.45rem 0 0;
  color: var(--muted);
}

.architecture-grid {
  grid-template-columns: minmax(0, 1fr) minmax(20rem, 0.44fr);
}

.arch-stage {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.arch-stage svg {
  display: block;
  width: 100%;
  min-height: 22rem;
}

.arch-edge {
  stroke: rgba(23, 33, 27, 0.22);
  stroke-width: 3;
}

.arch-node circle {
  fill: #fff;
  stroke: var(--green);
  stroke-width: 4;
  filter: drop-shadow(0 8px 12px rgba(23, 33, 27, 0.15));
}

.arch-node--asset circle { stroke: var(--blue); }
.arch-node--review circle { stroke: var(--amber); }
.arch-node--engine circle { stroke: var(--roof); }
.arch-node--output circle { stroke: var(--green-strong); }

.arch-node text {
  fill: var(--ink);
  font-size: 0.85rem;
  font-weight: 850;
}

.option-list {
  display: grid;
  gap: 0.65rem;
}

.option-row {
  display: grid;
  gap: 0.45rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 0.75rem;
}

.option-row div:first-child {
  display: flex;
  gap: 0.6rem;
  align-items: baseline;
  justify-content: space-between;
}

.option-row strong,
.option-row span {
  display: block;
}

.option-row span {
  color: var(--amber);
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
}

.option-row p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.fit-track {
  overflow: hidden;
  min-height: 0.72rem;
  border-radius: 999px;
  background: rgba(23, 33, 27, 0.08);
}

.fit-track span {
  display: block;
  min-height: 0.72rem;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green), var(--amber));
}

.table-card {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  border-bottom: 1px solid rgba(23, 33, 27, 0.1);
  padding: 0.68rem 0.75rem;
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 0.73rem;
  font-weight: 900;
  text-transform: uppercase;
}

.status-pill {
  display: inline-flex;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 850;
  padding: 0.25rem 0.48rem;
}

.status-pill--pending {
  background: rgba(199, 119, 45, 0.14);
  color: #70400e;
}

.check-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.75fr) minmax(20rem, 0.45fr);
  gap: 1rem;
}

.check-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 1rem;
  box-shadow: var(--shadow);
}

.check-card h3 {
  margin: 0 0 0.6rem;
}

.check-card ul {
  display: grid;
  gap: 0.45rem;
  margin: 0;
  padding-left: 1.2rem;
  color: var(--muted);
}

.deploy-code {
  overflow: auto;
  border-radius: 8px;
  background: #111713;
  color: #e9f4eb;
  padding: 1rem;
}

.app-footer {
  border-top: 1px solid var(--line);
  color: var(--muted);
  padding: 1.2rem 0 2rem;
}

@media (max-width: 1000px) {
  .command-bar,
  .tool-grid,
  .architecture-grid,
  .check-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 780px) {
  .app-header {
    position: static;
    align-items: flex-start;
    flex-direction: column;
  }

  .nav-links {
    justify-content: flex-start;
  }

  .feature-grid,
  .metric-grid {
    grid-template-columns: 1fr;
  }

  .estimate-total {
    grid-column: auto;
  }
}

@media (max-width: 520px) {
  .shell {
    width: min(100% - 1rem, 1220px);
  }

  .canvas-tools {
    display: grid;
  }
}
