/* pages/sco/style.css — SCO Performance Suite Unified Stylesheet */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@500;600;700&display=swap');

:root {
  --font: 'Plus Jakarta Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  /* Primary Brand */
  --primary: #0284c7;
  --primary-hover: #0369a1;
  --primary-light: #e0f2fe;
  --primary-glow: rgba(2, 132, 199, 0.25);
  --primary-gradient: linear-gradient(135deg, #0284c7 0%, #06b6d4 100%);
  --accent: #06b6d4;

  /* Status Colors */
  --success: #10b981;
  --success-bg: #dcfce7;
  --success-text: #15803d;
  --danger: #ef4444;
  --danger-bg: #fee2e2;
  --danger-text: #b91c1c;
  --warning: #f59e0b;
  --warning-bg: #fef3c7;
  --warning-text: #b45309;
  --purple: #8b5cf6;
  --purple-bg: #ede9fe;
  --purple-text: #6d28d9;

  /* Light Theme (Default) */
  --bg-app: #f8fafc;
  --bg-surface: #ffffff;
  --bg-subtle: #f1f5f9;
  --bg-hover: #e2e8f0;
  --border-color: #e2e8f0;
  --border-subtle: #f1f5f9;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-light: #94a3b8;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 14px -2px rgba(15, 23, 42, 0.06), 0 2px 6px -1px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 10px 25px -4px rgba(15, 23, 42, 0.08);

  --table-header: #f8fafc;
  --table-stripe: #fcfdfe;
  --drawer-bg: #ffffff;
  --backdrop-bg: rgba(15, 23, 42, 0.5);
}

[data-theme="dark"], body.dark-theme {
  --bg-app: #0b1120;
  --bg-surface: #131c31;
  --bg-subtle: #1e293b;
  --bg-hover: #2d3b53;
  --border-color: #1e293b;
  --border-subtle: #182234;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-light: #64748b;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 6px 18px rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 14px 30px rgba(0, 0, 0, 0.35);

  --primary-light: rgba(2, 132, 199, 0.2);
  --success-bg: rgba(16, 185, 129, 0.2);
  --success-text: #34d399;
  --danger-bg: rgba(239, 68, 68, 0.2);
  --danger-text: #f87171;
  --warning-bg: rgba(245, 158, 11, 0.2);
  --warning-text: #fbbf24;
  --purple-bg: rgba(139, 92, 246, 0.2);
  --purple-text: #c084fc;

  --table-header: #101726;
  --table-stripe: #0d1527;
  --drawer-bg: #0f172a;
  --backdrop-bg: rgba(0, 0, 0, 0.7);
}

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

body, input, select, textarea, button, table, th, td {
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif !important;
}

.num, .metric-value, .store-id, code, pre {
  font-family: 'JetBrains Mono', 'Roboto Mono', Consolas, Monaco, monospace !important;
}

body {
  background-color: var(--bg-app);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
  transition: background-color 0.25s ease, color 0.25s ease;
  -webkit-font-smoothing: antialiased;
}

/* ── SIDEBAR DRAWER ── */
.app-sidebar {
  width: 260px;
  background: var(--drawer-bg);
  border-right: 1px solid var(--border-color);
  color: var(--text-main);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 1000;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 2px 0 12px rgba(0, 0, 0, 0.03);
}

.sidebar-header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand-box {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.brand-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

.brand-icon img,
img.brand-icon {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: var(--radius-md);
  display: block;
}

.brand-logo-img {
  height: 34px;
  max-width: 110px;
  object-fit: contain;
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-size: 15px;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.3px;
  line-height: 1.2;
}

.brand-subtitle {
  font-size: 10.5px;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.sidebar-close-btn {
  display: none;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
}

.sidebar-nav {
  padding: 16px 12px;
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-heading {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  font-weight: 700;
  padding: 12px 12px 6px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: var(--radius-md);
  color: var(--text-main);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: var(--transition);
}

.nav-link i {
  width: 20px;
  text-align: center;
  font-size: 15px;
  color: var(--text-muted);
  transition: var(--transition);
}

.nav-link:hover {
  background: var(--bg-subtle);
  color: var(--primary);
}

.nav-link:hover i {
  color: var(--primary);
}

.nav-link.active {
  background: var(--primary-gradient);
  color: #ffffff;
  box-shadow: 0 4px 12px var(--primary-glow);
}

.nav-link.active i {
  color: #ffffff;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.footer-pill {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--bg-subtle);
  border-radius: var(--radius-sm);
  font-size: 11.5px;
  color: var(--text-muted);
  font-weight: 600;
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--backdrop-bg);
  backdrop-filter: blur(2px);
  z-index: 999;
  opacity: 0;
  transition: opacity 0.3s ease;
}

/* ── MAIN CONTENT WRAPPER ── */
.app-container {
  margin-left: 260px;
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  width: calc(100% - 260px);
  transition: margin-left 0.3s ease;
}

/* ── TOP HEADER / APP BAR ── */
.app-header {
  height: 52px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  padding: 0 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 500;
  backdrop-filter: blur(8px);
}

/* ── SUB-HEADER PERIOD BAR ── */
.sub-header-bar {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  padding: 8px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.sub-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 240px;
}

.sub-header-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  white-space: nowrap;
}

.sub-header-select {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 700;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  outline: none;
  transition: var(--transition);
  min-width: 220px;
}

.sub-header-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.sub-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.btn-menu-toggle {
  display: none;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: var(--transition);
}

.btn-menu-toggle:hover {
  background: var(--bg-hover);
}

.header-page-title {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Form Controls & Selects */
.header-select, .form-select, .form-input {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  outline: none;
  cursor: pointer;
  transition: var(--transition);
}

.header-select:focus, .form-select:focus, .form-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.icon-btn {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: var(--transition);
}

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

.action-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: var(--transition);
  text-decoration: none;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-secondary {
  background: var(--bg-subtle);
  border-color: var(--border-color);
  color: var(--text-main);
}
.btn-secondary:hover {
  background: var(--bg-hover);
}

/* ── VIEW CONTAINER ── */
.view-container {
  padding: 16px 18px;
  flex: 1;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
}

/* ── METRIC CARDS GRID (COMPACT & PRISTINE) ── */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.metrics-grid.metrics-grid-2,
.metrics-grid:has(> :last-child:nth-child(2)) {
  grid-template-columns: repeat(2, 1fr);
}

.metric-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
  transition: var(--transition);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.metric-card:hover {
  box-shadow: var(--shadow-sm);
  border-color: var(--primary);
  transform: translateY(-1px);
}

.metric-card::before {
  content: '';
  display: none;
}

.metric-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.metric-label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.metric-icon-box {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: var(--bg-subtle);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
}

.metric-value {
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.4px;
  color: var(--text-main);
  font-family: var(--font-mono);
  margin-bottom: 3px;
  line-height: 1.15;
}

.metric-subtext {
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
  line-height: 1.2;
}

/* ── BADGES & PILLS ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 700;
  line-height: 1.2;
}

.badge-success { background: var(--success-bg); color: var(--success-text); }
.badge-danger  { background: var(--danger-bg);  color: var(--danger-text);  }
.badge-warning { background: var(--warning-bg); color: var(--warning-text); }
.badge-purple  { background: var(--purple-bg);  color: var(--purple-text);  }
.badge-info    { background: var(--primary-light); color: var(--primary); }

/* ── CARD SECTIONS (COMPACT) ── */
.content-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
  overflow: hidden;
  margin-bottom: 14px;
}

.card-header {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.card-title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-body {
  padding: 12px 16px;
}

/* ── DATA TABLES (COMPACT ROWS) ── */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
  text-align: left;
}

.data-table thead th {
  background: var(--table-header);
  color: var(--text-muted);
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
  user-select: none;
}

.data-table thead th.sortable {
  cursor: pointer;
}
.data-table thead th.sortable:hover {
  color: var(--primary);
}

.data-table tbody td {
  padding: 7px 12px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-main);
  vertical-align: middle;
}

.data-table tbody tr:hover {
  background: var(--bg-subtle);
}

.data-table tfoot td {
  padding: 8px 12px;
  background: var(--table-header);
  font-weight: 800;
  border-top: 2px solid var(--border-color);
  color: var(--text-main);
}

.data-table tbody tr.row-total td {
  background: var(--bg-subtle);
  font-weight: 800;
  border-top: 1.5px solid var(--border-color);
  border-bottom: 1.5px solid var(--border-color);
  color: var(--primary);
}

.data-table tbody tr.row-subtotal td {
  background: var(--bg-subtle);
  font-weight: 700;
  border-top: 1px dashed var(--border-color);
  border-bottom: 1px dashed var(--border-color);
}

.num {
  text-align: right;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}
.center {
  text-align: center;
}

/* Multi-header styling */
.group-head th {
  font-size: 10.5px;
  text-align: center;
  font-weight: 800;
  letter-spacing: 0.8px;
  border-bottom: 2px solid var(--border-color) !important;
  padding: 8px 10px !important;
}

/* ── FILTER BAR & SEARCH ── */
.filter-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 18px;
}

.search-box,
.search-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  min-width: 220px;
}

.search-box i,
.search-box .search-icon,
.search-input-wrap i,
.search-input-wrap .search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 13.5px;
  pointer-events: none;
  z-index: 1;
}

.search-box input,
.search-box .form-input,
.search-input-wrap input,
.search-input-wrap .form-input,
.search-input {
  width: 100%;
  height: 38px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  padding: 8px 12px 8px 36px !important;
  border-radius: var(--radius-sm);
  outline: none;
  cursor: text;
  transition: var(--transition);
  box-sizing: border-box;
}

.search-box input:focus,
.search-box .form-input:focus,
.search-input-wrap input:focus,
.search-input-wrap .form-input:focus,
.search-input:focus {
  border-color: var(--primary);
  background: var(--bg-surface);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.search-box input::placeholder,
.search-input-wrap input::placeholder,
.search-input::placeholder {
  color: var(--text-muted);
  opacity: 0.8;
  font-weight: 400;
}

/* ── DETAIL & COVERAGE FILTER GRID ── */
.detail-filter-grid,
.filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px 20px;
  align-items: flex-end;
}

.detail-filter-grid .form-select,
.detail-filter-grid .form-input,
.filter-grid .form-select,
.filter-grid .form-input {
  height: 38px;
  width: 100%;
  box-sizing: border-box;
}

.detail-filter-grid .form-input,
.filter-grid .form-input {
  cursor: text;
  font-weight: 500;
}

.filter-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

/* ── DETAIL TABLE ACTION BUTTONS ── */
.btn-table-maps {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 6px;
  background: var(--primary-light);
  color: var(--primary);
  font-size: 11.5px;
  font-weight: 700;
  text-decoration: none;
  transition: var(--transition);
  white-space: nowrap;
}
.btn-table-maps:hover {
  background: var(--primary);
  color: #fff;
}

.btn-copy-mini {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 3px 6px;
  border-radius: 4px;
  font-size: 12px;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.btn-copy-mini:hover {
  color: var(--primary);
  background: var(--bg-hover);
}

.pill-group {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.filter-pill {
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.filter-pill:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.filter-pill.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 2px 8px var(--primary-glow);
}

/* ── STORE / AGENT CARDS (DETAIL VIEW) ── */
.agent-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

.store-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.store-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--primary);
  transform: translateY(-2px);
}

.store-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

.store-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.3;
}

.store-id {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--primary);
  font-weight: 600;
  margin-top: 2px;
}

.store-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 11.5px;
}

.store-stats {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  background: var(--bg-subtle);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  gap: 6px;
  text-align: center;
}

.stat-item {
  display: flex;
  flex-direction: column;
}

.stat-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 600;
}

.stat-val {
  font-size: 13px;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text-main);
  margin-top: 2px;
}

.store-actions {
  display: flex;
  gap: 8px;
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px dashed var(--border-color);
}

.btn-card-action {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  color: var(--text-main);
  text-decoration: none;
  transition: var(--transition);
}

.btn-card-action:hover {
  background: var(--bg-subtle);
  border-color: var(--primary);
  color: var(--primary);
}

.btn-card-maps {
  background: var(--primary-light);
  color: var(--primary);
  border-color: transparent;
}
.btn-card-maps:hover {
  background: var(--primary);
  color: #fff;
}

/* ── SETTINGS VIEW ── */
.settings-section {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 22px;
  margin-bottom: 20px;
}

.settings-section h3 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--text-main);
}

.settings-desc {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 18px;
}

.theme-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}

.theme-option-card {
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px;
  cursor: pointer;
  text-align: center;
  transition: var(--transition);
  background: var(--bg-surface);
}

.theme-option-card:hover {
  border-color: var(--primary);
}

.theme-option-card.active {
  border-color: var(--primary);
  background: var(--primary-light);
}

.theme-option-card i {
  font-size: 24px;
  margin-bottom: 8px;
  display: block;
}

.theme-option-card span {
  font-size: 13px;
  font-weight: 700;
}

/* ── TOAST NOTIFICATION ── */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 10px 18px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

/* ── EMPTY STATE ── */
.empty-state {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-muted);
}
.empty-state i {
  font-size: 40px;
  margin-bottom: 12px;
  opacity: 0.5;
}
.empty-state p {
  font-size: 14px;
  font-weight: 500;
}

/* ── RESPONSIVE RULES ── */
@media (max-width: 992px) {
  .app-sidebar {
    transform: translateX(-100%);
  }
  .app-sidebar.open {
    transform: translateX(0);
  }
  .sidebar-close-btn {
    display: block;
  }
  .sidebar-backdrop.active {
    display: block;
    opacity: 1;
  }
  .app-container {
    margin-left: 0;
    width: 100%;
  }
  .btn-menu-toggle {
    display: inline-flex;
  }
  .metrics-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 12px;
  }
}

@media (max-width: 640px) {
  .app-header {
    padding: 0 14px;
    height: 48px;
  }
  .sub-header-bar {
    padding: 8px 12px;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .sub-header-left {
    min-width: 100%;
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
  }
  .sub-header-select {
    width: 100%;
  }
  .sub-header-right {
    justify-content: flex-start;
  }
  .view-container {
    padding: 10px 8px;
  }
  .header-page-title span.title-text {
    display: none;
  }
  .metrics-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-bottom: 10px;
  }
  .metric-card {
    padding: 8px 10px;
  }
  .metric-header {
    margin-bottom: 3px;
  }
  .metric-label {
    font-size: 9.5px;
    letter-spacing: 0.2px;
  }
  .metric-icon-box {
    width: 20px;
    height: 20px;
    font-size: 10px;
  }
  .metric-value {
    font-size: 16px;
    margin-bottom: 2px;
  }
  .metric-subtext {
    font-size: 10px;
    flex-wrap: wrap;
    gap: 4px;
  }
  .content-card {
    margin-bottom: 10px;
  }
  .card-header {
    padding: 8px 12px;
  }
  .card-title {
    font-size: 12.5px;
  }
  .card-body {
    padding: 10px 12px;
  }
  .filter-bar {
    flex-direction: column;
    align-items: stretch;
  }
  .pill-group {
    overflow-x: auto;
    padding-bottom: 4px;
    flex-wrap: nowrap;
  }
  .filter-pill {
    white-space: nowrap;
  }
  .agent-grid {
    grid-template-columns: 1fr;
  }
  .detail-filter-grid,
  .filter-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
}

/* ── PROFIL TREN AGEN SPECIFIC STYLES ── */
.sparkline-svg {
  display: inline-block;
  vertical-align: middle;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.08));
}

.val-peak {
  font-weight: 800;
  color: var(--primary);
  background: var(--primary-light);
  padding: 1px 6px;
  border-radius: 4px;
  display: inline-block;
  font-size: 12px;
}

.val-dead {
  color: var(--danger-text, #dc2626);
  font-weight: 800;
  font-size: 12px;
  display: inline-block;
  letter-spacing: -0.2px;
}

.quick-filter-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 14px;
}

.quick-filter-btn {
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  color: var(--text-muted);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.quick-filter-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.quick-filter-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 2px 6px var(--primary-glow);
}

/* ── AREA COVERAGE MAP VIEW ── */
.coverage-page-wrapper {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.coverage-filter-card {
  padding: 14px 18px;
}

.coverage-map-card {
  position: relative;
  border-radius: var(--radius-md, 12px);
  overflow: hidden;
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  box-shadow: var(--shadow-sm);
}

.coverage-map-container {
  width: 100%;
  height: calc(100vh - 275px);
  min-height: 520px;
  z-index: 1;
}

@media (max-width: 768px) {
  .coverage-map-container {
    height: calc(100vh - 290px);
    min-height: 420px;
  }
}

.coverage-map-toolbar {
  position: absolute;
  top: 14px;
  left: 14px;
  right: 14px;
  z-index: 1000;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.coverage-map-toolbar > * {
  pointer-events: auto;
}

.coverage-toolbar-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.coverage-toolbar-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

.coverage-pill-badge {
  background: var(--bg-surface);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 700;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
  display: flex;
  align-items: center;
  gap: 6px;
}

.coverage-legend {
  position: absolute;
  bottom: 22px;
  left: 14px;
  z-index: 1000;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm, 8px);
  padding: 10px 14px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  font-size: 11.5px;
  max-width: calc(100% - 28px);
}

.coverage-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-main);
  font-weight: 600;
}

.coverage-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 1.5px solid #ffffff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  flex-shrink: 0;
}

/* Leaflet Dark Theme & UI Enhancements */
[data-theme="dark"] .leaflet-tile-pane {
  filter: brightness(0.7) invert(1) contrast(3) hue-rotate(200deg) saturate(0.3) brightness(0.75);
}

.leaflet-popup-content-wrapper {
  background: var(--bg-surface) !important;
  color: var(--text-main) !important;
  border: 1px solid var(--border-color) !important;
  border-radius: 12px !important;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25) !important;
  padding: 0 !important;
  overflow: hidden;
}

.leaflet-popup-content {
  margin: 0 !important;
  line-height: 1.4 !important;
}

.leaflet-popup-tip {
  background: var(--bg-surface) !important;
  border: 1px solid var(--border-color) !important;
}

.leaflet-container {
  font-family: var(--font) !important;
}

.map-popup-card {
  padding: 14px 16px;
  min-width: 250px;
  max-width: 320px;
}

.map-popup-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 8px;
}

.map-popup-title {
  font-weight: 700;
  font-size: 13.5px;
  color: var(--text-main);
  line-height: 1.35;
}

.map-popup-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  margin-bottom: 12px;
}

.map-popup-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.map-popup-label {
  color: var(--text-muted);
  font-size: 11.5px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.map-popup-val {
  font-weight: 600;
  color: var(--text-main);
  text-align: right;
}

.map-popup-actions {
  display: flex;
  gap: 8px;
  border-top: 1px solid var(--border-color);
  padding-top: 10px;
}

.map-popup-actions .action-btn {
  flex: 1;
  justify-content: center;
  text-align: center;
}

.leaflet-container a.action-btn.btn-primary,
.leaflet-container a.action-btn.btn-primary:visited,
.leaflet-container a.action-btn.btn-primary:hover,
.leaflet-container a.action-btn.btn-primary:active {
  color: #ffffff !important;
  background: var(--primary) !important;
  text-decoration: none !important;
}

.leaflet-container a.action-btn.btn-primary:hover {
  background: var(--primary-hover) !important;
}

.leaflet-container a.action-btn.btn-secondary,
.leaflet-container a.action-btn.btn-secondary:visited,
.leaflet-container a.action-btn.btn-secondary:hover,
.leaflet-container a.action-btn.btn-secondary:active {
  color: var(--text-main) !important;
  background: var(--bg-subtle) !important;
  text-decoration: none !important;
}


