:root {
  --ink: #18201b;
  --muted: #66716a;
  --line: #dce2db;
  --paper: #fbfcf8;
  --panel: #ffffff;
  --moss: #264d35;
  --moss-2: #3f6b4b;
  --copper: #b96332;
  --sky: #dbeaf2;
  --danger: #9b2c2c;
  --shadow: 0 18px 45px rgba(26, 33, 28, 0.14);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

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

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

a {
  color: inherit;
  text-decoration: none;
}

.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
  padding: 14px clamp(18px, 4vw, 56px);
  color: #fff;
  background: rgba(16, 25, 18, 0.76);
  backdrop-filter: blur(16px);
}

.brand,
.site-header nav {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand {
  font-weight: 800;
}

.brand-mark {
  position: relative;
  display: block;
  width: 38px;
  height: 38px;
  border: 2px solid rgba(255, 255, 255, 0.8);
  border-radius: 8px;
  background: var(--copper);
  overflow: hidden;
}

.brand-mark::before {
  content: "";
  position: absolute;
  left: 7px;
  right: 7px;
  top: 10px;
  height: 16px;
  background: #fff;
  clip-path: polygon(50% 0, 100% 48%, 100% 100%, 0 100%, 0 48%);
}

.brand-mark span {
  position: absolute;
  left: 14px;
  top: 21px;
  width: 10px;
  height: 7px;
  border-radius: 2px 2px 0 0;
  background: var(--moss);
}

.site-header nav a {
  padding: 10px 12px;
  border-radius: 6px;
  color: rgba(255, 255, 255, 0.86);
  font-weight: 700;
}

.site-header nav a:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 28px clamp(18px, 4vw, 56px);
  border-top: 1px solid var(--line);
  background: #fff;
}

.site-footer div,
.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.site-footer span,
.site-footer a {
  color: var(--muted);
}

.view {
  display: none;
}

.view-active {
  display: block;
}

.hero {
  position: relative;
  min-height: 86vh;
  display: flex;
  align-items: center;
  overflow: hidden;
  isolation: isolate;
}

.hero-media,
.hero-overlay {
  position: absolute;
  inset: 0;
}

.hero-media {
  z-index: -2;
  background-image: url("assets/roofing-hero.png");
  background-size: cover;
  background-position: center right;
}

.hero-overlay {
  z-index: -1;
  background:
    linear-gradient(90deg, rgba(13, 22, 15, 0.9) 0%, rgba(21, 33, 23, 0.76) 38%, rgba(21, 33, 23, 0.22) 70%, rgba(21, 33, 23, 0.05) 100%);
}

.hero-content {
  width: min(760px, calc(100% - 36px));
  margin: 88px 0 54px clamp(18px, 7vw, 96px);
  color: #fff;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--copper);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.hero h1,
.dashboard h1,
.section-intro h2 {
  margin: 0;
  line-height: 1.02;
  letter-spacing: 0;
}

.hero h1 {
  max-width: 740px;
  font-size: clamp(2.45rem, 6vw, 5.5rem);
}

.hero-copy {
  max-width: 560px;
  margin: 22px 0 0;
  color: rgba(255, 255, 255, 0.88);
  font-size: clamp(1rem, 1.7vw, 1.25rem);
  line-height: 1.55;
}

.hero-actions,
.quiz-actions,
.dashboard-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.hero-actions {
  margin-top: 30px;
}

.button {
  border: 0;
  border-radius: 8px;
  min-height: 48px;
  padding: 0 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-weight: 850;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button-primary {
  color: #fff;
  background: var(--copper);
  box-shadow: 0 12px 24px rgba(185, 99, 50, 0.28);
}

.button-secondary {
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
}

.trust-band {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--line);
}

.trust-band div {
  padding: 24px clamp(18px, 4vw, 52px);
  background: #fff;
}

.trust-band strong,
.trust-band span {
  display: block;
}

.trust-band span {
  margin-top: 4px;
  color: var(--muted);
}

.quiz-section,
.dashboard,
.content-section,
.legal-page {
  width: min(1180px, calc(100% - 36px));
  margin: 0 auto;
}

.quiz-section,
.content-section {
  padding: 74px 0 96px;
}

.section-intro {
  margin-bottom: 24px;
}

.section-intro h2,
.dashboard h1,
.legal-page h1 {
  font-size: clamp(2rem, 4vw, 3.5rem);
}

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

.info-grid article {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.info-grid strong {
  display: block;
  font-size: 1.1rem;
}

.info-grid p,
.service-note,
.legal-note {
  color: var(--muted);
  line-height: 1.55;
}

.service-note {
  max-width: 900px;
  margin: 22px 0 0;
}

.quiz {
  padding: clamp(20px, 4vw, 36px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.progress-shell {
  height: 8px;
  margin-bottom: 28px;
  overflow: hidden;
  border-radius: 99px;
  background: #e9eee8;
}

.progress-bar {
  width: 25%;
  height: 100%;
  border-radius: inherit;
  background: var(--moss-2);
  transition: width 220ms ease;
}

.quiz-step {
  display: none;
  min-height: 230px;
  margin: 0;
  padding: 0;
  border: 0;
}

.quiz-step.active {
  display: block;
}

.quiz-step legend {
  margin-bottom: 22px;
  font-size: clamp(1.4rem, 3vw, 2.1rem);
  font-weight: 900;
}

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

.option-grid.two {
  grid-template-columns: repeat(2, minmax(0, 240px));
}

.option-grid label {
  display: block;
}

.option-grid input {
  position: absolute;
  opacity: 0;
}

.option-grid span {
  display: flex;
  align-items: center;
  min-height: 104px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8faf5;
  cursor: pointer;
  font-weight: 850;
}

.option-grid input:checked + span {
  border-color: var(--moss);
  background: var(--sky);
  box-shadow: inset 0 0 0 2px var(--moss);
}

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

.form-grid label,
.toolbar label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-weight: 800;
}

.form-grid input,
.toolbar input,
.toolbar select,
.lead-table select,
.lead-table textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}

.form-grid input,
.toolbar input,
.toolbar select,
.lead-table select {
  min-height: 48px;
  padding: 0 12px;
}

.consent {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-top: 18px;
  color: var(--muted);
  font-size: 0.93rem;
  line-height: 1.45;
}

.legal-note {
  margin: 14px 0 0;
  font-size: 0.92rem;
}

.legal-note a,
.legal-note button,
.dialog-body a,
.legal-page a {
  color: var(--moss);
  font-weight: 850;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.legal-note button {
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.consent input {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  flex: 0 0 auto;
}

.form-message {
  min-height: 28px;
  margin-top: 12px;
  color: var(--moss);
  font-weight: 800;
}

.form-message.error {
  color: var(--danger);
}

.quiz-actions {
  justify-content: flex-end;
  margin-top: 22px;
}

#submitLead {
  display: none;
}

.dashboard {
  padding: 118px 0 72px;
}

.agency-dashboard {
  width: min(1380px, calc(100% - 36px));
}

.dashboard-header,
.toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
}

.dashboard-copy {
  max-width: 760px;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.55;
}

.dashboard-access {
  display: none;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-top: 22px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.dashboard-access h2 {
  margin: 0;
  font-size: clamp(1.4rem, 2vw, 2rem);
}

.dashboard-access p {
  max-width: 620px;
  color: var(--muted);
  line-height: 1.55;
}

.dashboard-access form {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 12px;
}

.dashboard-access label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-weight: 800;
}

.dashboard-access input {
  width: min(360px, 76vw);
  min-height: 48px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.dashboard-locked .dashboard-access {
  display: flex;
}

.dashboard-locked .command-metrics,
.dashboard-locked .dashboard-band,
.dashboard-locked .dashboard-layout {
  display: none;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin: 28px 0 18px;
}

.command-metrics {
  grid-template-columns: repeat(8, minmax(0, 1fr));
}

.metrics article {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.metrics span {
  display: block;
  font-size: 2rem;
  font-weight: 950;
}

.metrics strong {
  color: var(--muted);
}

.toolbar {
  align-items: end;
  justify-content: start;
  margin-bottom: 18px;
}

.toolbar label {
  min-width: min(320px, 100%);
}

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

.dashboard-band {
  margin-top: 18px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
}

.dashboard-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.34fr);
  gap: 18px;
  align-items: start;
}

.dashboard-layout .dashboard-band:first-child {
  margin-top: 0;
}

.dashboard-side {
  display: grid;
  gap: 18px;
}

.side-panel {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.section-heading h2,
.agent-card h3,
.opportunity-card h3,
.site-card h3 {
  margin: 0;
  letter-spacing: 0;
}

.section-heading h2 {
  font-size: clamp(1.25rem, 2vw, 1.8rem);
}

.section-heading > span,
.approval-item p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.section-heading.compact {
  align-items: start;
}

.agent-grid,
.opportunity-grid,
.site-grid {
  display: grid;
  gap: 14px;
}

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

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

.agent-card,
.opportunity-card,
.site-card {
  min-height: 100%;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.agent-card p,
.site-card p,
.opportunity-card p {
  color: var(--muted);
  line-height: 1.5;
}

.site-card a {
  color: var(--moss);
  font-weight: 850;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.card-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.status-pill,
.risk-pill,
.score-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 99px;
  color: var(--moss);
  background: #eef5ed;
  font-size: 0.8rem;
  font-weight: 900;
  white-space: nowrap;
}

.risk-pill {
  color: #6f3d1f;
  background: #f7eadf;
}

.score-pill.high {
  color: var(--moss);
  background: #e4f3e7;
}

.score-pill.medium {
  color: #7a4a1d;
  background: #f8ecda;
}

.score-pill.low {
  color: var(--danger);
  background: #f7e4e4;
}

.agent-card dl,
.opportunity-card dl {
  display: grid;
  gap: 10px;
  margin: 16px 0 0;
}

.agent-card dl div,
.opportunity-card dl div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

dt {
  color: var(--muted);
  font-weight: 800;
}

dd {
  margin: 0;
  text-align: right;
  font-weight: 900;
}

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

.ops-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}

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

.ops-table th {
  color: var(--muted);
  font-size: 0.8rem;
  text-transform: uppercase;
}

.score-ring {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  margin-bottom: 14px;
  border: 6px solid #dcebdd;
  border-right-color: var(--copper);
  border-radius: 50%;
  color: var(--moss);
  font-weight: 950;
}

.approval-list {
  display: grid;
  gap: 12px;
}

.approval-item {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fafbf7;
}

.approval-item strong {
  display: block;
  margin: 4px 0;
}

.approval-item.approved {
  background: #f0f7ee;
}

.approval-item.held {
  background: #fbf0e7;
}

.approval-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.approval-actions button {
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  font-weight: 900;
}

.check-list {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.check-list li {
  position: relative;
  padding-left: 28px;
  color: var(--muted);
  line-height: 1.45;
}

.check-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #e4f3e7;
  box-shadow: inset 0 0 0 5px var(--moss-2);
}

.check-list li.needs-review::before {
  background: #f8ecda;
  box-shadow: inset 0 0 0 5px var(--copper);
}

.lead-table {
  width: 100%;
  min-width: 1040px;
  border-collapse: collapse;
}

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

.lead-table th {
  color: var(--muted);
  font-size: 0.8rem;
  text-transform: uppercase;
}

.lead-title {
  display: block;
  font-weight: 900;
}

.lead-meta {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.lead-table textarea {
  min-height: 72px;
  padding: 10px;
  resize: vertical;
}

.delete-lead {
  color: var(--danger);
  background: transparent;
  border: 0;
  cursor: pointer;
  font-weight: 900;
}

.empty-state {
  display: none;
  padding: 28px;
  color: var(--muted);
  text-align: center;
}

.empty-state.show {
  display: block;
}

.policy-dialog {
  width: min(760px, calc(100% - 28px));
  max-height: min(760px, calc(100vh - 42px));
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.policy-dialog::backdrop {
  background: rgba(15, 22, 17, 0.58);
}

.dialog-header {
  position: sticky;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.dialog-header h2 {
  margin: 0;
}

.dialog-header button {
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  font-weight: 850;
}

.dialog-body {
  padding: 18px 22px 24px;
  color: var(--muted);
  line-height: 1.6;
}

.legal-main {
  padding-top: 96px;
}

.legal-page {
  padding: 48px 0 80px;
}

.legal-page article {
  max-width: 900px;
}

.legal-page h1 {
  margin: 0 0 12px;
}

.legal-page h2 {
  margin-top: 32px;
}

.legal-page p,
.legal-page li {
  color: var(--muted);
  line-height: 1.65;
}

.legal-page ul {
  padding-left: 22px;
}

@media (max-width: 840px) {
  .site-header {
    min-height: 66px;
    padding-inline: 16px;
  }

  .brand span:last-child {
    display: none;
  }

  .hero {
    min-height: 82vh;
  }

  .hero-content {
    margin: 84px 18px 44px;
  }

  .hero-overlay {
    background: linear-gradient(90deg, rgba(13, 22, 15, 0.94), rgba(13, 22, 15, 0.62));
  }

  .trust-band,
  .option-grid,
  .form-grid,
  .metrics,
  .info-grid,
  .command-metrics,
  .agent-grid,
  .opportunity-grid,
  .site-grid,
  .dashboard-layout {
    grid-template-columns: 1fr;
  }

  .option-grid.two {
    grid-template-columns: 1fr;
  }

  .dashboard-header,
  .toolbar,
  .dashboard-access {
    display: grid;
    align-items: stretch;
  }

  .dashboard-actions {
    justify-content: start;
  }

  .section-heading {
    display: grid;
    align-items: start;
  }

  .site-footer {
    display: grid;
  }
}
