/* ============================================
   QUALFIS HUB — Unified Stylesheet
   ============================================ */
:root, [data-theme="light"] {
  --text-xs: clamp(0.75rem, 0.7rem + 0.25vw, 0.875rem);
  --text-sm: clamp(0.875rem, 0.8rem + 0.35vw, 1rem);
  --text-base: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
  --text-lg: clamp(1.125rem, 1rem + 0.75vw, 1.5rem);
  --text-xl: clamp(1.5rem, 1.2rem + 1.25vw, 2.25rem);
  --space-1: 0.25rem; --space-2: 0.5rem; --space-3: 0.75rem;
  --space-4: 1rem; --space-5: 1.25rem; --space-6: 1.5rem; --space-8: 2rem;
  --color-bg: #f5f3ef; --color-surface: #ffffff; --color-surface-2: #faf9f7;
  --color-surface-offset: #efe9de; --color-divider: #e0d6c8; --color-border: #d4c8b5;
  --color-text: #2c2418; --color-text-muted: #7a6e5e; --color-text-faint: #b5a898;
  --color-primary: #a0522d; --color-primary-hover: #8b4513; --color-primary-light: #d4a574;
  --color-active: #059669; --color-potential: #d97706; --color-vacuum: #dc2626; --color-planned: #2563eb;
  --map-bg: #faf7f2; --map-state-fill: #efe9de; --map-state-stroke: #d4c8b5;
  --map-state-hover: #d4a574; --map-state-active: #a0522d;
  --font-display: 'Cabinet Grotesk', 'DM Sans', sans-serif;
  --font-body: 'Satoshi', 'Inter', sans-serif;
  --radius-sm: 0.375rem; --radius-md: 0.5rem; --radius-lg: 0.75rem; --radius-xl: 1rem;
  --transition: 180ms cubic-bezier(0.16, 1, 0.3, 1);
  --shadow-sm: 0 1px 3px rgba(44,36,24,0.06); --shadow-md: 0 4px 12px rgba(44,36,24,0.08);
  --shadow-lg: 0 12px 32px rgba(44,36,24,0.12);
  --hub-header-height: 56px;
}
[data-theme="dark"] {
  --color-bg: #131210; --color-surface: #1c1b18; --color-surface-2: #222119;
  --color-surface-offset: #252119; --color-divider: #3a352e; --color-border: #4a4338;
  --color-text: #e0d8cc; --color-text-muted: #8a7e6e; --color-text-faint: #5a5048;
  --color-primary: #d4a574; --color-primary-hover: #e0b888; --color-primary-light: #8b6842;
  --color-active: #34d399; --color-potential: #fbbf24; --color-vacuum: #f87171; --color-planned: #60a5fa;
  --map-bg: #1a1714; --map-state-fill: #2a2520; --map-state-stroke: #4a4338;
  --map-state-hover: #5a4a38; --map-state-active: #d4a574;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.2); --shadow-md: 0 4px 12px rgba(0,0,0,0.3);
  --shadow-lg: 0 12px 32px rgba(0,0,0,0.4);
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-font-smoothing: antialiased; scroll-behavior: smooth; }
body { height: 100vh; overflow: hidden; font-family: var(--font-body); font-size: var(--text-base);
  color: var(--color-text); background: var(--color-bg); display: flex; flex-direction: column; }
button { cursor: pointer; background: none; border: none; font: inherit; color: inherit; }
input, select, textarea { font: inherit; color: inherit; }

.hub-header { height: var(--hub-header-height); background: #1e293b; color: #e2e8f0;
  border-bottom: 1px solid #334155; flex-shrink: 0; z-index: 200; }
[data-theme="dark"] .hub-header { background: #0f172a; border-color: #1e293b; }
.hub-header-inner { height: 100%; max-width: 1600px; margin: 0 auto; padding: 0 var(--space-5);
  display: flex; align-items: center; gap: var(--space-6); }
.hub-brand { display: flex; align-items: center; gap: var(--space-3); flex-shrink: 0; }
.hub-logo { color: #f59e0b; }
.hub-title { font-family: var(--font-display); font-size: 1.1rem; font-weight: 800; color: #f1f5f9; line-height: 1.2; }
.hub-tagline { font-size: 0.65rem; color: #94a3b8; text-transform: uppercase; letter-spacing: 0.08em; }
.hub-nav { display: flex; gap: 2px; flex: 1; justify-content: flex-start; overflow-x: auto; scrollbar-width: none; -ms-overflow-style: none; }
.hub-nav::-webkit-scrollbar { display: none; }
.hub-nav-btn { display: flex; align-items: center; gap: 6px; padding: 8px 16px; font-size: 13px;
  font-weight: 500; color: #94a3b8; border-radius: var(--radius-md); transition: all var(--transition);
  border: 1px solid transparent; white-space: nowrap; }
.hub-nav-btn:hover { color: #e2e8f0; background: rgba(255,255,255,0.06); }
.hub-nav-btn.active { color: #fbbf24; background: rgba(251,191,36,0.1); border-color: rgba(251,191,36,0.3); }
.hub-actions { display: flex; gap: var(--space-3); flex-shrink: 0; align-items: center; }
.hub-theme-btn { width: 36px; height: 36px; display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-md); color: #94a3b8; transition: all var(--transition); }
.hub-theme-btn:hover { color: #e2e8f0; background: rgba(255,255,255,0.08); }

/* ═══ THEME TOGGLE SWITCH ═══ */
.hub-theme-switch { cursor: pointer; user-select: none; }
.hub-theme-switch-track {
  position: relative; display: flex; align-items: center;
  background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.12);
  border-radius: 20px; padding: 3px; gap: 0; overflow: hidden;
}
.hub-theme-switch-option {
  display: flex; align-items: center; gap: 5px; padding: 5px 14px;
  font-size: 12px; font-weight: 600; color: #94a3b8;
  border-radius: 16px; position: relative; z-index: 2;
  transition: color 250ms ease;
  white-space: nowrap;
}
.hub-theme-switch-option.active { color: #1e293b; }
[data-theme="dark"] .hub-theme-switch-option.active { color: #e2e8f0; }
.hub-theme-switch-slider {
  position: absolute; top: 3px; left: 3px;
  height: calc(100% - 6px); width: 50%;
  background: rgba(255,255,255,0.15); border-radius: 16px;
  transition: transform 300ms cubic-bezier(0.16, 1, 0.3, 1), background 300ms ease;
  z-index: 1;
}
[data-theme="light"] .hub-theme-switch-slider {
  background: #fbbf24; transform: translateX(0);
}
[data-theme="dark"] .hub-theme-switch-slider {
  background: #3b82f6; transform: translateX(100%);
}
/* Header is always dark bg, so track stays dark-styled */
.hub-theme-switch-track {
  background: rgba(255,255,255,0.08); border-color: rgba(255,255,255,0.12);
}
.hub-theme-switch-option { color: #94a3b8; }
[data-theme="light"] .hub-theme-switch-option[data-mode="light"].active { color: #1e293b; }
[data-theme="dark"] .hub-theme-switch-option[data-mode="dark"].active { color: #fff; }

.module-container { display: none; flex: 1; overflow: hidden; flex-direction: column; }
.module-container.active { display: flex; }

/* ═══ MAP LAYER TOGGLE BAR ═══ */
.map-layer-bar { flex-shrink: 0; background: var(--color-surface); border-bottom: 1px solid var(--color-divider); }
.map-layer-bar-inner { display: flex; align-items: center; gap: 16px; padding: 8px 24px; max-width: 1600px; margin: 0 auto; }
.map-layer-title { font-family: var(--font-display); font-size: 12px; font-weight: 700; color: var(--color-text-muted);
  text-transform: uppercase; letter-spacing: 0.06em; white-space: nowrap; }
.map-layer-chips { display: flex; gap: 6px; }
.map-layer-chip { display: flex; align-items: center; gap: 6px; padding: 6px 14px; border-radius: 20px;
  border: 1.5px solid var(--color-divider); background: var(--color-bg); color: var(--color-text-muted);
  font-family: var(--font-body); font-size: 12.5px; font-weight: 500; cursor: pointer; transition: all 180ms ease;
  white-space: nowrap; }
.map-layer-chip:hover { border-color: var(--color-primary-light); color: var(--color-text); background: var(--color-surface-2); }
.map-layer-chip.active { border-color: var(--color-primary); background: var(--color-primary); color: #fff; box-shadow: 0 2px 8px rgba(0,0,0,0.12); }
.map-layer-chip.active:hover { opacity: 0.92; }
.map-layer-chip.active svg { stroke: #fff; }
.map-layer-info { margin-left: auto; font-size: 11px; color: var(--color-text-faint); white-space: nowrap; }

/* Vendor pins overlay on agri map */
.vendor-pin { transition: r 150ms ease, opacity 150ms ease; }
.vendor-pin:hover { filter: brightness(1.1); }
.vendor-cluster { transition: r 150ms ease; }

/* ═══ AGRI MAP ═══ */
.agri-subheader { flex-shrink: 0; background: var(--color-surface); border-bottom: 1px solid var(--color-divider);
  padding: var(--space-2) var(--space-6); }
.agri-subheader-inner { display: flex; align-items: center; gap: var(--space-4); max-width: 1440px; margin: 0 auto; }
.agri-layout { flex: 1; display: grid; grid-template-columns: 1fr 400px; overflow: hidden; }
.map-section { position: relative; padding: var(--space-3); display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
#agri-map-container { flex: 1; min-height: 0; background: var(--map-bg); border-radius: var(--radius-lg);
  border: 1px solid var(--color-divider); overflow: hidden; position: relative; }
#agri-india-map { width: 100%; height: 100%; }
.map-controls { position: absolute; top: var(--space-3); right: var(--space-3); display: flex;
  flex-direction: column; gap: 2px; z-index: 10; }
.map-ctrl-btn { width: 32px; height: 32px; display: flex; align-items: center; justify-content: center;
  background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-sm);
  color: var(--color-text-muted); box-shadow: var(--shadow-sm); transition: all var(--transition); }
.map-ctrl-btn:hover { background: var(--color-surface-2); color: var(--color-text); border-color: var(--color-primary); }
.map-legend { padding: var(--space-2) 0; }
.map-legend h3 { font-size: var(--text-xs); font-weight: 600; color: var(--color-text-muted);
  text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: var(--space-2); }
.legend-items { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-4); }
.legend-item { display: flex; align-items: center; gap: var(--space-1); font-size: var(--text-xs);
  color: var(--color-text-muted); cursor: pointer; padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm); border: 1px solid transparent; transition: all var(--transition); }
.legend-item:hover { background: var(--color-surface-2); border-color: var(--color-border); }
.legend-item.active { background: var(--color-surface-2); border-color: var(--color-primary); color: var(--color-text); }
.legend-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.state-path { fill: var(--map-state-fill); stroke: var(--map-state-stroke); stroke-width: 0.5; cursor: pointer; transition: fill 200ms ease; }
.state-path:hover { fill: var(--map-state-hover); stroke: var(--color-primary); stroke-width: 1; }
.state-path.active { fill: var(--map-state-active); stroke: var(--color-primary) !important; stroke-width: 2 !important; fill-opacity: 0.02 !important; }
.state-path.has-spices { fill: color-mix(in srgb, var(--map-state-fill) 70%, var(--color-primary) 30%); }
.state-path.highlighted { fill: var(--color-primary); fill-opacity: 0.35; stroke: var(--color-primary); stroke-width: 1; }
.state-path.dimmed { fill: var(--map-state-fill); opacity: 0.4; }
.district-path { fill: transparent; stroke: var(--color-divider); stroke-width: 0.3; stroke-opacity: 0.3; cursor: pointer; transition: fill 0.2s ease; }
.district-path.district-active-state { stroke: var(--color-text-muted); stroke-width: 0.5; stroke-opacity: 0.6;
  fill: color-mix(in srgb, var(--color-primary) 5%, transparent 95%); }
.district-path.district-highlighted { fill: color-mix(in srgb, var(--color-primary) 15%, transparent 85%);
  stroke: var(--color-primary); stroke-width: 0.6; stroke-opacity: 0.7; }
.district-path.district-crop-highlight { fill: color-mix(in srgb, var(--color-primary) 35%, transparent 65%);
  stroke: var(--color-primary); stroke-width: 1; stroke-opacity: 1; }
.district-path:hover { stroke-opacity: 1 !important; stroke-width: 0.8 !important; }
.district-label { font-size: 4px; font-weight: 500; font-family: var(--font-body); fill: var(--color-text-muted);
  pointer-events: none; text-anchor: middle; opacity: 0.7; paint-order: stroke;
  stroke: var(--color-surface); stroke-width: 2px; stroke-linejoin: round; }
.district-label.district-label-active { fill: var(--color-primary); font-weight: 700; font-size: 4.5px; opacity: 1; }
[data-theme="dark"] .district-label { fill: var(--color-text-faint); stroke: var(--color-bg); }
.state-label { font-family: var(--font-body); fill: var(--color-text-muted); pointer-events: none;
  paint-order: stroke; stroke: var(--color-bg); stroke-width: 2px; }
.agri-sidebar { border-left: 1px solid var(--color-divider); background: var(--color-surface); overflow-y: auto; padding: var(--space-4) var(--space-5); }
.sidebar-prompt { text-align: center; padding: var(--space-8) var(--space-4); color: var(--color-text-muted); }
.sidebar-prompt p { font-size: var(--text-base); margin-top: var(--space-3); font-weight: 500; }
.sidebar-hint { font-size: var(--text-xs); display: block; margin-top: var(--space-2); color: var(--color-text-faint); }
.sidebar-back { font-size: var(--text-sm); color: var(--color-primary); margin-bottom: var(--space-4); padding: var(--space-1) 0; }
.sidebar-back:hover { color: var(--color-primary-hover); }
.stats-overview { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: var(--space-2); margin-top: var(--space-4); }
.stat-card { background: var(--color-surface-2); border-radius: var(--radius-md); padding: var(--space-3); text-align: center; }
.stat-number { font-family: var(--font-display); font-size: var(--text-lg); font-weight: 700; color: var(--color-primary); line-height: 1.2; }
.stat-label { font-size: var(--text-xs); color: var(--color-text-muted); margin-top: var(--space-1); }
.state-header { margin-bottom: var(--space-4); }
.state-name { font-family: var(--font-display); font-size: var(--text-xl); font-weight: 800; line-height: 1.15; }
.state-nickname { font-size: var(--text-sm); color: var(--color-primary); font-weight: 500; margin-top: var(--space-1); }
.state-meta { font-size: var(--text-xs); color: var(--color-text-muted); margin-top: var(--space-1); }
.state-category-badges { display: flex; gap: var(--space-1); margin-top: var(--space-2); flex-wrap: wrap; }
.category-badge { font-size: var(--text-xs); padding: 2px var(--space-2); border-radius: var(--radius-sm); font-weight: 600; }
.spice-badge { background: color-mix(in srgb, #d93025 12%, var(--color-surface-2) 88%); color: #d93025; }
.grain-badge { background: color-mix(in srgb, #795548 12%, var(--color-surface-2) 88%); color: #795548; }
.pulse-badge { background: color-mix(in srgb, #00897b 12%, var(--color-surface-2) 88%); color: #00897b; }
.millet-badge { background: color-mix(in srgb, #8d6e63 12%, var(--color-surface-2) 88%); color: #8d6e63; }
.spice-card { background: var(--color-bg); border: 1px solid var(--color-divider); border-radius: var(--radius-lg);
  padding: var(--space-4); margin-bottom: var(--space-3); cursor: default; transition: border-color var(--transition), box-shadow var(--transition); }
.spice-card:hover { border-color: var(--color-primary); box-shadow: 0 2px 8px color-mix(in srgb, var(--color-primary) 12%, transparent 88%); }
.spice-card.gi-tagged { border-color: color-mix(in srgb, #b5901e 30%, var(--color-divider) 70%); }
.spice-card-header { display: flex; align-items: center; gap: var(--space-2); margin-bottom: var(--space-3); }
.spice-category-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.spice-card-name { font-weight: 700; font-size: var(--text-base); flex: 1; }
.spice-card-icon { font-size: 1.2em; }
.gi-badge { font-size: 10px; font-weight: 700; background: #b5901e; color: #fff; padding: 1px 6px;
  border-radius: var(--radius-sm); text-transform: uppercase; letter-spacing: 0.05em; }
.spice-section { margin-bottom: var(--space-3); }
.spice-section:last-child { margin-bottom: 0; }
.spice-section-title { font-size: var(--text-xs); font-weight: 600; color: var(--color-text-muted);
  text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: var(--space-1); }
.spice-tags { display: flex; flex-wrap: wrap; gap: var(--space-1); }
.spice-tag { display: inline-block; font-size: var(--text-xs); background: var(--color-surface-2);
  color: var(--color-text); padding: 2px var(--space-2); border-radius: var(--radius-sm); border: 1px solid var(--color-divider); }
.spice-tag.grade-tag { background: color-mix(in srgb, var(--color-primary) 8%, var(--color-surface-2) 92%); }
.season-bar { display: grid; grid-template-columns: repeat(12, 1fr); gap: 2px; height: 20px; border-radius: var(--radius-sm); overflow: hidden; }
.season-month { display: flex; align-items: center; justify-content: center; font-size: 9px; font-weight: 500; border-radius: 2px; }
.season-month.inactive { background: var(--color-surface-offset); color: var(--color-text-faint); }
.season-month.harvest { background: var(--color-primary); color: #fff; font-weight: 600; }
.season-info { font-size: var(--text-xs); color: var(--color-text-muted); margin-bottom: var(--space-1); }
.season-info strong { color: var(--color-text); font-weight: 600; }
.spice-note { font-size: var(--text-xs); color: var(--color-text-muted); font-style: italic;
  padding-top: var(--space-2); border-top: 1px solid var(--color-divider); }
.spice-regions { font-size: var(--text-xs); color: var(--color-text-muted); }
.region-tag { display: inline-block; font-size: var(--text-xs); color: var(--color-text-muted); }
.district-hint { font-size: var(--text-xs); color: var(--color-primary); font-weight: 400; font-style: italic; }
.section-divider { display: flex; align-items: center; gap: var(--space-3); margin: var(--space-4) 0 var(--space-3); }
.section-divider::before, .section-divider::after { content: ""; flex: 1; height: 1px; background: var(--color-divider); }
.section-divider span { font-size: var(--text-xs); font-weight: 700; color: var(--color-primary);
  text-transform: uppercase; letter-spacing: 0.08em; white-space: nowrap; }
.search-box { position: relative; display: flex; align-items: center; }
.search-box .search-icon { position: absolute; left: 10px; color: var(--color-text-faint); pointer-events: none; z-index: 2; }
.search-box input { padding: var(--space-1) var(--space-3) var(--space-1) 34px; font-size: var(--text-sm);
  border: 1px solid var(--color-border); border-radius: var(--radius-md); background: var(--color-surface);
  color: var(--color-text); width: 220px; font-family: var(--font-body); transition: all var(--transition); }
.search-box input:focus { outline: none; border-color: var(--color-primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-primary) 15%, transparent 85%); width: 280px; }
.search-results { position: absolute; top: 100%; left: 0; right: 0; background: var(--color-surface);
  border: 1px solid var(--color-border); border-radius: var(--radius-md); box-shadow: var(--shadow-lg);
  max-height: 360px; overflow-y: auto; z-index: 200; margin-top: 4px; display: none; min-width: 300px; }
.search-results.visible { display: block; }
.search-result-item { display: flex; align-items: center; gap: var(--space-2); padding: var(--space-2) var(--space-3);
  cursor: pointer; transition: background var(--transition); font-size: var(--text-sm);
  border-bottom: 1px solid var(--color-divider); }
.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover { background: var(--color-surface-2); }
.search-result-item small { font-size: var(--text-xs); color: var(--color-text-muted); }
.search-result-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.search-empty { padding: var(--space-4); text-align: center; color: var(--color-text-muted); font-size: var(--text-sm); }
.season-filter { display: flex; align-items: center; gap: var(--space-2); }
.season-filter label { font-size: var(--text-xs); color: var(--color-text-muted); white-space: nowrap; }
.season-filter select { font-size: var(--text-sm); padding: var(--space-1) var(--space-3);
  border: 1px solid var(--color-border); border-radius: var(--radius-md); background: var(--color-surface); color: var(--color-text); }
.tooltip { position: fixed; pointer-events: none; background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: var(--radius-md); padding: var(--space-2) var(--space-3); box-shadow: var(--shadow-lg);
  z-index: 1000; opacity: 0; transition: opacity 150ms ease; max-width: 280px; font-size: var(--text-sm); }
.tooltip.visible { opacity: 1; }
.tooltip-title { font-weight: 700; font-size: var(--text-sm); margin-bottom: var(--space-1); }
.tooltip-spices { font-size: var(--text-xs); color: var(--color-text-muted); line-height: 1.5; }
.tooltip-spice-item { display: flex; align-items: center; gap: 4px; }

/* ═══ DISTRIBUTION MODULE ═══ */
.dist-layout { flex: 1; display: grid; grid-template-columns: 320px 1fr; overflow: hidden; }
.dist-sidebar { background: var(--color-surface); border-right: 1px solid var(--color-border); overflow-y: auto; }
.dist-sidebar-inner { padding: 0; }
.sidebar-section { padding: 14px 18px; border-bottom: 1px solid var(--color-divider); }
.section-title { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--color-text-muted); margin-bottom: 10px; display: flex; align-items: center; gap: 6px; }
.section-title i { font-size: 11px; }
.view-toggle { display: flex; gap: 4px; background: var(--color-surface-offset); padding: 3px; border-radius: var(--radius-md); }
.view-btn { flex: 1; padding: 6px 12px; border-radius: 6px; font-size: 13px; font-weight: 500; color: var(--color-text-muted); transition: all var(--transition); }
.view-btn.active { background: var(--color-surface); color: var(--color-text); box-shadow: var(--shadow-sm); }
.brand-filters { display: flex; flex-wrap: wrap; gap: 6px; }
.brand-chip { display: flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: var(--radius-xl);
  font-size: 12px; font-weight: 500; color: var(--color-text-muted); border: 1px solid var(--color-border); cursor: pointer; transition: all var(--transition); }
.brand-chip input { display: none; }
.brand-chip.active { background: color-mix(in srgb, var(--color-primary) 10%, transparent); border-color: var(--color-primary); color: var(--color-primary); }
.status-filters { display: flex; flex-direction: column; gap: 6px; }
.status-chip { display: flex; align-items: center; gap: 8px; padding: 5px 0; font-size: 13px; cursor: pointer; }
.status-chip input { width: 16px; height: 16px; accent-color: var(--color-primary); }
.chip-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.region-filters { display: flex; flex-wrap: wrap; gap: 4px; }
.region-btn { padding: 4px 10px; border-radius: var(--radius-xl); font-size: 12px; font-weight: 500;
  color: var(--color-text-muted); border: 1px solid var(--color-border); transition: all var(--transition); }
.region-btn.active { background: var(--color-primary); border-color: var(--color-primary); color: #fff; }
.region-btn:hover:not(.active) { border-color: var(--color-primary); color: var(--color-primary); }
.upload-btn { width: 100%; padding: 10px; border: 2px dashed var(--color-border); border-radius: var(--radius-md);
  font-size: 13px; font-weight: 500; color: var(--color-text-muted); display: flex; align-items: center;
  justify-content: center; gap: 8px; transition: all var(--transition); }
.upload-btn:hover { border-color: var(--color-primary); color: var(--color-primary); }
.upload-hint { font-size: 11px; color: var(--color-text-faint); text-align: center; margin-top: 6px; }
.upload-status { background: var(--color-surface-offset); border-radius: var(--radius-md); padding: 10px; }
.upload-info { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--color-active); }
.upload-meta { font-size: 11px; color: var(--color-text-muted); display: block; margin-top: 4px; }
.upload-clear { font-size: 11px; color: var(--color-vacuum); margin-top: 6px; padding: 2px 0; }
.column-mapping { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--color-divider); }
.column-mapping h4 { font-size: 12px; font-weight: 600; margin-bottom: 8px; }
.mapping-row { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.mapping-row label { font-size: 12px; color: var(--color-text-muted); min-width: 70px; }
.map-select { flex: 1; padding: 4px 8px; border: 1px solid var(--color-border); border-radius: var(--radius-sm); background: var(--color-surface); font-size: 12px; }
.apply-mapping-btn { width: 100%; padding: 8px; margin-top: 8px; background: var(--color-primary); color: #fff;
  font-size: 13px; font-weight: 600; border-radius: var(--radius-md); display: flex; align-items: center;
  justify-content: center; gap: 6px; transition: all var(--transition); }
.apply-mapping-btn:hover { filter: brightness(0.9); }
.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.dist-sidebar .stat-card { background: var(--color-surface-offset); padding: 10px; border-radius: var(--radius-md); text-align: center; }
.stat-value { font-family: var(--font-display); font-size: 20px; font-weight: 700; display: block; }
.stats-grid .stat-card:nth-child(1) .stat-value { color: var(--color-active); }
.stats-grid .stat-card:nth-child(2) .stat-value { color: var(--color-potential); }
.stats-grid .stat-card:nth-child(3) .stat-value { color: var(--color-vacuum); }
.stats-grid .stat-card:nth-child(4) .stat-value { color: var(--color-planned); }
.search-input { width: 100%; padding: 8px 12px; border: 1px solid var(--color-border); border-radius: var(--radius-md);
  background: var(--color-surface); font-size: 13px; transition: all var(--transition); }
.search-input:focus { outline: none; border-color: var(--color-primary); }
.dist-main { display: flex; flex-direction: column; overflow: hidden; position: relative; }
.dist-topbar { height: 44px; padding: 0 16px; display: flex; align-items: center; gap: 12px;
  border-bottom: 1px solid var(--color-divider); background: var(--color-surface); flex-shrink: 0; }
.current-view { font-size: 14px; font-weight: 600; flex: 1; }
.dist-topbar-actions { display: flex; gap: 4px; }
.icon-btn { width: 36px; height: 36px; border-radius: var(--radius-md); display: flex; align-items: center;
  justify-content: center; color: var(--color-text-muted); transition: all var(--transition); }
.icon-btn:hover { background: var(--color-surface-offset); color: var(--color-text); }
.dist-map-wrapper { flex: 1; position: relative; overflow: hidden; background: var(--map-bg); }
.dist-map-container { width: 100%; height: 100%; overflow: hidden; }
#distMapSvg { width: 100%; height: 100%; overflow: hidden; }

/* DISTRIBUTION MAP PATHS — with visible strokes and clear status colors */
#distMapSvg .state-path, #distMapSvg .district-path {
  stroke: #fff; stroke-width: 1.5; transition: fill 300ms ease; cursor: pointer; }
#distMapSvg .state-path:hover, #distMapSvg .district-path:hover {
  stroke-width: 2.5; stroke: #fff; filter: brightness(1.15); }
[data-theme="dark"] #distMapSvg .state-path, [data-theme="dark"] #distMapSvg .district-path {
  stroke: rgba(255,255,255,0.35); stroke-width: 1.5; }
[data-theme="dark"] #distMapSvg .state-path:hover, [data-theme="dark"] #distMapSvg .district-path:hover {
  stroke: rgba(255,255,255,0.7); stroke-width: 2.5; }
#distMapSvg .state-path.no-data, #distMapSvg .district-path.no-data { fill: #d5cfc5; }
[data-theme="dark"] #distMapSvg .state-path.no-data, [data-theme="dark"] #distMapSvg .district-path.no-data { fill: #3d3a34; }
#distMapSvg .state-path.active, #distMapSvg .district-path.active { fill: #059669; }
[data-theme="dark"] #distMapSvg .state-path.active, [data-theme="dark"] #distMapSvg .district-path.active { fill: #34d399; }
#distMapSvg .state-path.potential, #distMapSvg .district-path.potential { fill: #d97706; }
[data-theme="dark"] #distMapSvg .state-path.potential, [data-theme="dark"] #distMapSvg .district-path.potential { fill: #fbbf24; }
#distMapSvg .state-path.vacuum, #distMapSvg .district-path.vacuum { fill: #dc2626; }
[data-theme="dark"] #distMapSvg .state-path.vacuum, [data-theme="dark"] #distMapSvg .district-path.vacuum { fill: #f87171; }
#distMapSvg .state-path.planned, #distMapSvg .district-path.planned { fill: #2563eb; }
[data-theme="dark"] #distMapSvg .state-path.planned, [data-theme="dark"] #distMapSvg .district-path.planned { fill: #60a5fa; }
#distMapSvg .state-path.mixed, #distMapSvg .district-path.mixed { fill: #8b5cf6; }
[data-theme="dark"] #distMapSvg .state-path.mixed, [data-theme="dark"] #distMapSvg .district-path.mixed { fill: #a78bfa; }
#distMapSvg .state-label { font-size: 9px; font-weight: 600; fill: var(--color-text); text-anchor: middle;
  pointer-events: none; paint-order: stroke; stroke: var(--color-bg); stroke-width: 2.5px; opacity: 0.85; }
#distMapSvg .district-label { font-size: 7px; font-weight: 500; fill: var(--color-text); text-anchor: middle;
  pointer-events: none; paint-order: stroke; stroke: var(--color-bg); stroke-width: 2px; opacity: 0.8; }

.map-tooltip { position: absolute; pointer-events: none; background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: var(--radius-md); padding: 10px 14px; box-shadow: var(--shadow-lg); z-index: 20; font-size: 12px;
  max-width: 260px; opacity: 0; transition: opacity 150ms ease; }
.map-tooltip.visible { opacity: 1; }
.map-tooltip .tooltip-title { font-weight: 700; font-size: 14px; margin-bottom: 4px; }
.tooltip-row { display: flex; justify-content: space-between; gap: 12px; padding: 2px 0; }
.tooltip-label { color: var(--color-text-muted); }
.tooltip-value { font-weight: 600; }
.tooltip-status { display: inline-block; padding: 1px 8px; border-radius: var(--radius-xl); font-size: 11px; font-weight: 600; color: #fff; }
.tooltip-status.active { background: var(--color-active); }
.tooltip-status.potential { background: var(--color-potential); }
.tooltip-status.vacuum { background: var(--color-vacuum); }
.tooltip-status.planned { background: var(--color-planned); }
.dist-map-legend { position: absolute; bottom: 16px; right: 16px; background: var(--color-surface);
  border: 1px solid var(--color-border); border-radius: var(--radius-lg); padding: 12px 16px;
  box-shadow: var(--shadow-md); z-index: 10; min-width: 180px; }
.dist-map-legend h4 { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--color-text-muted); margin-bottom: 8px; }
.dist-map-legend .legend-item { display: flex; align-items: center; gap: 8px; padding: 3px 0; font-size: 12px; }
.legend-color { width: 14px; height: 14px; border-radius: 3px; flex-shrink: 0; }
.map-breadcrumb { position: absolute; top: 12px; left: 12px; display: flex; align-items: center; gap: 8px; z-index: 10; }
.breadcrumb-btn { display: flex; align-items: center; gap: 6px; padding: 6px 14px; background: var(--color-surface);
  border: 1px solid var(--color-border); border-radius: var(--radius-xl); font-size: 13px; font-weight: 500;
  box-shadow: var(--shadow-sm); transition: all var(--transition); }
.breadcrumb-btn:hover { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }
.breadcrumb-current { font-size: 14px; font-weight: 700; background: var(--color-surface); padding: 6px 14px;
  border-radius: var(--radius-xl); border: 1px solid var(--color-border); box-shadow: var(--shadow-sm); }
.detail-panel { position: absolute; right: 0; top: 0; bottom: 0; width: 340px; background: var(--color-surface);
  border-left: 1px solid var(--color-border); box-shadow: var(--shadow-lg); z-index: 15;
  transform: translateX(100%); transition: transform var(--transition); display: flex; flex-direction: column; overflow: hidden; }
.detail-panel.open { transform: translateX(0); }
.detail-header { padding: 14px 16px; border-bottom: 1px solid var(--color-divider); display: flex;
  align-items: center; justify-content: space-between; flex-shrink: 0; }
.detail-header h3 { font-size: 15px; font-weight: 700; }
.detail-close { width: 28px; height: 28px; border-radius: var(--radius-sm); display: flex;
  align-items: center; justify-content: center; color: var(--color-text-muted); }
.detail-close:hover { background: var(--color-surface-offset); }
.detail-body { flex: 1; overflow-y: auto; padding: 16px; }
.detail-placeholder { color: var(--color-text-faint); font-size: 13px; text-align: center; padding: 40px 0; }
.detail-stat { display: flex; justify-content: space-between; align-items: center; padding: 8px 0;
  border-bottom: 1px solid var(--color-divider); }
.detail-stat-label { font-size: 12px; color: var(--color-text-muted); }
.detail-stat-value { font-size: 14px; font-weight: 600; }
.detail-section-title { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--color-text-muted); margin: 16px 0 8px; }
.detail-distributor { background: var(--color-surface-offset); padding: 10px 12px; border-radius: var(--radius-md); margin-bottom: 8px; }
.detail-distributor-name { font-weight: 600; font-size: 13px; }
.detail-distributor-meta { font-size: 11px; color: var(--color-text-muted); margin-top: 2px; }
.detail-distributor-brand { display: inline-block; padding: 1px 8px; border-radius: var(--radius-xl);
  font-size: 10px; font-weight: 600; margin-top: 4px; }
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 50; display: flex;
  align-items: center; justify-content: center; backdrop-filter: blur(4px); }
.modal { background: var(--color-surface); border-radius: var(--radius-xl); box-shadow: var(--shadow-lg);
  width: 420px; max-height: 80vh; overflow-y: auto; }
.modal-header { padding: 16px 20px; border-bottom: 1px solid var(--color-divider); display: flex;
  align-items: center; justify-content: space-between; }
.modal-header h3 { font-size: 16px; font-weight: 700; }
.modal-close { width: 28px; height: 28px; border-radius: var(--radius-sm); display: flex;
  align-items: center; justify-content: center; color: var(--color-text-muted); }
.modal-close:hover { background: var(--color-surface-offset); }
.modal-body { padding: 20px; }
.form-row { margin-bottom: 14px; }
.form-row label { display: block; font-size: 12px; font-weight: 600; color: var(--color-text-muted); margin-bottom: 4px; }
.form-row select, .form-row input, .form-row textarea { width: 100%; padding: 8px 12px; border: 1px solid var(--color-border);
  border-radius: var(--radius-md); background: var(--color-surface); font-size: 13px; }
.form-row textarea { resize: vertical; min-height: 60px; }
.form-row select:focus, .form-row input:focus, .form-row textarea:focus { outline: none; border-color: var(--color-primary); }
.form-actions { display: flex; gap: 8px; margin-top: 20px; }
.btn-primary { flex: 1; padding: 10px 16px; background: var(--color-primary); color: #fff; font-weight: 600;
  border: none; border-radius: var(--radius-md); display: flex; align-items: center; justify-content: center;
  gap: 6px; transition: background var(--transition); }
.btn-primary:hover { filter: brightness(0.9); }
.btn-secondary { padding: 10px 16px; background: var(--color-surface-offset); color: var(--color-text);
  font-weight: 500; border: 1px solid var(--color-border); border-radius: var(--radius-md); }
.fab { position: fixed; bottom: 24px; right: 24px; width: 48px; height: 48px; border-radius: 50%;
  background: var(--color-primary); color: #fff; display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-lg); z-index: 25; font-size: 18px; transition: all var(--transition); }
.fab:hover { filter: brightness(0.9); transform: scale(1.05); }

/* ═══ PLACEHOLDER MODULES ═══ */
.module-placeholder { flex: 1; display: flex; align-items: center; justify-content: center; background: var(--color-bg); }
.placeholder-content { text-align: center; color: var(--color-text-muted); }
.placeholder-content svg { margin-bottom: var(--space-4); }
.placeholder-content h2 { font-family: var(--font-display); font-size: var(--text-xl); font-weight: 800;
  color: var(--color-text); margin-bottom: var(--space-2); }
.placeholder-content p { font-size: var(--text-sm); max-width: 320px; line-height: 1.6; margin: 0 auto var(--space-4); }
.coming-badge { display: inline-block; padding: 6px 20px; border-radius: var(--radius-xl);
  font-size: var(--text-xs); font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em;
  background: color-mix(in srgb, var(--color-primary) 10%, var(--color-surface-2) 90%);
  color: var(--color-primary); border: 1px solid color-mix(in srgb, var(--color-primary) 25%, transparent 75%); }
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--color-border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--color-text-faint); }
/* ═══════════ HOME SCREEN ═══════════ */
.home-screen {
  display: flex; flex-direction: column; min-height: 100%;
  padding: 40px 32px 24px;
  background: var(--color-bg);
  overflow-y: auto;
}
.home-header { text-align: center; margin-bottom: 36px; }
.home-greeting {
  font-family: var(--font-display); font-size: 28px; font-weight: 800;
  color: var(--color-text); margin: 0 0 4px;
}
.home-subtitle {
  font-size: 14px; color: var(--color-text-muted); margin: 0;
  letter-spacing: 0.02em;
}
.home-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  max-width: 960px;
  margin: 0 auto;
  width: 100%;
}
.home-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 14px;
  padding: 24px 20px 20px;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(.4,0,.2,1);
  text-align: center;
  position: relative;
  overflow: hidden;
}
.home-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 32px rgba(0,0,0,0.1);
  border-color: var(--color-primary);
}
.home-card-icon {
  width: 64px; height: 64px;
  border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 14px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.home-card h3 {
  font-family: var(--font-display); font-size: 16px; font-weight: 700;
  color: var(--color-text); margin: 0 0 6px;
}
.home-card p {
  font-size: 12px; color: var(--color-text-muted);
  margin: 0 0 10px; line-height: 1.5;
}
.home-card-stat {
  font-size: 11px; color: var(--color-text-faint);
  font-weight: 500; letter-spacing: 0.01em;
  padding-top: 10px; border-top: 1px solid var(--color-divider);
}
.home-footer {
  text-align: center; margin-top: auto; padding-top: 32px;
  font-size: 12px; color: var(--color-text-faint);
}

/* Header hidden on home screen */
.hub-header.home-mode .hub-nav { display: none; }
.hub-header.home-mode .hub-brand { cursor: default; }

@media (max-width: 900px) {
  .agri-layout { grid-template-columns: 1fr; }
  .agri-sidebar { border-left: none; border-top: 1px solid var(--color-divider); max-height: 400px; }
  .dist-layout { grid-template-columns: 1fr; }
  .dist-sidebar { display: none; }
  .hub-nav-btn span { display: none; }
  .hub-nav-btn { padding: 8px; }
  .home-grid { grid-template-columns: repeat(2, 1fr); gap: 14px; }
  .home-screen { padding: 24px 16px; }
  .home-greeting { font-size: 22px; }
}
@media (max-width: 500px) {
  .home-grid { grid-template-columns: 1fr; }
}
