:root {
  color-scheme: dark;
  --ink: #f4f3ee;
  --muted: #aeb8b4;
  --paper: #0d1110;
  --surface: #161d1b;
  --surface-strong: #1f2926;
  --line: #2b3834;
  --teal: #36b8ad;
  --teal-dark: #7ee3dc;
  --amber: #f0b85a;
  --graphite: #242d2a;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.32);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

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

a {
  color: inherit;
}

.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px clamp(18px, 4vw, 56px);
  background: rgba(13, 17, 16, 0.84);
  border-bottom: 1px solid rgba(70, 88, 82, 0.62);
  backdrop-filter: blur(16px);
}

.brand,
.nav-links,
.hero-actions,
.tool-topline,
.filters,
.site-footer {
  display: flex;
  align-items: center;
}

.brand {
  gap: 10px;
  text-decoration: none;
  font-weight: 800;
}

.brand-mark,
.tool-icon {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  color: #ffffff;
  background: var(--graphite);
  font-weight: 800;
}

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 8px;
}

.nav-links {
  gap: clamp(14px, 3vw, 30px);
  color: var(--muted);
  font-size: 0.94rem;
}

.nav-links a {
  text-decoration: none;
}

.nav-links a:hover {
  color: var(--teal-dark);
}

.hero {
  position: relative;
  min-height: 92vh;
  display: grid;
  align-items: center;
  padding: 120px clamp(18px, 6vw, 76px) 72px;
  overflow: hidden;
  isolation: isolate;
}

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

.hero-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: -2;
}

.hero-overlay {
  z-index: -1;
  background:
    linear-gradient(90deg, rgba(13, 17, 16, 0.96) 0%, rgba(13, 17, 16, 0.76) 42%, rgba(13, 17, 16, 0.18) 74%),
    linear-gradient(180deg, rgba(13, 17, 16, 0.12) 62%, var(--paper) 100%);
}

.hero-content {
  width: min(680px, 100%);
}

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

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.05;
}

h1 {
  max-width: 10ch;
  font-size: clamp(3.2rem, 8vw, 7.8rem);
}

h2 {
  font-size: clamp(2rem, 4.8vw, 4.5rem);
}

h3 {
  font-size: 1.3rem;
}

.hero-copy {
  max-width: 620px;
  margin: 24px 0 0;
  color: #ccd5d1;
  font-size: clamp(1.05rem, 2vw, 1.3rem);
}

.hero-actions {
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 34px;
}

.button {
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  padding: 12px 18px;
  border: 1px solid transparent;
  font-weight: 800;
  text-decoration: none;
}

.button-primary {
  background: var(--teal);
  color: #061110;
}

.button-primary:hover {
  background: #7ee3dc;
}

.button-secondary {
  background: rgba(22, 29, 27, 0.78);
  border-color: var(--line);
}

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

.stats-band div {
  background: #121816;
  padding: 24px clamp(18px, 4vw, 56px);
}

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

.stats-band strong {
  font-size: clamp(1.4rem, 3vw, 2.2rem);
}

.stats-band span {
  color: var(--muted);
}

.section,
.workflow-band {
  padding: clamp(54px, 8vw, 92px) clamp(18px, 6vw, 76px);
}

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

.search {
  width: min(340px, 100%);
}

.search input {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
}

.filters {
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 26px;
}

.filter {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 14px;
  background: rgba(22, 29, 27, 0.8);
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-weight: 750;
}

.filter.is-active {
  border-color: var(--teal);
  background: rgba(54, 184, 173, 0.16);
  color: #9af0e8;
}

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

.tool-card {
  min-height: 260px;
  display: flex;
  flex-direction: column;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.tool-topline {
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 24px;
}

.tool-icon {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--graphite), var(--teal-dark));
}

.tag {
  color: var(--amber);
  font-size: 0.8rem;
  font-weight: 850;
  text-transform: uppercase;
}

.tool-card p {
  color: var(--muted);
  margin: 14px 0 24px;
}

.tool-status {
  margin-top: auto;
  color: var(--teal-dark);
  font-weight: 850;
}

.empty-state {
  margin: 26px 0 0;
  color: var(--muted);
}

.workflow-band {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(280px, 1.1fr);
  gap: clamp(26px, 5vw, 72px);
  align-items: start;
  background: #111715;
  color: var(--ink);
}

.workflow-content p:last-child {
  max-width: 610px;
  color: var(--muted);
  font-size: 1.08rem;
}

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

.workflow-steps li {
  display: flex;
  align-items: center;
  gap: 18px;
  min-height: 72px;
  padding: 18px;
  border: 1px solid rgba(126, 227, 220, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
  font-weight: 760;
}

.loan-chat-section {
  background: #121816;
}

.chat-shell {
  display: grid;
  gap: 18px;
  max-width: 1180px;
  width: 100%;
}

.chat-panel {
  min-height: clamp(520px, 68vh, 760px);
  max-height: min(78vh, 860px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: clamp(18px, 2.5vw, 28px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0d1110;
}

.chat-message {
  width: min(860px, 100%);
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.chat-message.has-dashboard {
  width: 100%;
  padding: clamp(18px, 2.4vw, 26px);
}

.chat-message.user {
  align-self: flex-end;
  background: rgba(54, 184, 173, 0.14);
  border-color: rgba(126, 227, 220, 0.38);
}

.chat-message span {
  display: block;
  margin-bottom: 6px;
  color: var(--amber);
  font-size: 0.78rem;
  font-weight: 850;
  text-transform: uppercase;
}

.chat-message p {
  margin: 0;
  color: #dce4e1;
  white-space: pre-line;
}

.chat-chart {
  margin: 14px 0 0;
  padding-top: 12px;
  border-top: 1px solid rgba(126, 227, 220, 0.16);
}

.chat-chart figcaption {
  margin-bottom: 10px;
  color: #f2bd62;
  font-size: 0.82rem;
  font-weight: 850;
  text-transform: uppercase;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: -2px 0 10px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
}

.chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.chart-legend i {
  width: 12px;
  height: 8px;
  display: inline-block;
  border-radius: 3px;
}

.export-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 10px;
}

.export-bar button {
  min-height: 28px;
  padding: 4px 9px;
  border: 1px solid rgba(126, 227, 220, 0.22);
  border-radius: 6px;
  background: rgba(13, 17, 16, 0.56);
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 800;
}

.export-bar button:hover {
  border-color: var(--teal);
  color: #9af0e8;
}

.legend-current {
  background: var(--teal);
}

.legend-comparison {
  background: #f0b85a;
  opacity: 0.72;
}

.chat-chart svg {
  width: 100%;
  height: auto;
  display: block;
  overflow: visible;
}

.chart-label,
.chart-value,
.chart-detail {
  fill: #dce4e1;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.chart-label {
  font-size: 13px;
  font-weight: 800;
  text-transform: capitalize;
}

.chart-value {
  fill: #9af0e8;
  font-size: 13px;
  font-weight: 850;
}

.chart-detail {
  fill: var(--muted);
  font-size: 11px;
}

.chart-track {
  fill: #25312d;
}

.chart-bar {
  fill: var(--teal);
}

.chart-bar-comparison {
  fill: #f0b85a;
  opacity: 0.72;
}

.chart-axis {
  stroke: #34423d;
  stroke-width: 2;
}

.chart-line {
  fill: none;
  stroke: var(--teal);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 3;
}

.chart-marker {
  fill: #9af0e8;
  stroke: #0d1110;
  stroke-width: 2;
}

.chart-label-line {
  font-size: 11px;
}

.chart-value-line {
  font-size: 11px;
}

.driver-panel {
  margin: 14px 0 0;
  padding-top: 12px;
  border-top: 1px solid rgba(126, 227, 220, 0.16);
  overflow-x: auto;
}

.driver-panel h4 {
  margin: 0 0 6px;
  color: #f2bd62;
  font-size: 0.82rem;
  text-transform: uppercase;
}

.driver-meta {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 0.84rem;
}

.driver-table {
  width: 100%;
  min-width: 620px;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.driver-table th,
.driver-table td {
  padding: 9px 8px;
  border-bottom: 1px solid rgba(126, 227, 220, 0.12);
  text-align: right;
  white-space: nowrap;
}

.driver-table th:first-child,
.driver-table td:first-child {
  text-align: left;
  text-transform: capitalize;
}

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

.driver-table td {
  color: #dce4e1;
}

.driver-table .is-positive {
  color: #9af0e8;
}

.driver-table .is-negative {
  color: #f2bd62;
}

.analysis-table-panel {
  margin: 14px 0 0;
  padding-top: 12px;
  border-top: 1px solid rgba(126, 227, 220, 0.16);
  overflow-x: auto;
}

.analysis-table-panel h4 {
  margin: 0 0 6px;
  color: #f2bd62;
  font-size: 0.82rem;
  text-transform: uppercase;
}

.analysis-summary {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 0.84rem;
}

.analysis-table {
  width: 100%;
  min-width: 620px;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.analysis-table th,
.analysis-table td {
  padding: 9px 8px;
  border-bottom: 1px solid rgba(126, 227, 220, 0.12);
  text-align: left;
  white-space: nowrap;
}

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

.analysis-table td {
  color: #dce4e1;
}

.dashboard-panel {
  margin: 16px 0 0;
  padding-top: 14px;
  border-top: 1px solid rgba(126, 227, 220, 0.18);
}

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

.dashboard-heading h4 {
  margin: 3px 0 0;
  color: #f4f3ee;
  font-size: clamp(1.4rem, 3vw, 2rem);
  line-height: 1.05;
  text-transform: none;
}

.dashboard-eyebrow {
  display: block;
  margin: 0;
  color: #f2bd62;
  font-size: 0.82rem;
  font-weight: 850;
  text-transform: uppercase;
}

.dashboard-heading p {
  margin: 2px 0 0;
  padding: 6px 9px;
  border: 1px solid rgba(126, 227, 220, 0.18);
  border-radius: 999px;
  background: rgba(13, 17, 16, 0.44);
  color: var(--muted);
  font-size: 0.78rem;
  white-space: nowrap;
}

.dashboard-summary {
  display: grid;
  grid-template-columns: minmax(220px, 0.8fr) minmax(0, 1.2fr);
  gap: 10px;
  align-items: stretch;
}

.dashboard-hero-card {
  min-height: 156px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 18px;
  border: 1px solid rgba(126, 227, 220, 0.28);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(54, 184, 173, 0.18), rgba(13, 17, 16, 0.78));
}

.dashboard-hero-card span,
.dashboard-hero-card small {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 760;
}

.dashboard-hero-card strong {
  color: #f4f3ee;
  font-size: clamp(2.4rem, 7vw, 4.2rem);
  line-height: 0.95;
}

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

.dashboard-card {
  min-height: 112px;
  padding: 12px;
  border: 1px solid rgba(126, 227, 220, 0.13);
  border-radius: 8px;
  background: rgba(13, 17, 16, 0.5);
}

.dashboard-card span,
.dashboard-card small {
  display: block;
  color: var(--muted);
  font-size: 0.74rem;
}

.dashboard-card strong {
  display: block;
  margin: 8px 0 5px;
  color: #dce4e1;
  font-size: clamp(1.05rem, 2.4vw, 1.45rem);
  line-height: 1.1;
}

.dashboard-charts {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}

.dashboard-chart-section {
  padding: 14px;
  border: 1px solid rgba(126, 227, 220, 0.13);
  border-radius: 8px;
  background: rgba(13, 17, 16, 0.36);
}

.dashboard-chart-section .chat-chart {
  margin: 0;
  padding-top: 0;
  border-top: 0;
}

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

.chat-form input {
  min-height: 56px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 16px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
}

.chat-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.workflow-steps span {
  color: #f2bd62;
  font-weight: 900;
}

.contact-section {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.contact-section p {
  max-width: 620px;
  color: var(--muted);
}

.site-footer {
  justify-content: space-between;
  gap: 16px;
  padding: 28px clamp(18px, 6vw, 76px);
  border-top: 1px solid var(--line);
  color: var(--muted);
}

.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;
}

@media (max-width: 900px) {
  .site-header,
  .section-heading,
  .contact-section {
    align-items: flex-start;
    flex-direction: column;
  }

  .nav-links {
    width: 100%;
    justify-content: space-between;
  }

  .hero {
    min-height: 88vh;
  }

  .hero-overlay {
    background:
      linear-gradient(180deg, rgba(13, 17, 16, 0.97) 0%, rgba(13, 17, 16, 0.82) 62%, rgba(13, 17, 16, 0.28) 100%),
      linear-gradient(180deg, rgba(13, 17, 16, 0.12) 65%, var(--paper) 100%);
  }

  h1 {
    max-width: 9ch;
  }

  .stats-band,
  .tool-grid,
  .workflow-band,
  .dashboard-summary,
  .chat-form {
    grid-template-columns: 1fr;
  }

  .chat-panel {
    min-height: 520px;
    max-height: none;
  }

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

@media (max-width: 560px) {
  .site-header {
    position: static;
  }

  .hero {
    min-height: 760px;
    padding-top: 56px;
  }

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

  .stats-band {
    display: block;
  }

  .chat-panel {
    min-height: 460px;
    padding: 14px;
  }

  .chat-message {
    padding: 14px;
  }

  .dashboard-heading {
    display: block;
  }

  .dashboard-heading p {
    display: inline-block;
    margin-top: 10px;
  }

  .dashboard-cards {
    grid-template-columns: 1fr;
  }

  .site-footer {
    align-items: flex-start;
    flex-direction: column;
  }
}
