:root {
  --bg: #f5f1e8;
  --paper: #fffaf2;
  --ink: #1d2a35;
  --muted: #5f6b76;
  --line: #d4c6ae;
  --accent: #c55c32;
  --accent-soft: #efd5c8;
  --accent-strong: #842d14;
  --blue: #1c4d6c;
  --green: #336b4f;
  --shadow: 0 20px 45px rgba(56, 42, 17, 0.12);
  --radius: 22px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  background:
    radial-gradient(circle at top left, rgba(197, 92, 50, 0.14), transparent 28%),
    radial-gradient(circle at top right, rgba(28, 77, 108, 0.18), transparent 35%),
    var(--bg);
  color: var(--ink);
}

.page-shell {
  width: min(1440px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 48px;
}

.hero {
  display: grid;
  grid-template-columns: 1.3fr 0.9fr;
  gap: 20px;
  align-items: stretch;
  margin-bottom: 20px;
}

.hero-copy,
.chat-panel,
.panel {
  background: rgba(255, 250, 242, 0.92);
  border: 1px solid rgba(212, 198, 174, 0.8);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(6px);
}

.hero-copy {
  padding: 34px;
  position: relative;
  overflow: hidden;
}

.hero-copy::after {
  content: "";
  position: absolute;
  right: -60px;
  bottom: -60px;
  width: 220px;
  height: 220px;
  background: radial-gradient(circle, rgba(197, 92, 50, 0.15), transparent 70%);
  pointer-events: none;
}

.eyebrow {
  letter-spacing: 0.22em;
  text-transform: uppercase;
  font-size: 0.75rem;
  color: var(--accent-strong);
  margin: 0 0 16px;
}

h1,
h2,
h3,
th {
  font-family: "Avenir Next Condensed", "Franklin Gothic Medium", "Arial Narrow", sans-serif;
  letter-spacing: 0.02em;
}

h1 {
  margin: 0;
  font-size: clamp(2.4rem, 5vw, 4.4rem);
  line-height: 0.95;
}

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

.hero-badges {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 22px;
}

.badge {
  border-radius: 999px;
  border: 1px solid var(--line);
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.72);
  font-size: 0.9rem;
  color: var(--ink);
}

.chat-panel {
  padding: 22px;
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

.chat-header h2,
.panel-header h2 {
  margin: 0;
  font-size: 1.6rem;
}

.chat-header p,
.panel-header p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.chat-form {
  display: grid;
  gap: 12px;
  margin-top: 20px;
}

textarea,
button {
  font: inherit;
}

textarea {
  width: 100%;
  resize: vertical;
  min-height: 120px;
  border-radius: 18px;
  border: 1px solid var(--line);
  padding: 14px 16px;
  background: #fffdf8;
  color: var(--ink);
}

button {
  border: none;
  border-radius: 16px;
  padding: 12px 18px;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: white;
  font-weight: 700;
  cursor: pointer;
  transition: transform 140ms ease, box-shadow 140ms ease;
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 26px rgba(132, 45, 20, 0.18);
}

.chat-status {
  min-height: 1.4em;
  margin-top: 12px;
  color: var(--accent-strong);
}

.chat-answer {
  margin-top: 14px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
  white-space: pre-wrap;
  line-height: 1.55;
}

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

.panel {
  padding: 22px;
  animation: rise 420ms ease both;
}

.panel-wide {
  grid-column: 1 / -1;
}

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

.metric-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
  background: linear-gradient(180deg, rgba(255,255,255,0.72), rgba(239,213,200,0.35));
}

.metric-label {
  display: block;
  color: var(--muted);
  margin-bottom: 8px;
}

.metric-value {
  font-family: "Avenir Next Condensed", "Franklin Gothic Medium", "Arial Narrow", sans-serif;
  font-size: 1.9rem;
}

.insight-list {
  margin: 18px 0 0;
  padding-left: 18px;
  color: var(--ink);
}

.insight-list li + li {
  margin-top: 10px;
}

.chart {
  margin-top: 16px;
  min-height: 280px;
}

.chart-short {
  min-height: 240px;
}

.bar-chart {
  display: grid;
  gap: 10px;
}

.bar-row {
  display: grid;
  grid-template-columns: minmax(130px, 180px) 1fr minmax(80px, 110px);
  align-items: center;
  gap: 12px;
}

.bar-label,
.bar-value {
  font-size: 0.95rem;
}

.bar-track {
  height: 16px;
  border-radius: 999px;
  background: rgba(28, 77, 108, 0.1);
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--blue), var(--accent));
}

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

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

.region-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.68);
}

.region-card h3 {
  margin: 0 0 8px;
  font-size: 1.25rem;
}

.region-meta {
  color: var(--muted);
  margin-bottom: 10px;
}

.pill-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

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

.table-wrap {
  overflow-x: auto;
  margin-top: 16px;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  text-align: left;
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
}

th {
  color: var(--accent-strong);
}

tbody tr:hover {
  background: rgba(239, 213, 200, 0.24);
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1120px) {
  .hero,
  .dashboard-grid,
  .tag-grid,
  .region-grid {
    grid-template-columns: 1fr;
  }

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

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

  .hero-copy,
  .chat-panel,
  .panel {
    padding: 18px;
  }

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

  .bar-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }
}
