:root {
  /* Light Theme Tokens (Default) */
  --bg-dark: #f8fafc;
  --bg-card: #ffffff;
  --bg-card-hover: #f1f5f9;
  --bg-input: #ffffff;
  --border-color: #cbd5e1;
  --text-main: #0f172a;
  --text-muted: #475569;
  --accent-cyan: #0284c7;
  --accent-blue: #2563eb;
  --accent-emerald: #059669;
  --accent-rose: #e11d48;
  --accent-amber: #d97706;
  --glass-shadow: 0 4px 20px 0 rgba(0, 0, 0, 0.06);
  --tooltip-bg: #ffffff;
  --sticky-col-bg: #ffffff;
}

[data-theme="light"] {
  --bg-dark: #f8fafc;
  --bg-card: #ffffff;
  --bg-card-hover: #f1f5f9;
  --bg-input: #ffffff;
  --border-color: #cbd5e1;
  --text-main: #0f172a;
  --text-muted: #475569;
  --accent-cyan: #0284c7;
  --accent-blue: #2563eb;
  --accent-emerald: #059669;
  --accent-rose: #e11d48;
  --accent-amber: #d97706;
  --glass-shadow: 0 4px 20px 0 rgba(0, 0, 0, 0.06);
  --tooltip-bg: #ffffff;
  --sticky-col-bg: #ffffff;
}

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

body {
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  min-height: 100vh;
  line-height: 1.5;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Executive Unified Navbar */
.navbar {
  background: #ffffff;
  border-bottom: 1px solid #cbd5e1;
  padding: 0.75rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}

.navbar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.brand-badge {
  font-size: 0.68rem;
  font-weight: 800;
  padding: 0.2rem 0.55rem;
  border-radius: 0.35rem;
  background: #1B5E6B;
  color: white;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

/* ☰ Hamburger Button */
.hamburger-btn {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  cursor: pointer;
  padding: 0;
  transition: all 0.2s ease;
}

.hamburger-btn:hover {
  background: #e2e8f0;
}

.hamburger-btn .bar {
  width: 20px;
  height: 2px;
  background-color: #0f172a;
  border-radius: 2px;
  transition: all 0.25s ease-in-out;
}

.hamburger-btn.open .bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.hamburger-btn.open .bar:nth-child(2) {
  opacity: 0;
  transform: scaleX(0);
}

.hamburger-btn.open .bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

.nav-menu-wrapper {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.nav-menu-pills {
  display: flex;
  align-items: center;
  gap: 4px;
  background: #f1f5f9;
  padding: 4px;
  border-radius: 20px;
  border: 1px solid #cbd5e1;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 16px;
  border-radius: 16px;
  font-size: 0.825rem;
  font-weight: 600;
  color: #475569;
  text-decoration: none;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.nav-link-icon {
  font-size: 0.9rem;
}

.nav-link:hover {
  color: #0f172a;
  background: rgba(255, 255, 255, 0.6);
}

.nav-link.active {
  background: #1B5E6B;
  color: #ffffff !important;
  font-weight: 700;
  box-shadow: 0 2px 6px rgba(27, 94, 107, 0.25);
}

.nav-user-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-user-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 700;
  color: #334155;
  white-space: nowrap;
}

.user-role-badge {
  font-size: 0.625rem;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 8px;
  background: #e2e8f0;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.nav-logout-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 12px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
  border-radius: 20px;
  font-size: 0.775rem;
  font-weight: 700;
  text-decoration: none;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.nav-logout-btn:hover {
  background: #fee2e2;
  border-color: #f87171;
  color: #991b1b;
}

.user-avatar {
  font-size: 0.85rem;
}

.mobile-menu-backdrop {
  display: none;
}

/* 📊 ABM Tariffs Table Styles */
.tariff-id-pill {
  font-family: monospace;
  font-weight: 700;
  font-size: 0.775rem;
  color: #475569;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  padding: 2px 6px;
  border-radius: 4px;
}

.tariff-border-crossing {
  font-size: 0.775rem;
  color: #64748b;
  font-weight: 600;
}

.truck-type-tag {
  font-size: 0.775rem;
  color: #334155;
  font-weight: 600;
  background: #f1f5f9;
  padding: 2px 7px;
  border-radius: 4px;
}

.carrier-cost-val {
  font-weight: 600;
  color: #64748b;
  font-size: 0.85rem;
}

.margin-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 6px;
  font-weight: 800;
  font-size: 0.775rem;
  text-align: right;
}

.margin-positive {
  background: #ECFDF5;
  color: #047857;
  border: 1px solid #A7F3D0;
}

.margin-negative {
  background: #FEF2F2;
  color: #B91C1C;
  border: 1px solid #FCA5A5;
}

.status-chip {
  display: inline-block;
  font-size: 0.725rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 12px;
  text-transform: uppercase;
}

.status-active {
  background: #D4EDE4;
  color: #0A5A30;
  border: 1px solid #7AC8A0;
}

.status-inactive {
  background: #F1F5F9;
  color: #64748b;
  border: 1px solid #cbd5e1;
}

.btn-delete-ghost {
  background: transparent;
  color: #ef4444;
  border: 1px solid #fca5a5;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-delete-ghost:hover {
  background: #fef2f2;
  border-color: #ef4444;
  color: #b91c1c;
}

/* Main Layout */
.container {
  max-width: 1440px;
  margin: 0 auto;
  padding: 2rem;
}

/* KPI Cards Grid */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.kpi-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: 1rem;
  padding: 1.25rem;
  box-shadow: var(--glass-shadow);
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.kpi-card:hover {
  border-color: rgba(6, 182, 212, 0.4);
  transform: translateY(-2px);
}

.kpi-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.4rem;
  font-weight: 700;
}

.kpi-value {
  font-size: 1.9rem;
  font-weight: 800;
  color: var(--text-main);
}

/* Filters Bar */
.filters-bar {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: 1rem;
  padding: 1.25rem;
  margin-bottom: 1.75rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  align-items: end;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.form-group label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
}

.input-field, .select-field {
  width: 100%;
  padding: 0.6rem 0.85rem;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  color: var(--text-main);
  font-size: 0.85rem;
  outline: none;
  transition: border-color 0.2s ease;
}

.input-field:focus, .select-field:focus {
  border-color: var(--accent-cyan);
}

/* Buttons */
.btn-primary {
  padding: 0.65rem 1.25rem;
  background: linear-gradient(135deg, var(--accent-cyan) 0%, var(--accent-blue) 100%);
  color: white;
  border: none;
  border-radius: 0.5rem;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: opacity 0.2s ease, transform 0.1s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary:hover {
  opacity: 0.92;
  transform: translateY(-1px);
}

/* Table Design System - Responsive & Sticky Action Column */
/* Table Design System - Responsive, Compact & High-Legibility */
.table-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: 0.75rem;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.05);
  margin-bottom: 1.5rem;
  width: 100%;
}

.table-container {
  width: 100%;
  max-height: 70vh;
  overflow: auto;
  position: relative;
  -webkit-overflow-scrolling: touch;
}

/* Custom Sleek Scrollbars */
.table-container::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

.table-container::-webkit-scrollbar-track {
  background: rgba(15, 23, 42, 0.04);
}

.table-container::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.6);
  border-radius: 3px;
}

.table-container::-webkit-scrollbar-thumb:hover {
  background: #1B5E6B;
}

.prospects-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  text-align: left;
  min-width: 980px;
  table-layout: auto;
}

.prospects-table th {
  padding: 0.65rem 0.75rem;
  font-size: 0.725rem;
  font-weight: 800;
  text-transform: uppercase;
  color: #334155;
  border-bottom: 2px solid var(--border-color);
  border-right: 1px solid rgba(203, 213, 225, 0.6);
  white-space: nowrap;
  letter-spacing: 0.5px;
  vertical-align: middle;
  background: #f1f5f9;
  user-select: none;
}

.prospects-table th:last-child {
  border-right: none;
}

.table-container thead th {
  position: sticky;
  top: 0;
  z-index: 25;
  background: #f1f5f9;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

.prospects-table th.sortable {
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.prospects-table th.sortable:hover {
  background: #e2e8f0;
  color: #1B5E6B;
}

.sort-icon {
  font-size: 0.7rem;
  opacity: 0.5;
  margin-left: 3px;
  transition: opacity 0.15s ease;
}

.prospects-table th.sortable:hover .sort-icon {
  opacity: 1;
}

.prospects-table td {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--border-color);
  border-right: 1px solid rgba(226, 232, 240, 0.8);
  font-size: 0.825rem;
  vertical-align: middle;
  background-color: #ffffff;
  transition: background-color 0.15s ease;
}

.prospects-table td:last-child {
  border-right: none;
}

/* Subtle Zebra Striping */
.prospects-table tbody tr.dr:nth-child(4n+1) td {
  background-color: #ffffff;
}

.prospects-table tbody tr.dr:nth-child(4n+3) td {
  background-color: #f8fafc;
}

.prospects-table tbody tr.dr:hover td {
  background-color: #f0f7f9 !important;
}

/* Cell Typography & Badges */
.company-name {
  font-weight: 700;
  font-size: 0.875rem;
  color: var(--text-main);
  line-height: 1.3;
}

.company-rut {
  font-size: 0.725rem;
  color: var(--text-muted);
  margin-top: 1px;
}

.chips-wrapper {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  max-width: 220px;
}

.route-orig-dest {
  font-weight: 700;
  font-size: 0.825rem;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 4px;
}

.route-arrow {
  color: #1B5E6B;
  font-size: 0.8rem;
}

.route-border {
  font-size: 0.725rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Competitor Carrier Badge */
.carrier-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  background: #FEF2F2;
  border: 1px solid #FCA5A5;
  border-radius: 6px;
  font-weight: 700;
  font-size: 0.775rem;
  color: #991B1B;
  max-width: 180px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.carrier-icon {
  font-size: 0.8rem;
  flex-shrink: 0;
}

.carrier-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Metrics & Freight Values */
.truck-val {
  font-weight: 800;
  font-size: 1.15rem;
  color: var(--text-main);
}

.truck-sub, .freight-sub, .recency-sub {
  font-size: 0.725rem;
  color: var(--text-muted);
}

.freight-val {
  font-weight: 700;
  color: var(--text-main);
  font-size: 0.875rem;
}

.mercotruck-price-val {
  font-weight: 800;
  color: #134552;
  font-size: 0.9rem;
}

.diff-tag {
  display: inline-block;
  font-size: 0.725rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
  margin-top: 2px;
}

.diff-green {
  background: #ECFDF5;
  color: #047857;
  border: 1px solid #A7F3D0;
}

.diff-red {
  background: #FEF2F2;
  color: #B91C1C;
  border: 1px solid #FCA5A5;
}

.recency-days {
  font-weight: 800;
  font-size: 0.875rem;
}

/* Match Container Box */
.match-card-box {
  padding: 5px 10px;
  border-radius: 8px;
  text-align: left;
  display: inline-block;
  min-width: 135px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.match-card-box:hover {
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(0,0,0,0.08);
}

.match-box-exacto {
  background: #ECFDF5;
  border: 1px solid #6EE7B7;
  color: #047857;
}

.match-box-cercano {
  background: #FFFBEB;
  border: 1px solid #FDE68A;
  color: #B45309;
}

.match-badge-header {
  display: flex;
  align-items: center;
  gap: 5px;
  font-weight: 800;
  font-size: 0.775rem;
  letter-spacing: 0.4px;
}

.match-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
}

.match-box-exacto .match-dot { background: #10B981; }
.match-box-cercano .match-dot { background: #F59E0B; }

.match-route-sub {
  font-size: 0.7rem;
  color: #475569;
  margin-top: 2px;
  font-weight: 600;
}

/* STICKY MATCH COLUMN PINNED ON THE RIGHT (ONLY FOR PROSPECTS TABLE) */
.prospects-table tr:not(.er) th:last-child,
.prospects-table tr:not(.er) td:last-child {
  position: sticky;
  right: 0;
  z-index: 10;
  background: var(--sticky-col-bg, #ffffff);
  border-left: 1px solid var(--border-color);
  box-shadow: -4px 0 12px rgba(0, 0, 0, 0.05);
}

.prospects-table thead tr:not(.er) th:last-child {
  z-index: 40;
  top: 0;
  right: 0;
  background: #f8fafc;
}

.prospects-table tr:hover td:last-child {
  background-color: var(--bg-card-hover);
}

/* Action buttons in last column */
.action-cell-group {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.35rem;
  width: 100%;
  height: 100%;
}

.btn-action-sm {
  padding: 0.35rem 0.65rem;
  font-size: 0.775rem;
  font-weight: 600;
  border-radius: 0.375rem;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  text-decoration: none;
  white-space: nowrap;
  transition: all 0.15s ease;
  cursor: pointer;
  border: none;
}

.btn-action-map {
  background: rgba(59, 130, 246, 0.18);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.35);
}

.btn-action-map:hover {
  background: rgba(59, 130, 246, 0.3);
  border-color: #60a5fa;
}

.btn-action-decide {
  background: linear-gradient(135deg, var(--accent-cyan) 0%, var(--accent-blue) 100%);
  color: white;
}

.btn-action-decide:hover {
  opacity: 0.92;
  transform: translateY(-1px);
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.6rem;
  border-radius: 0.375rem;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
}

.badge-impo { background: rgba(59, 130, 246, 0.15); color: #60a5fa; }
.badge-expo { background: rgba(16, 185, 129, 0.15); color: #34d399; }
.badge-recent-90d { background: rgba(16, 185, 129, 0.2); color: #34d399; }
.badge-hist-general { background: rgba(245, 158, 11, 0.2); color: #fbbf24; }
.badge-diff-good { color: #34d399; font-weight: 700; }
.badge-diff-bad { color: #f87171; font-weight: 700; }

/* Interactive Tooltips */
[data-tooltip] {
  position: relative;
  cursor: help;
}

[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 125%;
  left: 50%;
  transform: translateX(-50%);
  background-color: var(--tooltip-bg);
  color: var(--text-main);
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  font-size: 0.75rem;
  font-weight: 500;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  border: 1px solid var(--border-color);
  z-index: 100;
}

[data-tooltip]:hover::after {
  opacity: 1;
  visibility: visible;
}

/* Modals */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.modal-backdrop.active {
  opacity: 1;
  visibility: visible;
}

.modal-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 1rem;
  padding: 1.75rem;
  width: 100%;
  max-width: 600px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
  max-height: 90vh;
  overflow-y: auto;
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1.5rem;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.page-btn {
  padding: 0.5rem 0.85rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  border-radius: 0.5rem;
  text-decoration: none;
  font-weight: 600;
}

.page-btn:hover {
  border-color: var(--accent-cyan);
}

/* ── MERCOTRUCK FUSION UI COMPONENTS ────────────────────────────────────── */

/* Country Flags Bar */
.country-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  align-items: center;
}
.cflag {
  padding: 6px 16px;
  border: 1px solid var(--border-color);
  border-radius: 20px;
  font-size: 0.825rem;
  cursor: pointer;
  background: var(--bg-card);
  color: var(--text-main);
  font-weight: 600;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.cflag.active {
  background: #1B5E6B;
  color: #ffffff;
  border-color: #1B5E6B;
  box-shadow: 0 2px 6px rgba(27, 94, 107, 0.3);
}
.cflag:hover:not(.active) {
  background: rgba(27, 94, 107, 0.1);
  border-color: #1B5E6B;
}

/* Chips & Badges */
.chip {
  display: inline-block;
  background: #E8F4F6;
  border: 1px solid #B0D8E0;
  border-radius: 4px;
  padding: 2px 7px;
  font-size: 0.75rem;
  margin: 1px;
  color: #134552;
  font-weight: 600;
}
[data-theme="dark"] .chip {
  background: rgba(41, 128, 160, 0.2);
  border-color: rgba(41, 128, 160, 0.5);
  color: #38bdf8;
}

.badge-exacto {
  background: #D4EDE4;
  color: #0A5A30;
  border: 1px solid #7AC8A0;
  font-weight: 700;
}
.badge-cercano {
  background: #FDE8C8;
  color: #8A4A00;
  border: 1px solid #DCA060;
  font-weight: 700;
}

/* Interactive Price Tooltip */
.pw {
  position: relative;
  display: inline-block;
}
.tt {
  display: none;
  position: absolute;
  bottom: calc(100% + 8px);
  right: 0;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-top: 3px solid #1B5E6B;
  border-radius: 8px;
  padding: 12px 14px;
  width: 250px;
  font-size: 0.8rem;
  z-index: 100;
  line-height: 1.6;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
  color: #0f172a;
  text-align: left;
}
[data-theme="dark"] .tt {
  background: #1e293b;
  border-color: #334155;
  border-top-color: #06b6d4;
  color: #f8fafc;
}
.pw:hover .tt {
  display: block;
}
.tt-hd {
  font-weight: 800;
  color: #134552;
  margin-bottom: 6px;
  padding-bottom: 4px;
  border-bottom: 1px solid #e2e8f0;
}
[data-theme="dark"] .tt-hd {
  color: #38bdf8;
  border-bottom-color: #334155;
}
.tt-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: #64748b;
  margin-bottom: 3px;
  font-size: 0.775rem;
}
.tt-val {
  color: #0f172a;
  font-weight: 600;
  text-align: right;
}
[data-theme="dark"] .tt-val {
  color: #f8fafc;
}
.tt-price {
  color: #1B5E6B;
  font-weight: 800;
}
[data-theme="dark"] .tt-price {
  color: #34d399;
}
.tt-sc {
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px solid #e2e8f0;
  font-size: 0.75rem;
  color: #64748b;
}

/* Dots indicator */
.dots {
  display: flex;
  gap: 4px;
  margin-top: 4px;
}
.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #cbd5e1;
}
.dot.on {
  background: #1B5E6B;
}
[data-theme="dark"] .dot.on {
  background: #06b6d4;
}
.ib {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1px solid #B0D8E0;
  background: #E8F4F6;
  font-size: 10px;
  color: #1B5E6B;
  cursor: help;
  vertical-align: middle;
  margin-left: 4px;
  font-weight: 800;
}

/* Expandable Detail Rows & Chevron */
.chev {
  display: inline-block;
  font-size: 0.75rem;
  transition: transform 0.2s ease;
  margin-right: 4px;
  color: #64748b;
  cursor: pointer;
}
.chev.open {
  transform: rotate(90deg);
  color: #1B5E6B;
}

.er td {
  padding: 0 !important;
  background: #f1f5f9;
  border-bottom: 1px solid var(--border-color);
  box-shadow: inset 0 2px 6px rgba(0,0,0,0.04);
}
[data-theme="dark"] .er td {
  background: #090d16;
}

.ei {
  padding: 20px 24px;
  display: grid;
  grid-template-columns: 1.3fr 1fr 1.3fr;
  gap: 24px;
  text-align: left;
  width: 100%;
  box-sizing: border-box;
}

@media (max-width: 1200px) {
  .ei {
    grid-template-columns: 1fr 1fr;
  }
  .ei-col-3 {
    grid-column: 1 / -1;
  }
}

@media (max-width: 768px) {
  .ei {
    grid-template-columns: 1fr;
  }
}

.et {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #134552;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 7px;
}
[data-theme="dark"] .et {
  color: #38bdf8;
}

.eb {
  width: 4px;
  height: 14px;
  background: #1B5E6B;
  border-radius: 2px;
  flex-shrink: 0;
}

.dt {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
  background: #ffffff;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid #cbd5e1;
}
[data-theme="dark"] .dt {
  background: #1e293b;
  border-color: #334155;
}

.dt th {
  text-align: left;
  color: #64748b;
  padding: 6px 10px;
  font-weight: 700;
  border-bottom: 1px solid #e2e8f0;
  background: #f1f5f9;
  font-size: 0.725rem;
  text-transform: uppercase;
}
[data-theme="dark"] .dt th {
  background: #0f172a;
  border-bottom-color: #334155;
  color: #94a3b8;
}

.dt td {
  padding: 6px 10px;
  border-bottom: 1px solid #f1f5f9;
}
[data-theme="dark"] .dt td {
  border-bottom-color: #334155;
}

.cc {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-left: 3px solid #1B5E6B;
  border-radius: 0 6px 6px 0;
  padding: 8px 10px;
  margin-bottom: 8px;
}
[data-theme="dark"] .cc {
  background: #1e293b;
  border-color: #334155;
  border-left-color: #06b6d4;
}

.ci {
  font-family: monospace;
  font-size: 0.725rem;
  color: #64748b;
  margin-bottom: 4px;
}

.cf {
  font-size: 0.8rem;
  line-height: 1.4;
}

.cr {
  color: #1B5E6B;
  font-weight: 800;
}
[data-theme="dark"] .cr {
  color: #38bdf8;
}

/* Call Card */
.call-card {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 14px 16px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}
[data-theme="dark"] .call-card {
  background: #1e293b;
  border-color: #334155;
}

.pill {
  display: inline-block;
  background: #E8F4F6;
  border: 1px solid #A8D4DC;
  border-radius: 5px;
  padding: 3px 8px;
  font-size: 0.8rem;
  color: #134552;
  font-weight: 700;
  margin: 2px 0;
}
[data-theme="dark"] .pill {
  background: rgba(6, 182, 212, 0.15);
  border-color: rgba(6, 182, 212, 0.4);
  color: #38bdf8;
}

.pill.red {
  background: #FAEAEA;
  border-color: #EEB0B0;
  color: #7A1A1A;
}
.pill.green {
  background: #D4EDE4;
  border-color: #7AC8A0;
  color: #0A5A30;
}

.script {
  background: #E8F4F6;
  border-left: 3px solid #1B5E6B;
  border-radius: 0 6px 6px 0;
  padding: 10px 12px;
  font-size: 0.825rem;
  color: #134552;
  line-height: 1.65;
  margin-top: 10px;
  font-style: italic;
}
[data-theme="dark"] .script {
  background: rgba(15, 23, 42, 0.8);
  border-left-color: #06b6d4;
  color: #e2e8f0;
}

.cpbtn {
  width: 100%;
  margin-top: 8px;
  padding: 7px;
  background: #1B5E6B;
  color: #ffffff;
  border: none;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s ease;
}
.cpbtn:hover {
  background: #134552;
}

/* Loading Overlay */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(245, 245, 242, 0.88);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 1;
  visibility: visible;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}
[data-theme="dark"] .loading-overlay {
  background: rgba(15, 23, 42, 0.90);
}
.loading-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.spinner-card {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 16px;
  padding: 32px 40px;
  width: 380px;
  max-width: 90vw;
  text-align: center;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.12);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  animation: cardFadeIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
[data-theme="dark"] .spinner-card {
  background: #1e293b;
  border-color: #334155;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}
@keyframes cardFadeIn {
  from { opacity: 0; transform: translateY(12px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.spinner-logo {
  font-size: 2.5rem;
  margin-bottom: 4px;
  animation: bounceLogo 1.5s infinite ease-in-out;
}
@keyframes bounceLogo {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
.spinner-ring {
  width: 48px;
  height: 48px;
  border: 4px solid rgba(27, 94, 107, 0.15);
  border-top-color: #1B5E6B;
  border-radius: 50%;
  animation: spinRing 0.8s infinite linear;
}
[data-theme="dark"] .spinner-ring {
  border-color: rgba(6, 182, 212, 0.2);
  border-top-color: #06b6d4;
}
@keyframes spinRing {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}
.spinner-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: #1B5E6B;
  letter-spacing: -0.01em;
}
[data-theme="dark"] .spinner-title {
  color: #38bdf8;
}
.spinner-sub {
  font-size: 0.825rem;
  color: #64748b;
  line-height: 1.5;
}
[data-theme="dark"] .spinner-sub {
  color: #94a3b8;
}
.spinner-bar {
  width: 100%;
  height: 4px;
  background: #e2e8f0;
  border-radius: 99px;
  overflow: hidden;
  margin-top: 6px;
}
[data-theme="dark"] .spinner-bar {
  background: #334155;
}
.spinner-progress {
  width: 40%;
  height: 100%;
  background: linear-gradient(90deg, #1B5E6B, #06b6d4);
  border-radius: 99px;
  animation: shimmerBar 1.2s infinite ease-in-out;
}
@keyframes shimmerBar {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(250%); }
}

/* 📱 Mobile & Tablet Responsive Design & Touch UX */
@media (max-width: 900px) {
  .navbar {
    padding: 0.65rem 1rem !important;
    flex-direction: row !important;
    justify-content: space-between !important;
    align-items: center !important;
  }

  .navbar-header {
    width: 100% !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
  }

  .hamburger-btn {
    display: flex !important;
  }

  .nav-menu-wrapper {
    position: fixed !important;
    top: 56px !important;
    left: 0 !important;
    right: 0 !important;
    background: #ffffff !important;
    padding: 1.25rem 1rem !important;
    flex-direction: column !important;
    gap: 0.85rem !important;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.15) !important;
    border-bottom: 1px solid #cbd5e1 !important;
    transform: translateY(-130%) !important;
    opacity: 0 !important;
    pointer-events: none !important;
    visibility: hidden !important;
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease !important;
    z-index: 999 !important;
  }

  .nav-menu-wrapper.open {
    transform: translateY(0) !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    visibility: visible !important;
  }

  .nav-menu-pills {
    flex-direction: column !important;
    width: 100% !important;
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    gap: 0.5rem !important;
  }

  .nav-link {
    width: 100% !important;
    padding: 0.75rem 1rem !important;
    font-size: 0.95rem !important;
    border-radius: 10px !important;
    background: #f8fafc !important;
    border: 1px solid #e2e8f0 !important;
    display: flex !important;
    align-items: center !important;
    gap: 0.65rem !important;
  }

  .nav-link.active {
    background: #1B5E6B !important;
    color: #ffffff !important;
    border-color: #1B5E6B !important;
  }

  .nav-user-chip {
    width: 100% !important;
    justify-content: center !important;
    padding: 0.65rem !important;
    border-radius: 10px !important;
    font-size: 0.85rem !important;
    background: #f1f5f9 !important;
  }

  .mobile-menu-backdrop {
    display: block !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    background: rgba(15, 23, 42, 0.45) !important;
    backdrop-filter: blur(2px) !important;
    opacity: 0 !important;
    pointer-events: none !important;
    visibility: hidden !important;
    transition: opacity 0.25s ease !important;
    z-index: 998 !important;
  }

  .mobile-menu-backdrop.open {
    opacity: 1 !important;
    pointer-events: auto !important;
    visibility: visible !important;
  }

  .kanban-grid {
    grid-template-columns: 1fr !important;
  }

  .map-modal-grid {
    grid-template-columns: 1fr !important;
  }

  #googleMapContainer, .places-panel {
    max-height: 320px !important;
    height: 320px !important;
  }

  .modal-card {
    padding: 1.1rem !important;
    width: 96% !important;
    max-height: 94vh !important;
  }

  .container {
    padding: 1rem 0.75rem !important;
  }

  .kpi-card {
    padding: 1rem !important;
  }

  h1 {
    font-size: 1.4rem !important;
  }
}

/* 📊 Tarifario Table - Enterprise Clean Row Layout & Horizontal Scroll */
.tariffs-card {
  background: #ffffff !important;
  border: 1px solid var(--border-color) !important;
  border-radius: 12px !important;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04) !important;
  overflow: hidden !important;
  margin-bottom: 2rem;
}

.tariffs-table-container {
  display: block !important;
  width: 100% !important;
  overflow-x: auto !important;
  -webkit-overflow-scrolling: touch !important;
}

.table-scroll-hint {
  display: none;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.85rem;
  font-size: 0.775rem;
  color: #1B5E6B;
  background: #ecfeff;
  border-bottom: 1px solid #cffafe;
  font-weight: 700;
}

.tariffs-table {
  display: table !important;
  width: 100% !important;
  min-width: 980px !important;
  border-collapse: collapse !important;
  font-size: 0.825rem;
  background: #ffffff;
}

.tariffs-table th,
.tariffs-table td {
  display: table-cell !important;
  white-space: nowrap !important;
  padding: 0.65rem 0.85rem !important;
  border-bottom: 1px solid #e2e8f0 !important;
  border-right: 1px solid #f1f5f9 !important;
  vertical-align: middle !important;
  position: static !important;
  box-shadow: none !important;
}

.tariffs-table th {
  background: #f8fafc !important;
  color: #475569 !important;
  font-size: 0.725rem !important;
  font-weight: 800 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.4px !important;
  border-bottom: 2px solid #cbd5e1 !important;
  border-right: 1px solid #e2e8f0 !important;
}

.tariffs-table th:last-child,
.tariffs-table td:last-child {
  border-right: none !important;
  position: static !important;
  box-shadow: none !important;
}

.tariffs-table td::before {
  display: none !important;
}

.tariffs-table th.col-id, .tariffs-table td.col-id { width: 65px; text-align: center; }
.tariffs-table th.col-route, .tariffs-table td.col-route { min-width: 220px; font-weight: 700; }
.tariffs-table th.col-border, .tariffs-table td.col-border { min-width: 130px; }
.tariffs-table th.col-cat, .tariffs-table td.col-cat { min-width: 130px; }
.tariffs-table th.col-truck, .tariffs-table td.col-truck { min-width: 110px; }
.tariffs-table th.col-price, .tariffs-table td.col-price { min-width: 100px; text-align: right; font-weight: 700; }
.tariffs-table th.col-cost, .tariffs-table td.col-cost { min-width: 100px; text-align: right; }
.tariffs-table th.col-margin, .tariffs-table td.col-margin { min-width: 90px; text-align: right; }
.tariffs-table th.col-status, .tariffs-table td.col-status { min-width: 85px; text-align: center; }
.tariffs-table th.col-actions, .tariffs-table td.col-actions { min-width: 90px; text-align: center; }

.tariffs-table tbody tr:hover td {
  background-color: #f8fafc !important;
}

/* 📱 Mobile Responsive Enhancements (< 768px) */
@media (max-width: 768px) {
  .table-scroll-hint {
    display: flex !important;
  }

  /* Compact 2-Column KPI Cards */
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.65rem !important;
    margin-bottom: 1.25rem !important;
  }

  .kpi-card {
    padding: 0.85rem !important;
    border-radius: 0.75rem !important;
  }

  .kpi-card:last-child {
    grid-column: span 2 !important;
  }

  .kpi-label {
    font-size: 0.68rem !important;
    margin-bottom: 0.25rem !important;
  }

  .kpi-value {
    font-size: 1.45rem !important;
  }

  /* Scrollable Country Flag Pills */
  .country-bar {
    display: flex !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    padding-bottom: 0.35rem !important;
    gap: 0.35rem !important;
    scrollbar-width: none !important;
    margin-bottom: 1rem !important;
  }

  .country-bar::-webkit-scrollbar {
    display: none !important;
  }

  .cflag {
    padding: 0.35rem 0.65rem !important;
    font-size: 0.775rem !important;
    white-space: nowrap !important;
    flex-shrink: 0 !important;
  }

  /* Single Column Filters on Mobile */
  .filters-bar {
    grid-template-columns: 1fr !important;
    padding: 1rem !important;
    gap: 0.75rem !important;
  }

  /* Prospects Table (Cards Transformation) */
  .table-card:not(.tariffs-card) {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
  }

  .table-container:not(.tariffs-table-container) {
    max-height: none !important;
    overflow: visible !important;
  }

  .prospects-table {
    min-width: 100% !important;
    display: block !important;
  }

  .prospects-table thead {
    display: none !important;
  }

  .prospects-table tbody {
    display: flex !important;
    flex-direction: column !important;
    gap: 12px !important;
  }

  .prospects-table tr.dr {
    display: flex !important;
    flex-direction: column !important;
    background: #ffffff !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 12px !important;
    padding: 14px 16px !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05) !important;
    position: relative !important;
    gap: 6px !important;
  }

  .prospects-table td {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    border-right: none !important;
    border-bottom: 1px dashed #e2e8f0 !important;
    padding: 6px 0 !important;
    background: transparent !important;
    width: 100% !important;
  }

  .prospects-table td:last-child {
    border-bottom: none !important;
  }

  .prospects-table td::before {
    content: attr(data-label);
    font-weight: 800;
    font-size: 0.725rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.3px;
  }

  .td-chev {
    position: absolute !important;
    top: 14px !important;
    right: 14px !important;
    width: auto !important;
    border-bottom: none !important;
    padding: 0 !important;
  }
  .td-chev::before {
    display: none !important;
  }

  .td-importador {
    border-bottom: 2px solid #cbd5e1 !important;
    padding-bottom: 10px !important;
    margin-bottom: 4px !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    padding-right: 30px !important;
  }
  .td-importador::before {
    display: none !important;
  }

  .td-match {
    justify-content: flex-end !important;
  }

  .carrier-badge {
    max-width: 220px !important;
  }

  .er td {
    border-radius: 12px !important;
  }
}


