:root {
  --paper: #f7f0e4;
  --paper-deep: #ecd9b2;
  --ink: #1b1916;
  --muted: #6e6556;
  --accent: #b5542d;
  --accent-soft: rgba(181, 84, 45, 0.16);
  --teal: #1d6f68;
  --teal-soft: rgba(29, 111, 104, 0.15);
  --wine: #6f2f38;
  --card: rgba(255, 250, 241, 0.74);
  --line: rgba(27, 25, 22, 0.12);
  --shadow: 0 22px 60px rgba(55, 34, 10, 0.16);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(181, 84, 45, 0.18), transparent 30%),
    radial-gradient(circle at right 20%, rgba(29, 111, 104, 0.16), transparent 24%),
    linear-gradient(180deg, #f8f2e8 0%, #efe4cf 100%);
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.22;
  background-image:
    linear-gradient(rgba(27, 25, 22, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(27, 25, 22, 0.04) 1px, transparent 1px);
  background-size: 24px 24px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.6), transparent 95%);
}

.app-shell {
  width: min(1240px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 40px;
}

.hero,
.panel,
.metric-card,
.place-card,
.proposal-card,
.report-highlight,
.report-list,
.subpanel {
  backdrop-filter: blur(16px);
}

.hero {
  display: grid;
  grid-template-columns: 1.8fr 1fr;
  gap: 24px;
  align-items: stretch;
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: linear-gradient(145deg, rgba(255, 249, 240, 0.84), rgba(241, 229, 205, 0.72));
  box-shadow: var(--shadow);
}

.eyebrow,
.section-kicker,
.mini-label,
.card-kicker {
  margin: 0 0 12px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.72rem;
  color: var(--wine);
}

.hero h1,
.panel h2,
.report-layout h3,
.subpanel h3 {
  font-family: Georgia, "Times New Roman", serif;
  letter-spacing: -0.03em;
}

.hero h1 {
  margin: 0;
  max-width: 12ch;
  font-size: clamp(2.6rem, 4.8vw, 4.4rem);
  line-height: 0.95;
}

.hero-text {
  max-width: 62ch;
  margin: 18px 0 0;
  font-size: 1.02rem;
  line-height: 1.7;
  color: var(--muted);
}

.hero-actions,
.toolbar,
.status-row,
.card-topline,
.mode-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

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

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

button,
.link-button {
  cursor: pointer;
  text-decoration: none;
  transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

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

.primary-button,
.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 18px;
  border-radius: 999px;
  border: 1px solid transparent;
}

.primary-button {
  background: var(--accent);
  color: #fff8f1;
  box-shadow: 0 16px 30px rgba(181, 84, 45, 0.24);
}

.link-button.is-disabled {
  opacity: 0.6;
}

.secondary-button {
  background: rgba(255, 249, 240, 0.72);
  color: var(--ink);
  border-color: rgba(27, 25, 22, 0.14);
}

.hero-card,
.panel,
.metric-card,
.place-card,
.proposal-card,
.report-highlight,
.report-list,
.subpanel {
  border: 1px solid var(--line);
  background: var(--card);
  box-shadow: var(--shadow);
}

.hero-card {
  padding: 24px;
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.pilot-badge {
  display: inline-flex;
  align-self: flex-start;
  margin-top: 2px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(111, 47, 56, 0.12);
  color: var(--wine);
  font-size: 0.78rem;
  font-weight: 700;
}

.hero-metric {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin: 14px 0;
}

.hero-metric-value {
  font-size: clamp(3.2rem, 6vw, 4.6rem);
  font-family: Georgia, "Times New Roman", serif;
  color: var(--teal);
}

.hero-metric-label,
.hero-note,
.panel-caption,
.metric-detail,
.audit-detail,
.report-list li,
.report-highlight p,
.proposal-card p,
.action-plan li,
.helper-note,
.place-card p,
.data-points dd,
.map-empty,
.footer-note {
  color: var(--muted);
}

.hero-progress {
  display: flex;
  justify-content: space-between;
  padding: 14px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.hero-note {
  margin: 16px 0 0;
  line-height: 1.6;
}

.dashboard {
  display: grid;
  gap: 18px;
  margin-top: 20px;
}

.panel {
  padding: 24px;
  border-radius: var(--radius-lg);
}

.panel-heading,
.subpanel-heading {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 18px;
}

.panel-heading {
  margin-bottom: 22px;
}

.subpanel-heading {
  margin-bottom: 16px;
}

.panel h2 {
  margin: 0;
  font-size: clamp(1.5rem, 2.8vw, 2.2rem);
}

.subpanel h3,
.report-highlight h3,
.report-list h3 {
  margin: 0;
  font-size: 1.24rem;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 999px;
  background: var(--teal-soft);
  color: var(--teal);
  font-size: 0.88rem;
  font-weight: 700;
}

.status-pill.subtle {
  background: rgba(111, 47, 56, 0.12);
  color: var(--wine);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
}

label {
  display: grid;
  gap: 8px;
  font-weight: 600;
}

label span {
  font-size: 0.92rem;
}

input,
select {
  width: 100%;
  padding: 13px 14px;
  border-radius: 14px;
  border: 1px solid rgba(27, 25, 22, 0.16);
  background: rgba(255, 249, 240, 0.9);
  color: var(--ink);
}

input::placeholder {
  color: rgba(110, 101, 86, 0.8);
}

.toolbar {
  margin-top: 18px;
}

.helper-note {
  margin: 16px 0 0;
  line-height: 1.6;
}

.results-grid {
  display: grid;
  grid-template-columns: 0.95fr 1.25fr;
  gap: 18px;
  margin-top: 18px;
}

.mode-grid {
  margin-top: 6px;
}

.mode-card {
  flex: 1 1 280px;
  padding: 20px;
  border-radius: 22px;
  border: 1px solid rgba(27, 25, 22, 0.12);
  background: rgba(255, 249, 240, 0.82);
  text-align: left;
}

.mode-card strong,
.mode-tag {
  display: block;
}

.mode-card strong {
  font-size: 1.2rem;
  font-family: Georgia, "Times New Roman", serif;
}

.mode-card p {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.65;
}

.mode-tag {
  margin-bottom: 10px;
  color: var(--wine);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 700;
}

.mode-card.is-active {
  border-color: rgba(29, 111, 104, 0.34);
  background: linear-gradient(145deg, rgba(29, 111, 104, 0.12), rgba(255, 249, 240, 0.86));
  box-shadow: 0 0 0 2px rgba(29, 111, 104, 0.08);
}

.subpanel {
  padding: 18px;
  border-radius: 20px;
}

.candidate-list,
.place-stack,
.metric-strip,
.audit-list,
.action-plan,
.report-list ul {
  display: grid;
  gap: 12px;
}

.candidate-list,
.audit-list,
.action-plan,
.report-list ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.candidate-item {
  width: 100%;
  padding: 16px 18px;
  border-radius: 18px;
  border: 1px solid rgba(27, 25, 22, 0.1);
  background: rgba(255, 249, 240, 0.84);
  text-align: left;
}

.candidate-item.is-selected {
  border-color: rgba(29, 111, 104, 0.34);
  box-shadow: 0 0 0 2px rgba(29, 111, 104, 0.08);
}

.candidate-item strong,
.place-card h4 {
  display: block;
  font-size: 1rem;
}

.candidate-item span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  line-height: 1.5;
}

.place-stack {
  grid-template-columns: 1fr;
}

.place-card {
  padding: 18px;
  border-radius: 18px;
}

.card-topline {
  justify-content: space-between;
  align-items: center;
}

.card-topline a {
  color: var(--teal);
  font-weight: 700;
}

.place-card h4 {
  margin: 0 0 6px;
}

.place-card p {
  margin: 0;
  line-height: 1.6;
}

.data-points {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 14px 0 0;
}

.data-points div {
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255, 249, 240, 0.88);
  border: 1px solid rgba(27, 25, 22, 0.08);
}

.data-points dt {
  margin: 0 0 4px;
  color: var(--wine);
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.data-points dd {
  margin: 0;
  line-height: 1.45;
}

.gbp-selector {
  display: grid;
  gap: 12px;
  margin-top: 16px;
  padding: 14px;
  border-radius: 18px;
  background: rgba(29, 111, 104, 0.08);
  border: 1px solid rgba(29, 111, 104, 0.16);
}

.gbp-selector[hidden] {
  display: none;
}

.gbp-selector label {
  gap: 7px;
}

.gbp-selector select {
  width: 100%;
}

.gbp-selector-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.gbp-selector-actions button {
  flex: 1 1 160px;
}

.map-shell {
  position: relative;
  min-height: 560px;
  border-radius: 24px;
  overflow: hidden;
  border: 1px solid rgba(27, 25, 22, 0.08);
  background: rgba(255, 249, 240, 0.76);
}

.live-map {
  width: 100%;
  height: 560px;
}

.fallback-map {
  position: absolute;
  inset: 0;
  padding: 22px;
  background:
    linear-gradient(90deg, rgba(27, 25, 22, 0.05) 1px, transparent 1px),
    linear-gradient(rgba(27, 25, 22, 0.05) 1px, transparent 1px),
    radial-gradient(circle at 22% 20%, rgba(29, 111, 104, 0.16), transparent 28%),
    radial-gradient(circle at 82% 76%, rgba(181, 84, 45, 0.18), transparent 30%),
    linear-gradient(135deg, #efe1c6 0%, #f8f1e6 52%, #e7d6bd 100%);
  background-size: 42px 42px, 42px 42px, auto, auto, auto;
}

.fallback-map[hidden],
.live-map[hidden] {
  display: none;
}

.fallback-map-inner {
  display: grid;
  grid-template-columns: minmax(240px, 0.55fr) minmax(360px, 1fr);
  gap: 22px;
  height: 100%;
}

.fallback-sidebar {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 22px;
  border-radius: 22px;
  background: rgba(255, 250, 241, 0.88);
  border: 1px solid rgba(27, 25, 22, 0.1);
  box-shadow: 0 18px 46px rgba(55, 34, 10, 0.14);
}

.fallback-kicker,
.proposal-stage {
  align-self: flex-start;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(29, 111, 104, 0.12);
  color: var(--teal);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.fallback-sidebar strong {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.35rem, 2vw, 2rem);
  line-height: 1.05;
}

.fallback-sidebar p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.fallback-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.fallback-stats div,
.proposal-metrics div {
  padding: 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.52);
  border: 1px solid rgba(27, 25, 22, 0.08);
}

.fallback-stats span,
.proposal-metrics span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.fallback-stats strong,
.proposal-metrics strong {
  font-size: 0.98rem;
}

.fallback-notice {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid rgba(27, 25, 22, 0.1);
}

.fallback-board {
  display: grid;
  gap: 10px;
  align-content: center;
  padding: 18px;
  border-radius: 24px;
  background: rgba(27, 25, 22, 0.08);
  box-shadow: inset 0 0 0 1px rgba(27, 25, 22, 0.07);
}

.fallback-cell {
  min-height: 70px;
  border: 0;
  border-radius: 18px;
  color: #fff;
  display: grid;
  place-items: center;
  gap: 2px;
  box-shadow: 0 12px 28px rgba(27, 25, 22, 0.16);
}

.fallback-cell.pending {
  color: var(--muted);
  background: rgba(255, 250, 241, 0.8);
  border: 1px dashed rgba(27, 25, 22, 0.18);
}

.fallback-cell.rank-good {
  background: linear-gradient(145deg, #2f8f72, #216a54);
}

.fallback-cell.rank-mid {
  background: linear-gradient(145deg, #c88a2f, #98651d);
}

.fallback-cell.rank-low {
  background: linear-gradient(145deg, #9d4c4c, #753333);
}

.fallback-cell.rank-null {
  background: linear-gradient(145deg, #706864, #49433f);
}

.fallback-cell.is-center {
  outline: 3px solid rgba(255, 255, 255, 0.82);
  outline-offset: -7px;
}

.fallback-rank {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.4rem, 2.5vw, 2.3rem);
  font-weight: 800;
  line-height: 1;
}

.fallback-cell small {
  font-size: 0.68rem;
  opacity: 0.86;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.map-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  text-align: center;
  line-height: 1.7;
  background:
    radial-gradient(circle at 18% 18%, rgba(29, 111, 104, 0.16), transparent 24%),
    radial-gradient(circle at 82% 72%, rgba(181, 84, 45, 0.18), transparent 24%),
    linear-gradient(135deg, #f3e8d1 0%, #f7f2e9 44%, #e7dcc8 100%);
}

.map-empty[hidden] {
  display: none;
}

.grid-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 16px;
  color: var(--muted);
  font-size: 0.92rem;
}

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

.grid-legend i {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  display: inline-block;
}

.legend-good {
  background: #2f8f72;
}

.legend-mid {
  background: #c88a2f;
}

.legend-low {
  background: #9d4c4c;
}

.legend-null {
  background: #706864;
}

.metric-strip {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.metric-card {
  padding: 18px;
  border-radius: var(--radius-md);
}

.metric-label {
  display: inline-block;
  font-size: 0.84rem;
  color: var(--wine);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.metric-value {
  display: block;
  margin-top: 8px;
  font-size: 1.9rem;
  font-family: Georgia, "Times New Roman", serif;
}

.split-panel,
.report-layout {
  display: grid;
  gap: 18px;
}

.split-panel {
  grid-template-columns: 1fr 1fr;
}

.audit-list li,
.action-plan li {
  padding: 16px 18px;
  border-radius: 18px;
  background: rgba(255, 249, 240, 0.82);
  border: 1px solid rgba(27, 25, 22, 0.1);
}

.audit-top {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  margin-bottom: 6px;
}

.audit-top strong {
  font-size: 1rem;
}

.audit-score {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 54px;
  padding: 8px 12px;
  border-radius: 999px;
  font-weight: 700;
}

.audit-score.good {
  background: rgba(47, 143, 114, 0.16);
  color: #236a53;
}

.audit-score.mid {
  background: rgba(200, 138, 47, 0.16);
  color: #9c661a;
}

.audit-score.low {
  background: rgba(157, 76, 76, 0.16);
  color: #7f3838;
}

.insight-box {
  padding: 18px;
  border-radius: 18px;
  margin-bottom: 16px;
  background: linear-gradient(135deg, rgba(29, 111, 104, 0.14), rgba(181, 84, 45, 0.12));
  border: 1px solid rgba(27, 25, 22, 0.08);
  line-height: 1.65;
}

.action-plan {
  counter-reset: step;
}

.action-plan li {
  padding-left: 56px;
  position: relative;
  line-height: 1.6;
}

.action-plan li::before {
  counter-increment: step;
  content: counter(step);
  position: absolute;
  left: 16px;
  top: 16px;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  font-size: 0.84rem;
  font-weight: 700;
}

.report-layout {
  grid-template-columns: minmax(320px, 1.35fr) repeat(3, minmax(0, 1fr));
}

.proposal-card,
.report-highlight,
.report-list {
  padding: 20px;
  border-radius: 20px;
}

.proposal-card {
  display: grid;
  gap: 14px;
  background:
    radial-gradient(circle at 8% 12%, rgba(181, 84, 45, 0.18), transparent 24%),
    linear-gradient(145deg, rgba(255, 250, 241, 0.9), rgba(231, 218, 196, 0.72));
}

.report-highlight h3,
.proposal-card h3,
.report-list h3 {
  margin-bottom: 12px;
}

.proposal-card h3 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.35rem, 2vw, 1.8rem);
  line-height: 1.08;
}

.proposal-card p {
  margin: 0;
  line-height: 1.62;
}

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

.talking-points {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.talking-points li {
  padding: 11px 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid rgba(27, 25, 22, 0.08);
  line-height: 1.45;
}

.report-list li {
  padding: 12px 0;
  border-top: 1px solid rgba(27, 25, 22, 0.08);
  line-height: 1.55;
}

.report-list li:first-child {
  border-top: 0;
  padding-top: 0;
}

.empty-state {
  padding: 18px;
  border-radius: 16px;
  border: 1px dashed rgba(27, 25, 22, 0.18);
  text-align: center;
  color: var(--muted);
}

.footer-note {
  padding: 14px 6px 0;
  text-align: center;
  font-size: 0.92rem;
}

@media (max-width: 1100px) {
  .hero,
  .results-grid,
  .split-panel,
  .report-layout {
    grid-template-columns: 1fr;
  }

  .fallback-map-inner {
    grid-template-columns: 1fr;
    overflow: auto;
  }

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

@media (max-width: 680px) {
  .app-shell {
    width: min(100% - 20px, 1240px);
    padding-top: 16px;
  }

  .hero,
  .panel,
  .subpanel,
  .proposal-card,
  .place-card {
    padding: 18px;
  }

  .hero h1 {
    max-width: none;
  }

  .panel-heading,
  .subpanel-heading,
  .status-row,
  .toolbar,
  .card-topline {
    flex-direction: column;
    align-items: stretch;
  }

  .metric-strip,
  .data-points,
  .proposal-metrics,
  .fallback-stats {
    grid-template-columns: 1fr;
  }

  .map-shell,
  .live-map,
  .fallback-map {
    min-height: 420px;
    height: 420px;
  }

  .fallback-map {
    padding: 12px;
  }

  .fallback-board {
    gap: 6px;
    padding: 10px;
  }

  .fallback-cell {
    min-height: 48px;
    border-radius: 12px;
  }
}
