@import url("https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&family=Space+Grotesk:wght@500;700&display=swap");

:root {
  --bg: #fbfaf6;
  --bg-2: #f3f0e8;
  --surface: rgba(255, 255, 255, 0.88);
  --surface-strong: #ffffff;
  --surface-dark: #111111;
  --text: #171311;
  --muted: #746c63;
  --line: rgba(23, 19, 17, 0.09);
  --accent: #9c5a2d;
  --accent-strong: #4b2f1d;
  --accent-soft: rgba(156, 90, 45, 0.08);
  --forest: #29513f;
  --forest-soft: rgba(41, 81, 63, 0.1);
  --gold: #d29234;
  --danger: #ae4f42;
  --danger-soft: rgba(174, 79, 66, 0.08);
  --shadow: 0 12px 36px rgba(23, 19, 17, 0.05);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
  --sidebar: 248px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Manrope", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(210, 146, 52, 0.08), transparent 24%),
    radial-gradient(circle at top right, rgba(41, 81, 63, 0.06), transparent 22%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(23, 19, 17, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(23, 19, 17, 0.02) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.22), transparent 84%);
}

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

button,
input,
select {
  font: inherit;
}

.shell {
  display: grid;
  grid-template-columns: var(--sidebar) minmax(0, 1fr);
  min-height: 100vh;
}

.rail {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 28px 22px;
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.76);
  backdrop-filter: blur(14px);
}

.brand {
  margin-bottom: 28px;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--accent-strong);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.brand-title {
  margin: 18px 0 8px;
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.66rem;
  line-height: 1;
  letter-spacing: -0.04em;
}

.brand-copy,
.rail-note,
.subtle {
  color: var(--muted);
  font-size: 0.94rem;
  line-height: 1.55;
}

.rail-nav {
  display: grid;
  gap: 8px;
  margin: 26px 0;
}

.rail-link {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  color: #665f57;
  transition:
    transform 180ms ease,
    background-color 180ms ease,
    color 180ms ease;
}

.rail-link:hover {
  background: rgba(23, 19, 17, 0.035);
  color: var(--text);
  transform: translateX(4px);
}

.rail-link.active {
  background: linear-gradient(135deg, rgba(156, 90, 45, 0.08), rgba(23, 19, 17, 0.02));
  color: var(--text);
  font-weight: 700;
}

.rail-link span:last-child {
  color: var(--muted);
  font-size: 0.78rem;
}

.rail-block {
  margin-top: 22px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.signal-list {
  display: grid;
  gap: 10px;
  margin: 14px 0 0;
}

.signal-item {
  display: grid;
  gap: 2px;
}

.signal-item strong {
  font-size: 0.92rem;
}

.page {
  padding: 28px;
}

.page-inner {
  max-width: 1440px;
}

.masthead {
  position: relative;
  overflow: hidden;
  display: grid;
  gap: 18px;
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: 34px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(250, 248, 243, 0.96)),
    linear-gradient(120deg, rgba(156, 90, 45, 0.04), transparent 38%);
  box-shadow: var(--shadow);
}

.masthead::after {
  content: "";
  position: absolute;
  right: -10%;
  top: -26%;
  width: 320px;
  aspect-ratio: 1;
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(156, 90, 45, 0.08), rgba(156, 90, 45, 0.015) 56%, transparent 70%);
  pointer-events: none;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent-strong);
}

.page-title {
  margin: 0;
  max-width: 840px;
  font-family: "Space Grotesk", sans-serif;
  font-size: clamp(2.25rem, 4vw, 4rem);
  line-height: 0.94;
  letter-spacing: -0.05em;
}

.page-subtitle {
  max-width: 760px;
  margin: 0;
  color: #625b54;
  font-size: 0.98rem;
  line-height: 1.55;
}

.masthead-row,
.inline-grid,
.split,
.stack {
  display: grid;
  gap: 18px;
}

.masthead-row {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
}

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

.button-link,
.ghost-link,
.filter-chip,
.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  white-space: nowrap;
}

.button-link {
  padding: 12px 18px;
  background: var(--surface-dark);
  color: #ffffff;
  font-weight: 700;
}

.ghost-link {
  padding: 12px 18px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  color: var(--text);
  font-weight: 700;
}

.metric-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-top: 22px;
}

.metric {
  padding: 18px 18px 20px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid var(--line);
}

.metric-value {
  font-size: 1.9rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 0.96;
}

.metric-label {
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.92rem;
}

.metric-note {
  margin-top: 10px;
  font-size: 0.82rem;
  color: #8a8075;
}

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

.panel {
  display: grid;
  gap: 16px;
  align-content: start;
  min-height: 100%;
  padding: 24px;
  border-radius: var(--radius-xl);
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(251, 249, 244, 0.88));
  box-shadow: 0 10px 24px rgba(23, 19, 17, 0.035);
}

.panel.dark {
  background: linear-gradient(180deg, rgba(252, 250, 245, 0.98), rgba(248, 245, 239, 0.94));
  color: var(--text);
}

.panel.dark .section-copy,
.panel.dark .subtle,
.panel.dark .label,
.panel.dark .list-meta,
.panel.dark .muted-line {
  color: var(--muted);
}

.panel.span-2 {
  grid-column: span 2;
}

.panel.span-3 {
  grid-column: 1 / -1;
}

.panel.tall {
  min-height: 420px;
}

.section-header {
  display: grid;
  gap: 8px;
}

.section-title {
  margin: 0;
  font-size: 1.18rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.section-copy {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
  font-size: 0.94rem;
}

.pill-row,
.tags,
.chip-row,
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pill,
.tag,
.badge,
.filter-chip {
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(23, 19, 17, 0.04);
  color: var(--accent-strong);
  font-size: 0.78rem;
  font-weight: 700;
}

.badge.forest,
.filter-chip.forest {
  background: var(--forest-soft);
  color: var(--forest);
}

.badge.gold {
  background: rgba(198, 138, 50, 0.12);
  color: #8e5e17;
}

.badge.danger,
.filter-chip.danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.two-column,
.three-column {
  display: grid;
  gap: 16px;
}

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

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

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

.data-table th,
.data-table td {
  padding: 12px 0;
  border-bottom: 1px solid rgba(23, 19, 17, 0.08);
  text-align: left;
  vertical-align: top;
  font-size: 0.92rem;
}

.data-table th {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.data-table tr:last-child td {
  border-bottom: 0;
}

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

.stat-block {
  padding: 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.84);
  border: 1px solid var(--line);
}

.stat-block strong {
  display: block;
  font-size: 1.38rem;
  line-height: 1;
  letter-spacing: -0.04em;
}

.label {
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.45;
}

.bars {
  display: grid;
  gap: 14px;
}

.bar-row {
  display: grid;
  gap: 8px;
}

.bar-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  font-size: 0.9rem;
}

.bar-track {
  position: relative;
  overflow: hidden;
  height: 12px;
  border-radius: 999px;
  background: rgba(23, 19, 17, 0.08);
}

.bar-fill {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--gold));
  transition: width 900ms cubic-bezier(0.2, 1, 0.2, 1);
}

.bar-fill.forest {
  background: linear-gradient(90deg, #315842, #79a16e);
}

.bar-fill.gold {
  background: linear-gradient(90deg, #a86f1e, #deb36b);
}

.bar-fill.danger {
  background: linear-gradient(90deg, var(--danger), #d89b91);
}

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

.list-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(23, 19, 17, 0.08);
}

.list-row:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.list-row strong,
.list-title {
  font-size: 0.96rem;
}

.list-meta {
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.55;
}

.list-value {
  font-size: 0.9rem;
  font-weight: 800;
}

.timeline {
  display: grid;
  gap: 14px;
}

.timeline-item {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 14px;
}

.timeline-mark {
  color: var(--accent-strong);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

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

.process-step {
  display: grid;
  gap: 8px;
  padding: 18px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid var(--line);
}

.process-index {
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent-strong);
}

.matrix {
  display: grid;
  gap: 12px;
}

.matrix-row {
  display: grid;
  grid-template-columns: 180px repeat(4, minmax(0, 1fr));
  gap: 10px;
  align-items: center;
}

.matrix-label {
  font-size: 0.88rem;
  font-weight: 700;
}

.matrix-cell {
  padding: 12px 10px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid var(--line);
  color: #5f4c41;
  font-size: 0.82rem;
}

.matrix-cell.strong {
  background: rgba(41, 69, 52, 0.1);
  color: var(--forest);
  font-weight: 700;
}

.matrix-cell.warn {
  background: rgba(198, 138, 50, 0.12);
  color: #8e5e17;
  font-weight: 700;
}

.matrix-cell.risk {
  background: rgba(143, 58, 50, 0.1);
  color: var(--danger);
  font-weight: 700;
}

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

.link-card {
  display: grid;
  gap: 10px;
  padding: 18px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.88);
  transition:
    transform 180ms ease,
    border-color 180ms ease,
    background-color 180ms ease;
}

.link-card:hover {
  transform: translateY(-4px);
  border-color: rgba(156, 90, 45, 0.14);
  background: rgba(255, 255, 255, 0.98);
}

.link-card strong {
  font-size: 1rem;
}

.link-card span {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

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

.province-column {
  display: grid;
  gap: 10px;
  padding: 16px;
  border-radius: 22px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 245, 239, 0.9)),
    linear-gradient(180deg, rgba(41, 81, 63, 0.04), transparent 55%);
  border: 1px solid var(--line);
}

.province-column h4,
.mini-title {
  margin: 0;
  font-size: 0.96rem;
  font-weight: 800;
}

.farm-chip {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.9);
  font-size: 0.84rem;
}

.farm-chip strong {
  font-size: 0.84rem;
}

.bullet-list {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 10px;
  color: var(--muted);
  line-height: 1.55;
}

.roadmap {
  display: grid;
  gap: 14px;
}

.roadmap-phase {
  display: grid;
  gap: 10px;
  padding: 18px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid var(--line);
}

.roadmap-phase strong {
  font-size: 1rem;
}

.divider {
  height: 1px;
  background: rgba(23, 19, 17, 0.08);
}

.inset-panel {
  padding: 18px;
  border-radius: 20px;
  box-shadow: none;
}

.caption {
  color: #877d74;
  font-size: 0.8rem;
  line-height: 1.45;
}

.status-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

[data-reveal] {
  opacity: 0;
  transform: translateY(18px);
  transition:
    opacity 500ms ease,
    transform 650ms cubic-bezier(0.2, 1, 0.2, 1);
}

[data-reveal].is-visible {
  opacity: 1;
  transform: none;
}

/* Dashboard-specific styles */
.chart-container {
  position: relative;
  width: 100%;
  min-height: 220px;
  padding: 12px;
}

.chart-container canvas {
  width: 100% !important;
  height: 100% !important;
}

.chart-container.small {
  min-height: 160px;
}

.chart-container.tall {
  min-height: 280px;
}

.kpi-card {
  position: relative;
  padding: 18px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line);
}

.kpi-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.kpi-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.kpi-trend {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 999px;
}

.kpi-trend.up {
  color: var(--forest);
  background: var(--forest-soft);
}

.kpi-trend.down {
  color: var(--danger);
  background: var(--danger-soft);
}

.kpi-trend.neutral {
  color: var(--gold);
  background: rgba(198, 138, 50, 0.12);
}

.kpi-trend.warning {
  color: var(--danger);
  background: var(--danger-soft);
}

.kpi-value {
  font-size: 2.2rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1;
}

.kpi-subtitle {
  margin-top: 6px;
  font-size: 0.82rem;
  color: var(--muted);
}

.sparkline-row {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 12px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid rgba(23, 19, 17, 0.06);
}

.sparkline-row:last-child {
  border-bottom: 0;
}

.sparkline-label {
  font-size: 0.84rem;
  font-weight: 600;
}

.sparkline-chart {
  height: 32px;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 700;
}

.status-badge::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.status-badge.success {
  background: var(--forest-soft);
  color: var(--forest);
}

.status-badge.success::before {
  background: var(--forest);
}

.status-badge.warning {
  background: rgba(198, 138, 50, 0.12);
  color: #8e5e17;
}

.status-badge.warning::before {
  background: var(--gold);
}

.status-badge.danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.status-badge.danger::before {
  background: var(--danger);
}

.status-badge.info {
  background: var(--accent-soft);
  color: var(--accent);
}

.status-badge.info::before {
  background: var(--accent);
}

.activity-feed {
  display: grid;
  gap: 10px;
}

.activity-item {
  display: grid;
  grid-template-columns: 80px 1fr;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(23, 19, 17, 0.06);
}

.activity-item:last-child {
  border-bottom: 0;
}

.activity-time {
  font-size: 0.74rem;
  color: var(--muted);
  font-weight: 600;
}

.activity-content {
  font-size: 0.86rem;
}

.activity-content strong {
  font-weight: 700;
}

.progress-ring {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px;
}

.progress-ring svg {
  width: 80px;
  height: 80px;
}

.progress-ring-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
}

.progress-ring-value {
  font-size: 1.1rem;
  font-weight: 800;
}

.data-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
}

.data-grid-item {
  padding: 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--line);
}

.data-grid-item strong {
  display: block;
  font-size: 1.28rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.data-grid-item span {
  font-size: 0.78rem;
  color: var(--muted);
}

.funnel {
  display: grid;
  gap: 6px;
}

.funnel-step {
  display: grid;
  grid-template-columns: 120px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 10px 0;
}

.funnel-label {
  font-size: 0.84rem;
  font-weight: 600;
}

.funnel-bar-track {
  height: 24px;
  border-radius: 6px;
  background: rgba(23, 19, 17, 0.06);
  overflow: hidden;
}

.funnel-bar-fill {
  height: 100%;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--accent), var(--gold));
  transition: width 800ms ease;
}

.funnel-value {
  font-size: 0.88rem;
  font-weight: 700;
  min-width: 60px;
  text-align: right;
}

.footnote {
  margin-top: 18px;
  color: #7a7067;
  font-size: 0.84rem;
}

@media (max-width: 1180px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .rail {
    position: relative;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .page {
    padding-top: 20px;
  }
}

@media (max-width: 980px) {
  .page {
    padding: 18px;
  }

  .masthead {
    padding: 24px;
  }

  .metric-strip,
  .dashboard-grid,
  .two-column,
  .three-column,
  .map-board,
  .link-grid,
  .process-flow {
    grid-template-columns: 1fr;
  }

  .panel.span-2,
  .panel.span-3 {
    grid-column: auto;
  }

  .matrix-row {
    grid-template-columns: 1fr;
  }

  .timeline-item {
    grid-template-columns: 1fr;
  }

  .masthead-row {
    grid-template-columns: 1fr;
  }

  .funnel-step {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .rail {
    padding: 20px 16px;
  }

  .page {
    padding: 14px;
  }

  .metric {
    padding: 16px;
  }

  .metric-value {
    font-size: 1.6rem;
  }

  .page-title {
    font-size: 2rem;
  }

  .panel {
    padding: 18px;
    border-radius: 22px;
  }

  .kpi-value {
    font-size: 1.8rem;
  }
}
