/* ============================================================
   Domino's Dynamic Territories — UI
   Built on the "Honour the Craving" design system
   ============================================================ */

@font-face {
  font-family: 'Obviously Narrow';
  src: url('/static/fonts/Obviously-NarrowBlack_1.otf') format('opentype');
  font-weight: 900;
  font-style: normal;
  font-display: swap;
}
@import url('https://fonts.googleapis.com/css2?family=Sofia+Sans:ital,wght@0,100..900;1,100..900&display=swap');

:root {
  --dmn-red: #E31837;
  --dmn-blue: #006491;
  --dmn-red-bright: #EC1D42;
  --dmn-blue-bright: #0A6BBA;
  --dmn-blue-deep: #0F4C8C;
  --dmn-coral: #F38873;
  --dmn-cream: #F6EBD6;
  --dmn-teal: #BCD7DB;
  --dmn-maroon: #7A0E20;
  --dmn-white: #FFFFFF;
  --dmn-off-white: #FAF6EE;
  --dmn-gray-50: #F4F1EB;
  --dmn-gray-100: #E8E3DA;
  --dmn-gray-300: #BDB6AA;
  --dmn-gray-500: #7A746A;
  --dmn-gray-700: #44403A;
  --dmn-gray-900: #1C1A17;
  --fg-1: var(--dmn-gray-900);
  --fg-2: var(--dmn-gray-700);
  --fg-3: var(--dmn-gray-500);
  --bg-1: var(--dmn-white);
  --bg-2: var(--dmn-off-white);
  --bg-3: var(--dmn-gray-50);
  --accent: var(--dmn-red);
  --accent-hover: #C31530;
  --border-1: rgba(11,11,11,0.10);
  --border-2: rgba(11,11,11,0.18);
  --success: #2E8B3D;
  --warning: #F2B01E;
  --error: #D81E2C;
  --shadow-sm: 0 2px 4px rgba(11,11,11,0.08);
  --shadow-md: 0 6px 18px rgba(11,11,11,0.10);
  --shadow-lg: 0 14px 40px rgba(11,11,11,0.14);
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 14px;
  --radius-pill: 999px;
  --font-display: 'Obviously Narrow', 'Arial Narrow', Impact, system-ui, sans-serif;
  --font-body: 'Sofia Sans', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --topbar-h: 56px;
  --sidebar-w: 280px;
  --panel-w: 320px;
  --schedule-bar-h: 48px;
  --ease: cubic-bezier(.2,.7,.3,1);
}

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

html, body {
  height: 100%;
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--fg-1);
  background: var(--bg-1);
  -webkit-font-smoothing: antialiased;
}

/* ── Login ─────────────────────────────────────────────────── */
.login-page {
  background: var(--dmn-red);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background-image: radial-gradient(ellipse at top, #f04060 0%, var(--dmn-red) 55%, var(--dmn-maroon) 100%);
}

.login-container { width: 100%; max-width: 420px; padding: 16px; }

.login-card {
  background: var(--dmn-white);
  border-radius: var(--radius-lg);
  padding: 40px 36px 36px;
  box-shadow: var(--shadow-lg);
}

.login-logo {
  display: flex;
  justify-content: center;
  margin-bottom: 20px;
}

.login-title {
  font-family: var(--font-display);
  font-size: 38px;
  font-weight: 900;
  text-transform: lowercase;
  color: var(--dmn-red);
  text-align: center;
  line-height: 1;
  margin-bottom: 4px;
}

.login-sub {
  text-align: center;
  color: var(--fg-3);
  font-size: 13px;
  margin-bottom: 28px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

/* ── Forms ─────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--fg-2);
  margin-bottom: 6px;
}
.form-input {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  border: 1.5px solid var(--border-2);
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--fg-1);
  background: var(--bg-1);
  outline: none;
  transition: border-color 150ms var(--ease);
}
.form-input:focus { border-color: var(--dmn-blue); }
.form-input-sm { height: 36px; font-size: 13px; }
.form-select {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border: 1.5px solid var(--border-2);
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--fg-1);
  background: var(--bg-1);
  outline: none;
  cursor: pointer;
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ── Buttons ─────────────────────────────────────────────────── */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  padding: 0 24px;
  background: var(--dmn-red);
  color: var(--dmn-white);
  border: none;
  border-radius: var(--radius-pill);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 120ms var(--ease);
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary.btn-full { width: 100%; }
.btn-primary.btn-sm { height: 34px; padding: 0 16px; font-size: 12px; }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  padding: 0 24px;
  background: transparent;
  color: var(--fg-1);
  border: 1.5px solid var(--dmn-gray-900);
  border-radius: var(--radius-pill);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 120ms var(--ease);
}
.btn-secondary:hover { background: var(--bg-3); }
.btn-secondary.btn-sm { height: 34px; padding: 0 14px; font-size: 12px; }

.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 32px;
  padding: 0 12px;
  background: transparent;
  color: var(--fg-2);
  border: none;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: color 120ms var(--ease);
}
.btn-ghost:hover { color: var(--fg-1); }
.btn-ghost.btn-sm { height: 26px; font-size: 12px; }

.icon-btn {
  width: 28px; height: 28px;
  border: none;
  background: var(--bg-3);
  border-radius: var(--radius-sm);
  font-size: 12px;
  cursor: pointer;
  color: var(--fg-2);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.icon-btn:hover { background: var(--dmn-gray-100); }

/* ── Messages ─────────────────────────────────────────────────── */
.error-msg { color: var(--error); font-size: 13px; font-weight: 600; margin-top: 10px; }
.warning-msg {
  background: #FFF8E7;
  border-left: 3px solid var(--warning);
  color: #7A5A00;
  font-size: 12px;
  padding: 8px 10px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin-top: 8px;
}
.success-msg { color: var(--success); font-size: 13px; font-weight: 600; margin-top: 10px; }

/* ── Topbar ─────────────────────────────────────────────────── */
.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--topbar-h);
  background: var(--dmn-blue-deep);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  z-index: 1000;
  box-shadow: var(--shadow-md);
}
.topbar-left { display: flex; align-items: center; gap: 12px; }
.topbar-logo { height: 36px; width: auto; object-fit: contain; }
.topbar-title {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 900;
  color: var(--dmn-white);
  text-transform: lowercase;
  letter-spacing: -0.01em;
}
.topbar-right { display: flex; align-items: center; gap: 10px; }
.topbar-user { font-size: 13px; color: var(--dmn-gray-300); }

.role-badge {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
}
.role-badge.fp { background: var(--dmn-red); color: var(--dmn-white); }
.role-badge.fc { background: var(--dmn-blue); color: var(--dmn-white); }

/* ── Layout ─────────────────────────────────────────────────── */
.dashboard-page {
  display: block;
  overflow: hidden;
}

.app-layout {
  position: fixed;
  top: var(--topbar-h);
  left: 0;
  right: 0;
  bottom: var(--schedule-bar-h);
  display: flex;
  overflow: hidden;
}

/* ── Sidebar ─────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--bg-1);
  border-right: 1px solid var(--border-1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 16px 10px;
  border-bottom: 1px solid var(--border-1);
}
.sidebar-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 900;
  text-transform: lowercase;
  color: var(--fg-1);
}
.store-count {
  background: var(--dmn-red);
  color: white;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
}

.search-box { padding: 10px 12px; border-bottom: 1px solid var(--border-1); }
.search-input-wrap { position: relative; }
.search-clear-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--fg-3);
  cursor: pointer;
  font-size: 11px;
  padding: 2px 4px;
  line-height: 1;
  border-radius: var(--radius-sm);
}
.search-clear-btn:hover { color: var(--fg-1); background: var(--bg-3); }

.store-list {
  list-style: none;
  overflow-y: auto;
  flex: 1;
  padding: 6px 0;
}

.store-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  cursor: pointer;
  transition: background 100ms var(--ease);
  border-bottom: 1px solid var(--border-1);
}
.store-item:hover { background: var(--bg-2); }
.store-item.active { background: #EEF4F8; border-left: 3px solid var(--dmn-blue); }
.store-item.active .store-num { color: var(--dmn-blue); }

.store-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.store-item-content { flex: 1; min-width: 0; }
.store-item-name {
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--fg-1);
}
.store-item-sub {
  font-size: 11px;
  color: var(--fg-3);
}
.store-num {
  font-size: 11px;
  font-weight: 700;
  color: var(--fg-3);
  flex-shrink: 0;
}

/* ── Map ─────────────────────────────────────────────────── */
.map-wrapper {
  flex: 1;
  position: relative;
  overflow: hidden;
}

#map {
  width: 100%;
  height: 100%;
}

/* ── Map Controls Panel ─────────────────────────────────────── */
.map-controls-panel {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--dmn-white);
  border-radius: var(--radius-lg);
  padding: 12px 18px;
  box-shadow: var(--shadow-md);
  z-index: 500;
  display: flex;
  gap: 20px;
  align-items: center;
  border: 1px solid var(--border-1);
}

.control-row { display: flex; align-items: center; }

.toggle-control {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}

.toggle-input { display: none; }

.toggle-track {
  width: 36px;
  height: 20px;
  background: var(--dmn-gray-300);
  border-radius: var(--radius-pill);
  position: relative;
  flex-shrink: 0;
  transition: background 180ms var(--ease);
}
.toggle-track::after {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 16px; height: 16px;
  background: white;
  border-radius: 50%;
  box-shadow: var(--shadow-sm);
  transition: transform 180ms var(--ease);
}
.toggle-input:checked + .toggle-track { background: var(--dmn-blue); }
.toggle-input:checked + .toggle-track::after { transform: translateX(16px); }

.toggle-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--fg-1);
  white-space: nowrap;
}

.iso-input {
  width: 50px;
  height: 28px;
  padding: 0 6px;
  border: 1.5px solid var(--border-2);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 700;
  text-align: center;
  outline: none;
}
.iso-input:focus { border-color: var(--dmn-blue); }

.toggle-unit {
  font-size: 12px;
  color: var(--fg-3);
  font-weight: 600;
}

/* ── Right Panel ─────────────────────────────────────────────── */
.right-panel {
  width: var(--panel-w);
  flex-shrink: 0;
  background: var(--bg-1);
  border-left: 1px solid var(--border-1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.panel-section {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow-y: auto;
}

.panel-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--border-1);
  flex-shrink: 0;
}
.panel-section-header h3 {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 900;
  text-transform: lowercase;
  color: var(--fg-1);
}

.panel-default {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  text-align: center;
  color: var(--fg-3);
}
.panel-empty-icon { font-size: 36px; margin-bottom: 12px; }
.panel-hint { font-size: 13px; color: var(--fg-3); padding: 0 16px 12px; }

.panel-actions {
  display: flex;
  gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid var(--border-1);
  flex-shrink: 0;
}

/* store details */
.store-detail-grid {
  padding: 14px 16px;
  display: grid;
  gap: 8px;
}
.store-detail-row {
  display: flex;
  flex-direction: column;
}
.store-detail-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg-3);
  margin-bottom: 2px;
}
.store-detail-value { font-size: 14px; color: var(--fg-1); }

.hours-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 3px;
  margin-top: 4px;
}
.hours-row { display: flex; justify-content: space-between; font-size: 12px; }
.hours-day { font-weight: 600; color: var(--fg-2); }
.hours-time { color: var(--fg-3); }
.hours-closed { color: var(--dmn-gray-300); font-style: italic; }

.hours-edit-container { margin-top: 4px; }
.hours-edit-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 5px;
}
.hours-edit-day {
  width: 26px;
  font-size: 12px;
  font-weight: 600;
  color: var(--fg-2);
  flex-shrink: 0;
}
.fp-filter-link {
  color: var(--dmn-blue);
  text-decoration: none;
  font-weight: 600;
}
.fp-filter-link:hover { text-decoration: underline; }

/* ── Segment editor ───────────────────────────────────────────── */
.segment-info-bar {
  padding: 8px 14px;
  border-bottom: 1px solid var(--border-1);
  background: var(--bg-3);
}
.seg-full-area-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--dmn-blue);
}
.seg-id-preview {
  font-size: 11px;
  font-weight: 700;
  color: var(--dmn-blue);
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}
.segment-draw-controls {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-1);
}
.color-picker {
  width: 34px; height: 34px;
  border: 1.5px solid var(--border-2);
  border-radius: var(--radius-sm);
  cursor: pointer; padding: 2px;
  flex-shrink: 0;
}
.segment-list { list-style: none; padding: 4px 0; flex: 1; overflow-y: auto; }
.seg-empty { padding: 16px 14px; font-size: 12px; color: var(--fg-3); }
.segment-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--border-1);
}
.segment-swatch {
  width: 12px; height: 12px;
  border-radius: 3px;
  flex-shrink: 0;
}
.segment-name-block { display: flex; align-items: center; gap: 4px; flex: 1; min-width: 0; }
.segment-id { font-size: 12px; font-weight: 700; color: var(--dmn-blue); flex-shrink: 0; }
.segment-desc { font-size: 12px; color: var(--fg-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.segment-del {
  font-size: 11px; color: var(--fg-3); cursor: pointer;
  padding: 2px 6px; border-radius: var(--radius-sm); border: none; background: none; flex-shrink: 0;
}
.segment-del:hover { background: #FFE8E8; color: var(--error); }

/* ── Scheduler ─────────────────────────────────────────────────── */
.form-hint { font-size: 11px; color: var(--fg-3); font-weight: 400; text-transform: none; letter-spacing: 0; }
.scheduler-form { padding: 12px 16px; border-bottom: 1px solid var(--border-1); overflow-y: auto; flex: 1; }

/* Per-day time table */
.day-schedule-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.day-schedule-table th {
  font-size: 10px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--fg-3); padding: 4px 6px 6px; text-align: left;
}
.day-row td { padding: 3px 4px; vertical-align: middle; }
.day-row-active { background: #F0F7FF; }
.day-check-label {
  display: flex; align-items: center; gap: 6px;
  cursor: pointer; font-weight: 600; color: var(--fg-2); white-space: nowrap;
}
.day-check-label input[type="checkbox"] { width: 14px; height: 14px; cursor: pointer; accent-color: var(--dmn-blue); }
.day-row .time-from,
.day-row .time-to {
  width: 76px; padding: 0 6px; height: 30px; font-size: 12px;
}
.day-row .time-from:disabled,
.day-row .time-to:disabled { opacity: 0.35; cursor: not-allowed; }
.day-rule-icon { font-size: 13px; width: 20px; text-align: center; }

/* Pending transfers list */
.pending-transfers { padding: 10px 14px; overflow-y: auto; max-height: 160px; }
.pending-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--fg-3); margin-bottom: 8px;
}
#transferList { list-style: none; display: grid; gap: 5px; }
.transfer-item {
  background: var(--bg-3); border-radius: var(--radius-md);
  padding: 7px 10px; font-size: 12px; display: flex; align-items: flex-start; gap: 8px;
}
.transfer-item-text { flex: 1; line-height: 1.45; }
.transfer-store { font-weight: 700; color: var(--dmn-blue); }
.transfer-source { color: var(--fg-2); font-size: 11px; }
.transfer-time { color: var(--fg-3); font-size: 11px; }
.transfer-del {
  border: none; background: none; cursor: pointer;
  font-size: 12px; color: var(--fg-3); padding: 2px; flex-shrink: 0;
}
.transfer-del:hover { color: var(--error); }

.scheduler-footer {
  display: flex; gap: 8px; align-items: center;
  padding: 10px 14px; border-top: 1px solid var(--border-1); flex-shrink: 0;
}
.scheduler-footer .btn-primary { flex: 1; }

/* ── Weekly overview ──────────────────────────────────────────── */
.weekly-day-block {
  border-bottom: 1px solid var(--border-1);
  padding: 10px 16px;
}
.weekly-day-header {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 900;
  text-transform: lowercase;
  color: var(--fg-1);
  margin-bottom: 6px;
}
.weekly-area-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  font-size: 12px;
}
.weekly-area-dot {
  width: 10px; height: 10px;
  border-radius: 50%; flex-shrink: 0;
}
.weekly-area-id { font-weight: 700; color: var(--dmn-blue); flex-shrink: 0; }
.weekly-area-label { flex: 1; color: var(--fg-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.weekly-area-time { font-weight: 600; color: var(--fg-1); flex-shrink: 0; font-size: 11px; }
.weekly-area-mandatory .weekly-area-id { color: var(--dmn-red); }
.weekly-area-takeover .weekly-area-id { color: #2E8B3D; }
.weekly-area-empty { font-size: 12px; color: var(--fg-3); padding: 4px 0; }

/* ── Schedule Bar ─────────────────────────────────────────────── */
.schedule-bar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--schedule-bar-h);
  background: var(--dmn-blue-deep);
  z-index: 900;
  transition: height 300ms var(--ease);
  border-top: 2px solid var(--dmn-red);
}
.schedule-bar.expanded {
  height: 300px;
}

.schedule-bar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  height: var(--schedule-bar-h);
}
.schedule-bar-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 900;
  text-transform: lowercase;
  color: var(--dmn-white);
  letter-spacing: -0.01em;
}

.schedule-bar-content {
  height: calc(300px - var(--schedule-bar-h));
  overflow: auto;
  padding: 0;
  background: #0a3a56;
}

/* ── Timeline ─────────────────────────────────────────────────── */
.timeline-wrapper { min-width: 800px; }
.timeline-axis {
  display: flex;
  border-bottom: 1px solid rgba(255,255,255,.1);
  padding-bottom: 4px;
  margin-bottom: 6px;
}
.timeline-row {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 24px;
  margin-bottom: 3px;
}
.timeline-store-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--dmn-gray-300);
  width: 160px;
  flex-shrink: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.timeline-track {
  flex: 1;
  height: 18px;
  background: rgba(255,255,255,.06);
  border-radius: 3px;
  position: relative;
  overflow: hidden;
}
.timeline-block {
  position: absolute;
  height: 100%;
  border-radius: 3px;
  opacity: 0.85;
  font-size: 9px;
  font-weight: 700;
  color: white;
  display: flex;
  align-items: center;
  padding: 0 4px;
  white-space: nowrap;
  overflow: hidden;
}
.timeline-block.own { background: var(--dmn-blue); }
.timeline-block.transfer-out { background: var(--dmn-coral); }
.timeline-block.transfer-in { background: #2E8B3D; }
.timeline-block.blocked { background: rgba(255,255,255,0.12); }

/* ── Leaflet overrides ─────────────────────────────────────────── */
.leaflet-popup-content-wrapper {
  border-radius: var(--radius-md) !important;
  box-shadow: var(--shadow-md) !important;
  font-family: var(--font-body) !important;
}
.leaflet-popup-content { font-size: 13px; line-height: 1.5; }
.popup-store-name { font-weight: 700; font-size: 14px; color: var(--fg-1); margin-bottom: 4px; }
.popup-store-num { font-size: 11px; color: var(--fg-3); margin-bottom: 6px; }
.popup-detail { color: var(--fg-2); font-size: 12px; }

/* ── Sidebar footer ────────────────────────────────────────────── */
.sidebar-footer {
  border-top: 1px solid var(--border-1);
  padding: 8px 12px;
  flex-shrink: 0;
}

/* ── Store pin markers ──────────────────────────────────────────── */
.store-pin-container {
  background: transparent !important;
  border: none !important;
}
.store-pin-marker {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 3px solid white;
  box-shadow: 0 2px 6px rgba(0,0,0,0.40);
  cursor: pointer;
  transition: transform 180ms var(--ease), box-shadow 180ms var(--ease);
}
.store-pin-marker.active {
  transform: scale(1.5);
  box-shadow: 0 0 0 3px var(--pin-color, var(--dmn-red)),
              0 3px 10px rgba(0,0,0,0.45);
}

/* ── Export modal ───────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.48);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-card {
  background: var(--bg-1);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 440px;
  max-width: 92vw;
  max-height: 84vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px 12px;
  border-bottom: 1px solid var(--border-1);
  flex-shrink: 0;
}
.modal-title {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 900;
  text-transform: lowercase;
  color: var(--fg-1);
}
.modal-body {
  padding: 16px 18px 20px;
  overflow-y: auto;
  flex: 1;
}
.modal-section-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg-3);
  margin-bottom: 10px;
}
.export-store-checks {
  border: 1px solid var(--border-1);
  border-radius: var(--radius-md);
  padding: 6px;
  max-height: 250px;
  overflow-y: auto;
  display: grid;
  gap: 2px;
}
.export-store-check {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  color: var(--fg-1);
  user-select: none;
}
.export-store-check:hover { background: var(--bg-3); }
.export-store-check input[type="checkbox"] {
  width: 15px; height: 15px;
  accent-color: var(--dmn-blue);
  cursor: pointer;
  flex-shrink: 0;
}
.export-store-num {
  font-size: 11px;
  color: var(--fg-3);
  margin-left: auto;
  flex-shrink: 0;
}
.export-btns {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ── Inline segment section ────────────────────────────────────── */
.segment-inline {
  border-top: 1px solid var(--border-1);
}
.segment-inline-header {
  padding: 8px 14px 0;
}
.segment-inline-title {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 900;
  text-transform: lowercase;
  color: var(--fg-1);
  display: block;
  margin-bottom: 4px;
}
.segment-inline .segment-info-bar {
  border-bottom: none;
  padding: 4px 0 6px;
  background: transparent;
}

/* ── Weekly table (bottom bar) ─────────────────────────────────── */
.weekly-table {
  border-collapse: collapse;
  font-size: 11px;
  min-width: 100%;
  white-space: nowrap;
}
.weekly-table thead {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--dmn-blue-deep);
}
.weekly-table th {
  padding: 6px 10px 5px;
  color: var(--dmn-gray-300);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 10px;
  letter-spacing: 0.06em;
  border-bottom: 1px solid rgba(255,255,255,0.10);
  text-align: center;
}
.wt-label-col {
  position: sticky;
  left: 0;
  z-index: 1;
  background: #0a3a56;
  min-width: 180px;
  max-width: 220px;
  text-align: left !important;
}
.weekly-table thead .wt-label-col { background: var(--dmn-blue-deep); }
.wt-day-col { width: 110px; }
.wt-store-row { border-bottom: 2px solid rgba(255,255,255,0.12); }
.wt-store-row td { padding: 5px 10px; vertical-align: middle; }
.wt-seg-row td { padding: 3px 10px; vertical-align: middle; }
.wt-own-seg { background: rgba(255,255,255,0.04); }
.wt-takeover { background: rgba(46,139,61,0.10); }
.wt-store-label {
  font-weight: 700;
  color: var(--dmn-white);
  padding-left: 10px !important;
  display: flex;
  align-items: center;
  gap: 7px;
  overflow: hidden;
}
.wt-seg-label {
  color: var(--dmn-gray-300);
  padding-left: 24px !important;
  font-size: 10px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.wt-takeover-label {
  color: #6ec98a;
  padding-left: 24px !important;
  font-size: 10px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.wt-from-store {
  color: var(--dmn-gray-500);
  font-size: 10px;
  margin-left: 3px;
}
.wt-seg-swatch {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 2px;
  margin-right: 4px;
  vertical-align: middle;
  flex-shrink: 0;
}
.wt-day-cell { text-align: center; font-size: 10px; line-height: 1.4; }
.wt-open { color: var(--dmn-teal); font-size: 11px; font-weight: 600; }
.wt-closed { color: rgba(255,255,255,0.20); }
.wt-transfer-out { color: var(--dmn-coral); }
.wt-transfer-in { color: #6ec98a; }
.wt-no-transfer { color: rgba(255,255,255,0.15); }

/* ── Weekly table delete buttons ───────────────────────────────── */
.wt-transfer-entry {
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  margin-bottom: 2px;
}
.wt-transfer-entry:last-child { margin-bottom: 0; }
.wt-del-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 11px;
  padding: 1px 3px;
  border-radius: 3px;
  color: rgba(255,255,255,0.25);
  flex-shrink: 0;
  line-height: 1;
  transition: color 120ms, background 120ms;
}
.wt-del-btn:hover { color: #ff6b6b; background: rgba(255,80,80,0.12); }
.wt-takeover-del-wrap {
  display: flex;
  align-items: center;
  gap: 5px;
  overflow: hidden;
}

/* Right-panel weekly overview delete button */
.area-del-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 12px;
  padding: 2px 4px;
  border-radius: 3px;
  color: var(--fg-3);
  flex-shrink: 0;
  margin-left: auto;
  transition: color 120ms, background 120ms;
}
.area-del-btn:hover { color: var(--error); background: #FFE8E8; }

/* ── Notification bell ─────────────────────────────────────────── */
.notif-wrap { position: relative; }

.notif-bell-btn {
  position: relative;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 18px;
  padding: 4px 6px;
  border-radius: var(--radius-sm);
  color: var(--dmn-white);
  display: flex;
  align-items: center;
  transition: background 120ms var(--ease);
}
.notif-bell-btn:hover { background: rgba(255,255,255,0.12); }

.notif-badge {
  position: absolute;
  top: 0; right: 0;
  background: var(--dmn-red);
  color: white;
  font-size: 9px;
  font-weight: 800;
  min-width: 16px;
  height: 16px;
  border-radius: var(--radius-pill);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
  line-height: 1;
}

.notif-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 400px;
  max-width: 92vw;
  background: var(--bg-1);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-1);
  z-index: 2000;
  overflow: hidden;
}
.notif-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px 8px;
  border-bottom: 1px solid var(--border-1);
  background: var(--bg-2);
}
.notif-panel-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 900;
  text-transform: lowercase;
  color: var(--fg-1);
}
.notif-tabs { display: flex; gap: 4px; }
.notif-tab {
  padding: 4px 10px;
  border: none;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  background: transparent;
  color: var(--fg-3);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  transition: all 120ms;
}
.notif-tab:hover { background: var(--bg-3); color: var(--fg-1); }
.notif-tab.active { background: var(--dmn-blue); color: white; }

.notif-panel-content { max-height: 420px; overflow-y: auto; }

.notif-empty {
  padding: 24px 16px;
  text-align: center;
  color: var(--fg-3);
  font-size: 13px;
}

.notif-config-item {
  border-bottom: 1px solid var(--border-1);
  padding: 10px 14px;
}
.notif-config-item:last-child { border-bottom: none; }
.notif-config-stores {
  font-size: 13px;
  font-weight: 700;
  color: var(--fg-1);
  margin-bottom: 2px;
}
.notif-config-meta {
  font-size: 11px;
  color: var(--fg-3);
  margin-bottom: 6px;
}
.notif-config-days {
  font-size: 11px;
  color: var(--fg-2);
  margin-bottom: 8px;
  line-height: 1.5;
}
.notif-config-actions { display: flex; gap: 6px; align-items: center; }
.notif-approve-btn {
  padding: 4px 14px;
  background: #2E8B3D;
  color: white;
  border: none;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.notif-approve-btn:hover { background: #256e31; }
.notif-decline-btn {
  padding: 4px 14px;
  background: transparent;
  color: var(--error);
  border: 1.5px solid var(--error);
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.notif-decline-btn:hover { background: #FFE8E8; }

/* Status badges */
.status-pending {
  display: inline-block;
  padding: 2px 7px;
  background: #FFF3CD;
  color: #856404;
  border-radius: var(--radius-pill);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.status-active {
  display: inline-block;
  padding: 2px 7px;
  background: #D4EDDA;
  color: #155724;
  border-radius: var(--radius-pill);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.status-declined {
  display: inline-block;
  padding: 2px 7px;
  background: #F8D7DA;
  color: #721C24;
  border-radius: var(--radius-pill);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* ── Scrollbar ─────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--dmn-gray-300); border-radius: 3px; }

/* ── Map controls bottom-left ──────────────────────────────────── */
.map-controls-left {
  position: absolute;
  bottom: 16px;
  left: 12px;
  background: var(--dmn-white);
  border-radius: var(--radius-lg);
  padding: 10px 14px;
  box-shadow: var(--shadow-md);
  z-index: 500;
  display: flex;
  flex-direction: column;
  gap: 8px;
  border: 1px solid var(--border-1);
  min-width: 190px;
}
.map-controls-left .control-row { display: flex; align-items: center; }
.radius-distance-row { padding-top: 2px; }
.form-select-sm {
  height: 32px;
  padding: 0 10px;
  font-size: 13px;
  border: 1.5px solid var(--border-2);
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  color: var(--fg-1);
  background: var(--bg-1);
  outline: none;
  cursor: pointer;
  width: 100%;
}

/* ── App menu ──────────────────────────────────────────────────── */
.app-menu-wrap { position: relative; }
.app-menu-btn {
  width: 32px; height: 32px;
  border: none;
  background: rgba(255,255,255,0.12);
  color: var(--dmn-white);
  border-radius: var(--radius-sm);
  font-size: 18px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 120ms var(--ease);
  flex-shrink: 0;
}
.app-menu-btn:hover { background: rgba(255,255,255,0.22); }

.app-menu-panel {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: 320px;
  max-width: 90vw;
  background: var(--bg-1);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-1);
  z-index: 2000;
  overflow: hidden;
}
.app-menu-header {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 900;
  text-transform: lowercase;
  color: var(--fg-1);
  padding: 12px 14px 8px;
  border-bottom: 1px solid var(--border-1);
  background: var(--bg-2);
}
.app-menu-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 12px;
}
.app-menu-empty {
  padding: 24px 16px;
  text-align: center;
  color: var(--fg-3);
  font-size: 13px;
}
.app-menu-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 8px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-1);
  text-decoration: none;
  color: var(--fg-1);
  transition: background 120ms var(--ease), border-color 120ms;
  cursor: pointer;
  min-height: 72px;
}
.app-menu-tile:hover { background: var(--bg-3); border-color: var(--dmn-blue); }
.app-menu-tile-icon { width: 32px; height: 32px; object-fit: contain; font-size: 24px; line-height: 1; }
.app-menu-tile-name {
  font-size: 11px; font-weight: 700; text-align: center; line-height: 1.3;
  color: var(--fg-1); word-break: break-word;
}

/* ── Profile icon + tooltip ─────────────────────────────────────── */
.profile-wrap-topbar { position: relative; }
.profile-icon-btn {
  width: 32px; height: 32px;
  border: none;
  background: rgba(255,255,255,0.12);
  color: var(--dmn-white);
  border-radius: 50%;
  font-size: 16px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 120ms var(--ease);
  flex-shrink: 0;
}
.profile-icon-btn:hover { background: rgba(255,255,255,0.24); }

.profile-tooltip {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 230px;
  background: var(--bg-1);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-1);
  z-index: 2000;
  padding: 14px;
  display: none;
}
.profile-tooltip-email {
  font-size: 13px; font-weight: 700; color: var(--fg-1);
  word-break: break-word; margin-bottom: 3px;
}
.profile-tooltip-role {
  font-size: 11px; font-weight: 600; color: var(--fg-3);
  text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 4px;
}
.profile-tooltip-login {
  font-size: 11px; color: var(--fg-3); margin-bottom: 12px;
}
.profile-tooltip-actions {
  display: flex; gap: 6px; flex-wrap: wrap;
  padding-top: 8px;
  border-top: 1px solid var(--border-1);
}

/* ── Generic page layout (profile, admin, request detail) ────────── */
.page-body {
  font-family: var(--font-body);
  background: var(--bg-2);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.page-content {
  flex: 1;
  max-width: 900px;
  width: 100%;
  margin: 0 auto;
  padding: 32px 20px 60px;
}
.page-title {
  font-family: var(--font-display);
  font-size: 38px;
  font-weight: 900;
  text-transform: lowercase;
  color: var(--fg-1);
  margin-bottom: 24px;
}
.page-card {
  background: var(--bg-1);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-1);
  overflow: hidden;
  margin-bottom: 20px;
}
.page-card-header {
  padding: 14px 20px 10px;
  border-bottom: 1px solid var(--border-1);
  background: var(--bg-2);
}
.page-card-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 900;
  text-transform: lowercase;
  color: var(--fg-1);
}
.page-card-body { padding: 20px; }

/* ── Admin table ─────────────────────────────────────────────────── */
.admin-table-wrap { overflow-x: auto; }
.admin-table {
  border-collapse: collapse;
  width: 100%;
  font-size: 13px;
}
.admin-table th {
  font-size: 10px; font-weight: 700; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--fg-3);
  padding: 8px 12px; text-align: left;
  border-bottom: 2px solid var(--border-1);
  white-space: nowrap;
  background: var(--bg-2);
}
.admin-table td { padding: 8px 12px; border-bottom: 1px solid var(--border-1); vertical-align: top; }
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: var(--bg-2); }
.admin-table .kml-yes { color: var(--success); font-weight: 700; }
.admin-table .kml-no { color: var(--fg-3); font-style: italic; }

/* Admin tabs */
.admin-tabs {
  display: flex;
  gap: 4px;
  padding: 14px 20px 0;
  border-bottom: 1px solid var(--border-1);
  background: var(--bg-2);
}
.admin-tab {
  padding: 8px 18px;
  border: none;
  border-bottom: 3px solid transparent;
  background: transparent;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 700;
  color: var(--fg-3);
  cursor: pointer;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  transition: all 120ms;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  margin-bottom: -1px;
}
.admin-tab:hover { color: var(--fg-1); }
.admin-tab.active { color: var(--dmn-blue); border-bottom-color: var(--dmn-blue); }
.admin-tab-content { display: none; }
.admin-tab-content.active { display: block; }

/* ── App links admin grid ─────────────────────────────────────────── */
.app-links-admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  padding: 16px;
}
.app-link-admin-card {
  border: 1px solid var(--border-1);
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.app-link-admin-icon {
  width: 40px; height: 40px;
  object-fit: contain;
  border-radius: var(--radius-sm);
  background: var(--bg-3);
  font-size: 28px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.app-link-admin-name { font-size: 13px; font-weight: 700; color: var(--fg-1); }
.app-link-admin-url { font-size: 11px; color: var(--fg-3); word-break: break-all; }
.app-link-admin-actions { display: flex; gap: 6px; margin-top: auto; }

/* ── Request detail page ─────────────────────────────────────────── */
.request-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
@media (max-width: 700px) { .request-detail-grid { grid-template-columns: 1fr; } }
.request-map { height: 320px; border-radius: var(--radius-md); overflow: hidden; }
.request-days-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.request-days-table th { font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--fg-3); padding: 4px 8px; border-bottom: 1px solid var(--border-1); }
.request-days-table td { padding: 5px 8px; border-bottom: 1px solid var(--border-1); }
.request-days-table tr:last-child td { border-bottom: none; }
.request-actions { display: flex; gap: 10px; align-items: center; margin-top: 16px; }
.btn-approve {
  display: inline-flex; align-items: center; justify-content: center;
  height: 40px; padding: 0 24px;
  background: #2E8B3D; color: white; border: none; border-radius: var(--radius-pill);
  font-family: var(--font-body); font-size: 13px; font-weight: 800;
  letter-spacing: 0.05em; text-transform: uppercase; cursor: pointer;
  transition: background 120ms;
}
.btn-approve:hover { background: #256e31; }
.btn-decline {
  display: inline-flex; align-items: center; justify-content: center;
  height: 40px; padding: 0 24px;
  background: transparent; color: var(--error); border: 1.5px solid var(--error);
  border-radius: var(--radius-pill);
  font-family: var(--font-body); font-size: 13px; font-weight: 800;
  letter-spacing: 0.05em; text-transform: uppercase; cursor: pointer;
  transition: all 120ms;
}
.btn-decline:hover { background: #FFE8E8; }
