/**
 * Production Dashboard — Material-style sidebar layout.
 * Fixed indigo sidebar · sticky topbar & filter bar · flat cards · Inter font.
 */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;600;700&display=swap');

:root {
  --font: 'Inter', 'IBM Plex Sans', 'Segoe UI', system-ui, sans-serif;
  --font-table: 'IBM Plex Sans', 'Inter', 'Segoe UI', system-ui, sans-serif;

  --primary: #405189;
  --primary-rgb: 64,81,137;
  --secondary: #3577f1;
  --success: #45CB85;
  --info: #299cdb;
  --warning: #ffbe0b;
  --danger: #f06548;
  --teal: #02a8b5;
  --purple: #6559cc;
  --orange: #f1963b;
  --pink: #f672a7;

  --gray-100: #f3f6f9;
  --gray-200: #eff2f7;
  --gray-300: #e9ebec;
  --gray-400: #ced4da;
  --gray-500: #adb5bd;
  --gray-600: #878a99;
  --gray-700: #495057;
  --gray-800: #343a40;
  --gray-900: #212529;

  --body-bg: #f2f2f7;
  --card-bg: #fff;
  --border: #e9ebec;
  --text: #212529;
  --text-muted: #6b7280;
  --text-label: #4b5563;
  --heading: #374151;

  --sidebar-bg: #151529;
  --sidebar-text: #abb9e8;
  --sidebar-active: #fff;
  --sidebar-hover-bg: rgba(255,255,255,.08);
  --sidebar-width: 210px;
  --topbar-height: 64px;

  --shadow: 0 1px 2px rgba(56,65,74,.15);
  --shadow-lg: 0 5px 10px rgba(30,32,37,.12);
  --radius: 0.25rem;

  /* Thin scrollbars (see block below) */
  --scrollbar-thin: 6px;
  --scrollbar-radius: 999px;
  --scrollbar-track: rgba(100, 116, 139, 0.1);
  --scrollbar-thumb: rgba(100, 116, 139, 0.4);
  --scrollbar-thumb-hover: rgba(71, 85, 105, 0.72);
  --scrollbar-track-modal: rgba(53, 119, 241, 0.07);
  --scrollbar-thumb-modal: rgba(53, 119, 241, 0.42);
  --scrollbar-thumb-modal-hover: rgba(37, 99, 235, 0.7);
}

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

body {
  font-family: var(--font);
  font-size: 0.875rem;
  color: var(--text);
  background: var(--body-bg);
  min-height: 100vh;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* —— Thin styled scrollbars: modal, wide tables, data tables, assistant —— */
.modal .modal-body {
  scrollbar-gutter: stable;
}
:is(
  .modal .modal-body,
  .region-target-report-wrap,
  .drill-table-wrap,
  .data-table-wrapper,
  .zone-summary-table-wrap,
  .chatbot-body
) {
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}

:is(
  .modal .modal-body,
  .region-target-report-wrap,
  .drill-table-wrap,
  .data-table-wrapper,
  .zone-summary-table-wrap,
  .chatbot-body
)::-webkit-scrollbar {
  width: var(--scrollbar-thin);
  height: var(--scrollbar-thin);
}
:is(
  .modal .modal-body,
  .region-target-report-wrap,
  .drill-table-wrap,
  .data-table-wrapper,
  .zone-summary-table-wrap,
  .chatbot-body
)::-webkit-scrollbar-track {
  background: var(--scrollbar-track);
  border-radius: var(--scrollbar-radius);
}
:is(
  .modal .modal-body,
  .region-target-report-wrap,
  .drill-table-wrap,
  .data-table-wrapper,
  .zone-summary-table-wrap,
  .chatbot-body
)::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  background-clip: padding-box;
  border: 2px solid transparent;
  border-radius: var(--scrollbar-radius);
}
:is(
  .modal .modal-body,
  .region-target-report-wrap,
  .drill-table-wrap,
  .data-table-wrapper,
  .zone-summary-table-wrap,
  .chatbot-body
)::-webkit-scrollbar-thumb:hover {
  background: var(--scrollbar-thumb-hover);
}
:is(
  .modal .modal-body,
  .region-target-report-wrap,
  .drill-table-wrap,
  .data-table-wrapper,
  .zone-summary-table-wrap,
  .chatbot-body
)::-webkit-scrollbar-corner {
  background: transparent;
}

/* Zone / area modal: match dashboard blue accent */
.modal--zone-area .modal-body {
  scrollbar-color: var(--scrollbar-thumb-modal) var(--scrollbar-track-modal);
}
.modal--zone-area .modal-body::-webkit-scrollbar-track {
  background: var(--scrollbar-track-modal);
}
.modal--zone-area .modal-body::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb-modal);
}
.modal--zone-area .modal-body::-webkit-scrollbar-thumb:hover {
  background: var(--scrollbar-thumb-modal-hover);
}

/* ═══════════ Sidebar ═══════════ */

.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform .25s ease;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255,255,255,.1);
}

.sidebar-logo {
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  background: linear-gradient(155deg, #2f3348 0%, #222536 100%);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,.95);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.06);
}

.sidebar-logo-svg {
  width: 15px;
  height: 15px;
  display: block;
}

.sidebar-brand-text {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.sidebar-title {
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.02em;
  line-height: 1.25;
}

.sidebar-tagline {
  font-size: 10px;
  font-weight: 500;
  color: rgba(171, 185, 232, 0.88);
  letter-spacing: 0.02em;
  line-height: 1.35;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.35) rgba(255, 255, 255, 0.06);
}
.sidebar-nav::-webkit-scrollbar {
  width: var(--scrollbar-thin);
  height: var(--scrollbar-thin);
}
.sidebar-nav::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.06);
  border-radius: var(--scrollbar-radius);
}
.sidebar-nav::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.32);
  border-radius: var(--scrollbar-radius);
  border: 2px solid transparent;
  background-clip: padding-box;
}
.sidebar-nav::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.5);
}
.sidebar-nav::-webkit-scrollbar-corner {
  background: transparent;
}

.sidebar-menu-title {
  display: block;
  padding: 6px 14px 4px;
  font-size: 10px;
  font-weight: 700;
  color: rgba(171,185,232,.5);
  text-transform: uppercase;
  letter-spacing: .08em;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 12px;
  font-weight: 500;
  border-radius: 0;
  transition: background .15s, color .15s;
}

.sidebar-link:hover {
  color: var(--sidebar-active);
  background: var(--sidebar-hover-bg);
}

.sidebar-link.active {
  color: var(--sidebar-active);
  background: rgba(255,255,255,.12);
  font-weight: 600;
}

.sidebar-icon { font-size: 15px; width: 20px; text-align: center; }

.sidebar-nav-group {
  padding-bottom: 6px;
}

/* One divider under the block: closed = under toggle; open = under submenu */
.sidebar-nav-group:not(.is-open) {
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar-nav-group.is-open {
  border-bottom: none;
}

.sidebar-nav-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  padding: 8px 14px 10px;
  margin: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: #fff;
  transition: background 0.15s ease;
}

.sidebar-nav-toggle:hover {
  background: var(--sidebar-hover-bg);
}

.sidebar-nav-toggle:focus-visible {
  outline: 2px solid rgba(53, 119, 241, 0.7);
  outline-offset: -2px;
}

.sidebar-nav-toggle-label {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #fff;
}

.sidebar-nav-chevron {
  flex-shrink: 0;
  color: rgba(171, 185, 232, 0.85);
  transition: transform 0.22s ease;
}

.sidebar-nav-group.is-open .sidebar-nav-chevron {
  transform: rotate(0deg);
}

.sidebar-nav-group:not(.is-open) .sidebar-nav-chevron {
  transform: rotate(-90deg);
}

.sidebar-submenu-panel {
  display: grid;
  grid-template-rows: 0fr;
  margin: 0;
  padding: 0;
  border: none;
  overflow: hidden;
  transition: grid-template-rows 0.22s ease;
}

.sidebar-nav-group.is-open .sidebar-submenu-panel {
  grid-template-rows: 1fr;
  padding-top: 4px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar-submenu-panel > .sidebar-submenu {
  min-height: 0;
  overflow: hidden;
}

.sidebar-nav-group.is-open .sidebar-submenu {
  overflow: visible;
}

/* No border/margin when collapsed — avoids stray “L” line from 0-height grid row */
.sidebar-submenu {
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0;
  border: none;
}

.sidebar-nav-group.is-open .sidebar-submenu {
  padding: 2px 0 6px 4px;
  margin-left: 14px;
  border-left: 2px solid rgba(255, 255, 255, 0.12);
}

.sidebar-sublink {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px 6px 12px;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 12px;
  font-weight: 500;
  transition: background .15s, color .15s;
}

.sidebar-sublink:hover {
  color: var(--sidebar-active);
  background: var(--sidebar-hover-bg);
}

.sidebar-sublink.active {
  color: var(--sidebar-active);
  background: rgba(255,255,255,.12);
  font-weight: 600;
}

.sales-board-section {
  scroll-margin-top: 120px;
}

.sidebar-footer {
  padding: 10px 14px;
  border-top: 1px solid rgba(255,255,255,.1);
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: stretch;
}

.sidebar-assistant-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  border: 1px solid rgba(255,255,255,.22);
  border-radius: var(--radius);
  background: rgba(255,255,255,.1);
  color: #fff;
  font-family: var(--font);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.sidebar-assistant-btn:hover {
  background: rgba(255,255,255,.16);
  border-color: rgba(255,255,255,.4);
}
.sidebar-assistant-btn .ai-icon--sidebar { flex-shrink: 0; }

.sidebar-footer-text {
  font-size: 11px;
  color: rgba(171,185,232,.45);
}

/* ═══════════ Main content ═══════════ */

.main-content {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left .25s ease;
}

/* ═══════════ Top bar ═══════════ */

.topbar {
  position: relative;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px 16px;
  padding: 0 20px;
  height: var(--topbar-height);
  background: var(--card-bg);
  box-shadow: var(--shadow);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
}

.sidebar-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  width: 36px;
  height: 36px;
  cursor: pointer;
  color: var(--gray-700);
  padding: 0;
  flex-shrink: 0;
  transition: color 0.2s, border-color 0.2s;
}

.sidebar-toggle:hover {
  color: var(--primary);
  border-color: var(--primary);
}

.hamburger-icon {
  width: 20px;
  height: 20px;
}

.assistant-header-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--card-bg);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  color: var(--primary);
  transition: border-color .15s, background .15s;
}
.assistant-header-btn:hover {
  border-color: var(--secondary);
  background: rgba(53, 119, 241, 0.06);
}

.page-title {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
  flex: 1 1 0%;
  min-width: 0;
}
.page-title h1 {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--heading);
  line-height: 1.25;
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.page-title p {
  font-size: 0.8125rem;
  color: var(--text-label);
  line-height: 1.45;
  min-width: 0;
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
}

.topbar-center { display: flex; align-items: center; }

.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; }

.filter-group { display: flex; flex-direction: column; gap: 2px; }
.filter-group label { font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; }

.filter-select {
  font-family: var(--font);
  height: 32px; padding: 0 10px;
  border-radius: var(--radius);
  border: 1px solid var(--gray-400);
  background: var(--card-bg);
  color: var(--text);
  font-size: 13px;
  min-width: 120px;
  cursor: pointer;
}
.filter-select:focus { outline: none; border-color: var(--secondary); box-shadow: 0 0 0 0.2rem rgba(53,119,241,.15); }

.topbar-right {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 8px;
  justify-content: flex-end;
  flex-shrink: 0;
}

.api-status {
  font-size: 0.7rem;
  padding: 4px 8px;
  border-radius: 4px;
  font-weight: 600;
}
.api-status.api-connected {
  color: var(--success);
  background: rgba(69, 203, 133, 0.15);
}
.api-status.api-offline {
  color: var(--gray-600);
  background: var(--gray-200);
}

.geo-data-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  font-size: 0.8125rem;
  line-height: 1.45;
  color: #7c2d12;
  background: #ffedd5;
  border-bottom: 1px solid #fdba74;
}
.geo-data-banner[hidden] {
  display: none !important;
}

.btn {
  font-family: var(--font);
  display: inline-flex; align-items: center; gap: 6px;
  height: 36px; padding: 0 14px;
  border-radius: 6px;
  border: 1px solid var(--primary);
  background: var(--primary);
  color: #fff;
  font-size: 0.8125rem; font-weight: 600;
  cursor: pointer;
  transition: all .15s ease-in-out;
}
.btn:hover { background: #364476; border-color: #364476; }

.btn-assistant {
  background: var(--secondary);
  border-color: var(--secondary);
}
.btn-assistant:hover {
  background: #2d6ad8;
  border-color: #2d6ad8;
}

.btn-icon {
  padding: 0;
  width: 36px;
  min-width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-icon .icon-fullscreen,
.btn-icon .icon-exit-fullscreen {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.btn-logout {
  background: #dc2626;
  border-color: #dc2626;
}
.btn-logout:hover {
  background: #b91c1c;
  border-color: #b91c1c;
}
.btn-logout .icon-logout {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* ═══════════ Filter bar ═══════════ */

.filter-bar {
  position: sticky;
  top: 0;
  z-index: 45;
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  padding: 14px 20px 16px;
  box-shadow: var(--shadow);
  /* Reduces browser scroll-anchoring fighting when filter height changes (less jump + flicker). */
  overflow-anchor: none;
}

/* Sits *above* the filter so its position does not change when the filter’s height changes. Drives IntersectionObserver for scroll mode. */
.filter-scroll-sentinel {
  width: 100%;
  height: 1px;
  margin: 0;
  padding: 0;
  border: 0;
  flex-shrink: 0;
  pointer-events: none;
  visibility: hidden;
  overflow: hidden;
}

.filter-bar__scroll-toggle {
  display: none;
  width: 100%;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 0 0 0;
  padding: 10px 14px;
  font-family: var(--font);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--primary);
  background: rgba(64, 81, 137, 0.08);
  border: 1px solid rgba(64, 81, 137, 0.2);
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.filter-bar__scroll-toggle:hover {
  background: rgba(64, 81, 137, 0.12);
  border-color: rgba(64, 81, 137, 0.32);
}
.filter-bar__scroll-toggle-chevron {
  font-size: 0.7rem;
  line-height: 1;
  opacity: 0.85;
}
.filter-bar--scroll-collapsed {
  padding-top: 10px;
  padding-bottom: 10px;
}
.filter-bar--scroll-collapsed .filter-bar__scroll-toggle {
  display: flex;
}
.filter-bar--scroll-collapsed .filter-bar__expandable.is-hidden {
  display: none;
}
.filter-bar--scroll-collapsed .filter-bar__expandable:not(.is-hidden) {
  margin-top: 10px;
  padding-top: 2px;
  border-top: 1px solid var(--border);
}

.filter-bar-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  row-gap: 14px;
  column-gap: 16px;
  width: 100%;
}

.filter-bar .filter-search {
  flex: 1;
  min-width: 140px;
}

.filter-bar .filter-search .filter-input {
  width: 100%;
  min-width: 0;
}

.filter-bar .filter-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 0 0 160px;
}

.filter-bar .filter-group label {
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--text-label);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  line-height: 1.2;
}

.filter-bar .filter-select {
  font-family: var(--font);
  height: 36px;
  padding: 0 12px;
  border-radius: 6px;
  border: 1px solid var(--gray-400);
  background: var(--card-bg);
  color: var(--text);
  font-size: 0.8125rem;
  min-width: 0;
  width: 100%;
  cursor: pointer;
}

.filter-bar .filter-select.is-loading {
  cursor: wait;
  opacity: 0.75;
}

.filter-input {
  font-family: var(--font);
  height: 36px;
  padding: 0 12px;
  border-radius: 6px;
  border: 1px solid var(--gray-400);
  background: var(--card-bg);
  color: var(--text);
  font-size: 0.8125rem;
  min-width: 0;
  width: 100%;
}

.filter-input::placeholder { color: var(--gray-500); }
.filter-input:focus { outline: none; border-color: var(--secondary); }

.filter-clear {
  font-family: var(--font);
  height: 36px;
  padding: 0 16px;
  border-radius: 6px;
  border: 1px solid rgba(220, 38, 38, 0.45);
  background: rgba(220, 38, 38, 0.08);
  color: #b91c1c;
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  margin-left: 0;
  align-self: flex-end;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.filter-clear:hover {
  background: rgba(220, 38, 38, 0.14);
  border-color: rgba(185, 28, 28, 0.6);
  color: #991b1b;
}

.filter-submit {
  font-family: var(--font);
  height: 36px;
  padding: 0 16px;
  border-radius: 6px;
  border: 1px solid rgba(53, 119, 241, 0.4);
  background: rgba(53, 119, 241, 0.12);
  color: #1d4ed8;
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  margin-left: 0;
  align-self: flex-end;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.filter-submit:hover {
  background: rgba(53, 119, 241, 0.2);
  border-color: rgba(29, 78, 216, 0.55);
  color: #1e40af;
}

.filter-date {
  min-width: 132px;
}

/* ═══════════ Page content ═══════════ */

.page-content {
  padding: 28px 24px calc(32px + 88px);
  flex: 1;
}

/* ═══════════ KPI cards ═══════════ */

.kpi-section {
  margin-bottom: 24px;
  padding-top: 4px;
}

/* Summary header: title left, trend granularity top-right */
.section-header--sales-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px 24px;
  margin-bottom: 20px;
  padding-bottom: 4px;
}

.section-header--sales-summary .section-header-text {
  flex: 1 1 16rem;
  min-width: 0;
}

.section-header--sales-summary .section-header-text h2 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--heading);
  margin-bottom: 8px;
  letter-spacing: -0.02em;
  line-height: 1.3;
}

.section-header--sales-summary .section-header-text p {
  font-size: 0.875rem;
  color: var(--text-label);
  line-height: 1.5;
  max-width: 44rem;
}

.summary-trend-toolbar {
  display: none;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  flex-shrink: 0;
  margin-left: auto;
  padding-top: 2px;
}

.summary-trend-toolbar__label {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-label);
}

.summary-trend-segmented {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--gray-100);
}

.summary-trend-btn {
  margin: 0;
  padding: 8px 16px;
  border: none;
  border-right: 1px solid var(--border);
  background: transparent;
  font-family: var(--font);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-label);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.summary-trend-btn:last-child {
  border-right: none;
}

.summary-trend-btn:hover {
  color: var(--heading);
  background: var(--card-bg);
}

.summary-trend-btn.is-active {
  color: #fff;
  background: var(--primary);
}

.summary-trend-btn:focus-visible {
  outline: 2px solid var(--secondary);
  outline-offset: 2px;
  z-index: 1;
}

@media (max-width: 576px) {
  .summary-trend-toolbar {
    align-items: stretch;
    width: 100%;
    margin-left: 0;
  }

  .summary-trend-segmented {
    width: 100%;
  }

  .summary-trend-btn {
    flex: 1;
    text-align: center;
  }
}

.page-section { margin-bottom: 28px; }
.page-section .section-header { margin-bottom: 20px; }
.page-section .section-header h2 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--heading);
  margin-bottom: 8px;
  letter-spacing: -0.02em;
  line-height: 1.3;
}
.page-section .section-header p {
  font-size: 0.875rem;
  color: var(--text-label);
  line-height: 1.5;
  max-width: 44rem;
}

.kpi-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 16px; }

.kpi-grid--sales {
  /* 3×2 for six cards; when Field routes + Stock are shown again, expand to 4×2 (desktop) */
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
@media (min-width: 769px) {
  .kpi-grid--sales:has(> .kpi-card:nth-child(8):not([hidden])) {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.kpi-section .kpi-grid + .chart-row {
  margin-top: 16px;
}

.kpi-section .ai-insight-row + .chart-row {
  margin-top: 20px;
}

.kpi-card {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  padding: 20px 20px;
  background: var(--card-bg);
  border-radius: 8px;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: all .2s ease-in-out;
  border: 1px solid rgba(15, 23, 42, 0.06);
}
.kpi-card[hidden] {
  display: none !important;
}
.kpi-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }

.kpi-card--detail {
  align-items: center;
}
.kpi-card--distribution .kpi-content--wide {
  width: 100%;
}
.kpi-content--wide {
  flex: 1;
  min-width: 0;
}
.kpi-detail-list {
  margin: 8px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.kpi-detail-list--compact {
  gap: 5px;
}
.kpi-detail-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  font-size: 0.8125rem;
  line-height: 1.45;
}
.kpi-detail-row dt {
  margin: 0;
  font-weight: 500;
  color: var(--text-label);
  flex-shrink: 0;
  white-space: nowrap;
}
.kpi-detail-row dd {
  margin: 0;
  font-weight: 600;
  color: var(--heading);
  text-align: right;
  min-width: 0;
}
.kpi-segment-pct {
  font-weight: 600;
  font-size: 0.8125rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
#salesKpiPrimaryChannelList .kpi-detail-row dd .kpi-segment-pct {
  margin-left: 0.15em;
}
#salesKpiSalesNetworkList.kpi-detail-list--compact {
  display: flex;
  flex-direction: column;
  gap: 0;
}
#salesKpiSalesNetworkList .kpi-detail-row {
  width: 100%;
}
.sales-network-counter--total dt,
.sales-network-counter--total dd {
  font-weight: 700;
  color: var(--heading);
}
.sales-network-counter--total dd strong {
  font-weight: 800;
}
.kpi-value--solo {
  margin-top: 6px;
  font-size: 22px;
}
.kpi-outlet-delta {
  margin-top: 8px;
  display: block;
  font-size: 11px;
}
.kpi-dist-bars {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}
.kpi-dist-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(48px, 72px) 36px;
  align-items: center;
  gap: 8px;
  font-size: 11px;
}
.kpi-dist-label {
  color: var(--text-muted);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.kpi-dist-track {
  height: 6px;
  background: var(--gray-200);
  border-radius: 3px;
  overflow: hidden;
}
.kpi-dist-fill {
  display: block;
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--secondary), var(--teal));
}
.kpi-dist-pct {
  font-weight: 600;
  color: var(--heading);
  text-align: right;
}

.kpi-card--stock-slabs {
  cursor: default;
}
.kpi-card--stock-slabs:hover {
  transform: none;
  box-shadow: var(--shadow);
}
.kpi-stock-slabs-hint {
  margin: 6px 0 0;
  font-size: 0.75rem;
  color: var(--text-label);
  line-height: 1.45;
}
.kpi-dist-row--clickable {
  cursor: pointer;
  border-radius: 6px;
  padding: 4px 2px;
  margin: -2px;
  transition: background 0.15s ease;
}
.kpi-dist-row--clickable:hover {
  background: var(--gray-100, rgba(0, 0, 0, 0.04));
}
.kpi-dist-row--clickable:focus {
  outline: 2px solid var(--secondary);
  outline-offset: 1px;
}

.drill-stock-slab-intro {
  margin: 0 0 12px;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.kpi-icon {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}
.kpi-icon.revenue   { background: rgba(2,168,181,.12); color: var(--teal); }
.kpi-icon.orders    { background: rgba(53,119,241,.12); color: var(--secondary); }
.kpi-icon.aov       { background: rgba(101,89,204,.12); color: var(--purple); }
.kpi-icon.customers { background: rgba(69,203,133,.12); color: var(--success); }
.kpi-icon.conversion{ background: rgba(241,150,59,.12); color: var(--orange); }
.kpi-icon.margin    { background: rgba(41,156,219,.12); color: var(--info); }

.kpi-icon--symbol .kpi-icon-svg {
  width: 22px;
  height: 22px;
  display: block;
  flex-shrink: 0;
}

.kpi-content { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.kpi-label {
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--heading);
  letter-spacing: 0.02em;
  line-height: 1.35;
}
.summary-kpi-label {
  font-size: 0.8125rem;
}
.kpi-value   { font-size: 20px; font-weight: 600; color: var(--heading); line-height: 1.2; }
.kpi-change  { font-size: 12px; font-weight: 600; }
.kpi-change.positive { color: var(--success); }
.kpi-change.negative { color: var(--danger); }

/* ═══════════ Chart cards ═══════════ */

.charts-section { display: flex; flex-direction: column; gap: 16px; }

.chart-row { display: grid; gap: 16px; }
.chart-row-2 { grid-template-columns: repeat(2,1fr); }
.chart-row-2.chart-row--single { grid-template-columns: 1fr; }
.chart-row-3 { grid-template-columns: repeat(3,1fr); }

.chart-card {
  background: var(--card-bg);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 18px 20px 20px;
  cursor: pointer;
  transition: box-shadow .2s ease-in-out, border-color .2s ease-in-out;
  border: 1px solid rgba(15, 23, 42, 0.06);
}
/* No translateY on hover: moving the card shifts SVG under the cursor and breaks bar hover (esp. rightmost columns). */
.chart-card:hover { box-shadow: var(--shadow-lg); }

.chart-wide { grid-column: 1 / -1; }

.chart-row--flavor-pack {
  margin-top: 12px;
  align-items: stretch;
}

/* Flavor / pack row: shared shell; each card uses its own light tint (see modifiers below). */
.chart-card--flavor-pack {
  padding: 16px 18px 18px;
  cursor: default;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.07);
}

/* Flavor wise → Pack wise: cool sky (light blue) */
.chart-card--flavor-pack-flow {
  background: linear-gradient(180deg, #f0f9ff 0%, #e0f2fe 100%);
  border-color: #bae6fd;
  box-shadow: 0 8px 22px rgba(14, 165, 233, 0.12);
}

.chart-card--flavor-pack-flow .chart-header {
  border-bottom-color: #bae6fd;
  margin-bottom: 10px;
  padding-bottom: 10px;
}

.chart-card--flavor-pack-flow .chart-header h3 {
  color: #0369a1;
}

.chart-card--flavor-pack-flow .chart-subtitle {
  color: #475569;
}

/* Pack wise -> Flavor wise: soft violet (elegant light purple; pairs with sky-blue sibling card) */
.chart-card--pack-flavor-flow {
  background: linear-gradient(180deg, #faf8ff 0%, #f1eeff 55%, #ebe4ff 100%);
  border-color: #ddd6fe;
  box-shadow: 0 8px 26px rgba(109, 40, 217, 0.1);
}

.chart-card--pack-flavor-flow .chart-header {
  border-bottom-color: #e9e4ff;
  margin-bottom: 10px;
  padding-bottom: 10px;
}

.chart-card--pack-flavor-flow .chart-header h3 {
  color: #5b4b8a;
}

.chart-card--pack-flavor-flow .chart-subtitle {
  color: #64748b;
}

.chart-container--flavor-stack {
  min-height: 240px;
  margin-top: 8px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #ffffff;
  padding: 6px;
  /* Let Highcharts HTML tooltips escape plot clipping (match Apex donut readability). */
  overflow: visible;
}

.chart-row--flavor-pack .chart-card {
  overflow: visible;
}

.chart-row--flavor-pack .chart-container--flavor-stack .highcharts-container,
.chart-row--flavor-pack .chart-container--flavor-stack .highcharts-root {
  overflow: visible !important;
}

.chart-row--flavor-pack .highcharts-tooltip {
  z-index: 120 !important;
}

/* Tooltip fill comes from JS (slice color); do not force a white box over it. */
.chart-row--flavor-pack .highcharts-label.highcharts-tooltip {
  filter: none;
}

.chart-header {
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.chart-header h3 {
  font-size: 1.0625rem;
  font-weight: 700;
  color: var(--heading);
  margin-bottom: 0;
  letter-spacing: -0.02em;
  line-height: 1.35;
}
.chart-subtitle {
  margin-top: 6px;
  font-size: 0.8125rem;
  color: var(--text-label);
  line-height: 1.5;
  max-width: 52rem;
}

.ai-insight-row { margin-top: 4px; }
.ai-insight-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 16px;
  border-left: 4px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
}
.ai-insight-card--primary { border-left-color: #405189; }
.ai-insight-card--secondary { border-left-color: #3577f1; }
.ai-insight-card__head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}
.ai-insight-card__body {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--heading);
}
.ai-insight-card__ask {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  align-self: flex-start;
  margin-top: 4px;
  padding: 9px 18px;
  min-height: 36px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0.01em;
  color: var(--primary);
  text-shadow: none;
  background: #fff;
  border: 1px solid rgba(var(--primary-rgb), 0.22);
  border-radius: 9999px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
  cursor: pointer;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease,
    color 0.15s ease;
}
.ai-insight-card__ask:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
.ai-insight-card--secondary .ai-insight-card__ask {
  color: var(--secondary);
  border-color: rgba(53, 119, 241, 0.28);
  box-shadow: 0 1px 2px rgba(37, 99, 235, 0.06);
}
.ai-insight-card--secondary .ai-insight-card__ask:focus-visible {
  outline-color: var(--secondary);
}
.ai-insight-card__ask:hover {
  background: rgba(var(--primary-rgb), 0.07);
  border-color: rgba(var(--primary-rgb), 0.35);
  box-shadow: 0 2px 8px rgba(var(--primary-rgb), 0.12);
}
.ai-insight-card--secondary .ai-insight-card__ask:hover {
  background: rgba(53, 119, 241, 0.1);
  border-color: rgba(37, 99, 235, 0.38);
  box-shadow: 0 2px 8px rgba(53, 119, 241, 0.14);
}

.ai-insight-inline {
  margin: 10px 0 0;
  padding: 10px 12px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--heading);
  background: rgba(15, 23, 42, 0.04);
  border-radius: 8px;
  border: 1px solid var(--border);
}

.chart-card--region-target {
  background: linear-gradient(180deg, var(--bg-card, #fff) 0%, var(--bg-body, #f8fafc) 100%);
  border-radius: var(--radius);
  /* Extra inset so title/subtitle/table are not flush to the card edge (more than default .chart-card). */
  padding: 24px 28px 28px;
  cursor: default;
  overflow: visible;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}
.chart-card--region-target:hover {
  transform: none;
  box-shadow: var(--shadow);
}
.chart-card--region-target > .chart-header {
  margin-bottom: 16px;
  padding: 8px 12px 16px;
}

.region-target-report-wrap {
  margin: 0 0 16px;
  overflow-x: auto;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-card, #fff);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.region-target-report-table {
  margin-bottom: 0;
  width: 100%;
  min-width: 920px;
  border-collapse: separate;
  border-spacing: 0;
}
.region-target-report-table thead th {
  white-space: nowrap;
  padding: 10px 12px;
  font-size: 11px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  background: var(--bg-card-hover, #f3f6f9);
  border-bottom: 1px solid var(--border);
}
.region-target-report-table thead th .data-table-sort {
  text-transform: none;
  letter-spacing: 0.03em;
  font-size: 0.8125rem;
}
.region-target-report-table thead tr:nth-child(2) th .data-table-sort {
  font-size: 0.6875rem;
  letter-spacing: 0.05em;
}
.region-target-report-table thead tr:first-child th {
  padding-top: 12px;
  vertical-align: bottom;
}
.region-target-report-table thead tr:nth-child(2) th {
  font-size: 10px;
  padding: 8px 10px;
  color: var(--text-muted);
}
.region-target-report-table thead th[rowspan] {
  vertical-align: middle;
  min-width: 88px;
  border-right: 1px solid var(--border);
}
.region-target-report-table .region-th-group {
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}
.region-target-report-table .region-th-group--primary {
  color: #405189;
  background: rgba(64, 81, 137, 0.06);
}
.region-target-report-table .region-th-group--secondary {
  color: #3577f1;
  background: rgba(53, 119, 241, 0.06);
}
.region-target-report-table tbody td {
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.01em;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.region-target-report-table tbody tr:last-child td {
  border-bottom: none;
}
.region-target-report-table tbody tr:hover td {
  background: rgba(64, 81, 137, 0.04);
}
.region-target-report-table tbody td.region-td-region {
  font-weight: 600;
  color: var(--heading);
  border-right: 1px solid var(--border);
  position: sticky;
  left: 0;
  z-index: 1;
  background: var(--bg-card, #fff);
  box-shadow: 4px 0 8px -4px rgba(15, 23, 42, 0.08);
}
.region-target-report-table tbody tr:hover td.region-td-region {
  background: #f0f2f8;
}
.region-target-report-table tbody td.region-td-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--text, #212529);
}
.region-target-report-table tbody td.region-td-pct {
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
  font-size: 12px;
}
.region-target-report-table tbody td.region-td-pct--bar {
  min-width: 96px;
  vertical-align: middle;
}
.region-ach-mini {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 5px;
  width: 100%;
}
.region-ach-mini__track {
  display: flex;
  flex-direction: row;
  width: 100%;
  height: 8px;
  border-radius: 4px;
  overflow: hidden;
  background: #e8edf5;
}
.region-ach-mini__track--secondary {
  background: #e8f0fe;
}
.region-ach-mini__seg {
  display: block;
  height: 100%;
  min-height: 8px;
  box-sizing: border-box;
}
.region-ach-mini__seg--fill {
  border-radius: 4px 0 0 4px;
  transition: flex-basis 0.35s ease;
}
.region-ach-mini__seg--fill-primary {
  background: #CC1512;
}
.region-ach-mini__seg--fill-secondary {
  background: #2E3293;
}
.region-ach-mini__seg--rest {
  flex: 1 1 0;
  min-width: 0;
  background: #dfe7f3;
}
.region-ach-mini__track--secondary .region-ach-mini__seg--rest {
  background: #dbeafe;
}
.region-ach-mini__pct {
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
  text-align: right;
  line-height: 1.2;
}
.region-target-report-table tbody td.region-td-pace {
  text-align: center;
}

/* Single panel: primary + secondary stacked bar blocks (no duplicate outer cards). */
.region-target-charts-panel {
  margin-top: 4px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-card, #fff);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  overflow: hidden;
  /* Keeps the last zone column slightly inset from the rounded clip so hover targets aren’t clipped. */
  padding-right: 10px;
  box-sizing: border-box;
}
.region-target-chart-pane {
  padding: 16px 20px 12px;
  cursor: pointer;
  transition: background 0.15s ease;
}
.region-target-chart-pane:hover {
  background: rgba(64, 81, 137, 0.035);
}
.region-target-chart-pane + .region-target-chart-pane {
  border-top: 1px solid var(--border);
}
.region-target-chart-pane__head {
  margin-bottom: 10px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.region-target-chart-pane__head h4 {
  margin: 0 0 2px;
  font-size: 1rem;
  font-weight: 700;
  color: var(--heading);
  letter-spacing: -0.02em;
  line-height: 1.35;
}
.region-target-chart-pane__head .chart-subtitle {
  margin-top: 6px;
}
.chart-container--region-stack {
  min-height: 440px;
  width: 100%;
}

.pace-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.pace-pill--behind { background: rgba(240, 101, 72, 0.15); color: #c0392b; }
.pace-pill--watch { background: rgba(245, 158, 11, 0.18); color: #b45309; }
.pace-pill--ahead { background: rgba(69, 203, 133, 0.18); color: #1e8449; }
.pace-pill--met { background: rgba(64, 81, 137, 0.12); color: var(--heading); }
.pace-pill--undefined { background: rgba(240, 101, 72, 0.16); color: #c0392b; }
.region-target-report-empty {
  text-align: center;
  color: var(--text-muted);
  padding: 16px !important;
}

/* Toolbar + sortable headers for dashboard data tables */
.data-table-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 12px;
  flex-wrap: wrap;
  padding: 10px 14px;
  background: var(--gray-100);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}
.data-table-toolbar--slab {
  margin-top: 4px;
}
.data-table-filter-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-label);
  letter-spacing: 0.03em;
  text-transform: uppercase;
  flex-shrink: 0;
}
.data-table-filter {
  flex: 1;
  min-width: 200px;
  max-width: 360px;
  padding: 8px 12px;
  font-family: var(--font);
  font-size: 0.8125rem;
  color: var(--text);
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.data-table-filter::placeholder {
  color: var(--gray-500);
}
.data-table-filter:hover {
  border-color: var(--gray-400);
}
.data-table-filter:focus {
  outline: none;
  border-color: var(--secondary);
  box-shadow: 0 0 0 3px rgba(53, 119, 241, 0.15);
}

.data-table-sort {
  display: inline-flex;
  align-items: center;
  justify-content: inherit;
  gap: 4px;
  width: 100%;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  font: inherit;
  font-family: var(--font-table);
  font-size: inherit;
  font-weight: 600;
  color: inherit;
  text-align: inherit;
  cursor: pointer;
  border-radius: 4px;
  transition: background 0.12s ease, color 0.12s ease;
}
.data-table-sort:hover {
  color: var(--secondary);
  background: rgba(53, 119, 241, 0.06);
}
.data-table-sort:focus-visible {
  outline: 2px solid var(--secondary);
  outline-offset: 2px;
}
.data-table-sort-icon {
  display: inline-block;
  width: 1em;
  height: 1em;
  flex-shrink: 0;
  opacity: 0.35;
  background: no-repeat center / contain;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 1.5L10 6H2z' opacity='.35'/%3E%3Cpath fill='%236b7280' d='M6 10.5L2 6h8z' opacity='.35'/%3E%3C/svg%3E");
}
.data-table-sort.is-active .data-table-sort-icon {
  opacity: 1;
  background-image: none;
  position: relative;
}
.data-table-sort.is-active.is-asc .data-table-sort-icon::after {
  content: "";
  position: absolute;
  inset: 0;
  background: no-repeat center / contain;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%233577f1' d='M6 2.5L10.5 9h-9z'/%3E%3C/svg%3E");
}
.data-table-sort.is-active.is-desc .data-table-sort-icon::after {
  content: "";
  position: absolute;
  inset: 0;
  background: no-repeat center / contain;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%233577f1' d='M6 9.5L1.5 3h9z'/%3E%3C/svg%3E");
}
.data-table-sort.is-active {
  color: var(--secondary);
}

.formula-hint {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  margin-left: 4px;
  border-radius: 50%;
  border: 1px solid currentColor;
  font-size: 10px;
  line-height: 1;
  font-style: normal;
  font-weight: 700;
  cursor: help;
  position: relative;
  vertical-align: middle;
  opacity: 0.85;
}

.formula-hint:hover,
.formula-hint:focus-visible {
  opacity: 1;
  outline: none;
}

.formula-hint:hover::after,
.formula-hint:focus-visible::after {
  content: attr(data-formula);
  position: absolute;
  left: 50%;
  top: calc(100% + 8px);
  transform: translateX(-50%);
  min-width: 210px;
  max-width: 320px;
  white-space: normal;
  padding: 8px 10px;
  border-radius: 8px;
  background: #111827;
  color: #f9fafb;
  font-size: 11px;
  line-height: 1.35;
  text-transform: none;
  letter-spacing: normal;
  z-index: 9999;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
  pointer-events: none;
}

.region-target-report-table {
  font-family: var(--font-table);
  font-size: 0.8125rem;
  font-feature-settings: "tnum" 1, "lnum" 1;
}
.region-target-report-table thead th {
  font-family: var(--font-table);
  font-weight: 600;
  letter-spacing: 0.04em;
}
.region-target-report-table thead tr:nth-child(2) th {
  font-size: 0.75rem;
  letter-spacing: 0.05em;
}
.region-target-report-table thead th.region-th-zone {
  position: sticky;
  left: 0;
  z-index: 3;
  vertical-align: middle;
  text-align: left;
  background: var(--bg-card-hover, #f3f6f9);
  border-right: 1px solid var(--border);
  box-shadow: 4px 0 8px -4px rgba(15, 23, 42, 0.06);
}
.region-target-report-table thead th.region-th--num,
.region-target-report-table thead th.region-th--pace {
  text-align: right;
}
.region-target-report-table thead th.region-th--num .data-table-sort,
.region-target-report-table thead th.region-th--pace .data-table-sort {
  justify-content: flex-end;
}
.region-target-report-table thead th.region-th--text {
  text-align: left;
}

.data-table-tfoot {
  border-top: 2px solid var(--border);
}
.data-table-tfoot .data-table-tfoot-row td {
  font-weight: 600;
  background: linear-gradient(180deg, #f8fafc 0%, #eef2f7 100%);
  border-bottom: none;
  padding-top: 12px;
  padding-bottom: 12px;
  vertical-align: middle;
}
.region-td-total {
  font-weight: 700;
  color: var(--heading);
}
.region-target-report-table tfoot td.region-td-region {
  position: sticky;
  left: 0;
  z-index: 1;
  box-shadow: 4px 0 8px -4px rgba(15, 23, 42, 0.08);
}
.data-table-tfoot-na {
  color: var(--text-muted);
  font-weight: 500;
}

.slab-achievement-table-wrap .region-target-report-table {
  min-width: 720px;
}
.slab-achievement-table thead th {
  text-transform: none;
  font-size: 12px;
  letter-spacing: 0;
}
.slab-achievement-table thead th.region-th--num {
  text-align: right;
}
.slab-achievement-table thead th.region-th--num .data-table-sort {
  justify-content: flex-end;
}
.slab-achievement-table thead th .data-table-sort {
  font-size: 12px;
  letter-spacing: 0.02em;
}
.chart-container--slab {
  min-height: 300px;
}

.chart-container {
  min-height: 200px;
  width: 100%;
  position: relative;
  /* Inset plot from card edge so last x-axis category is not flush against overflow/clipping. */
  padding-right: 6px;
  box-sizing: border-box;
}
.chart-container-tall { min-height: 280px; }

/* Top / low distribution rank: taller plot so vertical bars meet a readable minimum size */
.chart-container--distribution-rank {
  min-height: 480px;
}
#sales-distribution-rank .chart-row-2 {
  align-items: stretch;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
#sales-distribution-rank .chart-row-2 > .chart-card {
  height: 100%;
  min-width: 0;
}
#sales-distribution-rank .region-target-report-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
}
#sales-distribution-rank .distribution-rank-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 2px 12px 12px;
  border-bottom: 1px solid var(--border);
}
#sales-distribution-rank .distribution-rank-filter {
  flex: 1;
  min-width: 0;
}
#sales-distribution-rank .distribution-rank-pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 8px 6px;
  border-top: 1px solid var(--border);
}
#sales-distribution-rank .distribution-rank-pager__meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  letter-spacing: 0.01em;
}
#sales-distribution-rank .distribution-rank-pager__nav {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--gray-100);
}
#sales-distribution-rank .distribution-rank-pager__page {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--heading);
  padding: 0 8px;
}
#sales-distribution-rank .distribution-rank-pager__btn {
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--heading);
  border-radius: 10px;
  height: 32px;
  min-width: 62px;
  padding: 0 10px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .18s ease;
}
#sales-distribution-rank .distribution-rank-pager__btn--icon {
  min-width: 32px;
  width: 32px;
  padding: 0;
  border-radius: 999px;
  font-size: 1rem;
  line-height: 1;
}
#sales-distribution-rank .distribution-rank-pager__btn:hover:not(:disabled) {
  border-color: var(--secondary);
  color: var(--secondary);
  background: rgba(53, 119, 241, 0.08);
}
#sales-distribution-rank .distribution-rank-pager__btn:active:not(:disabled) {
  transform: translateY(1px);
}
#sales-distribution-rank .distribution-rank-pager__btn:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}
@media (max-width: 740px) {
  #sales-distribution-rank .distribution-rank-toolbar {
    flex-direction: column;
    align-items: stretch;
    padding: 0 10px 10px;
  }
  #sales-distribution-rank .distribution-rank-pager {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  #sales-distribution-rank .distribution-rank-pager__meta {
    text-align: center;
  }
  #sales-distribution-rank .distribution-rank-pager__nav {
    justify-content: center;
  }
}
#sales-distribution-rank .region-target-report-table {
  min-width: 0;
  width: 100%;
  table-layout: fixed;
}
#sales-distribution-rank .region-target-report-table th,
#sales-distribution-rank .region-target-report-table td {
  white-space: nowrap;
}
#sales-distribution-rank .region-target-report-table tbody td.region-td-text {
  font-weight: 500;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
}

#sales-distribution-rank .distribution-rank-table col.distribution-rank-col--rank {
  width: 6.25rem;
  min-width: 6.25rem;
}
#sales-distribution-rank .distribution-rank-table col.distribution-rank-col--entity {
  width: 44%;
  min-width: 168px;
}
#sales-distribution-rank .distribution-rank-table col.distribution-rank-col--metric {
  width: 17%;
}
#sales-distribution-rank .distribution-rank-th--rank,
#sales-distribution-rank .distribution-rank-td--rank {
  width: 6.25rem;
  min-width: 6.25rem;
  max-width: none;
  padding-left: 8px;
  padding-right: 8px;
  box-sizing: border-box;
  text-align: center;
}
#sales-distribution-rank .distribution-rank-th--rank {
  text-align: center;
}
#sales-distribution-rank .distribution-rank-th--rank .data-table-sort {
  justify-content: center;
  width: 100%;
  gap: 4px;
}
#sales-distribution-rank .distribution-rank-th--entity {
  min-width: 168px;
}
#sales-distribution-rank .distribution-rank-td--entity {
  white-space: normal;
  word-break: break-word;
  vertical-align: top;
  line-height: 1.35;
  overflow: visible;
  text-overflow: clip;
}
#sales-distribution-rank .distribution-rank-td__code {
  display: block;
  font-weight: 700;
  font-size: 0.8125rem;
  color: var(--heading);
  letter-spacing: 0.01em;
}
#sales-distribution-rank .distribution-rank-td__name {
  display: block;
  margin-top: 2px;
  font-weight: 500;
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* ═══════════ Production data table (Excel-like) ═══════════ */

.chart-row-table {
  display: block;
}

.data-table-section {
  width: 100%;
  margin-bottom: 20px;
}

.data-table-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.data-table-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.data-table-header h3 { font-size: 14px; font-weight: 600; color: var(--heading); }
.data-table-count { font-size: 12px; color: var(--text-muted); }

.data-table-wrapper {
  overflow-x: auto;
  max-height: 340px;
  overflow-y: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table th,
.data-table td {
  padding: 10px 12px;
  border: 1px solid var(--border);
  text-align: left;
  white-space: nowrap;
}

.data-table thead {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--gray-100);
}

.data-table th {
  font-weight: 600;
  color: var(--heading);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.data-table tbody tr:nth-child(even) { background: var(--gray-100); }
.data-table tbody tr:hover { background: rgba(53, 119, 241, 0.06); }

.data-table td { color: var(--text); }

.page-loader {
  position: fixed;
  inset: 0;
  z-index: 12050;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(248, 250, 252, 0.78);
  backdrop-filter: blur(2px);
}
.page-loader.is-active { display: flex; }
.page-loader__content {
  min-width: 260px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
  padding: 14px 18px;
}
.page-loader__spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(53, 119, 241, 0.2);
  border-top-color: #3577f1;
  border-radius: 999px;
  animation: pageLoaderSpin 0.8s linear infinite;
}
.page-loader__text {
  margin: 0;
  font-size: 13px;
  color: var(--heading);
  font-weight: 600;
}
body.is-page-loading { overflow: hidden; }

/* ═══════════ Modal ═══════════ */

.modal {
  position: fixed; inset: 0; display: none;
  align-items: center; justify-content: center;
  padding: max(12px, env(safe-area-inset-bottom));
  z-index: 1055;
}
.modal.active { display: flex; }
.modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 0;
}

.modal-content {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: min(1100px, 100%);
  height: auto;
  max-height: min(92vh, 100%);
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
}

.modal--zone-area .modal-content {
  max-width: min(1240px, 100%);
  border-radius: 14px;
  box-shadow: 0 24px 48px -12px rgba(15, 23, 42, 0.18), 0 0 0 1px rgba(15, 23, 42, 0.06);
}
.modal--zone-area .modal-header {
  padding: 18px 22px;
  background: linear-gradient(135deg, rgba(53, 119, 241, 0.07) 0%, rgba(124, 58, 237, 0.05) 50%, rgba(245, 158, 11, 0.06) 100%);
  border-bottom: 1px solid rgba(53, 119, 241, 0.12);
}
.modal--zone-area .modal-header h2 {
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}
.modal--zone-area .modal-body {
  padding: 0 22px 22px;
  background: linear-gradient(180deg, #f8fafc 0%, var(--card-bg) 48px);
}

.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.modal-header h2 { font-size: 15px; font-weight: 600; color: var(--heading); }

.modal-close {
  width: 28px; height: 28px; border: none;
  border-radius: var(--radius); background: transparent;
  color: var(--text-muted); font-size: 1.2rem; cursor: pointer;
}
.modal-close:hover { background: var(--gray-100); }

.modal-body {
  flex: 1 1 auto;
  min-height: 0;
  padding: 16px 20px 20px;
  overflow-y: auto;
}

.drill-chart { min-height: 230px; margin-bottom: 12px; }
.drill-chart--pie { min-height: 300px; max-width: 560px; margin-left: auto; margin-right: auto; margin-bottom: 16px; }
.drill-chart--region-pie { max-width: min(520px, 100%); }
.drill-empty { color: var(--text-muted); font-size: 13px; margin: 8px 0; }

.drill-section { margin-bottom: 22px; }
.drill-section__title {
  margin: 0 0 6px;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--heading);
  letter-spacing: -0.01em;
}
.drill-section__hint {
  margin: 0 0 12px;
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.45;
}
.drill-section--split {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  align-items: start;
}
.drill-section__col .drill-section__title { margin-bottom: 10px; }

.drill-table-wrap {
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: var(--card-bg);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}
.drill-table-wrap--wide { overflow-x: auto; }

.drill-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.drill-table th, .drill-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); text-align: left; }
.drill-table th { font-weight: 600; color: var(--text-muted); font-size: 12px; text-transform: uppercase; background: var(--gray-100); }
.drill-table--sentence th { text-transform: none; font-size: 13px; letter-spacing: normal; }
.drill-table--rich th { background: linear-gradient(180deg, var(--gray-100) 0%, rgba(0, 0, 0, 0.02) 100%); }
.drill-table--rich td { vertical-align: middle; }
.drill-table--striped tbody tr:nth-child(even) { background: rgba(0, 0, 0, 0.02); }
.drill-table--striped tbody tr:hover { background: rgba(53, 119, 241, 0.06); }
.drill-table--low tbody tr { background: rgba(220, 53, 69, 0.04); }
.drill-table--low tbody tr:hover { background: rgba(220, 53, 69, 0.08); }
.drill-num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.drill-num--pct { font-weight: 600; color: var(--heading); }
.drill-cell-sub { font-size: 12px; color: var(--text); line-height: 1.35; max-width: 220px; }
.drill-table tr:last-child td { border-bottom: none; }
.drill-table:not(.drill-table--striped):not(.drill-table--low) tbody tr:hover td { background: var(--gray-100); }

#regionTargetReportTable tbody tr.region-target-row--drill,
#regionTargetReportTable tbody tr.region-target-row--drill > td {
  cursor: pointer;
}
#regionTargetReportTable tbody tr.region-target-row--drill:hover td {
  background: rgba(53, 119, 241, 0.08);
}
#regionTargetReportTable tbody tr.region-target-row--drill:focus-visible {
  outline: 2px solid rgba(53, 119, 241, 0.35);
  outline-offset: -2px;
}

/* —— Zone / area wise drill (modal) —— */
.zone-drill-root {
  max-width: 100%;
}
.zone-drill-hero {
  position: relative;
  padding: 20px 4px 8px;
  margin-bottom: 4px;
}
.zone-drill-hero__eyebrow {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #64748b;
  margin-bottom: 6px;
}
.zone-drill-hero__title {
  margin: 0 0 8px;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--heading);
  line-height: 1.2;
}
.zone-drill-hero__lede {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--text-secondary);
  max-width: 52ch;
}
.zone-drill-hero__lede strong { color: var(--heading); font-weight: 600; }

.zone-drill-kpi-board { margin: 0 0 8px; }
.zone-drill-kpi-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}
@media (max-width: 800px) {
  .zone-drill-kpi-row { grid-template-columns: 1fr; }
}
.zone-drill-kpi-cluster {
  border-radius: 12px;
  padding: 12px 14px 14px;
  border: 1px solid var(--border);
  background: var(--card-bg);
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.04);
}
.zone-drill-kpi-cluster--primary {
  border-color: rgba(5, 150, 105, 0.28);
  background: linear-gradient(165deg, #f0fdf4 0%, #ffffff 40%, #f8fafc 100%);
  box-shadow: 0 4px 20px -8px rgba(5, 150, 105, 0.2);
}
.zone-drill-kpi-cluster--secondary {
  border-color: rgba(2, 132, 199, 0.28);
  background: linear-gradient(165deg, #f0f9ff 0%, #ffffff 40%, #f8fafc 100%);
  box-shadow: 0 4px 20px -8px rgba(2, 132, 199, 0.2);
}
.zone-drill-kpi-cluster--outlets {
  border-color: rgba(124, 58, 237, 0.2);
  background: linear-gradient(180deg, #fafaff 0%, #ffffff 55%);
}
.zone-drill-kpi-cluster__title {
  margin: 0 0 10px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #64748b;
}
.zone-drill-kpi-cluster--primary .zone-drill-kpi-cluster__title { color: #047857; }
.zone-drill-kpi-cluster--secondary .zone-drill-kpi-cluster__title { color: #0369a1; }
.zone-drill-kpi-cluster--outlets .zone-drill-kpi-cluster__title { color: #6d28d9; }
.zone-drill-kpi-cluster__grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.zone-drill-kpi-cluster__grid--wide {
  grid-template-columns: repeat(7, minmax(0, 1fr));
}
@media (max-width: 1200px) {
  .zone-drill-kpi-cluster__grid--wide {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}
@media (max-width: 640px) {
  .zone-drill-kpi-cluster__grid,
  .zone-drill-kpi-cluster__grid--wide {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
.zone-drill-kpi {
  min-width: 0;
  padding: 10px 10px 8px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(15, 23, 42, 0.08);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.zone-drill-kpi:hover {
  border-color: rgba(53, 119, 241, 0.22);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
}
.zone-drill-kpi__label {
  display: block;
  font-size: 0.68rem;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}
.zone-drill-kpi__value {
  display: block;
  font-size: 1.1rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--heading);
  letter-spacing: -0.02em;
  line-height: 1.2;
}
.zone-drill-kpi__meter {
  display: block;
  height: 4px;
  margin-top: 8px;
  border-radius: 3px;
  background: rgba(15, 23, 42, 0.1);
  overflow: hidden;
}
.zone-drill-kpi__meter::after {
  content: "";
  display: block;
  height: 100%;
  width: var(--zone-meter, 0%);
  border-radius: 3px;
  background: linear-gradient(90deg, #10b981, #34d399);
}
.zone-drill-kpi-cluster--secondary .zone-drill-kpi__meter::after {
  background: linear-gradient(90deg, #0284c7, #38bdf8);
}

.zone-drill-section-card {
  margin-top: 18px;
  border-radius: 14px;
  border: 1px solid rgba(15, 23, 42, 0.1);
  background: var(--card-bg);
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}
.zone-drill-section-card--summary { border-color: rgba(5, 150, 105, 0.18); }
.zone-drill-section-card--dist { border-color: rgba(53, 119, 241, 0.2); }
.zone-drill-section-card--donuts { border-color: rgba(217, 119, 6, 0.22); }
.zone-drill-donut-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  padding: 12px 16px 20px;
}
@media (max-width: 720px) {
  .zone-drill-donut-row {
    grid-template-columns: 1fr;
  }
}
.zone-drill-donut-card {
  min-width: 0;
  border-radius: 12px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  background: rgba(248, 250, 252, 0.65);
  padding: 10px 10px 16px;
}
.zone-drill-donut-card__title {
  margin: 0 0 8px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--heading);
  text-align: center;
}
.zone-drill-donut-chart {
  min-height: 300px;
}
.zone-drill-donut-empty {
  margin: 0;
  padding: 48px 12px;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-secondary);
}
.zone-drill-section-head {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px 18px;
  background: linear-gradient(90deg, rgba(248, 250, 252, 0.9) 0%, rgba(255, 255, 255, 0.95) 100%);
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}
.zone-drill-section-head__icon {
  flex: 0 0 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(53, 119, 241, 0.1);
  border: 1px solid rgba(53, 119, 241, 0.2);
}
.zone-drill-section-head__icon--table {
  background: linear-gradient(135deg, rgba(5, 150, 105, 0.15) 0%, rgba(5, 150, 105, 0.06) 100%);
  border-color: rgba(5, 150, 105, 0.3);
}
.zone-drill-section-head__icon--table::before {
  content: "▤";
  font-size: 1.1rem;
  opacity: 0.85;
}
.zone-drill-section-head__icon--list {
  background: linear-gradient(135deg, rgba(53, 119, 241, 0.2) 0%, rgba(124, 58, 237, 0.12) 100%);
  border-color: rgba(53, 119, 241, 0.3);
}
.zone-drill-section-head__icon--list::before {
  content: "☰";
  font-size: 1.05rem;
  opacity: 0.9;
  letter-spacing: -0.1em;
}
.zone-drill-section-head__title {
  margin: 0 0 4px;
  font-size: 1rem;
  font-weight: 700;
  color: var(--heading);
  letter-spacing: -0.02em;
}
.zone-drill-section-head__hint {
  margin: 0;
  font-size: 0.8rem;
  line-height: 1.45;
  color: var(--text-secondary);
  max-width: 56ch;
}
.zone-drill-section-card__body { padding: 0; }
.zone-drill-section-card__body .drill-table-wrap { border: none; border-radius: 0; box-shadow: none; }
.zone-area-summary-host { padding: 4px 0 8px; }

/* Area wise summary: grouped header — colors match distribution accordion (Primary / Secondary / Outlets) */
.drill-table--zone-summary .th-sub--pri { background: rgba(5, 150, 105, 0.1) !important; }
.drill-table--zone-summary .th-sub--sec { background: rgba(2, 132, 199, 0.1) !important; }
.drill-table--zone-summary .th-sub--shops { background: rgba(124, 58, 237, 0.1) !important; }
.drill-table--zone-summary .zone-summary-thead__row-groups th.region-th-zone {
  text-align: left;
}
.drill-table--zone-summary .zone-summary-thead__row-groups th.region-th-zone .data-table-sort {
  text-transform: none;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
}
.drill-table--zone-summary .zone-summary-thead__row-groups th.zone-dist-th-block:not(.region-th-zone) {
  vertical-align: middle;
}
.drill-table--zone-summary .zone-summary-thead__row-groups th.zone-dist-th-block--id {
  line-height: 1.25;
}
.drill-table--zone-summary .zone-summary-thead__row-groups th.zone-dist-th-block--id .data-table-sort {
  text-transform: none;
  color: #334155;
  font-weight: 600;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
}
.drill-table--zone-summary .zone-summary-thead__row-groups th.zone-dist-th-block--id .data-table-sort:hover {
  color: var(--heading);
}
/* Override main table’s first header row: group labels sit centered like distribution table */
.drill-table--zone-summary.region-target-report-table thead tr:first-child th:not([rowspan]) {
  vertical-align: middle !important;
  padding-top: 10px !important;
  padding-bottom: 8px !important;
}
.zone-summary-pct-cell { vertical-align: middle; }

.zone-pct-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 3.1rem;
  padding: 3px 8px;
  font-size: 0.75rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  border-radius: 6px;
  line-height: 1.2;
  border: 1px solid transparent;
}
.zone-pct-badge--neutral { color: #94a3b8; background: #f1f5f9; }
.zone-pct-badge--low { color: #b91c1c; background: #fee2e2; border-color: #fecaca; }
.zone-pct-badge--mid { color: #b45309; background: #fef3c7; border-color: #fde68a; }
.zone-pct-badge--ok { color: #a16207; background: #fef9c3; border-color: #facc15; }
.zone-pct-badge--strong { color: #047857; background: #d1fae5; border-color: #6ee7b7; }

.zone-drill-empty {
  text-align: center;
  padding: 36px 20px 28px;
}
.zone-drill-empty__icon {
  display: inline-flex;
  width: 52px;
  height: 52px;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
  font-size: 1.4rem;
  line-height: 1;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(53, 119, 241, 0.12) 0%, rgba(124, 58, 237, 0.1) 100%);
  color: #64748b;
}
.zone-drill-empty__title { margin: 0 0 6px; font-size: 1.05rem; font-weight: 700; color: var(--heading); }
.zone-drill-empty__hint { margin: 0; font-size: 0.85rem; color: var(--text-secondary); line-height: 1.5; max-width: 32rem; margin-left: auto; margin-right: auto; }

.zone-area-accordion {
  border: 1px solid rgba(53, 119, 241, 0.2);
  border-radius: 4px;
  background: linear-gradient(180deg, #fcfdff 0%, #f5f8ff 100%);
  margin: 0 0 10px;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
.zone-area-accordion[open] {
  border-color: rgba(53, 119, 241, 0.38);
  box-shadow: 0 8px 24px -10px rgba(53, 119, 241, 0.25);
}
.zone-area-accordion > summary {
  cursor: pointer;
  list-style: none;
  padding: 12px 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px 12px;
  background: rgba(53, 119, 241, 0.04);
  border-bottom: 1px solid transparent;
}
.zone-area-accordion[open] > summary {
  border-bottom-color: rgba(53, 119, 241, 0.1);
  background: rgba(255, 255, 255, 0.65);
}
.zone-area-accordion > summary::-webkit-details-marker { display: none; }
.zone-area-accordion > summary:hover { background: rgba(53, 119, 241, 0.08); }
.zone-area-accordion__title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
  font-size: 0.95rem;
  color: var(--heading);
}
.zone-area-accordion__pin {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.2);
}
.zone-area-accordion__name { overflow: hidden; text-overflow: ellipsis; }
.zone-area-accordion__meta {
  flex-shrink: 0;
  margin-left: auto;
  text-align: right;
  display: flex;
  align-items: center;
  justify-content: flex-end;
}
.zone-area-accordion__pill {
  display: inline-block;
  padding: 2px 10px;
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #0369a1;
  background: #e0f2fe;
  border-radius: 4px;
  border: 1px solid #bae6fd;
}
.zone-area-accordion__body { padding: 0 0 8px; }
.drill-table--zone-dist .drill-td-name { max-width: 12rem; overflow: hidden; text-overflow: ellipsis; }
.drill-table--zone-dist .drill-td-sub { color: var(--text-secondary); font-size: 0.8rem; }

.zone-dist-thead__groups th {
  text-align: center;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  padding: 8px 6px !important;
  color: #475569;
  border-bottom: 2px solid rgba(15, 23, 42, 0.1) !important;
}
.zone-dist-th-block--id { background: rgba(100, 116, 139, 0.1) !important; }
.zone-dist-th-block--primary { background: rgba(5, 150, 105, 0.12) !important; color: #047857 !important; }
.zone-dist-th-block--secondary { background: rgba(2, 132, 199, 0.12) !important; color: #0369a1 !important; }
.zone-dist-th-block--shops { background: rgba(124, 58, 237, 0.1) !important; color: #5b21b6 !important; }

.zone-drill-accordion-list { padding: 12px 12px 16px; }
.zone-area-accordion .drill-table th,
.zone-area-accordion .drill-table td { white-space: nowrap; }
.zone-area-accordion .drill-table tbody tr:hover td { background: rgba(53, 119, 241, 0.05); }
.zone-area-accordion .drill-table tbody tr:last-child td { border-bottom: none; }
.zone-area-accordion .drill-table-wrap { margin: 0 8px 0; }
.zone-area-accordion > summary::after {
  content: "";
  width: 9px; height: 9px;
  border-right: 2px solid #94a3b8;
  border-bottom: 2px solid #94a3b8;
  transform: rotate(45deg);
  margin-top: 2px;
  flex-shrink: 0;
  transition: transform 0.2s ease;
  opacity: 0.7;
}
.zone-area-accordion[open] > summary::after {
  margin-top: 6px;
  transform: rotate(225deg);
}
.zone-drill-summary-table th,
.zone-drill-summary-table td { white-space: nowrap; }

.kpi-detail-row--sale-drill {
  cursor: pointer;
  border-radius: 6px;
  margin: 0 -6px;
  padding: 2px 6px;
  transition: background 0.15s ease;
}
.kpi-detail-row--sale-drill:hover { background: rgba(53, 119, 241, 0.08); }
.kpi-detail-row--sale-drill:focus-within { outline: 2px solid rgba(53, 119, 241, 0.35); outline-offset: 1px; }
.kpi-detail-row--sale-drill dt { color: var(--link-color, #3577f1); }

/* ═══════════ ApexCharts overrides ═══════════ */

.chart-container .apexcharts-svg {
  overflow: visible !important;
}
.apexcharts-canvas { font-family: var(--font) !important; }
.apexcharts-text tspan { font-family: inherit; }
.apexcharts-yaxis text, .apexcharts-xaxis text { font-family: var(--font) !important; fill: var(--gray-600) !important; }
.apexcharts-title-text, .apexcharts-subtitle-text { fill: var(--gray-500); }
.apexcharts-legend-text { color: var(--gray-600) !important; font-family: var(--font) !important; font-size: 12px !important; }
.chart-container .apexcharts-legend,
.zone-drill-donut-chart .apexcharts-legend {
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb-modal) var(--scrollbar-track-modal);
}
.chart-container .apexcharts-legend::-webkit-scrollbar,
.zone-drill-donut-chart .apexcharts-legend::-webkit-scrollbar {
  width: var(--scrollbar-thin);
  height: var(--scrollbar-thin);
}
.chart-container .apexcharts-legend::-webkit-scrollbar-track,
.zone-drill-donut-chart .apexcharts-legend::-webkit-scrollbar-track {
  background: var(--scrollbar-track-modal);
  border-radius: var(--scrollbar-radius);
}
.chart-container .apexcharts-legend::-webkit-scrollbar-thumb,
.zone-drill-donut-chart .apexcharts-legend::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb-modal);
  background-clip: padding-box;
  border: 2px solid transparent;
  border-radius: var(--scrollbar-radius);
}
.chart-container .apexcharts-legend::-webkit-scrollbar-thumb:hover,
.zone-drill-donut-chart .apexcharts-legend::-webkit-scrollbar-thumb:hover {
  background: var(--scrollbar-thumb-modal-hover);
}
.apexcharts-gridline { stroke: var(--gray-100); }
.apexcharts-xaxis-tick { stroke: var(--border); }
.apexcharts-tooltip { font-family: var(--font) !important; font-size: 13px !important; border-radius: 5px; box-shadow: var(--shadow) !important; }
.apexcharts-tooltip.apexcharts-theme-light { border: 1px solid var(--border) !important; background: rgba(255,255,255,.96) !important; }
.apexcharts-tooltip.apexcharts-theme-light .apexcharts-tooltip-title { background: var(--card-bg) !important; border-bottom: 1px solid var(--border) !important; }
/*
 * Tooltip must not capture the pointer: if pointer-events: auto, moving onto the tooltip
 * leaves the chart grid in Apex’s eyes and it hides the tooltip — then the cursor is
 * “on” the bar again → show → loop (blink). Events pass through to the SVG instead.
 */
.apexcharts-tooltip {
  pointer-events: none !important;
}
.apexcharts-xaxistooltip,
.apexcharts-yaxistooltip {
  pointer-events: none !important;
}
/* Let hover hit bars/lines, not only floating % labels (reduces jitter near labels). */
.apexcharts-datalabels,
.apexcharts-datalabel,
.apexcharts-datalabel-label {
  pointer-events: none !important;
}
.apexcharts-radialbar .apexcharts-datalabels-group text { fill: var(--text); }
.apexcharts-radialbar-track path { stroke: var(--border); }
.apexcharts-radar-series polygon, .apexcharts-radar-series line { stroke: var(--border); }

/* ═══════════ Animations ═══════════ */

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

@keyframes pageLoaderSpin {
  to { transform: rotate(360deg); }
}

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

@keyframes pulseRing {
  0%   { transform: scale(1);   opacity: .6; }
  70%  { transform: scale(1.6); opacity: 0; }
  100% { transform: scale(1.6); opacity: 0; }
}

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

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

.kpi-card {
  animation: fadeSlideUp .45s ease both;
}
.kpi-card:nth-child(1) { animation-delay: .04s; }
.kpi-card:nth-child(2) { animation-delay: .08s; }
.kpi-card:nth-child(3) { animation-delay: .12s; }
.kpi-card:nth-child(4) { animation-delay: .16s; }
.kpi-card:nth-child(5) { animation-delay: .20s; }
.kpi-card:nth-child(6) { animation-delay: .24s; }

.chart-card {
  animation: fadeSlideUp .5s ease both;
}
.chart-row .chart-card:nth-child(1) { animation-delay: .06s; }
.chart-row .chart-card:nth-child(2) { animation-delay: .12s; }
.chart-row .chart-card:nth-child(3) { animation-delay: .18s; }

.kpi-value {
  animation: countUp .4s ease .3s both;
}

.sidebar-link {
  animation: fadeIn .3s ease both;
}
.sidebar-link:nth-child(2) { animation-delay: .04s; }
.sidebar-link:nth-child(3) { animation-delay: .08s; }
.sidebar-link:nth-child(4) { animation-delay: .12s; }
.sidebar-link:nth-child(5) { animation-delay: .16s; }
.sidebar-link:nth-child(6) { animation-delay: .20s; }
.sidebar-link:nth-child(7) { animation-delay: .24s; }
.sidebar-link:nth-child(8) { animation-delay: .28s; }

.topbar { animation: fadeIn .35s ease both; }
.page-content { animation: fadeIn .4s ease .15s both; }

/* Live status dot pulse */
.chatbot-status-dot {
  display: inline-block;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--success);
  margin-right: 4px;
  animation: pulseRing 1.8s ease-in-out infinite;
}

/* ═══════════ Chatbot ═══════════ */

.chatbot-root {
  position: fixed;
  inset: 0;
  z-index: 10060;
  pointer-events: none;
}
.chatbot-root .chatbot-fab {
  pointer-events: auto;
}
.chatbot-root .chatbot-panel {
  pointer-events: none;
}
.chatbot-root .chatbot-panel.open {
  pointer-events: auto;
}

.chatbot-fab {
  position: fixed;
  bottom: 24px; right: 24px;
  width: 56px; height: 56px;
  border: none;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(64,81,137,.4);
  z-index: 1;
  transition: transform .2s, box-shadow .2s;
  font-size: 22px;
}
.chatbot-fab:hover { transform: scale(1.08); box-shadow: 0 6px 20px rgba(64,81,137,.5); }
.chatbot-fab-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .3s;
}
.chatbot-fab.open .chatbot-fab-icon { transform: rotate(90deg); }

.chatbot-fab-pulse {
  position: absolute; inset: -4px;
  border-radius: 50%;
  border: 2px solid var(--primary);
  animation: pulseRing 2s ease-in-out infinite;
  pointer-events: none;
}
.chatbot-fab.open .chatbot-fab-pulse { display: none; }

.chatbot-panel {
  position: fixed;
  bottom: 88px; right: 24px;
  width: 360px;
  max-height: 520px;
  background: var(--card-bg);
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0,0,0,.18);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(16px) scale(.96);
  pointer-events: none;
  transition: opacity .25s ease, transform .25s ease;
}
.chatbot-panel.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.chatbot-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--primary);
  color: #fff;
}
.chatbot-header-left { display: flex; align-items: center; gap: 10px; }
.chatbot-header-left strong { font-size: 14px; display: block; }
.chatbot-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
}
.chatbot-status { font-size: 11px; opacity: .8; display: flex; align-items: center; flex-wrap: wrap; gap: 4px; }

.chatbot-close {
  background: none; border: none;
  color: rgba(255,255,255,.7);
  font-size: 20px; cursor: pointer;
  width: 28px; height: 28px;
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
}
.chatbot-close:hover { color: #fff; background: rgba(255,255,255,.12); }

.ai-icon {
  display: block;
  flex-shrink: 0;
}
.ai-icon--fab { width: 26px; height: 26px; color: #fff; }
.ai-icon--panel { width: 26px; height: 26px; color: #fff; }
.ai-icon--bubble { width: 18px; height: 18px; color: var(--primary); }
.ai-icon--inline { width: 16px; height: 16px; color: var(--primary); }
.ai-icon--btn { width: 18px; height: 18px; color: inherit; }
.ai-icon--sidebar { width: 17px; height: 17px; color: #fff; }
.ai-icon--header { width: 20px; height: 20px; color: var(--primary); }

.chatbot-spotlight {
  flex-shrink: 0;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, var(--gray-100) 0%, var(--card-bg) 100%);
}
.chatbot-spotlight-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 14px;
  border: none;
  background: transparent;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  color: var(--heading);
  cursor: pointer;
  text-align: left;
}
.chatbot-spotlight-toggle:hover { background: rgba(64, 81, 137, 0.07); }
.chatbot-spotlight-toggle-text {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.chatbot-spotlight-chevron {
  flex-shrink: 0;
  color: var(--gray-600);
  transition: transform .2s ease;
}
.chatbot-spotlight-toggle.is-collapsed .chatbot-spotlight-chevron {
  transform: rotate(-90deg);
}
.chatbot-spotlight-body {
  padding: 0 12px 12px;
}
.chatbot-spotlight-body.is-collapsed {
  display: none;
}
.chatbot-spotlight-intro {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.45;
  margin: 0 2px 8px;
}
.chatbot-spotlight-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.chatbot-spotlight-chip {
  width: 100%;
  text-align: left;
  font-family: var(--font);
  font-size: 12px;
  font-weight: 500;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card-bg);
  color: var(--primary);
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.chatbot-spotlight-chip:hover {
  background: rgba(53, 119, 241, 0.08);
  border-color: var(--secondary);
}

.chatbot-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chatbot-msg {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  animation: fadeSlideUp .3s ease both;
}
.chatbot-msg.user { flex-direction: row-reverse; }

.chatbot-msg-avatar { font-size: 18px; flex-shrink: 0; margin-top: 2px; }
.chatbot-msg.user .chatbot-msg-avatar { display: none; }

.chatbot-msg-bubble {
  padding: 10px 14px;
  border-radius: 12px 12px 12px 2px;
  font-size: 13px;
  line-height: 1.45;
  max-width: 82%;
}
.chatbot-msg.bot .chatbot-msg-bubble {
  background: var(--gray-100);
  color: var(--text);
}
.chatbot-msg.user .chatbot-msg-bubble {
  background: var(--primary);
  color: #fff;
  border-radius: 12px 12px 2px 12px;
}

.chatbot-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 2px 0 4px;
}

.chatbot-suggestion {
  font-family: var(--font);
  font-size: 12px;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--card-bg);
  color: var(--primary);
  cursor: pointer;
  transition: all .15s;
}
.chatbot-suggestion:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.chatbot-typing {
  display: flex; gap: 4px; padding: 10px 14px;
  background: var(--gray-100); border-radius: 12px;
  width: fit-content;
}
.chatbot-typing span {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--gray-500);
  animation: typingBounce .6s ease-in-out infinite;
}
.chatbot-typing span:nth-child(2) { animation-delay: .15s; }
.chatbot-typing span:nth-child(3) { animation-delay: .3s; }

@keyframes typingBounce {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-4px); }
}

.chatbot-footer {
  display: flex;
  gap: 8px;
  padding: 10px 14px;
  border-top: 1px solid var(--border);
  background: var(--card-bg);
}

.chatbot-input {
  flex: 1;
  font-family: var(--font);
  font-size: 13px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 20px;
  outline: none;
  color: var(--text);
  background: var(--gray-100);
}
.chatbot-input:focus { border-color: var(--secondary); background: var(--card-bg); }

.chatbot-send {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: none;
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s;
}
.chatbot-send-icon { width: 18px; height: 18px; }
.chatbot-send:hover { background: #364476; }

/* ═══════════ Sidebar overlay (mobile) ═══════════ */

.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.35);
  z-index: 99;
}
.sidebar-overlay.active { display: block; }

/* ═══════════ Responsive ═══════════ */

@media (max-width: 1400px) {
  .kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .kpi-grid--sales { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 1100px) {
  .chart-row-3, .chart-row-2 { grid-template-columns: 1fr 1fr; }
  .filter-bar-inner { gap: 8px; }
  .filter-bar .filter-select { min-width: 100px; }
}

/* Desktop: hamburger collapses sidebar */
body.sidebar-collapsed .sidebar { transform: translateX(-100%); }
body.sidebar-collapsed .main-content { margin-left: 0; }

@media (max-width: 992px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  body.sidebar-collapsed .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
}

@media (max-width: 768px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi-grid--sales { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .chart-row-3, .chart-row-2 { grid-template-columns: 1fr; }
  .chart-container, .chart-container-tall { min-height: 220px; }
  #sales-zone-target-achievement {
    min-width: 0;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  #sales-zone-target-achievement .chart-row {
    min-width: 0;
    max-width: 100%;
  }
  .chart-card--region-target {
    padding: 20px 12px 18px;
    width: 100%;
    max-width: 100%;
  }
  .chart-card--region-target > .chart-header {
    padding: 6px 6px 14px;
  }
  .region-target-report-wrap {
    max-width: 100%;
  }
  .page-content { padding: 22px 12px calc(16px + 88px); }
  .filter-bar { padding: 12px 12px 14px; }
  .data-table-section { width: 100%; }
  .data-table-wrapper { max-height: 280px; }
  .data-table th, .data-table td { padding: 8px 10px; font-size: 12px; }
}

@media (max-width: 480px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .topbar-right { display: none; }
  .assistant-header-btn { display: inline-flex; }
  .page-content { padding: 18px 8px calc(12px + 88px); }
  .chart-card--region-target {
    padding: 16px 8px 16px;
    width: 100%;
    max-width: 100%;
  }
}

/* Blocking overlay when `?token=` is invalid (401/403) — not dismissable */
body.is-auth-query-blocked {
  overflow: hidden;
}
.auth-query-unauthorized[hidden] {
  display: none !important;
}
.auth-query-unauthorized {
  position: fixed;
  inset: 0;
  z-index: 13060;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  box-sizing: border-box;
}
.auth-query-unauthorized__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.7);
  pointer-events: auto;
}
.auth-query-unauthorized__panel {
  position: relative;
  z-index: 1;
  max-width: 420px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.75rem 1.5rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35);
  text-align: center;
}
.auth-query-unauthorized__title {
  margin: 0 0 0.75rem;
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text);
}
.auth-query-unauthorized__message {
  margin: 0;
  font-size: 0.9375rem;
  line-height: 1.5;
  color: var(--text-muted);
}
