:root {
  --bg: #fff7ef;
  --bg-soft: #fffdf9;
  --panel: rgba(255, 255, 255, 0.92);
  --panel-strong: #ffffff;
  --panel-muted: #fff3e7;
  --ink: #17130f;
  --muted: #665d54;
  --border: rgba(23, 19, 15, 0.12);
  --accent: #f36c00;
  --accent-deep: #b84d00;
  --accent-soft: rgba(243, 108, 0, 0.1);
  --danger: #b93628;
  --shadow: 0 24px 70px rgba(77, 44, 18, 0.13);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Montserrat", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(243, 108, 0, 0.18), transparent 30%),
    radial-gradient(circle at bottom right, rgba(23, 19, 15, 0.08), transparent 28%),
    linear-gradient(180deg, #ffffff 0%, var(--bg) 100%);
  min-height: 100vh;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(243, 108, 0, 0.06) 1px, transparent 1px),
    linear-gradient(180deg, rgba(243, 108, 0, 0.05) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(circle at center, black, transparent 86%);
}

.page-shell {
  width: min(1460px, calc(100% - 32px));
  margin: 0 auto;
  padding: 16px 0 42px;
  position: relative;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) 440px;
  gap: 20px;
  align-items: end;
  margin-bottom: 16px;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 14px;
}

.brand-logo-frame {
  width: 210px;
  display: block;
  line-height: 0;
}

.brand-logo {
  width: 100%;
  height: auto;
  display: block;
}

.eyebrow {
  margin: 0 0 4px;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 0.78rem;
  color: var(--accent-deep);
  font-weight: 700;
}

.brand-subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.hero h1 {
  margin: 0;
  font-family: "Oswald", sans-serif;
  text-transform: uppercase;
  font-size: clamp(3rem, 6.2vw, 6.25rem);
  line-height: 0.9;
  letter-spacing: 0.02em;
  max-width: 18ch;
}

.lede {
  max-width: 72ch;
  font-size: 1rem;
  line-height: 1.7;
  color: var(--muted);
  margin: 14px 0 0;
}

.hero-card,
.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  border-radius: 28px;
}

.hero-card {
  padding: 20px 22px;
  background:
    linear-gradient(145deg, rgba(243, 108, 0, 0.14), rgba(255, 255, 255, 0.92)),
    var(--panel);
}

.hero-card-label {
  margin: 0 0 16px;
  color: var(--accent-deep);
  font-family: "Oswald", sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.hero-card ol {
  margin: 0;
  padding-left: 18px;
  line-height: 1.72;
  color: var(--muted);
}

.app-grid {
  display: grid;
  grid-template-columns: 340px minmax(440px, 1fr) 380px;
  gap: 20px;
}

.panel {
  padding: 24px;
}

.controls-panel,
.summary-panel {
  align-self: start;
}

h2,
h3 {
  margin: 0 0 16px;
  font-family: "Oswald", sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 1.18rem;
}

.field {
  display: block;
  margin-bottom: 14px;
}

.field span {
  display: block;
  margin-bottom: 8px;
  font-size: 0.9rem;
  color: var(--muted);
}

input {
  width: 100%;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid rgba(23, 19, 15, 0.14);
  background: var(--panel-strong);
  font: inherit;
  color: var(--ink);
}

input:focus {
  outline: 2px solid rgba(243, 108, 0, 0.22);
  border-color: rgba(243, 108, 0, 0.48);
}

.button {
  width: 100%;
  padding: 14px 16px;
  border: none;
  border-radius: 14px;
  background: #17130f;
  color: white;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: transform 180ms ease, background 180ms ease, box-shadow 180ms ease;
  margin-bottom: 10px;
}

.button:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 30px rgba(77, 44, 18, 0.18);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.62;
  transform: none;
}

.button-primary {
  background: linear-gradient(135deg, var(--accent) 0%, #ff9a3d 100%);
  color: #17130f;
}

.button-secondary {
  background: #fff0df;
  color: var(--ink);
  border: 1px solid rgba(243, 108, 0, 0.2);
}

.button-danger {
  background: rgba(185, 54, 40, 0.1);
  color: var(--danger);
}

.divider {
  height: 1px;
  background: var(--border);
  margin: 18px 0;
}

.actions {
  display: grid;
  grid-template-columns: 1fr;
}

.hint,
.status,
.material-note,
.notes-card p,
.lead-copy,
.estimate-locked p {
  color: var(--muted);
  line-height: 1.6;
}

.status {
  margin: 0;
}

.is-hidden {
  display: none;
}

.map-panel {
  min-height: 760px;
  display: flex;
  flex-direction: column;
}

.map-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  align-items: start;
}

.badge-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.badge {
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-deep);
  font-size: 0.78rem;
  font-weight: 700;
}

.map-canvas {
  flex: 1;
  width: 100%;
  aspect-ratio: 1 / 1;
  min-height: 520px;
  max-height: 760px;
  border-radius: 22px;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(243, 108, 0, 0.08), rgba(255, 255, 255, 0.5)),
    repeating-linear-gradient(
      45deg,
      rgba(23, 19, 15, 0.035) 0,
      rgba(23, 19, 15, 0.035) 10px,
      rgba(243, 108, 0, 0.035) 10px,
      rgba(243, 108, 0, 0.035) 20px
    );
  position: relative;
  border: 1px solid rgba(243, 108, 0, 0.22);
  display: grid;
  place-items: center;
  cursor: crosshair;
}

.map-canvas img {
  display: none;
  width: 100%;
  height: 100%;
  object-fit: fill;
  position: absolute;
  inset: 0;
}

.map-canvas.has-image img {
  display: block;
}

.drawing-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2;
}

.map-placeholder {
  position: relative;
  z-index: 1;
  padding: 18px 22px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.84);
  color: var(--muted);
  font-weight: 700;
  text-align: center;
}

.map-canvas.has-image .map-placeholder {
  display: none;
}

.roof-polygon {
  fill: rgba(243, 108, 0, 0.24);
  stroke: #ff7a10;
  stroke-width: 5;
  vector-effect: non-scaling-stroke;
}

.roof-polyline {
  fill: none;
  stroke: #ff7a10;
  stroke-width: 5;
  vector-effect: non-scaling-stroke;
}

.roof-point {
  fill: #ffffff;
  stroke: #f36c00;
  stroke-width: 4;
  vector-effect: non-scaling-stroke;
}

.summary-stat {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  gap: 16px;
}

.summary-stat:last-of-type {
  border-bottom: none;
}

.summary-stat strong {
  text-align: right;
}

.lead-card,
.estimate-gate,
.notes-card {
  background: var(--panel-muted);
  border: 1px solid rgba(243, 108, 0, 0.16);
  border-radius: 18px;
  padding: 18px;
}

.lead-form {
  margin-top: 14px;
}

.estimate-locked {
  text-align: center;
  padding: 10px 0;
}

.estimate-results {
  margin-top: 18px;
}

.estimate-table-header,
.estimate-row {
  display: grid;
  grid-template-columns: 1.2fr 0.9fr 0.9fr;
  gap: 12px;
  align-items: center;
}

.estimate-table-header {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.estimate-rows {
  margin-top: 14px;
}

.estimate-row {
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

.estimate-row strong {
  font-size: 1.02rem;
}

.materials-list {
  display: grid;
  gap: 14px;
}

.material-card {
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 16px;
  background: #fffaf5;
}

.material-card header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
}

.material-card h3 {
  margin: 0;
  font-size: 1rem;
}

.pill {
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.76rem;
  background: var(--accent-soft);
  color: var(--accent-deep);
  font-weight: 700;
}

@media (max-width: 1180px) {
  .app-grid {
    grid-template-columns: 1fr;
  }

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

  .hero h1 {
    max-width: none;
  }

  .map-panel {
    min-height: auto;
  }
}

@media (max-width: 720px) {
  .page-shell {
    width: min(100% - 20px, 1420px);
    padding-top: 20px;
  }

  .brand-lockup {
    align-items: start;
    flex-direction: column;
  }

  .brand-logo-frame {
    width: 180px;
  }

  .panel {
    padding: 18px;
    border-radius: 22px;
  }

  .map-canvas {
    min-height: 460px;
  }

  .map-header {
    flex-direction: column;
  }
}
