:root {
  --navy-950: #071225;
  --navy-900: #0b1930;
  --navy-800: #142744;
  --navy-700: #213b5f;
  --blue-600: #2f6fed;
  --blue-500: #4382f7;
  --teal-600: #0d987d;
  --teal-500: #16b898;
  --amber-500: #f4ad3d;
  --orange-500: #f07836;
  --red-500: #e05252;
  --slate-900: #172033;
  --slate-700: #455168;
  --slate-600: #667085;
  --slate-500: #8791a5;
  --slate-300: #d7dde7;
  --slate-200: #e8ecf2;
  --slate-100: #f2f5f9;
  --surface: #ffffff;
  --canvas: #f4f6fa;
  --shadow-sm: 0 1px 2px rgba(13, 26, 49, 0.06), 0 1px 5px rgba(13, 26, 49, 0.05);
  --shadow-md: 0 12px 32px rgba(13, 26, 49, 0.12);
  --radius-sm: 8px;
  --radius-md: 13px;
  --radius-lg: 18px;
  --header-height: 68px;
  color-scheme: light;
}

* { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; }

body {
  color: var(--slate-900);
  background: var(--canvas);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

button, input, select { font: inherit; }
button { color: inherit; }
a { color: inherit; text-decoration: none; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.app-header {
  height: var(--header-height);
  display: flex;
  align-items: center;
  gap: 26px;
  padding: 0 24px;
  color: #fff;
  background: linear-gradient(104deg, var(--navy-950), var(--navy-900) 58%, #102746);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  position: relative;
  z-index: 1200;
}

.brand { display: flex; align-items: center; gap: 11px; min-width: 204px; }

.brand-mark {
  width: 35px;
  height: 35px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: linear-gradient(145deg, #25d2ae, #198fef);
  box-shadow: 0 7px 18px rgba(25, 154, 214, 0.28);
}

.brand-mark svg { width: 21px; height: 21px; }
.brand-title { display: block; font-weight: 760; font-size: 16px; letter-spacing: -0.02em; }
.brand-subtitle { display: block; color: #8fa0b9; font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; margin-top: 1px; }

.main-nav { align-self: stretch; display: flex; align-items: center; gap: 5px; }

.nav-link {
  height: 100%;
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 15px;
  color: #9eacc0;
  font-size: 13px;
  font-weight: 620;
}

.nav-link:hover { color: #fff; }
.nav-link.active { color: #fff; }
.nav-link.active::after { content: ""; position: absolute; height: 3px; border-radius: 4px 4px 0 0; background: var(--teal-500); left: 15px; right: 15px; bottom: 0; }

.nav-icon { width: 16px; height: 16px; opacity: 0.88; }
.header-spacer { flex: 1; }
.header-actions { display: flex; align-items: center; gap: 9px; }

.button {
  appearance: none;
  border: 0;
  min-height: 38px;
  padding: 0 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 9px;
  background: var(--surface);
  color: var(--slate-900);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 150ms ease, box-shadow 150ms ease, background 150ms ease, border-color 150ms ease;
}

.button:hover { transform: translateY(-1px); box-shadow: 0 7px 17px rgba(7, 18, 37, 0.14); }
.button:disabled { cursor: wait; opacity: 0.65; transform: none; }
.button svg { width: 15px; height: 15px; }
.button-primary { color: #fff; background: linear-gradient(135deg, var(--teal-500), #12977f); }
.button-blue { color: #fff; background: linear-gradient(135deg, var(--blue-500), var(--blue-600)); }
.button-ghost { color: #d5deea; border: 1px solid rgba(255, 255, 255, 0.16); background: rgba(255, 255, 255, 0.05); }
.button-ghost:hover { background: rgba(255, 255, 255, 0.1); }
.button-outline { border: 1px solid var(--slate-300); background: #fff; color: var(--slate-700); }
.button-soft { background: #eaf2ff; color: #285cbd; }
.button-sm { min-height: 32px; padding: 0 11px; border-radius: 8px; font-size: 11px; }
.icon-button { width: 36px; height: 36px; padding: 0; min-height: 36px; }

.workspace-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #afbdd0;
  padding-right: 3px;
  white-space: nowrap;
  font-size: 11px;
  font-weight: 650;
}

.workspace-badge-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--teal-500); box-shadow: 0 0 0 4px rgba(22, 184, 152, 0.12); }
.workspace-empty .workspace-badge-dot { background: var(--slate-400); box-shadow: 0 0 0 4px rgba(148, 163, 184, 0.12); }

.kpi-strip {
  min-height: 82px;
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 1px;
  background: var(--slate-200);
  border-bottom: 1px solid var(--slate-200);
}

.mini-kpi { padding: 16px 24px 14px; background: #fff; display: flex; align-items: center; gap: 13px; }
.mini-kpi-icon { width: 39px; height: 39px; display: grid; place-items: center; border-radius: 12px; }
.mini-kpi-icon svg { width: 18px; height: 18px; }
.mini-kpi-icon.blue { color: #2f6fed; background: #eaf1ff; }
.mini-kpi-icon.teal { color: #0d987d; background: #e5f8f4; }
.mini-kpi-icon.amber { color: #c77a0a; background: #fff3dd; }
.mini-kpi-icon.violet { color: #7f58d8; background: #f1ebff; }
.mini-kpi-label { color: var(--slate-500); text-transform: uppercase; letter-spacing: 0.08em; font-size: 9px; font-weight: 750; }
.mini-kpi-value { display: flex; align-items: baseline; gap: 6px; font-size: 20px; font-weight: 760; letter-spacing: -0.035em; margin-top: 3px; }
.mini-kpi-detail { font-size: 10px; color: var(--slate-500); font-weight: 600; letter-spacing: 0; }

.map-shell { height: calc(100vh - var(--header-height) - 82px); min-height: 520px; display: grid; grid-template-columns: minmax(0, 1fr) 344px; }
.map-area { position: relative; min-width: 0; overflow: hidden; }
#fleet-map { width: 100%; height: 100%; background: #dfe7ed; }

.map-filter-panel {
  position: absolute;
  z-index: 700;
  top: 16px;
  left: 16px;
  right: 16px;
  max-width: 920px;
  min-height: 64px;
  display: grid;
  grid-template-columns: 1.15fr 1fr auto;
  gap: 10px;
  align-items: end;
  padding: 11px 12px;
  border: 1px solid rgba(216, 223, 233, 0.9);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 10px 30px rgba(23, 42, 72, 0.15);
  backdrop-filter: blur(12px);
}

.field-label { display: block; color: var(--slate-500); font-size: 9px; text-transform: uppercase; letter-spacing: 0.07em; font-weight: 750; margin: 0 0 5px 2px; }
.field-control { width: 100%; height: 34px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--slate-300); background: #fff; color: var(--slate-900); outline: none; font-size: 12px; }
.field-control:focus { border-color: var(--blue-500); box-shadow: 0 0 0 3px rgba(67, 130, 247, 0.12); }
.range-field { display: grid; grid-template-columns: 1fr auto; column-gap: 9px; align-items: center; }
.range-field .field-label { grid-column: 1 / -1; }
.range-field input { accent-color: var(--blue-600); width: 100%; }
.range-value { min-width: 46px; color: var(--slate-700); font-size: 11px; font-weight: 750; text-align: right; }
.map-legend {
  position: absolute;
  z-index: 700;
  left: 16px;
  bottom: 18px;
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 10px 14px;
  border: 1px solid rgba(216, 223, 233, 0.8);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(10px);
  color: var(--slate-600);
  font-size: 10px;
  font-weight: 650;
}

.legend-title { color: var(--slate-900); font-size: 9px; text-transform: uppercase; letter-spacing: 0.08em; }
.legend-item { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.legend-dot { width: 8px; height: 8px; border-radius: 50%; }
.legend-dot.territory { background: var(--blue-600); }
.legend-dot.outside { background: #8b95a6; }
.legend-dot.multidrop { background: var(--amber-500); }

.territory-sidebar { background: #fff; border-left: 1px solid var(--slate-200); display: flex; flex-direction: column; overflow: hidden; }
.sidebar-head { padding: 19px 19px 14px; border-bottom: 1px solid var(--slate-200); }
.sidebar-title-row { display: flex; justify-content: space-between; align-items: center; }
.sidebar-title { margin: 0; color: var(--slate-900); font-size: 14px; font-weight: 760; letter-spacing: -0.01em; }
.sidebar-count { display: inline-flex; padding: 3px 7px; border-radius: 99px; color: #285cbd; background: #eaf2ff; font-size: 9px; font-weight: 800; }
.sidebar-subtitle { margin: 5px 0 0; color: var(--slate-500); font-size: 10px; }
.territory-list { overflow-y: auto; padding: 7px 10px 16px; }

.territory-row {
  position: relative;
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 65px;
  padding: 10px 8px;
  border-bottom: 1px solid var(--slate-100);
  border-radius: 9px;
  cursor: pointer;
}

.territory-row:hover { background: #f7f9fc; }
.territory-rank { width: 29px; height: 29px; display: grid; place-items: center; border-radius: 9px; color: #35557f; background: #eef3f8; font-size: 10px; font-weight: 800; }
.territory-row:first-child .territory-rank { color: #fff; background: var(--navy-800); }
.territory-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; font-weight: 740; }
.territory-meta { display: flex; gap: 8px; margin-top: 5px; color: var(--slate-500); font-size: 9px; }
.volume-button { border: 1px solid #cfe0ff; border-radius: 7px; padding: 5px 7px; color: #2f67c6; background: #f0f5ff; font-size: 9px; font-weight: 800; cursor: pointer; }

.leaflet-control-zoom { border: 0 !important; box-shadow: 0 8px 22px rgba(23, 42, 72, 0.18) !important; }
.leaflet-control-zoom a { border: 0 !important; color: var(--navy-800) !important; }
.leaflet-control-attribution { font-size: 8px !important; }
.fleet-div-icon { background: transparent; border: 0; }
.fleet-pin { position: relative; width: 23px; height: 23px; border: 3px solid #fff; border-radius: 50% 50% 50% 7px; transform: rotate(-45deg); box-shadow: 0 4px 11px rgba(15, 34, 61, 0.28); }
.fleet-pin::after { content: ""; position: absolute; inset: 6px; border-radius: 50%; background: rgba(255, 255, 255, 0.9); }
.fleet-pin.territory { background: var(--blue-600); }
.fleet-pin.factory { background: var(--orange-500); }
.fleet-pin.outside { background: #7e899a; }
.fleet-pin.multidrop { background: var(--amber-500); }
.marker-cluster-small, .marker-cluster-medium, .marker-cluster-large { background: rgba(47, 111, 237, 0.22) !important; }
.marker-cluster div { color: #fff; background: var(--blue-600) !important; font-weight: 750; }

.map-popup { min-width: 235px; padding: 2px; }
.map-popup-kicker { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 9px; color: var(--blue-600); font-size: 9px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; }
.map-popup h3 { margin: 0 0 3px; color: var(--slate-900); font-size: 14px; }
.map-popup-sub { margin: 0 0 12px; color: var(--slate-500); font-size: 10px; }
.popup-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 9px; border-radius: 8px; background: var(--slate-100); }
.popup-label { display: block; color: var(--slate-500); font-size: 8px; text-transform: uppercase; letter-spacing: 0.05em; }
.popup-value { display: block; margin-top: 2px; color: var(--slate-900); font-size: 10px; font-weight: 750; }
.popup-products { margin-top: 10px; }
.popup-product { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; border-bottom: 1px solid var(--slate-100); font-size: 10px; }
.popup-product strong { color: var(--teal-600); }

dialog { color: inherit; }
.modal { width: min(760px, calc(100vw - 32px)); max-height: calc(100vh - 32px); padding: 0; border: 0; border-radius: var(--radius-lg); background: #fff; box-shadow: 0 30px 90px rgba(5, 14, 29, 0.28); overflow: hidden; }
.modal::backdrop { background: rgba(6, 15, 30, 0.68); backdrop-filter: blur(4px); }
.modal-head { min-height: 78px; display: flex; align-items: center; gap: 13px; padding: 18px 22px; color: #fff; background: linear-gradient(112deg, var(--navy-950), #112c50); }
.modal-head-icon { width: 39px; height: 39px; display: grid; place-items: center; border-radius: 11px; color: #fff; background: rgba(22, 184, 152, 0.18); border: 1px solid rgba(41, 211, 179, 0.25); }
.modal-head-icon svg { width: 19px; height: 19px; }
.modal-head h2 { margin: 0; font-size: 16px; }
.modal-head p { margin: 4px 0 0; color: #9eafc5; font-size: 10px; }
.modal-head-copy { flex: 1; }
.modal-close { width: 32px; height: 32px; border: 0; border-radius: 8px; color: #b6c1d0; background: rgba(255, 255, 255, 0.07); font-size: 20px; cursor: pointer; }
.modal-body { padding: 20px 22px; max-height: calc(100vh - 190px); overflow-y: auto; }
.import-intro { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin-bottom: 16px; padding: 12px 14px; border-radius: 10px; background: #eef5ff; }
.import-intro strong { display: block; color: #294c80; font-size: 11px; }
.import-intro span { display: block; margin-top: 3px; color: #6c7f99; font-size: 9px; }
.quick-file-label { position: relative; overflow: hidden; white-space: nowrap; }
.quick-file-label input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.file-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.file-field { min-height: 78px; position: relative; display: grid; grid-template-columns: 35px 1fr auto; align-items: center; gap: 11px; padding: 12px; border: 1px dashed #c9d1de; border-radius: 10px; background: #fbfcfe; transition: border 150ms ease, background 150ms ease; }
.file-field:hover { border-color: var(--blue-500); background: #f7faff; }
.file-field.has-file { border-style: solid; border-color: #9bd9cc; background: #f3fbf9; }
.file-field input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.file-field-icon { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 9px; background: #eef2f7; color: #48617e; font-size: 11px; font-weight: 850; }
.file-field.has-file .file-field-icon { background: #dff6f0; color: var(--teal-600); }
.file-field-title { display: block; color: var(--slate-900); font-size: 10px; font-weight: 760; }
.file-field-hint { display: block; margin-top: 3px; color: var(--slate-500); font-size: 8px; }
.file-field-name { max-width: 96px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--blue-600); font-size: 8px; font-weight: 700; }
.file-field.wide { grid-column: 1 / -1; }
.modal-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 16px; }
.modal-actions.single { justify-content: flex-end; }
.modal-action-group { display: flex; gap: 8px; }
.import-progress { margin-top: 14px; }
.progress-track { height: 5px; overflow: hidden; border-radius: 99px; background: var(--slate-200); }
.progress-bar { width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--teal-500), var(--blue-500)); transition: width 220ms ease; }
.progress-text { display: block; margin-top: 6px; color: var(--slate-500); font-size: 9px; text-align: center; }
.error-box { margin-top: 12px; padding: 10px 12px; color: #9d3030; border: 1px solid #f0c5c5; border-radius: 8px; background: #fff1f1; font-size: 10px; }

.volume-summary { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
.volume-summary-item { padding: 13px; border-radius: 10px; background: var(--slate-100); }
.volume-summary-item span { color: var(--slate-500); font-size: 9px; text-transform: uppercase; letter-spacing: 0.07em; }
.volume-summary-item strong { display: block; margin-top: 5px; font-size: 18px; }
.volume-destination { padding: 13px 0; border-bottom: 1px solid var(--slate-200); }
.volume-destination-head { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 9px; }
.volume-destination-head strong { font-size: 11px; }
.volume-destination-head span { color: var(--teal-600); font-size: 11px; font-weight: 800; }
.product-bar-row { display: grid; grid-template-columns: minmax(100px, 1fr) 2fr auto; gap: 10px; align-items: center; margin-top: 6px; font-size: 9px; color: var(--slate-600); }
.product-bar { height: 5px; overflow: hidden; border-radius: 99px; background: var(--slate-200); }
.product-bar-fill { height: 100%; border-radius: inherit; background: var(--blue-500); }

.toast-region { position: fixed; z-index: 3000; right: 18px; bottom: 18px; display: grid; gap: 8px; }
.toast { min-width: 260px; display: flex; align-items: center; gap: 9px; padding: 12px 14px; opacity: 0; transform: translateY(8px); border: 1px solid var(--slate-200); border-radius: 10px; background: #fff; box-shadow: var(--shadow-md); color: var(--slate-700); font-size: 11px; font-weight: 650; transition: opacity 200ms ease, transform 200ms ease; }
.toast.is-visible { opacity: 1; transform: translateY(0); }
.toast-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--teal-500); }
.toast-warning .toast-dot { background: var(--amber-500); }

/* Executive dashboard */
.executive-page { min-height: calc(100vh - var(--header-height)); padding: 26px 28px 40px; background: #f4f6fa; }
.executive-container { max-width: 1500px; margin: 0 auto; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
.page-eyebrow { color: var(--blue-600); text-transform: uppercase; letter-spacing: 0.11em; font-size: 9px; font-weight: 800; }
.page-heading h1 { margin: 5px 0 0; color: var(--navy-900); font-size: 26px; line-height: 1.15; letter-spacing: -0.04em; }
.page-heading p { max-width: 600px; margin: 7px 0 0; color: var(--slate-500); font-size: 11px; line-height: 1.6; }
.page-actions { display: flex; gap: 8px; }

.executive-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 13px; margin-bottom: 16px; }
.exec-kpi { position: relative; overflow: hidden; min-height: 122px; padding: 18px; border: 1px solid var(--slate-200); border-radius: var(--radius-md); background: #fff; box-shadow: var(--shadow-sm); }
.exec-kpi::after { content: ""; position: absolute; width: 74px; height: 74px; right: -22px; top: -25px; border-radius: 50%; background: var(--kpi-glow, #eaf1ff); }
.exec-kpi-top { display: flex; align-items: center; justify-content: space-between; }
.exec-kpi-label { color: var(--slate-500); font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; }
.exec-kpi-icon { width: 31px; height: 31px; display: grid; place-items: center; border-radius: 9px; color: var(--kpi-color, var(--blue-600)); background: var(--kpi-glow, #eaf1ff); z-index: 1; }
.exec-kpi-icon svg { width: 15px; height: 15px; }
.exec-kpi-value { margin-top: 12px; color: var(--navy-900); font-size: 26px; font-weight: 780; letter-spacing: -0.045em; }
.exec-kpi-note { margin-top: 4px; color: var(--slate-500); font-size: 9px; }
.exec-kpi.teal { --kpi-color: var(--teal-600); --kpi-glow: #e3f7f2; }
.exec-kpi.amber { --kpi-color: #bf7811; --kpi-glow: #fff1d9; }
.exec-kpi.violet { --kpi-color: #7550ca; --kpi-glow: #f0eaff; }

.executive-filters { display: grid; grid-template-columns: 1.25fr 1fr 1fr 1fr auto; gap: 10px; align-items: end; padding: 14px; margin-bottom: 16px; border: 1px solid var(--slate-200); border-radius: var(--radius-md); background: #fff; box-shadow: var(--shadow-sm); }
.filter-field { min-width: 0; }
.multi-select { position: relative; }
.multi-select summary { display: flex; align-items: center; justify-content: space-between; gap: 8px; list-style: none; cursor: pointer; }
.multi-select summary::-webkit-details-marker { display: none; }
.multi-select summary span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.multi-select summary svg { width: 14px; height: 14px; flex: 0 0 auto; transition: transform 150ms ease; }
.multi-select[open] summary svg { transform: rotate(180deg); }
.multi-select[open] summary { border-color: var(--blue-500); box-shadow: 0 0 0 3px rgba(67, 130, 247, 0.12); }
.multi-select-menu { position: absolute; z-index: 80; top: calc(100% + 6px); left: 0; width: max(100%, 320px); max-height: 280px; overflow-y: auto; padding: 7px; border: 1px solid var(--slate-200); border-radius: 9px; background: #fff; box-shadow: var(--shadow-md); }
.multi-select-option { display: grid; grid-template-columns: 16px minmax(0, 1fr); align-items: start; gap: 8px; padding: 8px; border-radius: 7px; color: var(--slate-700); cursor: pointer; font-size: 10px; line-height: 1.35; }
.multi-select-option:hover { background: var(--slate-100); }
.multi-select-option input { width: 14px; height: 14px; margin: 0; accent-color: var(--blue-600); }
.multi-select-option span { overflow-wrap: anywhere; }
.multi-select-empty { display: block; padding: 10px; color: var(--slate-500); font-size: 9px; }
.multi-select.is-disabled summary { color: var(--slate-400); background: var(--slate-100); cursor: not-allowed; }
.search-wrap { position: relative; }
.search-wrap svg { position: absolute; left: 10px; bottom: 9px; width: 15px; height: 15px; color: var(--slate-500); }
.search-wrap input { padding-left: 32px; }

.section-heading { display: flex; justify-content: space-between; align-items: end; margin: 22px 0 11px; }
.section-heading h2 { margin: 0; color: var(--navy-900); font-size: 15px; letter-spacing: -0.02em; }
.section-heading p { margin: 4px 0 0; color: var(--slate-500); font-size: 9px; }
.section-meta { color: var(--slate-500); font-size: 9px; }

.territory-card-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 13px; }
.territory-card { overflow: hidden; border: 1px solid var(--slate-200); border-radius: var(--radius-md); background: #fff; box-shadow: var(--shadow-sm); }
.territory-card-accent { height: 4px; background: var(--card-color, var(--blue-500)); }
.territory-card-body { padding: 16px; }
.territory-card-head { display: flex; justify-content: space-between; gap: 12px; align-items: start; }
.territory-card-title { margin: 0; font-size: 12px; font-weight: 760; }
.territory-card-badge { padding: 4px 7px; border-radius: 99px; color: #285cbd; background: #edf3ff; font-size: 8px; font-weight: 800; }
.territory-card-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 15px 0 13px; }
.territory-stat { padding: 9px; border-radius: 8px; background: var(--slate-100); }
.territory-stat span { display: block; color: var(--slate-500); font-size: 7px; text-transform: uppercase; letter-spacing: 0.05em; }
.territory-stat strong { display: block; margin-top: 4px; font-size: 11px; }
.territory-product { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; padding: 6px 0; border-top: 1px solid var(--slate-100); font-size: 9px; }
.territory-product span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--slate-600); }
.territory-product strong { color: var(--slate-900); }
.territory-empty { color: var(--slate-500); font-size: 9px; padding: 8px 0; }

.territory-breakdown-panel { overflow: hidden; border: 1px solid var(--slate-200); border-radius: var(--radius-md); background: #fff; box-shadow: var(--shadow-sm); }
.territory-breakdown-table { width: 100%; min-width: 1120px; border-collapse: collapse; }
.territory-breakdown-table th { padding: 12px 14px; color: var(--slate-500); background: #f7f9fc; border-bottom: 1px solid var(--slate-200); text-align: left; text-transform: uppercase; letter-spacing: 0.07em; font-size: 8px; font-weight: 800; white-space: nowrap; }
.territory-breakdown-table th:nth-child(1) { width: 18%; }
.territory-breakdown-table th:nth-child(2) { width: 15%; }
.territory-breakdown-table th:nth-child(3) { width: 15%; }
.territory-breakdown-table th:nth-child(4) { width: 29%; }
.territory-breakdown-table th:nth-child(5) { width: 23%; }
.territory-breakdown-table td { padding: 14px; border-bottom: 1px solid var(--slate-100); color: var(--slate-600); font-size: 10px; vertical-align: top; }
.territory-breakdown-table tbody tr:hover { background: #fbfcfe; }
.territory-breakdown-table tbody tr:last-child td { border-bottom: 0; }
.territory-table-name, .territory-table-value, .territory-volume-value { display: block; color: var(--slate-900); font-size: 11px; font-weight: 800; }
.territory-volume-value { color: var(--blue-600); }
.territory-table-note { display: block; margin-top: 4px; color: var(--slate-500); font-size: 8px; }
.breakdown-list { display: grid; gap: 5px; }
.breakdown-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: baseline; gap: 10px; }
.breakdown-item > span { overflow: hidden; color: var(--slate-600); text-overflow: ellipsis; white-space: nowrap; }
.breakdown-item strong { color: var(--slate-900); font-size: 9px; white-space: nowrap; }
.destination-breakdown-item strong { min-width: 22px; padding: 2px 6px; border-radius: 99px; color: #285cbd; background: #edf3ff; text-align: center; }
.breakdown-more { margin-top: 2px; }
.breakdown-more summary { width: fit-content; color: var(--blue-600); cursor: pointer; font-size: 8px; font-weight: 750; }
.breakdown-more-list { display: grid; gap: 5px; margin-top: 7px; }
.breakdown-empty { color: var(--slate-400); font-size: 9px; }
.territory-breakdown-table tfoot td { padding: 12px 14px; color: var(--slate-600); background: #f7f9fc; border-top: 1px solid var(--slate-200); font-size: 9px; }
.territory-breakdown-table tfoot td:first-child { color: var(--slate-900); font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em; }
.territory-breakdown-table tfoot strong, .territory-breakdown-table tfoot span { display: block; }

.orders-panel { overflow: hidden; border: 1px solid var(--slate-200); border-radius: var(--radius-md); background: #fff; box-shadow: var(--shadow-sm); }
.table-wrap { width: 100%; overflow-x: auto; }
.orders-table { width: 100%; border-collapse: collapse; min-width: 980px; }
.orders-table th { padding: 11px 14px; color: var(--slate-500); background: #f7f9fc; border-bottom: 1px solid var(--slate-200); text-align: left; text-transform: uppercase; letter-spacing: 0.07em; font-size: 8px; font-weight: 800; white-space: nowrap; }
.orders-table td { padding: 12px 14px; border-bottom: 1px solid var(--slate-100); color: var(--slate-600); font-size: 10px; vertical-align: middle; }
.orders-table tbody tr:hover { background: #fbfcfe; }
.orders-table tbody tr:last-child td { border-bottom: 0; }
.order-id { color: var(--blue-600); font-weight: 800; }
.destination-cell strong { display: block; color: var(--slate-900); font-size: 10px; }
.destination-cell span { display: block; margin-top: 3px; color: var(--slate-500); font-size: 8px; }
.table-volume { color: var(--teal-600); font-weight: 800; }
.tag { display: inline-flex; align-items: center; gap: 5px; margin: 2px 3px 2px 0; padding: 4px 7px; border-radius: 99px; font-size: 8px; font-weight: 750; white-space: nowrap; }
.tag::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.tag-allocated { color: #087b66; background: #e5f8f4; }
.tag-multidrop { color: #9a650b; background: #fff1d7; }
.tag-unmatched { color: #6e7787; background: #eef1f5; }
.product-stack { max-width: 210px; }
.product-stack span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.table-empty { padding: 38px !important; text-align: center; color: var(--slate-500); }
.table-footer { display: flex; align-items: center; justify-content: space-between; padding: 11px 14px; color: var(--slate-500); background: #fbfcfe; border-top: 1px solid var(--slate-100); font-size: 9px; }

.empty-state { padding: 34px; color: var(--slate-500); text-align: center; border: 1px dashed var(--slate-300); border-radius: var(--radius-md); background: #fff; font-size: 11px; }

@media (max-width: 1100px) {
  .workspace-badge { display: none; }
  .map-shell { grid-template-columns: minmax(0, 1fr) 300px; }
  .territory-card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .executive-filters { grid-template-columns: repeat(2, 1fr); }
  .executive-filters .button { min-height: 36px; }
}

@media (max-width: 820px) {
  :root { --header-height: 62px; }
  .app-header { padding: 0 14px; gap: 8px; }
  .brand { min-width: auto; }
  .brand-copy { display: none; }
  .main-nav { gap: 0; }
  .nav-link { padding: 0 10px; font-size: 11px; }
  .nav-link span { display: none; }
  .header-actions .button span { display: none; }
  .header-actions .button { width: 36px; padding: 0; }
  .kpi-strip { grid-template-columns: repeat(2, 1fr); }
  .mini-kpi { padding: 10px 14px; }
  .map-shell { height: auto; min-height: 0; display: block; }
  .map-area { height: 68vh; min-height: 490px; }
  .territory-sidebar { height: auto; max-height: none; border-left: 0; border-top: 1px solid var(--slate-200); }
  .territory-list { max-height: 370px; }
  .map-filter-panel { grid-template-columns: 1fr 1fr; }
  .map-filter-panel .button { grid-column: 1 / -1; }
  .map-legend { flex-wrap: wrap; right: 16px; gap: 8px 12px; }
  .executive-page { padding: 20px 14px 32px; }
  .executive-kpis { grid-template-columns: repeat(2, 1fr); }
  .territory-card-grid { grid-template-columns: 1fr; }
}

@media (max-width: 540px) {
  .app-header { gap: 5px; }
  .nav-link { padding: 0 7px; }
  .header-actions { gap: 5px; }
  .button-ghost { display: none; }
  .kpi-strip { min-height: 0; }
  .mini-kpi { min-width: 0; }
  .mini-kpi-icon { display: none; }
  .mini-kpi-value { font-size: 17px; }
  .mini-kpi-detail { display: none; }
  .map-area { min-height: 560px; }
  .map-filter-panel { grid-template-columns: 1fr; right: 12px; left: 12px; }
  .map-filter-panel .button { grid-column: auto; }
  .map-legend { font-size: 8px; }
  .file-grid { grid-template-columns: 1fr; }
  .file-field.wide { grid-column: auto; }
  .modal-actions, .import-intro, .page-heading { align-items: stretch; flex-direction: column; }
  .modal-action-group, .page-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .executive-kpis { grid-template-columns: 1fr; }
  .executive-filters { grid-template-columns: 1fr; }
  .page-heading h1 { font-size: 22px; }
}
