/* ============================================
   Ambar Kitchen - Financial Control Dashboard
   TMG Books - Presentation-quality styling
   ============================================ */

:root {
  --bg-primary: #0f1117;
  --bg-card: #1a1d27;
  --bg-card-hover: #1f2333;
  --bg-surface: #242838;
  --border: #2d3148;
  --border-accent: #3d4260;

  --text-primary: #f0f1f5;
  --text-secondary: #9ca3b8;
  --text-muted: #6b7290;

  --gold: #d4a853;
  --gold-dim: #b8923e;
  --gold-glow: rgba(212, 168, 83, 0.15);

  --green: #4ade80;
  --green-dim: #22c55e;
  --green-bg: rgba(74, 222, 128, 0.1);

  --blue: #60a5fa;
  --blue-dim: #3b82f6;

  --amber: #fbbf24;
  --red: #f87171;

  --accent-phase1: #60a5fa;
  --accent-phase2: #a78bfa;

  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,0.3), 0 4px 12px rgba(0,0,0,0.2);
  --shadow-lg: 0 4px 24px rgba(0,0,0,0.4);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
}

/* ---- HEADER ---- */

.header {
  background: linear-gradient(135deg, #141724 0%, #1a1d2e 50%, #1e2236 100%);
  border-bottom: 1px solid var(--border);
  padding: 2rem 2rem 1rem;
}

.header-inner {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 1.5rem;
}

.header-title {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  line-height: 1.1;
}

.header-subtitle {
  font-size: 0.95rem;
  color: var(--text-secondary);
  font-weight: 400;
  margin-top: 0.35rem;
  letter-spacing: 0.02em;
}

.header-right {
  display: flex;
  gap: 1.25rem;
  flex-wrap: wrap;
}

.north-star {
  background: var(--gold-glow);
  border: 1px solid var(--gold-dim);
  border-radius: var(--radius);
  padding: 0.85rem 1.25rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 160px;
}

.north-star-secondary {
  background: var(--green-bg);
  border-color: var(--green-dim);
}

.north-star-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--gold);
  font-weight: 600;
}

.north-star-secondary .north-star-label {
  color: var(--green);
}

.north-star-value {
  font-size: 1.65rem;
  font-weight: 800;
  color: var(--gold);
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.north-star-secondary .north-star-value {
  color: var(--green);
}

.north-star-desc {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 400;
}

.header-badge {
  max-width: 1280px;
  margin: 1rem auto 0;
  font-size: 0.72rem;
  color: var(--text-muted);
  letter-spacing: 0.03em;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

/* ---- SECTION TITLES ---- */

.section-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
  margin-bottom: 0.35rem;
}

.section-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
  max-width: 720px;
}

/* ---- KPI CARDS ---- */

.kpi-section {
  max-width: 1280px;
  margin: 2rem auto 0;
  padding: 0 2rem;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 1rem;
}

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1rem;
  display: flex;
  flex-direction: column;
  transition: border-color 0.2s;
}

.kpi-card:hover {
  border-color: var(--border-accent);
  background: var(--bg-card-hover);
}

.kpi-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.kpi-value {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.kpi-footnote {
  font-size: 0.72rem;
  color: var(--text-secondary);
  margin-top: 0.4rem;
}

/* ---- CHART ---- */

.chart-section {
  max-width: 1280px;
  margin: 2rem auto 0;
  padding: 0 2rem;
}

.chart-container {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
}

.chart-wrapper {
  position: relative;
  width: 100%;
  height: 420px;
}

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

/* ---- MONTHS TO TARGET ---- */

.target-section {
  max-width: 1280px;
  margin: 2rem auto 0;
  padding: 0 2rem;
}

.target-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
}

.target-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.target-scenario {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 700;
}

.target-base .target-scenario { color: var(--text-muted); }
.target-six .target-scenario { color: var(--blue); }
.target-seven .target-scenario { color: var(--gold); }

.target-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.target-months {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin-top: 0.25rem;
}

.target-base .target-months { color: var(--text-muted); }
.target-six .target-months { color: var(--blue); }
.target-seven .target-months { color: var(--gold); }

.target-end {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.target-bar-track {
  height: 6px;
  background: var(--bg-surface);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 0.25rem;
}

.target-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 1s ease;
}

.target-base .target-bar-fill { background: var(--text-muted); }
.target-six .target-bar-fill { background: var(--blue); }
.target-seven .target-bar-fill { background: var(--gold); }

/* ---- PLAN STRIP ---- */

.plan-section {
  max-width: 1280px;
  margin: 2rem auto 0;
  padding: 0 2rem;
}

.plan-strip {
  display: flex;
  align-items: stretch;
  gap: 0;
  flex-wrap: wrap;
}

.plan-phase {
  flex: 1;
  min-width: 220px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  position: relative;
}

.plan-phase h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.plan-current h3 { color: var(--text-secondary); }
.plan-phase1 h3 { color: var(--accent-phase1); }
.plan-phase2 h3 { color: var(--gold); }

.plan-phase-badge {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.plan-detail {
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.plan-gate {
  font-size: 0.72rem;
  color: var(--green);
  margin-top: 0.75rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
  font-weight: 500;
}

.plan-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  padding: 0 0.5rem;
  flex-shrink: 0;
}

/* ---- INSIGHT SECTION ---- */

.insight-section {
  max-width: 1280px;
  margin: 2rem auto 0;
  padding: 0 2rem;
}

.insight-card {
  background: linear-gradient(135deg, rgba(96, 165, 250, 0.06) 0%, rgba(212, 168, 83, 0.04) 100%);
  border: 1px solid var(--border-accent);
  border-radius: var(--radius);
  padding: 1.75rem;
}

.insight-card h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--accent-phase1);
  margin-bottom: 1rem;
}

.insight-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
}

.insight-item {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}

.insight-icon {
  flex-shrink: 0;
  color: var(--green);
  margin-top: 1px;
}

.insight-item p {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.55;
}

/* ---- ECONOMICS TABLE ---- */

.economics-section {
  max-width: 1280px;
  margin: 2rem auto 0;
  padding: 0 2rem;
}

.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.economics-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-card);
  font-size: 0.85rem;
}

.economics-table thead {
  background: var(--bg-surface);
}

.economics-table th {
  padding: 0.85rem 1.25rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
}

.economics-table th:first-child {
  min-width: 180px;
}

.economics-table td {
  padding: 0.7rem 1.25rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
}

.economics-table td:first-child {
  color: var(--text-primary);
  font-weight: 500;
}

.economics-table tr:last-child td {
  border-bottom: none;
}

.economics-table .highlight-row td {
  color: var(--gold);
  font-weight: 700;
  background: var(--gold-glow);
}

.economics-table .highlight-row td:first-child {
  color: var(--gold);
}

/* ---- DEADLINES ---- */

.deadlines-section {
  max-width: 1280px;
  margin: 2rem auto 0;
  padding: 0 2rem;
}

.deadlines-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
}

.deadline-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  display: flex;
  gap: 0.85rem;
  align-items: flex-start;
}

.deadline-icon {
  flex-shrink: 0;
  color: var(--text-muted);
  margin-top: 2px;
}

.deadline-body strong {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-primary);
  display: block;
  margin-bottom: 0.25rem;
}

.deadline-body p {
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ---- FOOTER ---- */

.footer {
  max-width: 1280px;
  margin: 3rem auto 0;
  padding: 1.5rem 2rem 2.5rem;
  border-top: 1px solid var(--border);
}

.footer p {
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.6;
  max-width: 720px;
}

.footer-brand {
  margin-top: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.03em;
}

/* ---- RESPONSIVE ---- */

@media (max-width: 768px) {
  .header {
    padding: 1.25rem 1rem 0.75rem;
  }

  .header-inner {
    flex-direction: column;
    gap: 1rem;
  }

  .header-right {
    width: 100%;
  }

  .north-star {
    flex: 1;
    min-width: 140px;
  }

  .header-title {
    font-size: 1.5rem;
  }

  .kpi-section,
  .chart-section,
  .target-section,
  .plan-section,
  .insight-section,
  .economics-section,
  .deadlines-section,
  .footer {
    padding-left: 1rem;
    padding-right: 1rem;
  }

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

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

  .chart-wrapper {
    height: 300px;
  }

  .chart-container {
    padding: 1rem;
  }

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

  .plan-strip {
    flex-direction: column;
    gap: 0.5rem;
  }

  .plan-arrow {
    transform: rotate(90deg);
    padding: 0.25rem 0;
  }

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

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

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

  .header-right {
    flex-direction: column;
  }

  .target-months {
    font-size: 1.5rem;
  }
}

/* ---- ANIMATIONS ---- */

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

.kpi-card,
.target-card,
.plan-phase,
.deadline-card,
.insight-card {
  animation: fadeIn 0.5s ease both;
}

.kpi-card:nth-child(1) { animation-delay: 0.05s; }
.kpi-card:nth-child(2) { animation-delay: 0.1s; }
.kpi-card:nth-child(3) { animation-delay: 0.15s; }
.kpi-card:nth-child(4) { animation-delay: 0.2s; }
.kpi-card:nth-child(5) { animation-delay: 0.25s; }
.kpi-card:nth-child(6) { animation-delay: 0.3s; }
