/* ============================================================
   RK KNIT FAB – SALES INTELLIGENCE DASHBOARD
   Complete Design System — Light Theme / Premium / Mobile-First
   ============================================================ */

/* ─── IMPORTS ─────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

/* ─── DESIGN TOKENS ───────────────────────────────────────── */
:root {
  /* Backgrounds */
  --bg-body: #F8F6F0; /* Soft warm ivory cream */
  --bg-card: #FFFFFF;
  --bg-glass: rgba(255, 254, 250, 0.75);
  --bg-glass-strong: rgba(255, 254, 250, 0.90);
  --bg-glass-subtle: rgba(255, 254, 250, 0.45);
  --bg-header: rgba(248, 246, 240, 0.85);
  --bg-modal-overlay: rgba(45, 42, 38, 0.45);
  --bg-hover: rgba(201, 31, 38, 0.05);
  --bg-active: rgba(201, 31, 38, 0.09);
  --bg-input: #F3EFE3; /* Warm darker cream */

  /* Text */
  --text-primary: #2B2520; /* Warm charcoal */
  --text-secondary: #6E665E; /* Warm gray */
  --text-tertiary: #A69C93; /* Warm beige-gray */
  --text-inverse: #FFFFFF;
  --text-accent: #C91F26; /* Crimson Red */

  /* Accent Colors */
  --accent: #C91F26; /* Crimson Red */
  --accent-light: #E5555A;
  --accent-lighter: #F7DCDD;
  --accent-bg: rgba(201, 31, 38, 0.06);
  --accent-gradient: linear-gradient(135deg, #C91F26 0%, #E5555A 100%);

  /* Status Colors */
  --success: #10B981;
  --success-light: #D1FAE5;
  --success-bg: rgba(16, 185, 129, 0.08);
  --warning: #F59E0B;
  --warning-light: #FEF3C7;
  --warning-bg: rgba(245, 158, 11, 0.08);
  --danger: #EF4444;
  --danger-light: #FEE2E2;
  --danger-bg: rgba(239, 68, 68, 0.08);
  --info: #D97706; /* Amber/Ochre instead of blue */
  --info-light: #FEF3C7;

  /* Borders */
  --border: rgba(43, 37, 32, 0.08);
  --border-strong: rgba(43, 37, 32, 0.15);
  --border-accent: rgba(201, 31, 38, 0.20);

  /* Shadows */
  --shadow-xs: 0 1px 2px rgba(43, 37, 32, 0.04);
  --shadow-sm: 0 1px 4px rgba(43, 37, 32, 0.06), 0 1px 2px rgba(43, 37, 32, 0.04);
  --shadow-md: 0 4px 16px rgba(43, 37, 32, 0.07), 0 2px 4px rgba(43, 37, 32, 0.04);
  --shadow-lg: 0 8px 32px rgba(43, 37, 32, 0.10), 0 2px 8px rgba(43, 37, 32, 0.04);
  --shadow-xl: 0 16px 48px rgba(43, 37, 32, 0.14), 0 4px 12px rgba(43, 37, 32, 0.06);
  --shadow-glow: 0 0 20px rgba(201, 31, 38, 0.15);
  --shadow-card: 0 2px 8px rgba(43, 37, 32, 0.04), 0 0 1px rgba(43, 37, 32, 0.06);

  /* Glass */
  --glass-blur: blur(24px);
  --glass-border: 1px solid rgba(255, 254, 250, 0.6);

  /* Radius */
  --radius-xs: 8px;
  --radius-sm: 12px;
  --radius-md: 16px;
  --radius-lg: 20px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* Spacing Scale */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;

  /* Typography */
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --fs-xs: 0.6875rem;
  --fs-sm: 0.75rem;
  --fs-base: 0.875rem;
  --fs-md: 1rem;
  --fs-lg: 1.125rem;
  --fs-xl: 1.25rem;
  --fs-2xl: 1.5rem;
  --fs-3xl: 1.875rem;
  --fs-4xl: 2.25rem;

  /* Transitions */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --duration-fast: 150ms;
  --duration-base: 250ms;
  --duration-slow: 400ms;

  /* Heatmap Scales — Sales (Warm Crimson/Red) */
  --hm-sales-0: #F3EFE3;
  --hm-sales-1: #FDEDEC;
  --hm-sales-2: #FADBD8;
  --hm-sales-3: #F5B7B1;
  --hm-sales-4: #EC7063;
  --hm-sales-5: #C91F26;

  /* Heatmap Scales — Weight (Emerald) */
  --hm-weight-0: #F3EFE3;
  --hm-weight-1: #D1FAE5;
  --hm-weight-2: #6EE7B7;
  --hm-weight-3: #34D399;
  --hm-weight-4: #10B981;
  --hm-weight-5: #059669;

  /* Heatmap Scales — Rolls (Amber) */
  --hm-rolls-0: #F3EFE3;
  --hm-rolls-1: #FEF3C7;
  --hm-rolls-2: #FCD34D;
  --hm-rolls-3: #FBBF24;
  --hm-rolls-4: #F59E0B;
  --hm-rolls-5: #D97706;

  /* Layout */
  --max-width: 1200px;
  --header-height: 64px;
  --bottom-nav-height: 64px;
  --safe-area-bottom: env(safe-area-inset-bottom, 0px);
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font);
  font-size: var(--fs-base);
  color: var(--text-primary);
  background: var(--bg-body);
  line-height: 1.6;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  padding-bottom: calc(var(--bottom-nav-height) + var(--safe-area-bottom) + 16px);
}

img { max-width: 100%; display: block; }
button { cursor: pointer; font-family: var(--font); border: none; background: none; }
input, textarea { font-family: var(--font); }
a { color: var(--accent); text-decoration: none; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-tertiary); }

/* ─── SPLASH SCREEN ───────────────────────────────────────── */
#splash-screen {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: var(--bg-body);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
  transition: opacity 0.5s var(--ease-out), visibility 0.5s;
}

#splash-screen.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.splash-logo {
  width: 96px;
  height: 96px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: splash-pulse 1.5s ease-in-out infinite;
}

.splash-text {
  font-size: var(--fs-sm);
  color: var(--text-tertiary);
  font-weight: 500;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.splash-bar {
  width: 120px;
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
  margin-top: var(--space-2);
}

.splash-bar::after {
  content: '';
  display: block;
  width: 40%;
  height: 100%;
  background: var(--accent-gradient);
  border-radius: 2px;
  animation: splash-load 1.2s ease-in-out infinite;
}

@keyframes splash-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

@keyframes splash-load {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(350%); }
}

/* ─── APP SHELL ───────────────────────────────────────────── */
#app {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-4);
  opacity: 0;
  transition: opacity 0.4s var(--ease-out);
}

#app.visible { opacity: 1; }

/* ─── COMPANY HEADER ──────────────────────────────────────── */
.company-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) 0;
  margin-bottom: var(--space-2);
}

.company-brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.company-logo {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.company-info h1 {
  font-size: var(--fs-md);
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.company-info span {
  font-size: var(--fs-xs);
  color: var(--text-tertiary);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.btn-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: all var(--duration-fast) var(--ease-out);
  font-size: 18px;
}

.btn-icon:hover {
  background: var(--bg-hover);
  color: var(--accent);
}

/* ─── KPI HEADER (Sticky) ─────────────────────────────────── */
#kpi-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-header);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  margin: 0 calc(-1 * var(--space-4));
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border);
  transition: box-shadow var(--duration-base) var(--ease-out);
}

#kpi-header.scrolled {
  box-shadow: var(--shadow-md);
}

.kpi-scroll {
  display: flex;
  gap: var(--space-3);
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding: var(--space-1) 0;
}

.kpi-scroll::-webkit-scrollbar { display: none; }

.kpi-card {
  flex: 0 0 auto;
  min-width: 146px;
  padding: var(--space-4);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  scroll-snap-align: start;
  transition: all var(--duration-base) var(--ease-out);
  cursor: default;
  position: relative;
  overflow: hidden;
}

.kpi-card[data-metric="sales"] { border-left: 4px solid var(--accent); background: linear-gradient(180deg, #FFFFFF 0%, rgba(201, 31, 38, 0.01) 100%); }
.kpi-card[data-metric="weight"] { border-left: 4px solid var(--success); background: linear-gradient(180deg, #FFFFFF 0%, rgba(16, 185, 129, 0.01) 100%); }
.kpi-card[data-metric="rolls"] { border-left: 4px solid var(--warning); background: linear-gradient(180deg, #FFFFFF 0%, rgba(245, 158, 11, 0.01) 100%); }
.kpi-card[data-metric="realization"] { border-left: 4px solid #CA7A14; background: linear-gradient(180deg, #FFFFFF 0%, rgba(202, 122, 20, 0.01) 100%); }
.kpi-card[data-metric="growth"] { border-left: 4px solid #D24D57; background: linear-gradient(180deg, #FFFFFF 0%, rgba(210, 77, 87, 0.01) 100%); }

.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.kpi-label {
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: var(--space-1);
  white-space: nowrap;
}

.kpi-value {
  font-size: var(--fs-xl);
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.2;
  letter-spacing: -0.5px;
  white-space: nowrap;
}

.kpi-trend {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: var(--fs-xs);
  font-weight: 600;
  margin-top: var(--space-1);
  padding: 2px 6px;
  border-radius: var(--radius-full);
}

.kpi-trend.up {
  color: var(--success);
  background: var(--success-bg);
}

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

.kpi-trend.neutral {
  color: var(--text-tertiary);
  background: var(--bg-input);
}

/* ─── PERIOD SELECTOR ─────────────────────────────────────── */
#period-selector {
  display: flex;
  gap: var(--space-2);
  padding: var(--space-5) 0 var(--space-4);
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

#period-selector::-webkit-scrollbar { display: none; }

.pill {
  flex: 0 0 auto;
  padding: var(--space-2) var(--space-5);
  border-radius: var(--radius-full);
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
  transition: all var(--duration-base) var(--ease-out);
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

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

.pill.active {
  background: var(--accent-gradient);
  color: var(--text-inverse);
  border-color: transparent;
  box-shadow: var(--shadow-glow);
  transform: scale(1.02);
}

/* ─── SECTION TITLES ──────────────────────────────────────── */
.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
}

.section-title h2 {
  font-size: var(--fs-lg);
  font-weight: 700;
  color: var(--text-primary);
}

.section-title .section-badge {
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-bg);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
}

/* ─── GLASS CARD ──────────────────────────────────────────── */
.glass-card {
  background: var(--bg-glass-strong);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: var(--space-5);
  transition: all var(--duration-base) var(--ease-out);
}

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

/* ─── METRIC SELECTOR (Overlay Checkboxes) ────────────────── */
.metric-controls {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) 0;
  flex-wrap: wrap;
}

.metric-check {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.metric-check input[type="checkbox"] {
  display: none;
}

.metric-check .check-box {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  border: 2px solid var(--border-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--duration-fast) var(--ease-out);
  font-size: 12px;
  color: transparent;
  flex-shrink: 0;
}

.metric-check input:checked + .check-box {
  border-color: transparent;
  color: #fff;
}

.metric-check[data-metric="value"] input:checked + .check-box {
  background: var(--accent);
}
.metric-check[data-metric="weight"] input:checked + .check-box {
  background: var(--success);
}
.metric-check[data-metric="rolls"] input:checked + .check-box {
  background: var(--warning);
}

.metric-check .check-label {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text-secondary);
}

/* ─── HEATMAP SECTION ─────────────────────────────────────── */
#heatmap-section {
  margin-bottom: var(--space-8);
}

/* Heatmap Controls Grid & Toggles */
.heatmap-controls-grid {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

@media (min-width: 640px) {
  .heatmap-controls-grid {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-6);
  }
}

.year-toggle-wrapper {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.year-toggles {
  display: flex;
  gap: 4px;
  background: var(--bg-input);
  padding: 3px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.year-btn {
  padding: 4px 12px;
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--text-secondary);
  border-radius: var(--radius-xs);
  transition: all var(--duration-fast) var(--ease-out);
  background: transparent;
}

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

.year-btn.active {
  background: var(--bg-card);
  color: var(--accent);
  box-shadow: var(--shadow-sm);
}

/* Month Filter */
.month-filter-wrapper {
  margin-bottom: var(--space-4);
  background: var(--bg-glass-strong);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--border);
}

.month-toggles {
  display: flex;
  gap: var(--space-2);
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.month-toggles::-webkit-scrollbar {
  display: none;
}

.month-btn {
  flex: 0 0 auto;
  padding: 6px 12px;
  border-radius: var(--radius-full);
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-card);
  border: 1px solid var(--border);
  transition: all var(--duration-fast) var(--ease-out);
}

.month-btn:hover {
  border-color: var(--border-accent);
  color: var(--accent);
  background: var(--accent-bg);
}

.month-btn.active {
  background: var(--accent-gradient);
  color: var(--text-inverse);
  border-color: transparent;
  box-shadow: var(--shadow-glow);
}

/* Month Grid */
.heatmap-months {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

.heatmap-month {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  box-shadow: var(--shadow-card);
  border: 1px solid var(--border);
}

.heatmap-month-title {
  font-size: var(--fs-base);
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--space-3);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.heatmap-month-total {
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--text-tertiary);
}

.heatmap-day-labels {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
  margin-bottom: var(--space-2);
}

.heatmap-day-label {
  text-align: center;
  font-size: 9px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: var(--space-1) 0;
}

.heatmap-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
}

.heatmap-cell {
  aspect-ratio: 1;
  border-radius: 4px;
  position: relative;
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
  min-height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.heatmap-cell:hover {
  transform: scale(1.15);
  z-index: 5;
  box-shadow: var(--shadow-md);
}

.heatmap-cell.empty {
  background: transparent;
  cursor: default;
}

.heatmap-cell.empty:hover {
  transform: none;
  box-shadow: none;
}

.heatmap-cell.no-data {
  background: var(--hm-sales-0);
}

/* Day number inside cell */
.heatmap-cell .cell-day {
  font-size: 9px;
  font-weight: 600;
  color: rgba(0, 0, 0, 0.35);
  position: absolute;
  top: 2px;
  left: 3px;
  line-height: 1;
}

.heatmap-cell.level-3 .cell-day,
.heatmap-cell.level-4 .cell-day,
.heatmap-cell.level-5 .cell-day {
  color: rgba(255, 255, 255, 0.6);
}

/* Heatmap intensity levels — Sales */
.heatmap-cell.sales-1 { background: var(--hm-sales-1); }
.heatmap-cell.sales-2 { background: var(--hm-sales-2); }
.heatmap-cell.sales-3 { background: var(--hm-sales-3); }
.heatmap-cell.sales-4 { background: var(--hm-sales-4); }
.heatmap-cell.sales-5 { background: var(--hm-sales-5); }

/* Weight */
.heatmap-cell.weight-1 { background: var(--hm-weight-1); }
.heatmap-cell.weight-2 { background: var(--hm-weight-2); }
.heatmap-cell.weight-3 { background: var(--hm-weight-3); }
.heatmap-cell.weight-4 { background: var(--hm-weight-4); }
.heatmap-cell.weight-5 { background: var(--hm-weight-5); }

/* Rolls */
.heatmap-cell.rolls-1 { background: var(--hm-rolls-1); }
.heatmap-cell.rolls-2 { background: var(--hm-rolls-2); }
.heatmap-cell.rolls-3 { background: var(--hm-rolls-3); }
.heatmap-cell.rolls-4 { background: var(--hm-rolls-4); }
.heatmap-cell.rolls-5 { background: var(--hm-rolls-5); }

/* Overlay indicators — corner dots for secondary metrics */
.heatmap-cell .overlay-dot {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.heatmap-cell .overlay-dot.weight-dot {
  bottom: 2px;
  right: 2px;
  background: var(--success);
}

.heatmap-cell .overlay-dot.rolls-dot {
  bottom: 2px;
  left: 2px;
  background: var(--warning);
}

/* Legend */
.heatmap-legend {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  margin-top: var(--space-4);
  font-size: var(--fs-xs);
  color: var(--text-tertiary);
  font-weight: 500;
}

.heatmap-legend-scale {
  display: flex;
  gap: 2px;
}

.heatmap-legend-cell {
  width: 14px;
  height: 14px;
  border-radius: 3px;
}

/* ─── HEATMAP TOOLTIP ─────────────────────────────────────── */
.heatmap-tooltip {
  position: fixed;
  z-index: 1000;
  background: var(--bg-glass-strong);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: var(--glass-border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  padding: var(--space-3) var(--space-4);
  pointer-events: none;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity var(--duration-fast) var(--ease-out),
              transform var(--duration-fast) var(--ease-out);
  min-width: 160px;
}

.heatmap-tooltip.visible {
  opacity: 1;
  transform: translateY(0);
}

.heatmap-tooltip .tooltip-date {
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}

.heatmap-tooltip .tooltip-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-4);
  padding: 2px 0;
}

.heatmap-tooltip .tooltip-label {
  font-size: var(--fs-xs);
  color: var(--text-tertiary);
  font-weight: 500;
}

.heatmap-tooltip .tooltip-value {
  font-size: var(--fs-xs);
  color: var(--text-primary);
  font-weight: 700;
}

/* ─── WEEK DRILLDOWN ──────────────────────────────────────── */
.week-drilldown {
  margin-top: var(--space-4);
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transition: max-height 0.5s var(--ease-out), opacity 0.3s var(--ease-out);
}

.week-drilldown.expanded {
  max-height: 2000px;
  opacity: 1;
}

.week-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  background: var(--accent-bg);
  border-radius: var(--radius-sm);
  margin-bottom: var(--space-3);
  cursor: pointer;
  transition: background var(--duration-fast);
}

.week-header:hover {
  background: var(--accent-lighter);
}

.week-header h3 {
  font-size: var(--fs-base);
  font-weight: 700;
  color: var(--accent);
}

.week-header .week-total {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text-secondary);
}

.week-days {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.day-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
}

.day-card:hover {
  background: var(--bg-hover);
  border-color: var(--border-accent);
  transform: translateX(4px);
}

.day-card .day-date {
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
}

.day-card .day-name {
  font-size: var(--fs-xs);
  color: var(--text-tertiary);
  font-weight: 500;
}

.day-card .day-metrics {
  display: flex;
  gap: var(--space-4);
  flex-wrap: wrap;
}

.day-card .day-metric {
  text-align: center;
}

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

.day-card .day-metric-value {
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--text-primary);
}

.day-card .day-growth {
  font-size: var(--fs-xs);
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  white-space: nowrap;
}

.day-card .day-growth.up {
  color: var(--success);
  background: var(--success-bg);
}

.day-card .day-growth.down {
  color: var(--danger);
  background: var(--danger-bg);
}

/* ─── DAY DETAIL MODAL ────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: var(--bg-modal-overlay);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--duration-base) var(--ease-out),
              visibility var(--duration-base);
}

.modal-overlay.visible {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  background: var(--bg-card);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  box-shadow: var(--shadow-xl);
  overflow-y: auto;
  transform: translateY(100%);
  transition: transform 0.4s var(--ease-out);
  padding-bottom: var(--safe-area-bottom);
}

.modal-overlay.visible .modal-content {
  transform: translateY(0);
}

.modal-handle {
  width: 36px;
  height: 4px;
  background: var(--border-strong);
  border-radius: 2px;
  margin: var(--space-3) auto var(--space-2);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-5) var(--space-4);
  border-bottom: 1px solid var(--border);
}

.modal-header h2 {
  font-size: var(--fs-lg);
  font-weight: 700;
}

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-xs);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: var(--text-tertiary);
  transition: all var(--duration-fast);
}

.modal-close:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.modal-body {
  padding: var(--space-5);
}

.modal-kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}

.modal-kpi {
  padding: var(--space-3);
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  text-align: center;
}

.modal-kpi .modal-kpi-label {
  font-size: var(--fs-xs);
  color: var(--text-tertiary);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: var(--space-1);
}

.modal-kpi .modal-kpi-value {
  font-size: var(--fs-lg);
  font-weight: 800;
  color: var(--text-primary);
}

.modal-chart-container {
  height: 180px;
  margin-bottom: var(--space-4);
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  padding: var(--space-3);
}

.modal-chart-title {
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--space-3);
}

/* ─── ANALYTICS SECTION ───────────────────────────────────── */
#analytics-section {
  margin-bottom: var(--space-8);
}

.analytics-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-4);
}

.chart-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  box-shadow: var(--shadow-card);
  transition: all var(--duration-base) var(--ease-out);
}

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

.chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
}

.chart-title {
  font-size: var(--fs-base);
  font-weight: 700;
  color: var(--text-primary);
}

.chart-value {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text-secondary);
}

.chart-container {
  height: 200px;
  position: relative;
}

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

/* ─── INSIGHTS SECTION ────────────────────────────────────── */
#insights-section {
  margin-bottom: var(--space-8);
}

.insights-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.insight-card {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xs);
  transition: all var(--duration-base) var(--ease-out);
  opacity: 0;
  transform: translateY(12px);
}

.insight-card.visible {
  opacity: 1;
  transform: translateY(0);
}

.insight-card:hover {
  border-color: var(--border-accent);
  box-shadow: var(--shadow-sm);
}

.insight-icon {
  font-size: 24px;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  background: var(--bg-input);
}

.insight-card.highlight .insight-icon { background: var(--accent-bg); }
.insight-card.positive .insight-icon { background: var(--success-bg); }
.insight-card.negative .insight-icon { background: var(--danger-bg); }
.insight-card.warning .insight-icon { background: var(--warning-bg); }

.insight-text {
  font-size: var(--fs-base);
  color: var(--text-primary);
  line-height: 1.5;
  font-weight: 500;
}

/* ─── HEATMAP TABS SECTION ────────────────────────────────── */
#heatmap-tabs-section {
  margin-bottom: var(--space-8);
}

.tab-bar {
  display: flex;
  gap: 0;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  padding: 3px;
  margin-bottom: var(--space-4);
}

.tab-btn {
  flex: 1;
  padding: var(--space-2) var(--space-3);
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text-secondary);
  border-radius: var(--radius-xs);
  transition: all var(--duration-base) var(--ease-out);
  text-align: center;
}

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

.tab-btn.active {
  background: var(--bg-card);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

.mini-heatmap-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.mini-heatmap-cell {
  aspect-ratio: 1;
  border-radius: 3px;
  min-height: 20px;
  transition: transform var(--duration-fast);
}

.mini-heatmap-cell:hover {
  transform: scale(1.2);
}

/* ─── REPORT BUTTON ───────────────────────────────────────── */
.report-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  width: 100%;
  padding: var(--space-4);
  background: var(--accent-gradient);
  color: var(--text-inverse);
  border-radius: var(--radius-md);
  font-size: var(--fs-base);
  font-weight: 700;
  box-shadow: var(--shadow-glow);
  transition: all var(--duration-base) var(--ease-out);
  margin-bottom: var(--space-8);
}

.report-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(79, 70, 229, 0.25);
}

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

/* ─── BOTTOM NAVIGATION ───────────────────────────────────── */
#bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 200;
  background: var(--bg-glass-strong);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-top: 1px solid var(--border);
  box-shadow: 0 -2px 16px rgba(0, 0, 0, 0.06);
  padding-bottom: var(--safe-area-bottom);
  transition: transform var(--duration-base) var(--ease-out);
}

#bottom-nav.hidden {
  transform: translateY(100%);
}

.nav-items {
  display: flex;
  align-items: center;
  justify-content: space-around;
  max-width: var(--max-width);
  margin: 0 auto;
  height: var(--bottom-nav-height);
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: var(--space-1) var(--space-3);
  color: var(--text-tertiary);
  font-size: 20px;
  transition: all var(--duration-fast) var(--ease-out);
  position: relative;
  -webkit-tap-highlight-color: transparent;
}

.nav-item .nav-label {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.nav-item.active {
  color: var(--accent);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  top: -1px;
  left: 50%;
  transform: translateX(-50%);
  width: 20px;
  height: 3px;
  background: var(--accent-gradient);
  border-radius: 0 0 2px 2px;
}

/* ─── LOADING SKELETON ────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--bg-input) 25%, #E8EAF0 50%, var(--bg-input) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius-xs);
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.skeleton-card {
  height: 80px;
  border-radius: var(--radius-md);
}

.skeleton-chart {
  height: 200px;
  border-radius: var(--radius-lg);
}

/* ─── EMPTY STATE ─────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: var(--space-12) var(--space-6);
  color: var(--text-tertiary);
}

.empty-state .empty-icon {
  font-size: 48px;
  margin-bottom: var(--space-4);
}

.empty-state h3 {
  font-size: var(--fs-lg);
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: var(--space-2);
}

.empty-state p {
  font-size: var(--fs-base);
  max-width: 320px;
  margin: 0 auto;
  line-height: 1.6;
}

/* ─── ANIMATIONS ──────────────────────────────────────────── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

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

.anim-fadeInUp {
  animation: fadeInUp 0.5s var(--ease-out) both;
}

.anim-stagger-1 { animation-delay: 0.05s; }
.anim-stagger-2 { animation-delay: 0.10s; }
.anim-stagger-3 { animation-delay: 0.15s; }
.anim-stagger-4 { animation-delay: 0.20s; }
.anim-stagger-5 { animation-delay: 0.25s; }

/* ─── RESPONSIVE: TABLET ──────────────────────────────────── */
@media (min-width: 640px) {
  .kpi-card { min-width: 160px; }

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

  .modal-content {
    max-height: 80vh;
    border-radius: var(--radius-xl);
    margin: auto var(--space-4);
  }

  .modal-overlay {
    align-items: center;
  }

  .modal-overlay.visible .modal-content {
    transform: translateY(0);
  }

  .heatmap-cell {
    min-height: 36px;
  }

  .heatmap-cell .cell-day {
    font-size: 10px;
  }

  .day-card {
    grid-template-columns: auto 1fr auto auto;
  }
}

/* ─── RESPONSIVE: DESKTOP ─────────────────────────────────── */
@media (min-width: 1024px) {
  #app { padding: 0 var(--space-8); }

  .kpi-scroll { gap: var(--space-4); }

  .kpi-card {
    min-width: 180px;
    padding: var(--space-4) var(--space-5);
  }

  .kpi-value { font-size: var(--fs-2xl); }

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

  .chart-container { height: 260px; }

  .heatmap-cell {
    min-height: 42px;
    border-radius: 5px;
  }

  #bottom-nav { display: none; }

  body {
    padding-bottom: var(--space-8);
  }

  .modal-content {
    max-width: 560px;
  }
}

/* ─── PRINT STYLES ────────────────────────────────────────── */
@media print {
  * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  body {
    background: #fff !important;
    padding: 0 !important;
    font-size: 11pt;
  }

  #bottom-nav,
  #period-selector,
  .modal-overlay,
  #splash-screen,
  .report-btn,
  .heatmap-nav-btn,
  .metric-controls,
  .header-actions {
    display: none !important;
  }

  #kpi-header {
    position: relative !important;
    background: #fff !important;
    backdrop-filter: none !important;
    border: none !important;
    box-shadow: none !important;
    margin: 0 !important;
  }

  .kpi-scroll {
    flex-wrap: wrap;
    gap: 8px;
  }

  .kpi-card {
    backdrop-filter: none !important;
    border: 1px solid #e0e0e0 !important;
    box-shadow: none !important;
    min-width: auto;
    flex: 1;
  }

  #app {
    max-width: 100% !important;
    opacity: 1 !important;
  }

  .glass-card,
  .chart-card,
  .heatmap-month,
  .insight-card {
    backdrop-filter: none !important;
    box-shadow: none !important;
    break-inside: avoid;
    border: 1px solid #e0e0e0 !important;
  }

  .chart-container { height: 180px !important; }

  .insight-card {
    opacity: 1 !important;
    transform: none !important;
  }

  /* Page breaks */
  #analytics-section { page-break-before: always; }
  #insights-section { page-break-before: always; }

  @page {
    size: A4;
    margin: 15mm;
  }
}

/* ─── PRINT REPORT LAYOUT ─────────────────────────────────── */
#print-report {
  display: none;
}

@media print {
  #print-report {
    display: block;
  }

  .print-page {
    page-break-after: always;
    padding: 20px 0;
  }

  .print-page:last-child {
    page-break-after: auto;
  }

  .print-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 2px solid var(--accent);
    padding-bottom: 16px;
    margin-bottom: 24px;
  }

  .print-header h1 {
    font-size: 20pt;
    font-weight: 800;
    color: var(--text-primary);
  }

  .print-header .print-date {
    font-size: 10pt;
    color: var(--text-secondary);
  }

  .print-kpi-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 24px;
  }

  .print-kpi {
    padding: 16px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    text-align: center;
  }

  .print-kpi .print-kpi-label {
    font-size: 8pt;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 4px;
  }

  .print-kpi .print-kpi-value {
    font-size: 16pt;
    font-weight: 800;
    color: var(--text-primary);
  }

  .print-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 9pt;
    margin-bottom: 24px;
  }

  .print-table th {
    background: var(--accent);
    color: #fff;
    padding: 8px 12px;
    text-align: left;
    font-weight: 700;
  }

  .print-table td {
    padding: 6px 12px;
    border-bottom: 1px solid #e0e0e0;
  }

  .print-table tr:nth-child(even) td {
    background: #f9f9f9;
  }
}

/* ─── SWIPE HINT ──────────────────────────────────────────── */
.swipe-hint {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  font-size: var(--fs-xs);
  color: var(--text-tertiary);
  padding: var(--space-2) 0;
  animation: fadeIn 0.6s ease-out 1s both;
}

.swipe-hint::before,
.swipe-hint::after {
  content: '';
  width: 20px;
  height: 1px;
  background: var(--border-strong);
}

/* ─── YEAR SELECTOR ───────────────────────────────────────── */
.year-selector {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.year-selector select {
  appearance: none;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  padding: var(--space-2) var(--space-4) var(--space-2) var(--space-3);
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%236B7194'%3E%3Cpath d='M2 4l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  padding-right: 28px;
}

/* ============================================================
   RK KNIT FAB - Modern Light Dashboard Refresh
   ============================================================ */
:root {
  --bg-body: #F7F9FD;
  --bg-card: #FFFFFF;
  --bg-glass: rgba(255, 255, 255, 0.82);
  --bg-glass-strong: rgba(255, 255, 255, 0.94);
  --bg-glass-subtle: rgba(255, 255, 255, 0.62);
  --bg-header: rgba(247, 249, 253, 0.92);
  --bg-modal-overlay: rgba(17, 24, 39, 0.36);
  --bg-hover: rgba(228, 42, 53, 0.07);
  --bg-active: rgba(228, 42, 53, 0.10);
  --bg-input: #EEF2F7;

  --text-primary: #111827;
  --text-secondary: #4B5563;
  --text-tertiary: #8A94A6;
  --text-inverse: #FFFFFF;
  --text-accent: #E42A35;

  --accent: #E42A35;
  --accent-light: #F0555F;
  --accent-lighter: #FFE5E7;
  --accent-bg: rgba(228, 42, 53, 0.08);
  --accent-gradient: linear-gradient(135deg, #E42A35 0%, #B81928 100%);
  --brand-blue: #2843A8;
  --brand-blue-bg: rgba(40, 67, 168, 0.09);
  --brand-ink: #1F1B67;

  --success: #0F9F8F;
  --success-light: #D9F8F4;
  --success-bg: rgba(15, 159, 143, 0.09);
  --warning: #C77900;
  --warning-light: #FFF1D6;
  --warning-bg: rgba(199, 121, 0, 0.10);
  --danger: #E42A35;
  --danger-light: #FFE5E7;
  --danger-bg: rgba(228, 42, 53, 0.10);
  --info: #2843A8;
  --info-light: #E6ECFF;

  --border: rgba(17, 24, 39, 0.08);
  --border-strong: rgba(17, 24, 39, 0.14);
  --border-accent: rgba(228, 42, 53, 0.22);

  --shadow-xs: 0 1px 2px rgba(17, 24, 39, 0.04);
  --shadow-sm: 0 2px 6px rgba(17, 24, 39, 0.06);
  --shadow-md: 0 10px 28px rgba(17, 24, 39, 0.10);
  --shadow-lg: 0 18px 42px rgba(17, 24, 39, 0.13);
  --shadow-xl: 0 28px 70px rgba(17, 24, 39, 0.18);
  --shadow-glow: 0 12px 24px rgba(228, 42, 53, 0.18);
  --shadow-card: 0 1px 0 rgba(17, 24, 39, 0.04), 0 10px 24px rgba(17, 24, 39, 0.06);

  --glass-blur: blur(18px);
  --glass-border: 1px solid rgba(17, 24, 39, 0.08);

  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius-md: 8px;
  --radius-lg: 8px;
  --radius-xl: 8px;

  --hm-sales-0: #EEF2F7;
  --hm-sales-1: #FFE5E7;
  --hm-sales-2: #FFC5CA;
  --hm-sales-3: #FF8E96;
  --hm-sales-4: #F0555F;
  --hm-sales-5: #E42A35;

  --hm-weight-0: #EEF2F7;
  --hm-weight-1: #E6ECFF;
  --hm-weight-2: #C7D4FF;
  --hm-weight-3: #8FA6F5;
  --hm-weight-4: #526FD1;
  --hm-weight-5: #2843A8;

  --hm-rolls-0: #EEF2F7;
  --hm-rolls-1: #D9F8F4;
  --hm-rolls-2: #A7EDE4;
  --hm-rolls-3: #66D4C7;
  --hm-rolls-4: #27B5A4;
  --hm-rolls-5: #0F9F8F;
}

* {
  letter-spacing: 0 !important;
}

html,
body {
  background: #F7F9FD;
}

body {
  color: var(--text-primary);
  background:
    linear-gradient(180deg, #FBFCFF 0%, #F7F9FD 36%, #EEF3F9 100%);
  line-height: 1.5;
}

#app {
  max-width: 1180px;
  padding: 0 14px;
}

.company-header {
  align-items: center;
  min-height: 78px;
  padding: 14px 0 10px;
  margin-bottom: 2px;
}

.company-brand {
  gap: 12px;
  min-width: 0;
}

.company-logo {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: #FFFFFF;
  border: 1px solid rgba(40, 67, 168, 0.14);
  box-shadow: 0 10px 20px rgba(31, 27, 103, 0.12);
  overflow: hidden;
}

.company-logo img {
  width: 100% !important;
  height: 100% !important;
  object-fit: contain;
}

.company-info {
  min-width: 0;
}

.company-info h1 {
  font-size: 1.06rem;
  font-weight: 900;
  color: var(--brand-ink);
  line-height: 1.05;
}

.company-info span {
  display: inline-flex;
  margin-top: 5px;
  color: var(--accent);
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
}

.header-actions {
  gap: 8px;
}

.btn-icon {
  position: relative;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: #FFFFFF;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  color: transparent;
  font-size: 0;
}

.btn-icon:hover {
  color: transparent;
  background: #FFFFFF;
  border-color: var(--border-accent);
  transform: translateY(-1px);
}

#btn-refresh::before {
  content: '';
  position: absolute;
  inset: 12px;
  border: 2px solid var(--brand-blue);
  border-left-color: transparent;
  border-radius: 50%;
}

#btn-refresh::after {
  content: '';
  position: absolute;
  top: 11px;
  right: 11px;
  width: 7px;
  height: 7px;
  border-top: 2px solid var(--brand-blue);
  border-right: 2px solid var(--brand-blue);
  transform: rotate(20deg);
}

#btn-print::before {
  content: '';
  position: absolute;
  left: 12px;
  right: 12px;
  top: 11px;
  height: 11px;
  border: 2px solid var(--brand-blue);
  border-radius: 3px 3px 1px 1px;
}

#btn-print::after {
  content: '';
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 10px;
  height: 15px;
  border: 2px solid var(--accent);
  border-radius: 3px;
  background: linear-gradient(#FFFFFF 0 42%, transparent 42%);
}

#kpi-header {
  top: 0;
  margin: 0 -14px;
  padding: 10px 14px 8px;
  background: rgba(247, 249, 253, 0.90);
  border-bottom: 1px solid rgba(17, 24, 39, 0.08);
}

#kpi-header.scrolled {
  box-shadow: 0 14px 30px rgba(17, 24, 39, 0.10);
}

.kpi-scroll {
  gap: 10px;
  padding: 3px 0 5px;
}

.kpi-card {
  min-width: 156px;
  min-height: 104px;
  padding: 14px;
  border-radius: 8px;
  background: #FFFFFF;
  border: 1px solid rgba(17, 24, 39, 0.08);
  box-shadow: var(--shadow-card);
}

.kpi-card::before {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  border-radius: 8px 0 0 8px;
  background: var(--accent);
}

.kpi-card[data-metric="sales"],
.kpi-card[data-metric="weight"],
.kpi-card[data-metric="rolls"],
.kpi-card[data-metric="realization"],
.kpi-card[data-metric="growth"] {
  border-left: 0;
  background: #FFFFFF;
}

.kpi-card[data-metric="weight"]::before { background: var(--brand-blue); }
.kpi-card[data-metric="rolls"]::before { background: var(--success); }
.kpi-card[data-metric="realization"]::before { background: var(--warning); }
.kpi-card[data-metric="growth"]::before { background: #111827; }

.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.kpi-label {
  margin-bottom: 7px;
  color: var(--text-tertiary);
  font-size: 0.67rem;
  font-weight: 900;
  text-transform: uppercase;
}

.kpi-value {
  color: var(--text-primary);
  font-size: 1.28rem;
  font-weight: 900;
  line-height: 1.1;
  letter-spacing: 0 !important;
}

.kpi-trend {
  max-width: 100%;
  margin-top: 9px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 0.67rem;
  font-weight: 800;
  white-space: nowrap;
}

.kpi-trend.neutral {
  color: var(--brand-blue);
  background: var(--brand-blue-bg);
}

.swipe-hint {
  padding: 3px 0 0;
  color: var(--text-tertiary);
  font-weight: 700;
}

#period-selector {
  position: relative;
  gap: 4px;
  margin: 14px 0 18px;
  padding: 4px;
  background: #E8EDF5;
  border: 1px solid rgba(17, 24, 39, 0.06);
  border-radius: 8px;
}

.pill {
  flex: 1 0 auto;
  min-width: 82px;
  padding: 10px 14px;
  border-radius: 6px;
  color: var(--text-secondary);
  background: transparent;
  border: 0;
  box-shadow: none;
  font-size: 0.76rem;
  font-weight: 900;
}

.pill:hover {
  background: rgba(255, 255, 255, 0.62);
  color: var(--brand-blue);
}

.pill.active {
  color: var(--text-primary);
  background: #FFFFFF;
  box-shadow: 0 4px 12px rgba(17, 24, 39, 0.09);
  transform: none;
}

.section-title {
  margin-bottom: 12px;
}

.section-title h2 {
  color: var(--brand-ink);
  font-size: 1.03rem;
  font-weight: 900;
}

.section-title .section-badge {
  color: var(--brand-blue);
  background: var(--brand-blue-bg);
  border-radius: 999px;
  font-weight: 900;
}

#heatmap-section,
#analytics-section,
#insights-section,
#heatmap-tabs-section {
  margin-bottom: 28px;
}

.heatmap-controls-grid {
  gap: 10px;
  margin-bottom: 10px;
}

.metric-controls {
  gap: 8px;
  padding: 0;
}

.metric-check {
  gap: 7px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #FFFFFF;
}

.metric-check .check-box {
  width: 18px;
  height: 18px;
  border-radius: 5px;
  border-width: 1.5px;
}

.metric-check .check-label {
  color: var(--text-primary);
  font-weight: 900;
}

.year-toggles,
.tab-bar {
  padding: 4px;
  border-radius: 8px;
  background: #E8EDF5;
  border: 1px solid rgba(17, 24, 39, 0.06);
}

.year-btn,
.tab-btn {
  border-radius: 6px;
  color: var(--text-secondary);
  font-weight: 900;
}

.year-btn.active,
.tab-btn.active {
  color: var(--brand-blue);
  background: #FFFFFF;
  box-shadow: 0 4px 12px rgba(17, 24, 39, 0.08);
}

.month-filter-wrapper {
  margin-bottom: 14px;
  padding: 8px;
  border-radius: 8px;
  background: #FFFFFF;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
}

.month-toggles {
  gap: 6px;
}

.month-btn {
  min-width: 48px;
  padding: 8px 10px;
  border-radius: 7px;
  background: #F3F6FA;
  border: 1px solid transparent;
  color: var(--text-secondary);
  font-weight: 900;
}

.month-btn:hover {
  color: var(--accent);
  background: var(--accent-bg);
}

.month-btn.active {
  color: #FFFFFF;
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 8px 18px rgba(228, 42, 53, 0.20);
}

.heatmap-months {
  gap: 14px;
}

.heatmap-month,
.chart-card,
.insight-card,
.glass-card {
  border-radius: 8px;
  background: #FFFFFF;
  border: 1px solid rgba(17, 24, 39, 0.08);
  box-shadow: var(--shadow-card);
}

.heatmap-month {
  padding: 14px;
}

.heatmap-month-title {
  margin-bottom: 12px;
  color: var(--text-primary);
  font-size: 0.92rem;
  font-weight: 900;
}

.heatmap-month-total {
  color: var(--accent);
  font-weight: 900;
}

.heatmap-grid,
.heatmap-day-labels {
  gap: 4px;
}

.heatmap-cell {
  min-height: 34px;
  border-radius: 6px;
}

.heatmap-cell:hover {
  transform: scale(1.08);
}

.heatmap-cell .cell-day {
  top: 4px;
  left: 5px;
  color: rgba(17, 24, 39, 0.46);
  font-weight: 900;
}

.heatmap-legend {
  margin-top: 12px;
  color: var(--text-secondary);
  font-weight: 800;
}

.heatmap-legend-cell {
  width: 18px;
  height: 10px;
  border-radius: 999px;
}

.week-header {
  background: #F3F6FA;
  border: 1px solid var(--border);
}

.week-header:hover {
  background: var(--brand-blue-bg);
}

.week-header h3 {
  color: var(--brand-blue);
  font-weight: 900;
}

.day-card {
  border-radius: 8px;
  background: #FFFFFF;
}

.day-card:hover {
  background: #FAFBFD;
  transform: translateX(2px);
}

.analytics-grid {
  gap: 14px;
}

.chart-card {
  padding: 16px;
  min-height: 292px;
}

.chart-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.chart-header {
  margin-bottom: 12px;
  align-items: flex-start;
  gap: 10px;
}

.chart-title {
  color: var(--brand-ink);
  font-size: 0.94rem;
  font-weight: 900;
}

.chart-value {
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 900;
  white-space: nowrap;
}

.chart-container {
  height: 216px;
}

.insights-list {
  gap: 10px;
}

.insight-card {
  align-items: center;
  padding: 14px;
  gap: 12px;
}

.insight-card:hover {
  border-color: rgba(40, 67, 168, 0.18);
  box-shadow: var(--shadow-md);
}

.insight-icon {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  color: var(--brand-blue);
  background: var(--brand-blue-bg);
  font-size: 0.63rem;
  font-weight: 900;
}

.insight-card.highlight .insight-icon {
  color: var(--accent);
  background: var(--accent-bg);
}

.insight-card.warning .insight-icon {
  color: var(--warning);
  background: var(--warning-bg);
}

.insight-text {
  color: var(--text-primary);
  font-size: 0.88rem;
  font-weight: 700;
}

.glass-card {
  padding: 14px;
  backdrop-filter: none;
}

.mini-heatmap-grid {
  gap: 4px;
}

.mini-heatmap-cell {
  min-height: 24px;
  border-radius: 5px;
}

.report-btn {
  position: relative;
  min-height: 52px;
  margin-bottom: 30px;
  padding: 15px 18px;
  border-radius: 8px;
  background: var(--accent-gradient);
  box-shadow: 0 16px 28px rgba(228, 42, 53, 0.22);
}

.report-btn:hover {
  box-shadow: 0 18px 34px rgba(228, 42, 53, 0.26);
}

.report-btn span:first-child {
  display: none;
}

.report-btn::before {
  content: '';
  width: 18px;
  height: 18px;
  border: 2px solid #FFFFFF;
  border-radius: 4px;
  box-shadow: inset 0 -6px 0 rgba(255, 255, 255, 0.28);
}

.modal-content {
  border-radius: 8px 8px 0 0;
  background: #FFFFFF;
}

.modal-header {
  border-bottom: 1px solid var(--border);
}

.modal-kpi,
.modal-chart-container {
  border-radius: 8px;
  background: #F3F6FA;
  border: 1px solid var(--border);
}

.modal-kpi .modal-kpi-value {
  color: var(--brand-ink);
}

.heatmap-tooltip {
  border-radius: 8px;
  background: rgba(17, 24, 39, 0.94);
  border: 0;
  box-shadow: var(--shadow-lg);
}

.heatmap-tooltip .tooltip-date,
.heatmap-tooltip .tooltip-value {
  color: #FFFFFF;
}

.heatmap-tooltip .tooltip-label {
  color: #CBD5E1;
}

#bottom-nav {
  background: rgba(255, 255, 255, 0.94);
  border-top: 1px solid rgba(17, 24, 39, 0.08);
  box-shadow: 0 -14px 30px rgba(17, 24, 39, 0.08);
}

.nav-items {
  height: 66px;
}

.nav-item {
  min-width: 58px;
  gap: 4px;
  padding: 7px 8px 6px;
  border-radius: 8px;
  color: var(--text-tertiary);
  font-size: 0;
}

.nav-item > span:first-child {
  display: none;
}

.nav-item::before,
.nav-item.active::before {
  content: '';
  position: static;
  width: 21px;
  height: 21px;
  transform: none;
  border-radius: 6px;
  background: currentColor;
}

.nav-item[data-section="kpi-header"]::before {
  clip-path: polygon(8% 62%, 30% 62%, 30% 92%, 8% 92%, 8% 62%, 39% 38%, 61% 38%, 61% 92%, 39% 92%, 39% 38%, 70% 16%, 92% 16%, 92% 92%, 70% 92%, 70% 16%);
}

.nav-item[data-section="heatmap-section"]::before {
  clip-path: polygon(8% 8%, 30% 8%, 30% 30%, 8% 30%, 8% 8%, 39% 8%, 61% 8%, 61% 30%, 39% 30%, 39% 8%, 70% 8%, 92% 8%, 92% 30%, 70% 30%, 70% 8%, 8% 39%, 30% 39%, 30% 61%, 8% 61%, 8% 39%, 39% 39%, 61% 39%, 61% 61%, 39% 61%, 39% 39%, 70% 39%, 92% 39%, 92% 61%, 70% 61%, 70% 39%, 8% 70%, 30% 70%, 30% 92%, 8% 92%, 8% 70%, 39% 70%, 61% 70%, 61% 92%, 39% 92%, 39% 70%, 70% 70%, 92% 70%, 92% 92%, 70% 92%, 70% 70%);
}

.nav-item[data-section="analytics-section"]::before {
  clip-path: polygon(8% 74%, 20% 62%, 38% 72%, 58% 38%, 74% 48%, 92% 18%, 92% 34%, 78% 58%, 62% 48%, 42% 84%, 22% 74%, 8% 88%);
}

.nav-item[data-section="insights-section"]::before {
  border-radius: 50%;
  clip-path: polygon(50% 0, 66% 24%, 94% 35%, 72% 56%, 74% 86%, 50% 72%, 26% 86%, 28% 56%, 6% 35%, 34% 24%);
}

.nav-item[data-section="heatmap-tabs-section"]::before {
  clip-path: polygon(9% 15%, 34% 5%, 34% 85%, 9% 95%, 9% 15%, 39% 5%, 64% 15%, 64% 95%, 39% 85%, 39% 5%, 69% 15%, 91% 5%, 91% 85%, 69% 95%, 69% 15%);
}

.nav-item .nav-label {
  color: inherit;
  font-size: 0.62rem;
  font-weight: 900;
}

.nav-item.active {
  color: var(--accent);
  background: var(--accent-bg);
}

.nav-item.active::after {
  content: '';
  position: absolute;
  top: 4px;
  width: 18px;
  height: 3px;
  border-radius: 999px;
  background: var(--accent);
}

.splash-logo {
  width: 118px;
  height: 118px;
  border-radius: 50%;
  background: #FFFFFF;
  box-shadow: 0 20px 50px rgba(31, 27, 103, 0.16);
}

.splash-text {
  color: var(--brand-ink);
  font-weight: 900;
}

.splash-bar {
  background: #E8EDF5;
}

.splash-bar::after {
  background: var(--accent-gradient);
}

@media (min-width: 640px) {
  #app {
    padding: 0 22px;
  }

  #kpi-header {
    margin: 0 -22px;
    padding-left: 22px;
    padding-right: 22px;
  }

  .kpi-card {
    min-width: 176px;
  }

  .heatmap-controls-grid {
    align-items: flex-start;
  }
}

@media (min-width: 900px) {
  .kpi-scroll {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    overflow: visible;
  }

  .kpi-card {
    min-width: 0;
  }

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

  .chart-container {
    height: 248px;
  }
}

@media (min-width: 1024px) {
  #app {
    padding: 0 28px;
  }

  #kpi-header {
    margin: 0 -28px;
    padding-left: 28px;
    padding-right: 28px;
  }

  .heatmap-months {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 390px) {
  #app {
    padding: 0 10px;
  }

  #kpi-header {
    margin: 0 -10px;
    padding-left: 10px;
    padding-right: 10px;
  }

  .company-logo {
    width: 46px;
    height: 46px;
  }

  .company-info h1 {
    font-size: 0.98rem;
  }

  .kpi-card {
    min-width: 146px;
  }

  .pill {
    min-width: 76px;
    padding-left: 10px;
    padding-right: 10px;
  }

  .chart-card {
    padding: 14px;
  }
}

/* ─── DEMO BANNER ─────────────────────────────────────────── */
.demo-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-top: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--warning-bg);
  border: 1px solid rgba(245, 158, 11, 0.25);
  border-radius: var(--radius-md);
  color: #D97706;
  font-size: var(--fs-sm);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
  animation: slideInDown 0.4s var(--ease-out);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.demo-banner.hidden {
  display: none !important;
}

.demo-banner-content {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.demo-banner-icon {
  font-size: 16px;
  animation: shake 2s infinite ease-in-out;
  display: inline-block;
}

.btn-banner-link {
  color: var(--text-inverse);
  background: var(--warning);
  padding: 6px var(--space-3);
  border-radius: var(--radius-full);
  font-size: var(--fs-xs);
  font-weight: 700;
  transition: all var(--duration-fast) var(--ease-out);
  box-shadow: 0 2px 4px rgba(245, 158, 11, 0.2);
  white-space: nowrap;
}

.btn-banner-link:hover {
  background: #D97706;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(245, 158, 11, 0.3);
}

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

@keyframes slideInDown {
  from {
    transform: translateY(-12px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes shake {
  0%, 100% { transform: rotate(0deg); }
  10%, 30%, 50%, 70%, 90% { transform: rotate(-5deg); }
  20%, 40%, 60%, 80% { transform: rotate(5deg); }
}
