/* ─────────────────────────────────────────────
   Design tokens
───────────────────────────────────────────── */
:root {
  --bg:            #f5f5f6;
  --card:          #ffffff;
  --border:        #e5e5e7;
  --border-light:  #efefef;
  --radius:        14px;

  --text-primary:   #1a1a1a;
  --text-secondary: #7a7a7e;
  --text-muted:     #a3a3a8;

  --accent:         #b4a7f5;
  --accent-light:   #d8d0fb;
  --accent-blue:    #a8d4f5;
  --accent-blue-fill: #dbeefe;

  --green:          #5cb585;
  --green-bg:       #e2f5ec;

  --font-sans: 'Instrument Sans', system-ui, sans-serif;
  --font-mono: 'DM Mono', 'Courier New', monospace;

  --gap:    32px;
  --pad-card: 24px 28px;
}

/* ─────────────────────────────────────────────
   Reset & base
───────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  font-family: var(--font-sans);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

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

/* ─────────────────────────────────────────────
   Animations
───────────────────────────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.fi { animation: fadeUp 0.45s ease both; }
.fi1 { animation-delay: 0.04s; }
.fi2 { animation-delay: 0.08s; }
.fi3 { animation-delay: 0.14s; }
.fi4 { animation-delay: 0.20s; }
.fi5 { animation-delay: 0.28s; }
.fi6 { animation-delay: 0.34s; }
.fi7 { animation-delay: 0.40s; }

/* ─────────────────────────────────────────────
   Layout
───────────────────────────────────────────── */
.page-wrap {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 32px;
}

/* ─────────────────────────────────────────────
   Header
───────────────────────────────────────────── */
.site-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 44px 0 36px;
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--gap);
}

.site-title {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.04em;
  color: var(--text-primary);
}

.site-updated {
  font-size: 12px;
  color: var(--text-muted);
}

/* ─────────────────────────────────────────────
   Utility classes
───────────────────────────────────────────── */
.mono { font-family: var(--font-mono); }
.muted { color: var(--text-muted); }
.green { color: var(--green); }

/* ─────────────────────────────────────────────
   Cards
───────────────────────────────────────────── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

/* ─────────────────────────────────────────────
   KPI Grid
───────────────────────────────────────────── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: var(--gap);
}

.kpi-card {
  padding: var(--pad-card);
  display: flex;
  flex-direction: column;
  min-height: 168px;
}

.kpi-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 16px;
  letter-spacing: 0.01em;
}

.kpi-number {
  font-size: 36px;
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1;
  color: var(--text-primary);
  margin-top: auto;
}

.kpi-sub {
  font-size: 12px;
  margin-top: 8px;
}

/* ─── Sparkline ─── */
.sparkline {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 40px;
  margin-top: 12px;
}

.spark-bar {
  flex: 1;
  border-radius: 2px 2px 0 0;
  min-height: 4px;
  transition: height 0.3s ease;
}

/* ─────────────────────────────────────────────
   Chart Cards
───────────────────────────────────────────── */
.chart-card {
  padding: var(--pad-card);
  margin-bottom: var(--gap);
}

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

.section-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.01em;
}

.chart-sub {
  font-size: 11px;
  color: var(--text-muted);
}

.chart-wrap {
  position: relative;
  height: 280px;
}

.chart-wrap--sm {
  height: 200px;
}

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

/* ─────────────────────────────────────────────
   Range Selector
───────────────────────────────────────────── */
.range-selector {
  display: flex;
  gap: 2px;
  background: var(--bg);
  border-radius: 8px;
  padding: 3px;
}

.range-btn {
  padding: 5px 12px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 500;
  background: transparent;
  color: var(--text-muted);
  transition: all 0.15s ease;
  line-height: 1;
}

.range-btn:hover {
  color: var(--text-primary);
  background: var(--border-light);
}

.range-btn.active {
  background: var(--card);
  color: var(--text-primary);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

/* ─────────────────────────────────────────────
   Two-column layout (monthly section)
───────────────────────────────────────────── */
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: var(--gap);
}

.two-col .chart-card {
  margin-bottom: 0;
}

/* ─────────────────────────────────────────────
   Milestones
───────────────────────────────────────────── */
.milestones-card {
  padding: 0;
  margin-bottom: var(--gap);
  overflow: hidden;
}

.milestones-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 28px 20px; /* Increased bottom padding */
}

.milestones-nav {
  display: flex;
  gap: 8px;
}

.nav-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text-secondary);
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.nav-btn:hover {
  border-color: var(--text-primary);
  color: var(--text-primary);
}

.milestones-grid {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  gap: 0;
  padding: 0;
  border-top: 1px solid var(--border-light);
}

.milestones-grid::-webkit-scrollbar { display: none; }
.milestones-grid { -ms-overflow-style: none; scrollbar-width: none; }

.milestone-col {
  flex: 0 0 33.333%; /* Full fraction: 3 items per view */
  padding: 24px 28px;
  border-right: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  scroll-snap-align: start;
}

.milestone-date {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.milestone-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.milestone-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 16px;
  flex-grow: 1;
  white-space: normal;
}

.milestone-total {
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  background: var(--bg);
  padding: 4px 8px;
  border-radius: 4px;
  align-self: flex-start;
}

.milestone-tag {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 8px;
}

/* ─────────────────────────────────────────────
   Monthly Table
───────────────────────────────────────────── */
.table-card {
  padding: 0;
  margin-bottom: 48px;
}

.table-header {
  padding: 20px 28px 0;
  margin-bottom: 12px;
}

.table-scroll {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.data-table thead tr {
  border-bottom: 1px solid var(--border);
}

.data-table thead th {
  padding: 12px 28px;
  text-align: left;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  white-space: nowrap;
}

.data-table tbody tr {
  border-bottom: 1px solid var(--border-light);
  transition: background 0.12s ease;
}

.data-table tbody tr:last-child {
  border-bottom: none;
}

.data-table tbody tr:hover td {
  background: #fafafb;
}

.data-table tbody td {
  padding: 14px 28px;
  font-family: var(--font-mono);
  color: var(--text-secondary);
  white-space: nowrap;
}

.data-table tbody td:first-child {
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 13px;
  color: var(--text-primary);
}

.td-green {
  color: var(--green) !important;
  font-weight: 500;
}

.growth-pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 500;
  font-family: var(--font-mono);
}

.growth-pill--high {
  background: var(--green-bg);
  color: var(--green);
}

.growth-pill--low {
  background: var(--bg);
  color: var(--text-secondary);
}

/* ─────────────────────────────────────────────
   Pagination
───────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 16px;
  border-top: 1px solid var(--border-light);
}

.page-btn {
  padding: 5px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
}

.page-btn:hover:not(:disabled) {
  border-color: var(--text-muted);
  color: var(--text-primary);
}

.page-btn:disabled {
  color: var(--border);
  cursor: default;
  border-color: var(--border-light);
}

.page-info {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-muted);
}

/* ─────────────────────────────────────────────
   Footer
───────────────────────────────────────────── */
.site-footer {
  border-top: 1px solid var(--border-light);
  padding: 20px 0 32px;
  font-size: 11px;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.footer-link {
  color: var(--text-muted);
  text-decoration: underline;
  text-decoration-color: var(--border);
  transition: color 0.15s;
}

.footer-link:hover {
  color: var(--text-secondary);
}

/* ─────────────────────────────────────────────
   Responsive
───────────────────────────────────────────── */
@media (max-width: 768px) {
  .page-wrap { padding: 0 16px; }

  .site-header {
    padding: 28px 0 24px;
    margin-bottom: 24px;
  }

  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 24px;
  }

  .kpi-card { min-height: 140px; }

  .kpi-number { font-size: 28px; }

  .two-col {
    grid-template-columns: 1fr;
    gap: 12px;
    margin-bottom: 24px;
  }

  .chart-card { margin-bottom: 24px; }

  .milestone-col {
    flex: 0 0 100%;
    padding: 20px 24px;
  }

  .data-table thead th,
  .data-table tbody td { padding: 10px 16px; }

  .table-header { padding: 16px 16px 0; }

  .range-btn { padding: 5px 8px; }
}
