/* ─── ROOT VARIABLES ─────────────────────────────────────────────────────── */
:root {
  /* Brand */
  --red:        #e63946;
  --red-lt:     #fff1f2;
  --navy:       #1d1d2e;
  --navy-lt:    #2e2e47;
  --navy-dim:   rgba(29,29,46,.07);

  /* Semantic accent colours */
  --green:      #10b981;
  --green-lt:   #ecfdf5;
  --amber:      #f59e0b;
  --amber-lt:   #fef9ed;
  --blue:       #3b82f6;
  --blue-lt:    #eff6ff;
  --purple:     #8b5cf6;
  --purple-lt:  #f5f3ff;

  /* Layout */
  --bg:         #f0f2f8;
  --surface:    #ffffff;
  --border:     #e4e8f0;
  --text:       #1a1a2e;
  --muted:      #7c839e;

  /* Shadows */
  --shadow-sm:  0 1px 3px rgba(0,0,0,.05), 0 1px 2px rgba(0,0,0,.04);
  --shadow:     0 4px 16px rgba(0,0,0,.07), 0 1px 4px rgba(0,0,0,.04);
  --shadow-md:  0 8px 28px rgba(0,0,0,.10), 0 2px 8px rgba(0,0,0,.05);
  --shadow-lift:0 14px 36px rgba(0,0,0,.12), 0 2px 8px rgba(0,0,0,.06);
  --shadow-lg:  0 24px 48px rgba(0,0,0,.14);

  /* Shape */
  --radius-sm:  6px;
  --radius:     12px;
  --radius-lg:  16px;

  /* Typography */
  --font: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  /* Motion */
  --ease:     cubic-bezier(0.2, 0, 0, 1);
  --duration: 0.18s;
}

/* ─── RESET ──────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.55;
}
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, select, textarea { font-family: inherit; font-size: 1rem; }
a { color: inherit; }

/* ─── HEADER ─────────────────────────────────────────────────────────────── */
.app-header {
  background: linear-gradient(135deg, #0a0a0a 0%, #1a1a1a 100%);
  height: 64px;
  display: flex;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 16px rgba(0,0,0,.22), 0 1px 3px rgba(0,0,0,.16);
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.header-inner {
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ─── LOGO ───────────────────────────────────────────────────────────────── */
.logo {
  display: flex;
  align-items: center;
  gap: 24px;
  text-decoration: none;
  user-select: none;
}
.logo-img {
  height: 44px;
  width: auto;
  filter: brightness(0) invert(1);
  opacity: 0.92;
}
.logo-text {
  font-size: 13px;
  font-weight: 400;
  color: rgba(255,255,255,.58);
  letter-spacing: 2px;
  text-transform: uppercase;
}
.logo-text strong {
  font-weight: 800;
  color: #ffffff;
}

/* ─── NAV ────────────────────────────────────────────────────────────────── */
.app-nav {
  display: flex;
  gap: 2px;
}
.nav-item {
  padding: 8px 15px;
  font-size: 13px;
  font-weight: 600;
  color: rgba(255,255,255,.52);
  border-radius: var(--radius-sm);
  transition: color var(--duration) var(--ease), background var(--duration) var(--ease);
  position: relative;
  letter-spacing: 0.1px;
}
.nav-item:hover { color: rgba(255,255,255,.88); background: rgba(255,255,255,.07); }
.nav-item.active { color: #fff; background: rgba(255,255,255,.12); }
.nav-item.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 50%;
  transform: translateX(-50%);
  width: 22px;
  height: 2px;
  background: var(--red);
  border-radius: 2px 2px 0 0;
}

/* ─── MAIN ───────────────────────────────────────────────────────────────── */
.app-main {
  max-width: 1400px;
  margin: 0 auto;
  padding: 28px 24px;
}

/* ─── SECTIONS ───────────────────────────────────────────────────────────── */
.section { display: none; }
.section.active { display: block; }

/* ─── PAGE HEADER ────────────────────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 14px;
}
.page-title {
  font-size: 24px;
  font-weight: 800;
  color: var(--navy);
  line-height: 1.15;
  letter-spacing: -0.4px;
}
.page-sub {
  font-size: 13px;
  color: var(--muted);
  margin-top: 4px;
  font-weight: 500;
}
.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* ─── PERIOD TABS ────────────────────────────────────────────────────────── */
.period-tabs {
  display: flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 4px;
  gap: 2px;
  box-shadow: var(--shadow-sm);
}
.period-btn {
  padding: 6px 13px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  border-radius: var(--radius-sm);
  transition: all var(--duration) var(--ease);
}
.period-btn:hover { color: var(--text); background: var(--bg); }
.period-btn.active {
  background: var(--navy);
  color: #fff;
  box-shadow: 0 2px 8px rgba(29,29,46,.28);
}

/* ─── CARDS ──────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 22px;
  box-shadow: var(--shadow);
}
.card-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.9px;
  margin-bottom: 18px;
}

/* ─── KPI GRID ───────────────────────────────────────────────────────────── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 14px;
}
.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: var(--shadow);
  border-top: 3px solid transparent;
  transition: box-shadow var(--duration) var(--ease), transform var(--duration) var(--ease);
}
.kpi-card:hover {
  box-shadow: var(--shadow-lift);
  transform: translateY(-2px);
}
.kpi-card.kpi-red    { border-top-color: var(--red); }
.kpi-card.kpi-navy   { border-top-color: var(--navy-lt); }
.kpi-card.kpi-green  { border-top-color: var(--green); }
.kpi-card.kpi-amber  { border-top-color: var(--amber); }
.kpi-card.kpi-blue   { border-top-color: var(--blue); }
.kpi-card.kpi-purple { border-top-color: var(--purple); }
.kpi-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.7px;
  margin-bottom: 9px;
}
.kpi-value {
  font-size: 29px;
  font-weight: 800;
  color: var(--navy);
  line-height: 1.1;
  margin-bottom: 6px;
  letter-spacing: -0.5px;
}
.kpi-sub {
  font-size: 11.5px;
  color: var(--muted);
  font-weight: 500;
}

/* ─── RATE CARDS ROW ─────────────────────────────────────────────────────── */
.rate-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 14px;
}
.rate-card {
  padding: 18px 20px;
  transition: box-shadow var(--duration) var(--ease), transform var(--duration) var(--ease);
}
.rate-card:hover {
  box-shadow: var(--shadow-lift);
  transform: translateY(-2px);
}
.rate-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.7px;
  margin-bottom: 8px;
}
.rate-value {
  font-size: 26px;
  font-weight: 800;
  margin-bottom: 10px;
  letter-spacing: -0.4px;
}
.rate-bar-bg {
  height: 6px;
  background: var(--bg);
  border-radius: 3px;
  margin-bottom: 8px;
  overflow: hidden;
}
.rate-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width .5s cubic-bezier(0.4, 0, 0.2, 1);
}
.rate-sub {
  font-size: 11.5px;
  color: var(--muted);
  font-weight: 500;
}

/* ─── TWO COL LAYOUT ─────────────────────────────────────────────────────── */
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 14px;
}

/* ─── CHARTS ─────────────────────────────────────────────────────────────── */
.chart-wrap {
  position: relative;
  height: 220px;
}
.chart-wrap.chart-tall { height: 280px; }
.chart-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}

/* ─── TARGET VS ACTUAL ───────────────────────────────────────────────────── */
.tva-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}
.tva-row:last-child { margin-bottom: 0; }
.tva-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.tva-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.tva-nums {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
}
.tva-sep { margin: 0 4px; }
.tva-bar-bg {
  height: 8px;
  background: var(--bg);
  border-radius: 4px;
  overflow: hidden;
}
.tva-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width .5s cubic-bezier(0.4, 0, 0.2, 1);
}
.tva-pct {
  font-size: 12px;
  font-weight: 700;
  text-align: right;
}
.empty-state {
  font-size: 13px;
  color: var(--muted);
  padding: 20px 0;
  text-align: center;
  font-weight: 500;
}
.link-btn {
  color: var(--red);
  font-size: 13px;
  text-decoration: underline;
  cursor: pointer;
  font-weight: 600;
}

/* ─── FORECAST ───────────────────────────────────────────────────────────── */
.forecast-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.forecast-item {
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  border: 1px solid var(--border);
}
.forecast-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 5px;
}
.forecast-value {
  font-size: 21px;
  font-weight: 800;
  color: var(--navy);
  margin-bottom: 3px;
  letter-spacing: -0.3px;
}
.forecast-sub {
  font-size: 11.5px;
  color: var(--muted);
  font-weight: 500;
}

/* ─── TIME METRICS ───────────────────────────────────────────────────────── */
.time-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.time-item {
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  border: 1px solid var(--border);
}
.time-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}
.time-value {
  font-size: 18px;
  font-weight: 800;
  color: var(--navy);
  letter-spacing: -0.2px;
}

/* ─── PIPELINE STATS ─────────────────────────────────────────────────────── */
.pipeline-stats {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.stat-pill {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  box-shadow: var(--shadow);
  flex: 1;
  min-width: 140px;
  transition: box-shadow var(--duration) var(--ease), transform var(--duration) var(--ease);
}
.stat-pill:hover { box-shadow: var(--shadow-lift); transform: translateY(-2px); }
.stat-pill-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}
.stat-pill-value {
  font-size: 20px;
  font-weight: 800;
  color: var(--navy);
  letter-spacing: -0.2px;
}
.stat-pill-value.green { color: var(--green); }

/* ─── STAGE FILTERS ──────────────────────────────────────────────────────── */
.stage-filters {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.stage-filter-btn {
  padding: 6px 13px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  transition: all var(--duration) var(--ease);
  display: flex;
  align-items: center;
  gap: 5px;
  box-shadow: var(--shadow-sm);
}
.stage-filter-btn:hover { border-color: var(--navy); color: var(--navy); background: #fafbff; }
.stage-filter-btn.active {
  background: var(--navy);
  color: #fff;
  border-color: var(--navy);
  box-shadow: 0 2px 8px rgba(29,29,46,.28);
}
.filter-count {
  background: rgba(0,0,0,.1);
  border-radius: 10px;
  padding: 1px 6px;
  font-size: 10px;
  font-weight: 700;
}
.stage-filter-btn.active .filter-count { background: rgba(255,255,255,.2); }

/* ─── STAGE BADGES ───────────────────────────────────────────────────────── */
.stage-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.stage-lead        { background: #dbeafe; color: #1d4ed8; }
.stage-prospect    { background: #fef3c7; color: #b45309; }
.stage-meeting     { background: #fee2e2; color: #b91c1c; }
.stage-negotiation { background: #ede9fe; color: #6d28d9; }
.stage-won         { background: #d1fae5; color: #047857; }
.stage-lost        { background: #f3f4f6; color: #4b5563; }

/* ─── TABLE ──────────────────────────────────────────────────────────────── */
.table-card { padding: 0; overflow: hidden; }
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.data-table th {
  background: #f6f8fc;
  padding: 11px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.7px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  font-size: 13.5px;
}
.data-table tbody tr { transition: background var(--duration); }
.data-table tbody tr:hover { background: #f6f8fc; }
.data-table tbody tr:last-child td { border-bottom: none; }
.totals-row td {
  border-top: 2px solid var(--border);
  border-bottom: none;
  background: #f6f8fc;
  font-size: 12.5px;
  font-weight: 700;
}
.notes-cell {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 12px;
}
.actions-cell {
  white-space: nowrap;
  text-align: right;
}

/* ─── ICON BUTTONS ───────────────────────────────────────────────────────── */
.icon-btn {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all var(--duration) var(--ease);
  color: var(--muted);
}
.icon-btn:hover { background: var(--bg); color: var(--text); }
.del-btn:hover { background: var(--red-lt); color: var(--red); }

/* ─── BUTTONS ────────────────────────────────────────────────────────────── */
.btn-primary {
  background: var(--red);
  color: #fff;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 700;
  transition: all var(--duration) var(--ease);
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(230,57,70,.32);
  letter-spacing: 0.1px;
}
.btn-primary:hover {
  background: #cc2f3b;
  box-shadow: 0 4px 14px rgba(230,57,70,.42);
  transform: translateY(-1px);
}
.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  transition: all var(--duration) var(--ease);
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
}
.btn-secondary:hover {
  border-color: var(--navy);
  color: var(--navy);
  background: #fafbff;
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}
.btn-danger {
  background: var(--red-lt);
  color: var(--red);
  border: 1px solid #fecaca;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 700;
  transition: all var(--duration) var(--ease);
}
.btn-danger:hover {
  background: var(--red);
  color: #fff;
  border-color: var(--red);
  transform: translateY(-1px);
}

/* ─── REPORTS CONTROLS ───────────────────────────────────────────────────── */
.report-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
  flex-wrap: wrap;
  background: var(--surface);
  padding: 12px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.control-label {
  font-size: 11px;
  color: var(--muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}
.gran-btn {
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: all var(--duration) var(--ease);
}
.gran-btn:hover { border-color: var(--navy); color: var(--navy); }
.gran-btn.active {
  background: var(--navy);
  color: #fff;
  border-color: var(--navy);
  box-shadow: 0 2px 6px rgba(29,29,46,.22);
}
.export-btns {
  margin-left: auto;
  display: flex;
  gap: 6px;
}

/* ─── SUMMARY GRID ───────────────────────────────────────────────────────── */
.summary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.sum-item {
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12.5px;
  border: 1px solid var(--border);
}
.sum-item span { color: var(--muted); font-weight: 500; }
.sum-item strong { color: var(--navy); font-size: 13px; font-weight: 700; }

/* ─── SETTINGS ───────────────────────────────────────────────────────────── */
.settings-tabs {
  display: flex;
  gap: 2px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 4px;
  width: fit-content;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}
.settings-tab {
  padding: 8px 22px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  border-radius: var(--radius-sm);
  transition: all var(--duration) var(--ease);
}
.settings-tab:hover { color: var(--text); background: var(--bg); }
.settings-tab.active {
  background: var(--navy);
  color: #fff;
  box-shadow: 0 2px 6px rgba(29,29,46,.22);
}
.settings-panel { display: none; margin-bottom: 16px; }
.settings-panel.active { display: block; }
.danger-zone { border-color: #fecaca; }
.danger-title { color: var(--red); }

/* ─── FORMS ──────────────────────────────────────────────────────────────── */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 22px;
}
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group.full { grid-column: 1 / -1; }
.form-group label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.1px;
}
.form-group input,
.form-group select,
.form-group textarea {
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  color: var(--text);
  background: var(--surface);
  transition: border-color var(--duration), box-shadow var(--duration);
  outline: none;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(29,29,46,.10);
}
.form-group textarea { resize: vertical; }
.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ─── MODAL ──────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(8,8,20,.52);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  backdrop-filter: blur(5px);
}
.modal-overlay.hidden { display: none; }
.modal-box {
  background: var(--surface);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 560px;
  box-shadow: var(--shadow-lg);
  max-height: 90vh;
  overflow-y: auto;
  border: 1px solid rgba(255,255,255,.7);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 22px 16px;
  border-bottom: 1px solid var(--border);
}
.modal-header h2 {
  font-size: 17px;
  font-weight: 800;
  color: var(--navy);
  letter-spacing: -0.2px;
}
.modal-close {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--duration) var(--ease);
}
.modal-close:hover { background: var(--bg); color: var(--text); }
#modal-body { padding: 22px; }

/* ─── EMPTY STATE ────────────────────────────────────────────────────────── */
.empty-page {
  text-align: center;
  padding: 70px 20px;
}
.empty-icon { font-size: 44px; margin-bottom: 16px; }
.empty-page h3 { font-size: 18px; font-weight: 700; color: var(--navy); margin-bottom: 8px; }
.empty-page p { font-size: 13.5px; color: var(--muted); margin-bottom: 24px; font-weight: 500; }

/* ─── TOAST ──────────────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 28px;
  right: 28px;
  background: var(--navy);
  color: #fff;
  padding: 12px 20px;
  border-radius: var(--radius);
  font-size: 13.5px;
  font-weight: 600;
  box-shadow: var(--shadow-md);
  transform: translateY(16px);
  opacity: 0;
  transition: all .28s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 2000;
  border: 1px solid rgba(255,255,255,.08);
}
.toast.show { transform: translateY(0); opacity: 1; }

/* ─── PRINT ──────────────────────────────────────────────────────────────── */
@media print {
  .app-header, .report-controls, .export-btns, .page-header .header-actions,
  .btn-primary, .btn-secondary { display: none !important; }
  .section { display: block !important; }
  .section:not(#section-reports) { display: none !important; }
  .app-main { padding: 0; }
  .card { box-shadow: none; border: 1px solid #ddd; }
  .two-col { grid-template-columns: 1fr 1fr; }
  body { background: white; }
}

/* ─── RESPONSIVE ─────────────────────────────────────────────────────────── */

/* ── Tablet (≤1100px) ── */
@media (max-width: 1100px) {
  .kpi-grid { grid-template-columns: repeat(4, 1fr); }
  .export-btns { flex-wrap: wrap; }
}

/* ── Small tablet (≤900px) ── */
@media (max-width: 900px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .rate-row { grid-template-columns: repeat(2, 1fr); }
  .two-col { grid-template-columns: 1fr; }
  .summary-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .form-group.full { grid-column: 1; }
}

/* ── Mobile (≤640px) ── */
@media (max-width: 640px) {

  /* Header stacks: logo row on top, nav below */
  .app-header { height: auto; }
  .header-inner {
    flex-direction: column;
    padding: 10px 14px;
    gap: 8px;
    align-items: stretch;
  }
  .logo { justify-content: center; gap: 14px; }
  .logo-text { font-size: 10px; letter-spacing: 1.2px; }

  /* Nav scrolls horizontally */
  .app-nav {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    justify-content: flex-start;
    gap: 4px;
    padding-bottom: 2px;
  }
  .app-nav::-webkit-scrollbar { display: none; }
  .nav-item {
    padding: 8px 14px;
    font-size: 12px;
    white-space: nowrap;
    flex-shrink: 0;
  }

  /* Main content */
  .app-main { padding: 16px 12px; }

  /* Page header stacks */
  .page-header {
    flex-direction: column;
    gap: 12px;
    align-items: stretch;
  }
  .page-title { font-size: 20px; }
  .header-actions { width: 100%; }

  /* Period tabs scroll horizontally */
  .period-tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    width: 100%;
    flex-wrap: nowrap;
  }
  .period-tabs::-webkit-scrollbar { display: none; }
  .period-btn { flex-shrink: 0; white-space: nowrap; }

  /* KPI cards */
  .kpi-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi-card { padding: 14px 16px; }
  .kpi-value { font-size: 24px; }
  .kpi-label { font-size: 10px; margin-bottom: 6px; }

  /* Cards */
  .card { padding: 16px; }
  .card-title { margin-bottom: 14px; }

  /* Tables: horizontal scroll */
  .table-card { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .data-table { min-width: 620px; }

  /* Pipeline stats stack */
  .pipeline-stats { flex-direction: column; }
  .stat-pill { min-width: 0; }

  /* Stage filters scroll */
  .stage-filters {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
    scrollbar-width: none;
    padding-bottom: 4px;
  }
  .stage-filters::-webkit-scrollbar { display: none; }
  .stage-filter-btn { flex-shrink: 0; }

  /* Report controls stack */
  .report-controls { flex-direction: column; align-items: stretch; gap: 10px; }
  .export-btns {
    margin-left: 0;
    width: 100%;
    flex-direction: column;
    gap: 6px;
  }
  .export-btns .btn-secondary { text-align: center; }

  /* Settings tabs scroll */
  .settings-tabs {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .settings-tabs::-webkit-scrollbar { display: none; }
  .settings-tab { flex-shrink: 0; white-space: nowrap; padding: 8px 16px; }

  /* Forecast & summary grids single column */
  .forecast-grid { grid-template-columns: 1fr; }
  .time-metrics { grid-template-columns: 1fr; }

  /* Touch targets: min 44px */
  .icon-btn { width: 38px; height: 38px; font-size: 15px; }
  .btn-primary,
  .btn-secondary,
  .btn-danger { padding: 12px 18px; min-height: 44px; font-size: 14px; }

  /* Inputs: 16px font prevents iOS auto-zoom, 44px min-height for touch */
  .form-group input,
  .form-group select,
  .form-group textarea {
    font-size: 16px;
    padding: 11px 12px;
    min-height: 44px;
  }

  /* Modal full-width on mobile */
  .modal-overlay { padding: 8px; align-items: flex-end; }
  .modal-box {
    border-radius: var(--radius) var(--radius) 0 0;
    max-height: 92vh;
  }
  #modal-body { padding: 16px; }
  .modal-header { padding: 16px; }

  /* Toast spans full width */
  .toast {
    left: 12px;
    right: 12px;
    bottom: 16px;
    text-align: center;
  }

  /* Charts slightly shorter */
  .chart-wrap { height: 200px; }
  .chart-wrap.chart-tall { height: 240px; }
}

/* ── Very small phones (≤380px) ── */
@media (max-width: 380px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .kpi-value { font-size: 22px; }
  .logo-text { display: none; }
  .nav-item { padding: 7px 11px; font-size: 11px; }
  .page-title { font-size: 18px; }
  .app-main { padding: 12px 8px; }
}
