/* ============================================
   Jelly Belly Analytics - Apple-style Light Theme
   ============================================ */

:root {
  /* Apple system colors */
  --blue: #007AFF;
  --indigo: #5856D6;
  --purple: #AF52DE;
  --pink: #FF2D55;
  --red: #FF3B30;
  --orange: #FF9500;
  --yellow: #FFCC00;
  --green: #34C759;
  --teal: #5AC8FA;
  --mint: #00C7BE;

  /* Neutrals */
  --bg: #F2F2F7;
  --card-bg: rgba(255, 255, 255, 0.72);
  --card-border: rgba(0, 0, 0, 0.06);
  --card-shadow: 0 2px 16px rgba(0, 0, 0, 0.06), 0 0 1px rgba(0, 0, 0, 0.1);
  --card-hover-shadow: 0 4px 24px rgba(0, 0, 0, 0.1), 0 0 1px rgba(0, 0, 0, 0.12);
  --text-primary: #1C1C1E;
  --text-secondary: #3C3C43;
  --text-tertiary: #8E8E93;
  --separator: rgba(60, 60, 67, 0.08);
  --fill: rgba(120, 120, 128, 0.12);

  --radius: 16px;
  --radius-sm: 12px;
  --radius-xs: 8px;
  --transition: all 0.25s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text',
               'Inter', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Ambient blobs — soft, light */
.ambient-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.25;
  animation: float 25s ease-in-out infinite;
}

.blob-1 {
  width: 500px;
  height: 500px;
  background: var(--blue);
  top: -15%;
  right: -5%;
}

.blob-2 {
  width: 450px;
  height: 450px;
  background: var(--purple);
  bottom: -15%;
  left: -5%;
  animation-delay: -8s;
}

.blob-3 {
  width: 350px;
  height: 350px;
  background: var(--teal);
  top: 45%;
  left: 25%;
  animation-delay: -16s;
}

@keyframes float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(20px, -30px) scale(1.03); }
  66% { transform: translate(-15px, 15px) scale(0.97); }
}

/* Dashboard wrapper */
.dashboard-wrap {
  position: relative;
  z-index: 1;
  margin: 0;
  padding: 24px 32px;
  margin-left: 64px;
}

/* ── Sidebar ──────────────────────────────── */
.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  width: 64px;
  height: 100vh;
  background: linear-gradient(180deg, rgba(240, 245, 255, 0.92) 0%, rgba(230, 238, 255, 0.88) 100%);
  backdrop-filter: blur(24px) saturate(200%);
  -webkit-backdrop-filter: blur(24px) saturate(200%);
  border-right: 1px solid rgba(0, 122, 255, 0.08);
  box-shadow: 2px 0 20px rgba(0, 50, 120, 0.06);
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 16px;
  gap: 8px;
  transition: width 0.25s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  overflow: hidden;
}

.sidebar:hover {
  width: 180px;
}

.sidebar-logo {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  flex-shrink: 0;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
  padding: 0 10px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--text-tertiary);
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.nav-item:hover {
  background: rgba(0, 122, 255, 0.06);
  color: var(--text-secondary);
}

.nav-item.active {
  background: rgba(255, 255, 255, 0.65);
  backdrop-filter: blur(12px) saturate(150%);
  -webkit-backdrop-filter: blur(12px) saturate(150%);
  color: var(--blue);
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.06), 0 0 0 1px rgba(0, 122, 255, 0.1);
}

.nav-item svg {
  flex-shrink: 0;
}

.nav-label {
  opacity: 0;
  transition: opacity 0.2s ease 0.05s;
}

.sidebar:hover .nav-label {
  opacity: 1;
}

/* ── Page Content Toggle ─────────────────── */
.page-content {
  display: none;
}

.page-content.active {
  display: block;
}

/* ── Full-width chart (spans both columns) ── */
.chart-full-width {
  grid-column: 1 / -1;
}

.chart-full-width .chart-body {
  min-height: 220px;
}

/* Glass card */
.glass-card {
  background: var(--card-bg);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
  transition: var(--transition);
}

/* Opt-out for cards where the backdrop-filter compositing layer hurts
   SVG text crispness (e.g., the outlets trend chart labels). Uses a
   solid white background so the card still reads as a card. */
.glass-card.no-blur {
  background: #ffffff;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.glass-card:hover {
  box-shadow: var(--card-hover-shadow);
}

/* ── Header ────────────────────────────────── */
.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 0 20px;
  margin-bottom: 16px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo-mark svg {
  display: block;
}

.header-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.5px;
  line-height: 1.2;
}

.header-subtitle {
  font-size: 0.78rem;
  color: var(--text-tertiary);
  font-weight: 500;
  letter-spacing: 0.3px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.last-synced {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  font-weight: 500;
}

.data-range-badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.75rem;
  font-weight: 600;
  color: #5C3D2E;
  background: rgba(196, 112, 75, 0.08);
  border: 1px solid rgba(196, 112, 75, 0.2);
  padding: 5px 10px;
  border-radius: 8px;
  white-space: nowrap;
}
.data-range-badge.stale {
  color: #B8391A;
  background: rgba(184, 57, 26, 0.08);
  border-color: rgba(184, 57, 26, 0.25);
}
.data-range-badge.loading {
  opacity: 0.6;
}

.user-menu {
  display: flex;
  align-items: center;
  gap: 8px;
}
.user-name {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
}
.logout-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px; height: 32px;
  border-radius: 8px;
  border: none;
  background: var(--fill);
  color: var(--text-tertiary);
  cursor: pointer;
  transition: all 0.2s ease;
}
.logout-btn:hover {
  background: rgba(255, 59, 48, 0.1);
  color: #FF3B30;
}

.sync-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  background: var(--blue);
  color: #fff;
  border: none;
  border-radius: var(--radius-xs);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 2px 8px rgba(0, 122, 255, 0.3);
}

.sync-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(0, 122, 255, 0.35);
  filter: brightness(1.05);
}

.sync-btn:active { transform: translateY(0); }

.sync-btn.loading .sync-icon {
  animation: spin 1s linear infinite;
}

.sync-btn.loading { opacity: 0.7; pointer-events: none; }

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* ── Filter Bar ────────────────────────────── */
.filter-bar {
  display: flex;
  align-items: stretch;
  gap: 12px;
  padding: 14px 20px;
  margin-bottom: 16px;
  flex-wrap: wrap;
  overflow: visible;
  position: relative;
  z-index: 10;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
  justify-content: flex-end;
  flex-shrink: 0;
}

/* Branch filter-group should not stretch */
.filter-group:has(.custom-select) {
  max-width: 160px;
}

.filter-label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  white-space: nowrap;
}

.filter-label svg {
  opacity: 0.5;
  flex-shrink: 0;
}

.filter-select,
.filter-input {
  background: var(--fill);
  border: 1px solid transparent;
  border-radius: var(--radius-xs);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.82rem;
  height: 38px;
  padding: 0 12px;
  outline: none;
  transition: var(--transition);
  min-width: 140px;
}

.filter-select:focus,
.filter-input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.15);
  background: #fff;
}

.filter-select option {
  background: #fff;
  color: var(--text-primary);
}

/* Custom searchable select */
.custom-select {
  position: relative;
  width: 140px;
  max-width: 140px;
  min-width: 0;
  flex-shrink: 0;
}

.custom-select .filter-input {
  width: 140px;
  max-width: 140px;
  min-width: 0 !important;
  cursor: pointer;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
  padding: 0 10px;
  font-size: 0.78rem;
}

.select-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  width: 240px;
  margin-top: 4px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-xs);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
  max-height: 260px;
  overflow-y: auto;
  z-index: 100;
}

.select-dropdown.open {
  display: block;
}

.select-option {
  padding: 6px 12px;
  font-size: 0.8rem;
  color: var(--text-primary);
  cursor: pointer;
  transition: background 0.12s ease;
  border-bottom: 1px solid var(--separator);
}

.select-option:hover {
  background: rgba(0, 122, 255, 0.06);
}

/* Checkbox row layout */
.cb-row {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 500;
}

.cb-row input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: var(--blue);
  cursor: pointer;
  flex-shrink: 0;
}

.cb-row .branch-code {
  font-size: 0.65rem;
  color: var(--text-tertiary);
  margin-left: auto;
  font-weight: 400;
}

/* Apply button pinned at bottom of dropdown */
.select-apply {
  position: sticky;
  bottom: 0;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.95);
  border-top: 1px solid var(--separator);
}

.select-apply-btn {
  width: 100%;
  padding: 7px 0;
  background: var(--blue);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.select-apply-btn:hover {
  filter: brightness(1.08);
}

.filter-input::-webkit-calendar-picker-indicator {
  cursor: pointer;
  opacity: 0.5;
}

/* Period pills */
.period-pills {
  display: flex;
  gap: 3px;
  background: var(--fill);
  border-radius: var(--radius-xs);
  padding: 3px;
  height: 38px;
  align-items: center;
}

.pill {
  padding: 6px 14px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.pill:hover {
  color: var(--text-primary);
}

.pill.active {
  background: #fff;
  color: var(--blue);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.filter-apply-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 38px;
  padding: 0 18px;
  background: var(--green);
  color: #fff;
  border: none;
  border-radius: var(--radius-xs);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 2px 8px rgba(52, 199, 89, 0.25);
  align-self: flex-end;
  white-space: nowrap;
}

.filter-apply-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(52, 199, 89, 0.3);
}

/* ── Filter Context Bar ───────────────────── */
.filter-context-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 8px 20px;
  margin: 0 0 12px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-primary);
  background: linear-gradient(135deg, rgba(99,102,241,0.08) 0%, rgba(139,92,246,0.08) 100%);
  border: 1px solid rgba(99,102,241,0.15);
  border-radius: 8px;
  letter-spacing: 0.02em;
}

.filter-context-bar .ctx-separator {
  opacity: 0.3;
  font-weight: 300;
}

/* ── Summary Cards ─────────────────────────── */
.summary-cards {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 14px;
  margin-bottom: 16px;
}
.summary-cards.financial-cards {
  grid-template-columns: repeat(5, 1fr);
}

.summary-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 20px 18px;
}

.card-icon-wrap {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 70%, transparent));
  color: #fff;
  flex-shrink: 0;
}

.card-content {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.card-label {
  font-size: 0.68rem;
  color: var(--text-tertiary);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.card-value {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.3;
  letter-spacing: -0.5px;
}

.card-desc {
  font-size: 0.62rem;
  color: var(--text-tertiary);
  font-weight: 500;
  line-height: 1.3;
  margin-top: 2px;
}

/* ── Collapsible Extra KPIs ────────────────── */
.summary-cards-extra {
  margin-bottom: 16px;
}

.extra-kpi-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--glass-bg);
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-bottom: 10px;
}

.extra-kpi-toggle:hover {
  color: var(--text-primary);
  border-color: var(--accent-primary);
}

.extra-kpi-toggle .extra-kpi-icon {
  transition: transform 0.3s ease;
}

.extra-kpi-toggle.expanded .extra-kpi-icon {
  transform: rotate(45deg);
}

.extra-kpi-cards {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 0.4s ease, opacity 0.3s ease;
}

.extra-kpi-cards.expanded {
  max-height: 500px;
  opacity: 1;
}

.extra-kpi-cards .summary-card {
  padding: 16px 14px;
}

.extra-kpi-cards .card-value {
  font-size: 1.15rem;
}

.extra-kpi-cards .card-icon-wrap {
  width: 36px;
  height: 36px;
}

.extra-kpi-cards .card-icon-wrap svg {
  width: 18px;
  height: 18px;
}

/* ── Charts Grid ───────────────────────────── */
.charts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 20px;
}

.charts-grid-3col {
  grid-template-columns: 1fr 1fr 1fr;
}

.chart-container {
  padding: 22px;
  overflow: hidden;
}

.chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--separator);
}

.chart-group-toggle {
  display: flex;
  gap: 2px;
  background: var(--fill);
  border-radius: 8px;
  padding: 2px;
}

.group-pill {
  border: none;
  background: transparent;
  color: var(--text-tertiary);
  font-size: 0.7rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.group-pill:hover {
  color: var(--text-secondary);
}

.group-pill.active {
  background: #fff;
  color: var(--blue);
  box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}

.chart-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-primary);
}

.chart-title svg {
  color: var(--blue);
  opacity: 0.7;
}

.chart-desc {
  font-size: 0.68rem;
  color: var(--text-tertiary);
  font-weight: 500;
  margin-top: 2px;
  line-height: 1.3;
}

.chart-body {
  width: 100%;
  min-height: 280px;
  position: relative;
}

#chart-payment-breakdown {
  min-height: auto;
}

#chart-comm-waterfall {
  min-height: 180px;
  max-height: 280px;
}

#chart-comm-settlements .pnl-table-wrap,
#chart-comm-by-restaurant .pnl-table-wrap {
  max-height: 420px;
  overflow-y: auto;
}

#chart-comm-settlements .pnl-table thead,
#chart-comm-by-restaurant .pnl-table thead {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--card-bg);
}

.chart-body svg {
  width: 100%;
  height: auto;
}

.chart-error {
  color: var(--red);
  font-size: 0.85rem;
  text-align: center;
  padding: 40px 20px;
  opacity: 0.7;
}

.chart-empty {
  color: var(--secondary);
  font-size: 0.85rem;
  text-align: center;
  padding: 40px 20px;
  opacity: 0.6;
}

/* ── D3 Tooltip ────────────────────────────── */
.d3-tooltip {
  position: fixed;
  background: rgba(28, 28, 30, 0.92);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  color: #fff;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.78rem;
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', sans-serif;
  line-height: 1.6;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease;
  z-index: 9999;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  max-width: 240px;
}

.d3-tooltip.visible {
  opacity: 1;
}

/* ── D3 Chart Style Overrides ──────────────── */
.chart-body .domain {
  stroke: var(--separator) !important;
}

.chart-body .tick line {
  stroke: var(--separator) !important;
}

.chart-body .tick text,
.chart-body text {
  fill: var(--text-tertiary) !important;
}

.chart-body .grid line {
  stroke: rgba(60, 60, 67, 0.04) !important;
  stroke-dasharray: 3,3 !important;
}

/* ── Branch P&L Table ─────────────────────── */
.pnl-table-wrap {
  overflow-x: auto;
}

.pnl-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.pnl-table th {
  text-align: left;
  padding: 10px 14px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-tertiary);
  border-bottom: 2px solid var(--separator);
  white-space: nowrap;
}

.pnl-table th.num {
  text-align: right;
}

.pnl-table td {
  padding: 10px 14px;
  color: var(--text-primary);
  font-weight: 500;
  border-bottom: 1px solid var(--separator);
  white-space: nowrap;
}

.pnl-table td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.pnl-table tbody tr:hover {
  background: rgba(0, 122, 255, 0.03);
}

.pnl-table tbody tr:nth-child(even) {
  background: rgba(120, 120, 128, 0.03);
}

.pnl-table tbody tr:nth-child(even):hover {
  background: rgba(0, 122, 255, 0.05);
}

.pnl-table .positive { color: var(--green); }
.pnl-table .negative { color: var(--red); }

.brand-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 8px;
  vertical-align: middle;
}

.pnl-table .total-row td {
  border-top: 2px solid var(--border);
  background: rgba(0,0,0,0.02);
}

/* ── Outlets page ──────────────────────────── */
.outlet-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  margin-top: 14px;
  padding: 10px 4px 2px;
  border-top: 1px dashed var(--separator);
}

.outlet-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: background 0.15s ease;
}

.outlet-legend-item:hover {
  background: rgba(0,0,0,0.04);
}

.outlet-legend-item.active {
  background: rgba(0,122,255,0.1);
  color: var(--blue);
}

.outlet-legend-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.outlet-caret {
  display: inline-block;
  width: 10px;
  color: var(--text-tertiary);
  font-weight: 700;
  transition: transform 0.15s ease;
}

.outlet-row:hover {
  background: rgba(0,122,255,0.04) !important;
}

/* ── Footer ────────────────────────────────── */
.dashboard-footer {
  text-align: center;
  padding: 20px;
  color: var(--text-tertiary);
  font-size: 0.75rem;
  font-weight: 500;
}

/* ── Sync Modal ────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(12px) saturate(150%);
  -webkit-backdrop-filter: blur(12px) saturate(150%);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal-overlay.active {
  display: flex;
}

.modal-content {
  padding: 36px;
  max-width: 400px;
  width: 90%;
  text-align: center;
  background: rgba(255, 255, 255, 0.85);
}

.modal-icon {
  margin-bottom: 14px;
  color: var(--blue);
  animation: spin 2s linear infinite;
  display: inline-block;
}

.modal-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 20px;
}

.progress-bar-container {
  width: 100%;
  height: 5px;
  background: var(--fill);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 14px;
}

.progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--blue), var(--purple));
  border-radius: 3px;
  transition: width 0.5s ease;
}

.progress-text {
  font-size: 0.85rem;
  color: var(--text-primary);
  font-weight: 600;
  margin-bottom: 4px;
}

.progress-detail {
  font-size: 0.75rem;
  color: var(--text-tertiary);
}

/* ── Responsive ────────────────────────────── */
@media (max-width: 1024px) {
  .summary-cards {
    grid-template-columns: repeat(2, 1fr);
  }
  .extra-kpi-cards {
    grid-template-columns: repeat(3, 1fr);
  }
  .charts-grid-3col {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 768px) {
  /* ─ Sidebar → horizontal top nav ─ */
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100% !important;
    height: 52px;
    flex-direction: row;
    padding: 0 8px;
    gap: 0;
    border-right: none;
    border-bottom: 1px solid var(--card-border);
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.04);
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
  }

  .sidebar:hover { width: 100% !important; }

  .sidebar-logo { margin-bottom: 0; margin-right: 8px; flex-shrink: 0; }

  .sidebar-nav {
    flex-direction: row;
    gap: 2px;
    padding: 0;
    flex-shrink: 0;
  }

  .nav-item {
    padding: 8px 10px;
    flex-shrink: 0;
  }

  .nav-item.active {
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.06), 0 0 0 1px rgba(0, 122, 255, 0.1);
  }

  .nav-label { opacity: 1; font-size: 0.72rem; }

  /* ─ Main content ─ */
  .dashboard-wrap {
    margin-left: 0;
    margin-top: 52px;
    padding: 12px 12px;
  }

  /* ─ Header ─ */
  .dashboard-header {
    flex-direction: column;
    gap: 10px;
    text-align: center;
    padding: 12px 0 14px;
    margin-bottom: 12px;
  }

  .header-left { justify-content: center; }
  .header-title { font-size: 1.2rem; }

  .header-right {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
  }

  .user-menu { order: -1; }
  .user-name { font-size: 0.72rem; }
  .logout-btn { width: 28px; height: 28px; }
  .sync-btn { padding: 7px 14px; font-size: 0.75rem; }

  /* ─ Filter bar ─ */
  .filter-bar {
    flex-direction: column;
    align-items: stretch;
    padding: 12px 14px;
    gap: 10px;
  }

  .filter-group { width: 100%; max-width: none !important; }

  .filter-select, .filter-input {
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
  }

  .custom-select {
    width: 100% !important;
    max-width: none !important;
  }
  .custom-select .filter-input {
    width: 100% !important;
    max-width: none !important;
  }

  .select-dropdown {
    width: 100%;
    left: 0;
    right: 0;
  }

  .period-pills {
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
    height: auto;
    padding: 4px;
  }

  .pill { padding: 6px 12px; font-size: 0.72rem; }

  .filter-apply-btn {
    width: 100%;
    justify-content: center;
  }

  /* ─ Summary cards ─ */
  .summary-cards {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-bottom: 12px;
  }

  .summary-card { padding: 14px 12px; gap: 10px; }
  .card-icon-wrap { width: 36px; height: 36px; border-radius: 10px; }
  .card-icon-wrap svg { width: 18px; height: 18px; }
  .card-value { font-size: 1.1rem; }
  .extra-kpi-cards { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .card-label { font-size: 0.6rem; }
  .card-desc { font-size: 0.55rem; }

  /* ─ Charts ─ */
  .charts-grid { grid-template-columns: 1fr; gap: 10px; }
  .charts-grid-3col { grid-template-columns: 1fr; }
  .chart-full-width { grid-column: 1; }
  .chart-container { padding: 14px; }
  .chart-body { min-height: 220px; }
  .chart-title { font-size: 0.8rem; }
  .chart-desc { font-size: 0.62rem; }

  .chart-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .chart-group-toggle {
    align-self: stretch;
    justify-content: center;
  }

  /* ─ Commission page ─ */
  .comm-header {
    flex-direction: column;
    gap: 10px;
    align-items: flex-start;
  }

  .comm-platform-toggle {
    width: 100%;
    justify-content: center;
  }

  .comm-view-toggle {
    width: 100%;
    justify-content: center;
  }

  .platform-pill { font-size: 0.7rem; padding: 5px 10px; }
  .view-pill { font-size: 0.7rem; padding: 5px 10px; }

  /* ─ Tables: horizontal scroll ─ */
  .pnl-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -14px;
    padding: 0 14px;
  }

  .pnl-table { font-size: 0.72rem; min-width: 600px; }
  .pnl-table th { padding: 8px 10px; font-size: 0.62rem; }
  .pnl-table td { padding: 8px 10px; }

  /* ─ D3 tooltip ─ */
  .d3-tooltip { max-width: 180px; font-size: 0.72rem; padding: 8px 12px; }

  /* ─ Blobs: hide on mobile for performance ─ */
  .blob { display: none; }

  /* ─ Modal ─ */
  .modal-content { padding: 24px 20px; }
}

/* ─ Extra-small screens (< 400px) ─ */
@media (max-width: 400px) {
  .summary-cards { grid-template-columns: 1fr; }
  .extra-kpi-cards { grid-template-columns: 1fr; }
  .card-value { font-size: 1rem; }

  .nav-item { padding: 6px 8px; }
  .nav-label { font-size: 0.65rem; }

  .header-title { font-size: 1rem; }
  .header-subtitle { font-size: 0.68rem; }

  .dashboard-wrap { padding: 8px 8px; }

  .chart-container { padding: 10px; }
  .chart-body { min-height: 180px; }
}

/* ── Commission Page Header ───────────────── */
.comm-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.comm-page-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}

.comm-page-subtitle {
  font-size: 0.72rem;
  color: var(--text-tertiary);
  font-weight: 500;
}

.comm-platform-toggle {
  display: flex;
  gap: 4px;
  background: rgba(0, 0, 0, 0.04);
  border-radius: 8px;
  padding: 3px;
}

.platform-pill {
  padding: 6px 14px;
  border: none;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  background: transparent;
  color: var(--text-tertiary);
  transition: all 0.2s ease;
}

.platform-pill:hover {
  color: var(--text-secondary);
}

.platform-pill.active {
  background: #fff;
  color: var(--text-primary);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.comm-view-toggle {
  display: flex;
  gap: 4px;
  background: rgba(0, 0, 0, 0.04);
  border-radius: 8px;
  padding: 3px;
  margin-left: auto;
  align-self: center;
}

.view-pill {
  padding: 6px 14px;
  border: none;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  background: transparent;
  color: var(--text-tertiary);
  transition: all 0.2s ease;
}

.view-pill:hover {
  color: var(--text-secondary);
}

.view-pill.active {
  background: #fff;
  color: var(--text-primary);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.view-pill[data-view="reconciliation"].active {
  background: #3b82f6;
  color: #fff;
}

.comm-sync-status {
  padding: 10px 16px;
  border-radius: var(--radius-xs);
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 14px;
}

.comm-sync-status.syncing {
  background: rgba(0, 122, 255, 0.08);
  color: var(--blue);
  border: 1px solid rgba(0, 122, 255, 0.15);
}

.comm-sync-status.done {
  background: rgba(52, 199, 89, 0.08);
  color: var(--green);
  border: 1px solid rgba(52, 199, 89, 0.15);
}

.comm-sync-status.error {
  background: rgba(255, 59, 48, 0.08);
  color: var(--red);
  border: 1px solid rgba(255, 59, 48, 0.15);
}

/* ── iOS Safe Areas ───────────────────────── */
@supports (padding: env(safe-area-inset-top)) {
  .sidebar {
    padding-top: max(16px, env(safe-area-inset-top));
  }
  @media (max-width: 768px) {
    .sidebar {
      padding-top: max(0px, env(safe-area-inset-top));
      padding-left: env(safe-area-inset-left);
      padding-right: env(safe-area-inset-right);
    }
    .dashboard-wrap {
      padding-bottom: env(safe-area-inset-bottom);
    }
  }
}

/* ── Flip Button ───────────────────────────── */
.flip-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px; height: 28px;
  border: 1px solid rgba(0,0,0,0.1);
  border-radius: 7px;
  background: rgba(255,255,255,0.5);
  cursor: pointer;
  color: #8E8E93;
  transition: all 0.2s;
  flex-shrink: 0;
}
.flip-btn:hover {
  background: rgba(0,122,255,0.08);
  color: #007AFF;
  border-color: rgba(0,122,255,0.2);
}

/* ── Add Location Button ──────────────────── */
.loc-add-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, #007AFF, #5856D6);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 700;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 2px 8px rgba(0,122,255,0.25);
}
.loc-add-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(0,122,255,0.35);
}
.loc-add-btn-sm {
  padding: 6px 14px;
  font-size: 0.72rem;
}

/* Recenter button */
.loc-recenter-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 14px;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 8px;
  background: rgba(30,30,40,0.85);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: all 0.2s;
  backdrop-filter: blur(8px);
  z-index: 1000;
  position: absolute;
  top: 12px;
  right: 12px;
}
.loc-recenter-btn:hover {
  background: rgba(0,122,255,0.8);
  border-color: rgba(0,122,255,0.5);
}

/* ── Store Map ─────────────────────────────── */

.map-legend {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 12px;
  padding: 0 4px;
}
.map-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
}
.map-legend-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  display: inline-block;
}
.map-legend-dot.active { background: #34C759; }
.map-legend-dot.planned {
  background: transparent;
  border: 2px dashed #FF9500;
  width: 8px; height: 8px;
}
.map-legend-stats {
  margin-left: auto;
  font-size: 0.72rem;
  color: var(--text-tertiary);
  font-weight: 500;
}

/* Marker wrapper */
.store-marker-icon {
  background: none !important;
  border: none !important;
}
.store-marker-wrap {
  position: relative;
  width: 56px;
  height: 56px;
}
.store-marker-dot {
  z-index: 2;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  animation: dotGlow 2.5s ease-in-out infinite;
}
.store-marker-icon:hover .store-marker-dot {
  transform: translate(-50%, -50%) scale(1.35) !important;
  filter: brightness(1.15) saturate(1.2);
}

/* Pulsing glow rings for active markers */
.marker-ring {
  position: absolute;
  top: 50%; left: 50%;
  width: 36px; height: 36px;
  margin-top: -18px; margin-left: -18px;
  border: 2px solid;
  border-radius: 50%;
  opacity: 0;
  pointer-events: none;
}
.marker-ring-1 {
  animation: ringPulse 2.6s ease-out infinite;
}
.marker-ring-2 {
  animation: ringPulse 2.6s ease-out 1.3s infinite;
}
@keyframes ringPulse {
  0% { transform: scale(0.5); opacity: 0.7; }
  50% { opacity: 0.2; }
  100% { transform: scale(2.6); opacity: 0; }
}

/* Breathing glow on the dot */
@keyframes dotGlow {
  0%, 100% { filter: brightness(1) drop-shadow(0 0 4px currentColor); }
  50% { filter: brightness(1.2) drop-shadow(0 0 8px currentColor); }
}

/* Marker drop animation */
.marker-drop {
  animation: markerDrop 0.7s cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes markerDrop {
  0% { transform: translateY(-60px) scale(0.3); opacity: 0; }
  50% { opacity: 1; }
  70% { transform: translateY(4px) scale(1.08); }
  100% { transform: translateY(0) scale(1); opacity: 1; }
}

/* Popup styles */
.store-popup-wrap .leaflet-popup-content-wrapper {
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.12);
  padding: 0;
}
.store-popup-wrap .leaflet-popup-content {
  margin: 0;
}
.store-popup-wrap .leaflet-popup-tip {
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.store-popup {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 14px;
  font-family: 'Inter', sans-serif;
}
.store-popup strong {
  font-size: 0.82rem;
  color: #1a1a2e;
}
.popup-brand {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.popup-detail {
  font-size: 0.7rem;
  color: #6b7280;
}
.popup-status {
  display: inline-block;
  margin-top: 4px;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  width: fit-content;
}
.popup-status-active {
  background: rgba(52, 199, 89, 0.15);
  color: #34C759;
}
.popup-status-planned {
  background: rgba(255, 149, 0, 0.15);
  color: #FF9500;
}

/* Location status badges */
.loc-status-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 6px;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.loc-status-active {
  background: rgba(52, 199, 89, 0.12);
  color: #34C759;
}
.loc-status-planned {
  background: rgba(255, 149, 0, 0.12);
  color: #FF9500;
}

/* Location action buttons */
.loc-action-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  color: #8E8E93;
  transition: all 0.15s;
}
.loc-action-btn:hover {
  background: rgba(0,122,255,0.1);
  color: #007AFF;
}
.loc-delete-btn:hover {
  background: rgba(255,59,48,0.1);
  color: #FF3B30;
}

/* ── Location Modal ─────────────────────────── */
.loc-modal-content {
  text-align: left !important;
  max-width: 440px !important;
  background: #fff !important;
  border-radius: 16px !important;
  padding: 28px 30px 24px !important;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25), 0 0 0 1px rgba(0,0,0,0.06) !important;
  max-height: 90vh;
  overflow-y: auto;
}
.loc-modal-content .modal-title {
  text-align: center;
  margin-bottom: 20px;
  font-size: 1.1rem;
  font-weight: 700;
  color: #1a1a2e;
}
.loc-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.loc-full { grid-column: 1 / -1; }
.loc-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.loc-field > span {
  font-size: 0.7rem;
  font-weight: 600;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.loc-field input, .loc-field select {
  padding: 10px 12px;
  border: 1.5px solid #e0e0e6;
  border-radius: 8px;
  font-size: 0.84rem;
  font-family: 'Inter', sans-serif;
  background: #fff;
  color: #1a1a2e;
  transition: border-color 0.15s, box-shadow 0.15s;
  -webkit-appearance: none;
}
.loc-field select {
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23555' stroke-width='2.5'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E") no-repeat right 10px center;
  padding-right: 30px;
}
.loc-field input:focus, .loc-field select:focus {
  outline: none;
  border-color: #007AFF;
  box-shadow: 0 0 0 3px rgba(0,122,255,0.12);
}
/* Divider between store info and location picker */
.loc-section-divider {
  height: 1px;
  background: #e8e8ed;
  margin: 16px 0 14px;
}
/* Address search */
.loc-search-wrap {
  position: relative;
  margin-bottom: 12px;
}
.loc-search-results {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 10;
  background: #fff;
  border: 1px solid #e0e0e6;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  max-height: 180px;
  overflow-y: auto;
  margin-top: 4px;
}
.loc-search-result {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  font-size: 0.76rem;
  color: #333;
  cursor: pointer;
  border-bottom: 1px solid #f0f0f0;
  transition: background 0.1s;
}
.loc-search-result:last-child { border-bottom: none; }
.loc-search-result:hover { background: #f0f5ff; }
.loc-search-result span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: #333;
}
.loc-search-loading {
  padding: 10px 12px;
  font-size: 0.74rem;
  color: #999;
  text-align: center;
}
/* Compact coordinate row */
.loc-coord-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}
.loc-coord-row input {
  background: #f7f7fa;
  font-size: 0.8rem;
}
.loc-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}
.btn-secondary {
  padding: 11px 24px;
  border: 1.5px solid #ddd;
  border-radius: 10px;
  background: #fff;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  color: #555;
  transition: all 0.15s;
}
.btn-secondary:hover {
  background: #f5f5f5;
  border-color: #bbb;
}
.btn-primary {
  padding: 11px 30px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, #007AFF, #5856D6);
  color: #fff;
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  transition: all 0.2s;
  box-shadow: 0 2px 8px rgba(0,122,255,0.25);
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(0,122,255,0.35);
}

/* ── Scrollbar ─────────────────────────────── */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.1);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.2);
}

/* ══════ Pitch Page ══════ */
.pitch-tab-toggle {
  display: inline-flex;
  gap: 4px;
  background: rgba(0, 0, 0, 0.04);
  border-radius: 8px;
  padding: 3px;
}
.pitch-tab { display: none; }
.pitch-tab.active { display: block; }

/* ── Deck Slideshow ── */
.deck-slideshow {
  position: relative;
  background: #f4f5f7;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 4px 24px rgba(0,0,0,0.08);
}
.deck-slideshow.fullscreen {
  position: fixed; inset: 0; z-index: 9999;
  border-radius: 0; background: #f7f8fa;
  display: flex; flex-direction: column;
}
.deck-controls {
  position: absolute; top: 12px; right: 16px; z-index: 10;
  display: flex; align-items: center; gap: 8px;
}
.deck-btn {
  display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border: none; border-radius: 10px;
  background: rgba(0,0,0,0.06); cursor: pointer;
  color: var(--text-primary); transition: all 0.15s;
}
.deck-btn:hover { background: rgba(0,0,0,0.12); }
.deck-btn:disabled { opacity: 0.3; cursor: default; }
.deck-counter {
  font-size: 0.78rem; font-weight: 600;
  color: var(--text-secondary); min-width: 50px; text-align: center;
}

/* Slide base */
.deck-slide {
  display: none; flex-direction: column; position: relative;
  min-height: 560px; padding: 32px 40px 24px;
}
.deck-slide.active { display: flex; }
.deck-slideshow.fullscreen .deck-slide {
  min-height: 100vh; height: 100vh; padding: 48px 80px 36px;
  justify-content: center; align-items: center; overflow-y: auto;
}
.deck-slideshow.fullscreen .deck-slide .slide-header,
.deck-slideshow.fullscreen .deck-slide .slide-body,
.deck-slideshow.fullscreen .deck-slide .slide-footer {
  width: 100%; max-width: 1200px;
}
.deck-slideshow.fullscreen .deck-slide .slide-body {
  flex: 1;
}
.deck-slideshow.fullscreen .slide-title { font-size: 2rem; }
.deck-slideshow.fullscreen .slide-subtitle { font-size: 1rem; }
.deck-slideshow.fullscreen .slide-kpi-value { font-size: 2.2rem; }
.deck-slideshow.fullscreen .slide-big-value { font-size: 2.8rem; }
.deck-slideshow.fullscreen .slide-chart { min-height: 320px; }
.deck-slideshow.fullscreen .slide-card-header h3 { font-size: 1rem; }
.deck-slideshow.fullscreen .slide-metric-value { font-size: 2.6rem; }
.deck-slideshow.fullscreen .slide-metric-label { font-size: 0.9rem; }
.deck-slideshow.fullscreen .slide-metric-desc { font-size: 0.95rem; }
.deck-slideshow.fullscreen .slide-metric-card .card-icon-wrap { width: 56px; height: 56px; }
.deck-slideshow.fullscreen .slide-metric-card { padding: 24px 28px; gap: 20px; }
.deck-slideshow.fullscreen .slide-kpi-row { gap: 20px; }
.deck-slideshow.fullscreen .slide-two-col,
.deck-slideshow.fullscreen .slide-three-col { gap: 28px; }

/* Slide header */
.slide-header {
  display: flex; flex-wrap: wrap; align-items: baseline;
  gap: 16px; margin-bottom: 20px; padding-bottom: 12px;
  border-bottom: 2px solid #e2e8f0;
}
.slide-title {
  font-size: 1.6rem; font-weight: 800;
  color: var(--text-primary); margin: 0;
}
.slide-subtitle {
  font-size: 0.85rem; color: var(--text-tertiary);
}
.slide-brand {
  position: absolute; bottom: 12px; right: 20px; font-size: 0.72rem; font-weight: 700;
  color: var(--text-tertiary); letter-spacing: 1.5px; opacity: 0.6;
}
.slide-footer {
  margin-top: auto; padding-top: 12px; text-align: center;
  font-size: 0.68rem; color: var(--text-tertiary);
  border-top: 1px solid #e2e8f0;
}

/* Slide body */
.slide-body { flex: 1; display: flex; flex-direction: column; gap: 16px; }

/* Slide KPI row */
.slide-kpi-row {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px;
}
.slide-kpi-card {
  background: var(--card-bg); border-radius: 14px; padding: 16px 20px;
  border: 1px solid var(--card-border);
  display: flex; align-items: center; gap: 14px;
  transition: var(--transition);
}
.slide-kpi-card:hover { box-shadow: var(--card-hover-shadow); }
.slide-kpi-card .card-icon-wrap { flex-shrink: 0; }
.slide-kpi-label {
  display: block; font-size: 0.62rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.6px;
  color: var(--text-tertiary); margin-bottom: 4px;
}
.slide-kpi-value {
  display: block; font-size: 1.8rem; font-weight: 800;
  color: var(--text-primary); line-height: 1.15;
}
.slide-kpi-desc {
  display: block; font-size: 0.72rem; margin-top: 2px;
}

/* Slide layouts */
.slide-two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.slide-three-col { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; }
.slide-card {
  background: var(--card-bg); border-radius: 14px; padding: 20px;
  border: 1px solid var(--card-border);
  transition: var(--transition);
}
.slide-card:hover { box-shadow: var(--card-hover-shadow); }
.slide-card-header {
  display: flex; justify-content: space-between;
  align-items: center; margin-bottom: 8px;
}
.slide-card-header h3 { margin: 0; font-size: 0.9rem; font-weight: 700; }
.slide-chart { width: 100%; }

/* Slide badges */
.slide-badge {
  display: inline-block; padding: 3px 10px; border-radius: 20px;
  font-size: 0.68rem; font-weight: 700;
}
.slide-badge.green { background: #dcfce7; color: #16a34a; }
.slide-badge.amber { background: #fef3c7; color: #d97706; }

/* Slide entrance animations */
/* Cards inside slides start invisible until animation class is added */
.deck-slide .slide-kpi-card,
.deck-slide .slide-metric-card,
.deck-slide .slide-card,
.deck-slide .slide-insight-card,
.deck-slide .slide-check-card {
  opacity: 0;
  transform: translateY(24px) scale(0.96);
}
.deck-slide .slide-header,
.deck-slide .slide-footer {
  opacity: 0;
}

@keyframes slideCardIn {
  from { opacity: 0; transform: translateY(24px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes slideHeaderIn {
  from { opacity: 0; transform: translateY(-12px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes slideFooterIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
.slide-animate-in {
  animation: slideCardIn 0.55s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.slide-header-animate {
  animation: slideHeaderIn 0.4s ease both;
}
.slide-footer-animate {
  animation: slideFooterIn 0.5s ease 0.35s both;
}

/* Inner element animations (breakdown items, tags, bars, values) */
@keyframes staggerIn {
  from { opacity: 0; transform: translateX(-16px); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes growUp {
  from { transform: scaleY(0); }
  to { transform: scaleY(1); }
}
@keyframes valuePop {
  0% { opacity: 0; transform: scale(0.6); }
  60% { opacity: 1; transform: scale(1.08); }
  100% { opacity: 1; transform: scale(1); }
}
.anim-stagger-in {
  animation: staggerIn 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.anim-grow-up {
  transform-origin: bottom center;
  animation: growUp 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
.anim-value-pop {
  animation: valuePop 0.6s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.anim-width-in {
  transition: width 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}

/* Initial hidden states for inner animated elements */
.deck-slide .slide-breakdown-item,
.deck-slide .slide-tag,
.deck-slide .slide-divider,
.deck-slide .slide-footnote,
.deck-slide .slide-text-small,
.deck-slide .slide-insight-card h4,
.deck-slide .slide-insight-card p,
.deck-slide .slide-insight-card .card-icon-wrap {
  opacity: 0;
}
.deck-slide .slide-ramp-bar {
  transform: scaleY(0);
  transform-origin: bottom center;
}
.deck-slide .slide-big-value,
.deck-slide .slide-kpi-value {
  opacity: 0;
}

/* Bullet-style text reveal animation (staggered slide-in, no physical bullet dot) */
@keyframes bulletTextSlide {
  from { opacity: 0; transform: translateX(-18px); filter: blur(3px); }
  to { opacity: 1; transform: translateX(0); filter: blur(0); }
}
.anim-bullet-in {
  animation: bulletTextSlide 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* Initial hidden states for bullet-animated elements */
.deck-slide .slide-check-card,
.deck-slide .slide-assumption-item {
  opacity: 0;
}

/* Pitch chart tooltip */
.pitch-chart-tip {
  position: fixed; pointer-events: none; z-index: 9999;
  background: rgba(30, 30, 30, 0.92); color: #fff;
  border-radius: 10px; padding: 10px 14px;
  font-size: 0.75rem; line-height: 1.5;
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 4px 20px rgba(0,0,0,0.18);
  opacity: 0; transform: translateY(4px);
  transition: opacity 0.15s ease, transform 0.15s ease;
  max-width: 220px;
}
.pitch-chart-tip.visible {
  opacity: 1; transform: translateY(0);
}
.pitch-chart-tip .tip-title {
  font-weight: 700; font-size: 0.8rem; margin-bottom: 4px;
  color: #f0f0f0;
}
.pitch-chart-tip .tip-row {
  display: flex; justify-content: space-between; gap: 16px;
  padding: 2px 0;
}
.pitch-chart-tip .tip-dot {
  display: inline-block; width: 8px; height: 8px;
  border-radius: 50%; margin-right: 6px; vertical-align: middle;
}
.pitch-chart-tip .tip-label { color: #ccc; }
.pitch-chart-tip .tip-val { font-weight: 600; color: #fff; }
.pitch-chart-tip .tip-divider {
  height: 1px; background: rgba(255,255,255,0.12); margin: 4px 0;
}
.pitch-chart-tip .tip-total {
  font-weight: 700; font-size: 0.82rem;
}

/* Revenue Progression (slide 4) */
.revenue-progression {
  display: flex; align-items: center; gap: 0; justify-content: center;
}
.rev-step {
  text-align: center; flex: 1;
  opacity: 0; transform: translateY(12px) scale(0.9);
}
.rev-step-label {
  display: block; font-size: 0.72rem; color: var(--text-tertiary);
  font-weight: 600; text-transform: uppercase; letter-spacing: 0.3px;
  margin-bottom: 4px;
}
.rev-step-value {
  display: block;
}
.rev-step-bar {
  display: block; height: 4px; background: rgba(0,0,0,0.06);
  border-radius: 2px; margin-top: 8px; overflow: hidden;
}
.rev-step-bar span {
  display: block; height: 100%; border-radius: 2px;
  width: 0 !important;
  transition: width 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}
.rev-step.anim-step-in {
  animation: revStepIn 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.rev-step.anim-step-in .rev-step-bar span {
  width: var(--bar-w) !important;
}
.rev-chevron {
  flex-shrink: 0; padding: 0 4px;
  opacity: 0; transform: translateX(-8px);
}
.rev-chevron.anim-chevron-in {
  animation: revChevronIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
@keyframes revStepIn {
  from { opacity: 0; transform: translateY(12px) scale(0.9); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes revChevronIn {
  from { opacity: 0; transform: translateX(-8px) scale(0.5); }
  to { opacity: 1; transform: translateX(0) scale(1); }
}

/* Slide metrics grid (2x2 on exec summary) */
.slide-metrics-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
}
.slide-two-col > .slide-metrics-grid {
  height: 100%;
}
.slide-two-col > .slide-metrics-grid > .slide-metric-card {
  height: 100%;
}
.slide-metric-card {
  background: var(--card-bg); border-radius: 14px; padding: 20px 22px;
  border: 1px solid var(--card-border);
  display: flex; align-items: center; gap: 16px;
  transition: var(--transition);
}
.slide-metric-card:hover { box-shadow: var(--card-hover-shadow); }
.slide-metric-card .card-icon-wrap { flex-shrink: 0; width: 48px; height: 48px; border-radius: 12px; }
.slide-metric-card .card-icon-wrap svg { width: 22px; height: 22px; }
.slide-metric-content { min-width: 0; flex: 1; }
.slide-metric-label {
  display: block; font-size: 0.78rem; font-weight: 700;
  color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 0.5px;
  margin-bottom: 4px;
}
.slide-metric-value {
  display: block; font-size: 2rem; font-weight: 900;
  color: var(--text-primary); line-height: 1.1;
  letter-spacing: -0.5px;
}
.slide-metric-desc {
  display: block; font-size: 0.82rem; color: var(--text-secondary); margin-top: 4px; font-weight: 500;
}

/* Big value text */
.slide-big-value {
  display: block; font-size: 2.4rem; font-weight: 800;
  color: var(--text-primary); line-height: 1.1;
}

/* Slide helpers */
.slide-divider { height: 1px; background: rgba(0,0,0,0.06); margin: 12px 0; }
.slide-footnote { font-size: 0.7rem; color: var(--text-tertiary); }
.slide-text-small { font-size: 0.72rem; color: var(--text-tertiary); display: block; }
.slide-breakdown-list { display: flex; flex-direction: column; gap: 8px; }
.slide-breakdown-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 0; border-bottom: 1px solid rgba(0,0,0,0.04);
  font-size: 0.82rem;
}
.slide-breakdown-item span:last-child { font-weight: 600; }
.slide-breakdown-item.total-row {
  border-top: 2px solid var(--text-primary); border-bottom: none;
  font-weight: 700; padding-top: 10px; margin-top: 4px;
}

/* Ramp visual */
.slide-ramp-visual {
  display: flex; align-items: flex-end; gap: 12px;
  justify-content: center; margin: 16px 0;
}
.slide-ramp-bar {
  width: 50px; border-radius: 8px 8px 0 0;
  display: flex; align-items: flex-end; justify-content: center;
  padding-bottom: 4px; font-size: 0.7rem; font-weight: 700; color: #16a34a;
}

/* Tags */
.slide-tag-row { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.slide-tag {
  display: inline-block; padding: 3px 10px; border-radius: 6px;
  font-size: 0.72rem; font-weight: 600;
  background: rgba(0,0,0,0.04); color: var(--text-secondary);
}
.slide-tag.green { background: #dcfce7; color: #16a34a; }
.slide-tag.amber { background: #fef3c7; color: #d97706; }

/* Insight cards */
.slide-insight-card {
  background: var(--card-bg); border-radius: var(--radius-sm); padding: 14px 16px;
  border: 1px solid var(--card-border);
  display: flex; align-items: flex-start; gap: 12px;
}
.slide-insight-card .card-icon-wrap { width: 36px; height: 36px; flex-shrink: 0; }
.slide-insight-card h4 { margin: 0 0 4px; font-size: 0.85rem; }
.slide-insight-card p { margin: 0; font-size: 0.78rem; color: var(--text-secondary); line-height: 1.4; }

/* Progress bar */
.slide-progress-bar {
  height: 6px; background: rgba(0,0,0,0.06); border-radius: 3px;
  overflow: hidden; margin: 8px 0 4px;
}
.slide-progress-bar div { height: 100%; border-radius: 3px; }

/* Legend */
.slide-legend { display: flex; gap: 12px; flex-wrap: wrap; }
.slide-legend-item { display: flex; align-items: center; gap: 4px; font-size: 0.7rem; color: var(--text-secondary); }
.slide-legend-dot { width: 10px; height: 10px; border-radius: 3px; }

/* Sensitivity slide */
.slide-scale-bar {
  display: flex; align-items: center; gap: 12px;
  background: #f7f8fa; border-radius: 10px; padding: 10px 16px;
}
.slide-scale-label { font-size: 0.72rem; font-weight: 600; color: var(--text-secondary); white-space: nowrap; }
.slide-scale-track { display: flex; flex: 1; height: 32px; border-radius: 8px; overflow: hidden; }
.slide-scale-seg {
  display: flex; align-items: center; justify-content: center;
  font-size: 0.72rem; font-weight: 700; color: white;
}
.slide-scale-seg.amber { flex: 4; background: #F59E0B; }
.slide-scale-seg.green { flex: 6; background: #34C759; }
.slide-vs-col {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 8px;
}
.slide-scenario-metrics { display: flex; flex-direction: column; gap: 14px; }
.slide-scenario-row {
  display: flex; justify-content: space-between; align-items: baseline;
}
.slide-scenario-row .label { font-size: 0.72rem; color: var(--text-tertiary); text-transform: uppercase; }
.slide-scenario-row .value { font-size: 1.5rem; font-weight: 800; letter-spacing: -0.3px; }
.slide-scenario-row .desc { font-size: 0.72rem; margin-left: 8px; }
.deck-slide .slide-scenario-row { opacity: 0; transform: translateY(8px); }
.slide-check-card {
  background: #f7f8fa; border-radius: 10px; padding: 12px 16px;
  font-size: 0.78rem; color: var(--text-secondary); line-height: 1.4;
}


/* ── Tech Infographic — Hub & Spoke (Slide 7) ─────────── */

.tech-infographic {
  display: flex;
  align-items: stretch;
  flex: 1;
  min-height: 0;
}

/* Source & Impact columns */
.tech-col {
  display: flex;
  flex-direction: column;
  gap: 8px;
  justify-content: center;
  width: 20%;
  flex-shrink: 0;
}
.tech-col-label {
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--text-tertiary);
  text-align: center;
  margin-bottom: 2px;
}

/* Source cards */
.tech-source {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border-radius: 10px;
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--text-primary);
  opacity: 0;
  transform: translateX(-20px);
}
.tech-source-icon {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* Impact cards */
.tech-impact {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border-radius: 10px;
  opacity: 0;
  transform: translateX(20px);
}
.tech-impact-val {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--imp-color);
  line-height: 1;
  letter-spacing: -0.02em;
}
.tech-impact-lbl {
  font-size: 0.62rem;
  font-weight: 600;
  color: var(--text-secondary);
  line-height: 1.2;
}

/* Connector columns */
.tech-conn-col {
  width: 8%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  padding: 20px 0;
}
.tech-conn-svg {
  width: 100%;
  height: 100%;
}
.tech-conn-path {
  stroke-dasharray: 200;
  stroke-dashoffset: 200;
}
.tech-conn-arrow {
  opacity: 0;
}

/* Center hub */
.tech-hub-col {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 0;
}
.tech-hub {
  width: 100%;
  max-width: 220px;
  padding: 22px 18px;
  border-radius: 16px;
  text-align: center;
  position: relative;
  overflow: hidden;
  opacity: 0;
  transform: scale(0.85);
}
.tech-hub-glow {
  position: absolute;
  inset: -30px;
  background: radial-gradient(circle at center, rgba(79,70,229,0.07) 0%, transparent 70%);
  pointer-events: none;
}
.tech-hub-orb {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4F46E5, #7C3AED);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 10px;
  box-shadow: 0 4px 20px rgba(79,70,229,0.3);
  position: relative;
}
.tech-hub-orb::after {
  content: '';
  position: absolute;
  inset: -5px;
  border-radius: 50%;
  border: 2px solid rgba(79,70,229,0.15);
}
.tech-hub-name {
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--text-primary);
  line-height: 1.3;
  margin-bottom: 10px;
}
.tech-hub-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  justify-content: center;
}
.tech-hub-pill {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 0.58rem;
  font-weight: 600;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  color: var(--text-secondary);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

/* Capability modules grid (6 items, 3 per row) */
.tech-modules {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.tech-module {
  flex: 1 1 calc(33.333% - 6px);
  min-width: 160px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 10px;
  opacity: 0;
  transform: translateY(16px);
}
.tech-module-icon {
  width: 32px;
  height: 32px;
  border-radius: 7px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.tech-module-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.tech-module-text strong {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-primary);
}
.tech-module-text span {
  font-size: 0.62rem;
  color: var(--text-secondary);
  line-height: 1.35;
}

/* Fullscreen scaling for tech infographic */
.deck-slideshow.fullscreen .tech-source { padding: 12px 16px; font-size: 0.88rem; }
.deck-slideshow.fullscreen .tech-source-icon { width: 34px; height: 34px; }
.deck-slideshow.fullscreen .tech-hub { max-width: 300px; padding: 32px 24px; }
.deck-slideshow.fullscreen .tech-hub-orb { width: 68px; height: 68px; }
.deck-slideshow.fullscreen .tech-hub-orb svg { width: 36px; height: 36px; }
.deck-slideshow.fullscreen .tech-hub-name { font-size: 1.1rem; }
.deck-slideshow.fullscreen .tech-hub-pill { font-size: 0.72rem; padding: 5px 12px; }
.deck-slideshow.fullscreen .tech-impact-val { font-size: 1.5rem; }
.deck-slideshow.fullscreen .tech-impact-lbl { font-size: 0.76rem; }
.deck-slideshow.fullscreen .tech-impact { padding: 14px 18px; }
.deck-slideshow.fullscreen .tech-module { padding: 16px 20px; }
.deck-slideshow.fullscreen .tech-module-icon { width: 44px; height: 44px; }
.deck-slideshow.fullscreen .tech-module-text strong { font-size: 0.9rem; }
.deck-slideshow.fullscreen .tech-module-text span { font-size: 0.76rem; }

/* Mini table */
.slide-mini-table {
  width: 100%; border-collapse: collapse; font-size: 0.78rem;
}
.slide-mini-table th {
  padding: 8px 10px; text-align: left; font-weight: 600;
  font-size: 0.7rem; color: var(--text-tertiary);
  border-bottom: 1px solid rgba(0,0,0,0.08);
}
.slide-mini-table td {
  padding: 8px 10px; border-bottom: 1px solid rgba(0,0,0,0.04);
}
.deck-slide .slide-mini-table tr { opacity: 0; transform: translateY(8px); }

/* Assumptions list */
.slide-assumptions-list { display: flex; flex-direction: column; gap: 6px; }
.slide-assumption-item {
  display: flex; align-items: flex-start; gap: 6px;
  font-size: 0.72rem; color: #E2E8F0; line-height: 1.3;
}
.slide-assumption-item strong { color: white; }

/* Scale bar animation (slide 6) */
.deck-slide .slide-scale-bar { opacity: 0; transform: translateY(12px); }
.deck-slide .slide-scale-seg { transform: scaleX(0); transform-origin: left center; }
@keyframes scaleSegIn {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

/* Deploy bars (slide 10) */
.slide-deploy-stack { display: flex; flex-direction: column; gap: 8px; flex: 1; }
.slide-deploy-bar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 14px; border-radius: 10px; color: white; font-size: 0.78rem;
  position: relative; overflow: hidden;
}
.slide-deploy-bar strong { font-size: 1rem; }
.slide-deploy-pct { font-size: 0.7rem; opacity: 0.7; }
.deck-slide .slide-deploy-bar { opacity: 0; transform: translateX(-20px); }
@keyframes deployBarIn {
  from { opacity: 0; transform: translateX(-20px); }
  to { opacity: 1; transform: translateX(0); }
}

/* Timeline vertical (slide 10) */
.slide-timeline-vertical { display: flex; flex-direction: column; gap: 0; }
.slide-timeline-step {
  display: flex; gap: 12px; position: relative;
  padding-bottom: 4px;
}
/* Remove old static connector line */
.slide-timeline-step::before { display: none; }

/* Dot wrapper for pulse ring positioning */
.slide-timeline-dot-wrap {
  position: relative; width: 32px; height: 32px; flex-shrink: 0;
}
.slide-timeline-dot {
  width: 32px; height: 32px; border-radius: 10px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.8rem; position: relative; z-index: 2;
}
/* Pulse ring around dot */
.slide-timeline-dot-ring {
  position: absolute; top: -4px; left: -4px; width: 40px; height: 40px;
  border-radius: 12px; border: 2px solid transparent;
  opacity: 0; z-index: 1;
  pointer-events: none;
}
.slide-timeline-dot-ring.timeline-ring-pulse {
  animation: timelineDotPulse 0.6s cubic-bezier(0.22,1,0.36,1) forwards;
}
@keyframes timelineDotPulse {
  0% { opacity: 0; transform: scale(0.6); }
  50% { opacity: 0.7; transform: scale(1.15); }
  100% { opacity: 0.35; transform: scale(1); }
}

/* Animated connector line between steps */
.slide-timeline-connector {
  width: 2px; height: 16px; margin-left: 15px;
  border-left: 2px solid #34C759;
  transform-origin: top center;
  transform: scaleY(0);
}

.slide-timeline-content {
  flex: 1; display: flex; justify-content: space-between; align-items: center;
}
.slide-timeline-label { font-size: 0.65rem; color: var(--text-tertiary); text-transform: uppercase; }
.slide-timeline-text { font-size: 0.85rem; font-weight: 700; }
.slide-timeline-note { font-size: 0.7rem; color: var(--text-secondary); }
.slide-timeline-count {
  text-align: center; font-size: 0.68rem; color: var(--text-tertiary);
}
.slide-timeline-count strong { display: block; font-size: 1.2rem; color: var(--text-primary); }
.deck-slide .slide-timeline-step { opacity: 0; transform: scale(0.92) translateY(8px); }

/* Invest comparison bars (slide 10) */
.slide-invest-bars { margin-top: 8px; }
.deck-slide .slide-invest-row { opacity: 0; transform: translateY(8px); }
.slide-invest-bar-fill { transition: width 0.8s cubic-bezier(0.22, 1, 0.36, 1); }
.slide-invest-row {
  display: flex; align-items: center; gap: 8px; margin-bottom: 6px;
  font-size: 0.78rem;
}
.slide-invest-row span:first-child { width: 50px; font-weight: 600; color: var(--text-secondary); }
.slide-invest-bar-wrap { flex: 1; height: 24px; background: rgba(0,0,0,0.04); border-radius: 6px; overflow: hidden; position: relative; }
.slide-invest-bar-fill { height: 100%; border-radius: 6px; display: flex; align-items: center; justify-content: flex-end; padding-right: 8px; font-weight: 700; color: white; font-size: 0.72rem; }

/* P&L Table (reused for 10cr/4cr tabs) */
.pitch-pnl-table {
  width: 100%; border-collapse: collapse; font-size: 0.78rem;
}
.pitch-pnl-table th {
  padding: 10px 14px; text-align: right; font-weight: 700;
  font-size: 0.7rem; text-transform: uppercase;
  color: var(--text-tertiary); border-bottom: 2px solid rgba(0,0,0,0.06);
}
.pitch-pnl-table th:first-child { text-align: left; }
.pitch-pnl-table td {
  padding: 8px 14px; text-align: right;
  border-bottom: 1px solid rgba(0,0,0,0.03); color: var(--text-secondary);
}
.pitch-pnl-table td:first-child { text-align: left; color: var(--text-primary); }
.pitch-row-bold td { font-weight: 700; color: var(--text-primary); }
.pitch-row-highlight td { font-weight: 700; color: #34C759; background: rgba(52, 199, 89, 0.04); }
.pitch-row-cost td:first-child { padding-left: 24px; }

/* ── Pitch Inline Edit Popup ── */
.pitch-edit-overlay {
  position: fixed; inset: 0; z-index: 10000;
  background: rgba(0,0,0,0.35); backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center;
  animation: pitchEditFadeIn 0.15s ease;
}
@keyframes pitchEditFadeIn { from { opacity: 0; } to { opacity: 1; } }

.pitch-edit-popup {
  background: #fff; border-radius: 14px; padding: 20px 22px;
  box-shadow: 0 12px 48px rgba(0,0,0,0.18), 0 0 0 1px rgba(0,0,0,0.06);
  width: 400px; max-width: calc(100vw - 32px); max-height: calc(100vh - 64px);
  display: flex; flex-direction: column; gap: 14px;
  animation: pitchEditSlideIn 0.2s ease;
}
@keyframes pitchEditSlideIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }

.pitch-edit-popup h4 {
  margin: 0; font-size: 0.85rem; color: var(--text-primary);
  display: flex; align-items: center; gap: 8px;
}
.pitch-edit-popup h4 svg { color: var(--accent-blue); flex-shrink: 0; }

.pitch-edit-popup textarea {
  width: 100%; min-height: 80px; max-height: 200px; resize: vertical;
  border: 1.5px solid var(--card-border); border-radius: 8px;
  padding: 10px 12px; font-family: inherit; font-size: 0.85rem;
  line-height: 1.5; color: var(--text-primary); background: var(--card-bg);
  transition: border-color 0.15s;
  box-sizing: border-box;
}
.pitch-edit-popup textarea:focus {
  outline: none; border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(0,122,255,0.1);
}

.pitch-edit-actions {
  display: flex; gap: 8px; justify-content: flex-end;
}
.pitch-edit-actions button {
  padding: 8px 18px; border-radius: 8px; font-size: 0.78rem;
  font-weight: 600; cursor: pointer; border: none; transition: var(--transition);
}
.pitch-edit-cancel {
  background: rgba(0,0,0,0.05); color: var(--text-secondary);
}
.pitch-edit-cancel:hover { background: rgba(0,0,0,0.1); }
.pitch-edit-save {
  background: var(--accent-blue); color: #fff;
}
.pitch-edit-save:hover { background: #0066d6; }
.pitch-edit-reset {
  margin-right: auto; background: none; color: #FF3B30;
  font-size: 0.72rem; padding: 8px 12px;
}
.pitch-edit-reset:hover { background: rgba(255,59,48,0.08); }

.pitch-edit-hint {
  font-size: 0.65rem; color: var(--text-tertiary); margin: 0;
}

/* Chart editor form fields */
.pitch-edit-popup .chart-edit-grid {
  display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px;
}
.pitch-edit-popup .chart-edit-field {
  display: flex; flex-direction: column; gap: 4px;
}
.pitch-edit-popup .chart-edit-field label {
  font-size: 0.7rem; font-weight: 600; color: var(--text-secondary);
  text-transform: uppercase; letter-spacing: 0.3px;
}
.pitch-edit-popup .chart-edit-field input {
  border: 1.5px solid var(--card-border); border-radius: 8px;
  padding: 8px 10px; font-family: inherit; font-size: 0.85rem;
  color: var(--text-primary); background: var(--card-bg);
  transition: border-color 0.15s; width: 100%; box-sizing: border-box;
}
.pitch-edit-popup .chart-edit-field input:focus {
  outline: none; border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(0,122,255,0.1);
}
.pitch-edit-popup .chart-edit-section {
  font-size: 0.72rem; font-weight: 700; color: var(--text-tertiary);
  text-transform: uppercase; letter-spacing: 0.3px;
  padding-bottom: 4px; border-bottom: 1px solid rgba(0,0,0,0.06);
  margin-top: 6px; grid-column: 1 / -1;
}

/* Chart container editable highlight */
#page-pitch .slide-chart:hover,
#page-pitch .chart-body:hover {
  outline: 2px dashed rgba(0,122,255,0.3);
  outline-offset: 2px;
  cursor: pointer;
  border-radius: 4px;
}

/* Editable element highlight on hover */
#page-pitch [data-pitch-editable]:hover {
  outline: 2px dashed rgba(0,122,255,0.3);
  outline-offset: 2px;
  cursor: text;
  border-radius: 4px;
}

/* Comparison Table (reused) */
.pitch-comparison-table { width: 100%; border-collapse: collapse; font-size: 0.8rem; }
.pitch-comparison-table th {
  padding: 10px 12px; text-align: left; font-weight: 700;
  font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.3px;
  color: var(--text-tertiary); border-bottom: 2px solid rgba(0,0,0,0.06);
}
.pitch-comparison-table td { padding: 10px 12px; border-bottom: 1px solid rgba(0,0,0,0.04); }
.pitch-val-10cr { font-weight: 600; color: #6366F1; }
.pitch-val-4cr { font-weight: 600; color: #F59E0B; }
.pitch-delta.positive { color: #34C759; font-weight: 600; }
.pitch-delta.negative { color: #FF3B30; font-weight: 600; }

/* ── Pitch: Tablet (≤1024px) ── */
@media (max-width: 1024px) {
  .slide-two-col { grid-template-columns: 1fr 1fr; }
  .slide-three-col { grid-template-columns: 1fr 1fr; }
  .slide-kpi-row { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .slide-metrics-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .slide-vs-col { min-width: 0; }
}

/* ── Pitch: Mobile (≤768px) ── */
@media (max-width: 768px) {
  /* Pitch header & toggle */
  #page-pitch .comm-header {
    flex-direction: column;
    gap: 10px;
    align-items: flex-start;
  }
  .pitch-tab-toggle {
    width: 100%;
    justify-content: center;
  }

  /* Deck slideshow container */
  .deck-slideshow {
    border-radius: 10px;
    margin: 0 -4px;
  }
  .deck-slide {
    padding: 16px 14px 14px;
    min-height: auto;
  }
  .deck-controls {
    top: 6px;
    right: 6px;
    gap: 4px;
  }
  .deck-btn { width: 30px; height: 30px; }
  .deck-counter { font-size: 0.65rem; padding: 3px 8px; }

  /* Slide header */
  .slide-header { padding-bottom: 10px; margin-bottom: 10px; }
  .slide-title { font-size: 1.1rem; }
  .slide-subtitle { font-size: 0.72rem; }
  .slide-brand { font-size: 0.55rem; letter-spacing: 2px; }

  /* Slide body spacing */
  .slide-body { gap: 12px; }

  /* KPI row — 2 per row on mobile */
  .slide-kpi-row {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }
  .slide-kpi-card { padding: 10px; gap: 8px; }
  .slide-kpi-card .card-icon-wrap { width: 32px; height: 32px; }
  .slide-kpi-card .card-icon-wrap svg { width: 16px; height: 16px; }
  .slide-kpi-label { font-size: 0.55rem; }
  .slide-kpi-value { font-size: 1.1rem; }
  .slide-kpi-desc { font-size: 0.6rem; }

  /* Grid layouts — stack on mobile */
  .slide-two-col,
  .slide-three-col {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .slide-two-col[style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
  }

  /* Metrics grid — 2 col on mobile */
  .slide-metrics-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }
  .slide-metric-card { padding: 12px; gap: 10px; }
  .slide-metric-card .card-icon-wrap { width: 36px; height: 36px; }
  .slide-metric-label { font-size: 0.65rem; }
  .slide-metric-value { font-size: 1.2rem; }
  .slide-metric-desc { font-size: 0.68rem; }

  /* Charts in slides */
  .slide-chart { min-height: 200px !important; }
  .slide-card { padding: 12px; }
  .slide-card-header h3 { font-size: 0.8rem; }



  /* Insight cards */
  .slide-insight-card { padding: 10px 12px; gap: 10px; }
  .slide-insight-card .card-icon-wrap { width: 30px; height: 30px; }
  .slide-insight-card h4 { font-size: 0.78rem; }
  .slide-insight-card p { font-size: 0.7rem; }

  /* Tables in slides */
  .slide-mini-table { font-size: 0.68rem; }
  .slide-mini-table th { padding: 6px 8px; font-size: 0.58rem; }
  .slide-mini-table td { padding: 6px 8px; }

  /* Scenario comparison — stack vs cols */
  .slide-vs-col { min-width: 0; }
  .slide-scenario-row .value { font-size: 1rem; }
  .slide-scenario-row .desc { font-size: 0.6rem; }

  /* Breakdown lists */
  .slide-breakdown-item { font-size: 0.72rem; }

  /* Footer */
  .slide-footer { padding-top: 8px; margin-top: 8px; }
  .slide-footer span { font-size: 0.6rem; }

  /* Fullscreen overrides for mobile */
  .deck-slideshow.fullscreen .deck-slide {
    padding: 16px 14px;
  }
  .deck-slideshow.fullscreen .slide-title { font-size: 1.3rem; }
  .deck-slideshow.fullscreen .slide-kpi-value { font-size: 1.4rem; }
  .deck-slideshow.fullscreen .slide-kpi-row { gap: 10px; }
  .deck-slideshow.fullscreen .slide-two-col,
  .deck-slideshow.fullscreen .slide-three-col { gap: 14px; }
  .deck-slideshow.fullscreen .slide-chart { min-height: 240px; }

  /* 10Cr / 4Cr tab — P&L table scroll */
  .pitch-pnl-table { font-size: 0.7rem; min-width: 500px; }
  .pitch-comparison-table { font-size: 0.7rem; min-width: 400px; }
  #pitch-10cr-pnl-table,
  #pitch-4cr-pnl-table {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Scale bar */
  .slide-scale-bar { flex-direction: column; gap: 6px; }
  .slide-scale-label { font-size: 0.65rem; }
  .slide-scale-track { height: 24px; }

  /* Progress bar */
  .slide-progress-bar { height: 6px; }

  /* Big values */
  .slide-big-value { font-size: 1.6rem; }

  /* Ramp visual */
  .slide-ramp-visual { gap: 4px; }
  .slide-ramp-bar { font-size: 0.6rem; }

  /* Tags */
  .slide-tag { font-size: 0.6rem; padding: 3px 8px; }
  .slide-badge { font-size: 0.6rem; padding: 3px 8px; }

  /* Tech infographic mobile — stack vertically */
  .tech-infographic { flex-direction: column; gap: 10px; }
  .tech-col { width: 100%; flex-direction: row; flex-wrap: wrap; gap: 6px; justify-content: center; }
  .tech-col-label { width: 100%; }
  .tech-source, .tech-impact { min-width: calc(50% - 4px); flex: 0 0 auto; }
  .tech-conn-col { display: none; }
  .tech-hub-col { padding: 0; }
  .tech-hub { max-width: 100%; }
  .tech-modules { flex-direction: column; gap: 8px; }
  .tech-module { padding: 10px 12px; }
  .tech-module-icon { width: 30px; height: 30px; }
  .tech-module-text strong { font-size: 0.72rem; }
  .tech-module-text span { font-size: 0.58rem; }
}

/* ── Pitch: Extra-small (≤400px) ── */
@media (max-width: 400px) {
  .slide-kpi-row { grid-template-columns: 1fr; }
  .slide-metrics-grid { grid-template-columns: 1fr; }
  .slide-kpi-value { font-size: 1rem; }
  .slide-title { font-size: 1rem; }
  .deck-slide { padding: 12px 10px 10px; }
  .pitch-tab-toggle { gap: 2px; }
  .pitch-tab-toggle .view-pill { font-size: 0.65rem; padding: 4px 8px; }
}
