:root {
  --ink: #17211d;
  --muted: #647069;
  --paper: #f4f1e9;
  --surface: #fffdf8;
  --line: #d9d5c9;
  --accent: #1f6a4a;
  --accent-soft: #dcecdf;
  --warm: #bb5d38;
  --shadow: 0 18px 50px rgba(31, 45, 38, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 92% 3%, rgba(187, 93, 56, 0.12), transparent 28rem),
    var(--paper);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
}

.app-shell {
  min-height: 100vh;
  padding: 40px clamp(20px, 5vw, 80px) 24px;
}

.app-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 32px;
  max-width: 1440px;
  margin: 0 auto 28px;
}

.app-header h1,
.page-heading h2,
.empty-chart h3 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 500;
  letter-spacing: -0.035em;
}

.app-header h1 {
  max-width: 780px;
  font-size: clamp(38px, 6vw, 72px);
  line-height: 0.98;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.16em;
}

.subtitle,
.page-heading p,
.empty-chart p {
  color: var(--muted);
  line-height: 1.65;
}

.subtitle {
  margin: 16px 0 0;
  font-size: 17px;
}

.source-state {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 280px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 253, 248, 0.72);
}

.source-state div {
  display: grid;
  gap: 3px;
}

.source-state small {
  overflow: hidden;
  max-width: 300px;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #3a9b66;
  box-shadow: 0 0 0 5px rgba(58, 155, 102, 0.13);
}

.status-dot-warning {
  background: var(--warm);
  box-shadow: 0 0 0 5px rgba(187, 93, 56, 0.13);
}

.main-tabs {
  max-width: 1440px;
  margin: 0 auto;
}

.main-tabs .tab {
  padding: 15px 24px !important;
  border: 0 !important;
  border-bottom: 1px solid var(--line) !important;
  background: transparent !important;
  color: var(--muted) !important;
  font-weight: 700;
}

.main-tabs .tab--selected {
  border-bottom: 3px solid var(--accent) !important;
  color: var(--ink) !important;
}

.page-content {
  max-width: 1440px;
  margin: 28px auto 0;
  padding: clamp(22px, 4vw, 46px);
  border: 1px solid rgba(217, 213, 201, 0.86);
  border-radius: 24px;
  background: rgba(255, 253, 248, 0.88);
  box-shadow: var(--shadow);
}

.page-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 0.72fr);
  gap: 48px;
  align-items: end;
}

.page-heading h2 {
  font-size: clamp(30px, 4vw, 48px);
}

.page-heading p {
  max-width: 720px;
  margin-bottom: 0;
}

.page-controls {
  display: grid;
  gap: 12px;
}

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

.housing-controls {
  grid-template-columns: 1fr 1fr;
}

.page-controls .Select-control,
.page-controls .DateRangePickerInput {
  min-height: 44px;
  border-color: var(--line);
  border-radius: 10px;
  background: var(--surface);
}

.page-controls .Select-placeholder,
.page-controls .Select-value-label,
.page-controls .DateInput_input {
  color: var(--ink) !important;
  font-size: 14px;
}

.page-controls .DateRangePickerInput {
  display: flex;
  align-items: center;
  width: 100%;
}

.page-controls .DateInput {
  width: 45%;
  background: transparent;
}

.page-controls .DateInput_input {
  padding: 9px 10px;
  background: transparent;
}

.page-controls .DateRangePickerInput_arrow {
  padding: 0 4px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin: 38px 0 22px;
}

.metric-card {
  min-height: 145px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
}

.metric-label,
.metric-detail {
  margin: 0;
  color: var(--muted);
}

.metric-label {
  font-size: 13px;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.metric-value {
  margin: 10px 0 8px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 36px;
}

.metric-detail {
  font-size: 13px;
}

.chart-grid {
  display: grid;
  gap: 18px;
}

.chart-panel,
.table-panel {
  overflow: hidden;
  margin-top: 18px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
}

.chart-panel:first-child,
.table-panel:first-child {
  margin-top: 0;
}

.chart-panel h3,
.table-panel h3 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 27px;
  font-weight: 500;
  letter-spacing: -0.025em;
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 32px;
  margin-bottom: 12px;
}

.panel-note {
  max-width: 510px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
  text-align: right;
}

.chart-panel .js-plotly-plot,
.chart-panel .plot-container {
  min-height: 420px;
}

.table-panel + .table-panel {
  margin-top: 18px;
}

.findings-panel {
  margin-top: 18px;
  padding: 16px 18px;
  border-radius: 12px;
  background: #f4f1e9;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.findings-panel p,
.findings-panel ul {
  margin: 0;
}

.findings-panel ul {
  padding-left: 20px;
}

.single-column-heading {
  grid-template-columns: 1fr;
}

.empty-chart {
  position: relative;
  overflow: hidden;
  min-height: 350px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #f8f6f0;
}

.empty-chart-grid {
  position: absolute;
  inset: 0;
  opacity: 0.42;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 100% 72px, 120px 100%;
  mask-image: linear-gradient(to bottom, transparent, black 35%, black);
}

.empty-chart-copy {
  position: relative;
  z-index: 1;
  max-width: 580px;
  margin: 110px auto;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 253, 248, 0.94);
  text-align: center;
}

.empty-chart-copy h3 {
  font-size: 30px;
}

.empty-chart-copy p:last-child {
  margin-bottom: 0;
}

.app-footer {
  display: flex;
  justify-content: space-between;
  max-width: 1440px;
  margin: 18px auto 0;
  color: var(--muted);
  font-size: 12px;
}

@media (max-width: 820px) {
  .app-shell {
    padding: 24px 14px;
  }

  .app-header,
  .page-heading {
    grid-template-columns: 1fr;
  }

  .app-header {
    display: grid;
    align-items: start;
  }

  .source-state {
    min-width: 0;
  }

  .metric-grid,
  .page-controls.two-columns,
  .housing-controls {
    grid-template-columns: 1fr;
  }

  .panel-heading {
    display: grid;
    gap: 8px;
  }

  .panel-note {
    text-align: left;
  }

  .chart-panel,
  .table-panel {
    padding: 14px;
  }

  .app-footer {
    display: grid;
    gap: 6px;
  }
}
