/* ==========================================================================
   COCOTOURS LOGISTICS ERP - CARIBBEAN HIGH-VELOCITY ERP DESIGN SYSTEM
   Palette: Deep Caribbean Teal (#00685f / #0d9488), Marine Slate (#0b1c30 / #0f172a),
            Radiant Emerald (#10b981), Warm Amber (#d97706), Soft Error (#ba1a1a)
   Typography: Outfit (Display & Headlines), Plus Jakarta Sans (Body), 
               Inter (Tabular Data, Code, Badges with 'tnum')
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Outfit:wght@500;600;700;800&family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:wght,FILL@100..700,0..1&display=swap');

:root {
  /* Canvas & Backgrounds (Stitch Tonal Surfaces) */
  --bg-base: #f8f9ff;
  --bg-surface: #ffffff;
  --bg-subtle: #eff4ff;
  --bg-hover: #e5eeff;
  --bg-input: #eff4ff;
  --bg-modal: #ffffff;

  /* Surfaces */
  --surface-container-lowest: #ffffff;
  --surface-container-low: #eff4ff;
  --surface-container: #e5eeff;
  --surface-container-high: #dce9ff;
  --surface-container-highest: #d3e4fe;

  /* Borders & Outlines */
  --border-light: rgba(109, 122, 119, 0.18);
  --border-subtle: #e2e8f0;
  --border-strong: #cbd5e1;
  --border-focus: #00685f;

  /* Primary Brand - Deep Caribbean Teal */
  --primary: #00685f;
  --primary-hover: #005049;
  --primary-container: #008378;
  --on-primary: #ffffff;
  --on-primary-container: #f4fffc;
  --primary-fixed: #89f5e7;
  --primary-fixed-dim: #6bd8cb;
  --coco-green: #00685f;
  --coco-green-hover: #005049;
  --coco-green-light: #e6f7f5;
  --coco-green-glow: rgba(0, 104, 95, 0.2);

  /* Secondary & Accents */
  --secondary: #565e74;
  --secondary-container: #dae2fd;
  --on-secondary-container: #5c647a;

  /* Tertiary - Radiant Emerald for Live/Success */
  --tertiary: #006947;
  --tertiary-container: #00855b;
  --tertiary-fixed: #6ffbbe;
  --emerald-live: #10b981;

  /* Alert / Error / Warning */
  --error: #ba1a1a;
  --error-container: #ffdad6;
  --on-error-container: #93000a;
  --coco-red: #ba1a1a;
  --coco-red-hover: #93000a;
  --coco-red-light: #fef2f2;
  --coco-red-glow: rgba(186, 26, 26, 0.15);

  --amber-warning: #d97706;
  --amber-warning-bg: #fffbeb;
  --amber-warning-border: #fde68a;

  /* Text Colors */
  --text-primary: #0b1c30;
  --text-secondary: #3d4947;
  --text-muted: #565e74;
  --text-light: #6d7a77;
  --text-white: #ffffff;

  /* Status Tokens */
  --status-pendiente-bg: #fffbeb;
  --status-pendiente-text: #b45309;
  --status-pendiente-border: #fde68a;

  --status-asignado-bg: #eff6ff;
  --status-asignado-text: #1d4ed8;
  --status-asignado-border: #bfdbfe;

  --status-trayecto-bg: #f5f3ff;
  --status-trayecto-text: #6d28d9;
  --status-trayecto-border: #ddd6fe;

  --status-completado-bg: #ecfdf5;
  --status-completado-text: #047857;
  --status-completado-border: #a7f3d0;

  --status-revisar-bg: #fef2f2;
  --status-revisar-text: #b91c1c;
  --status-revisar-border: #fecaca;

  /* Sizing & Radius */
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 10px;
  --radius-xl: 14px;
  --radius-full: 9999px;

  /* Elevation Shadows */
  --shadow-sm: 0 1px 3px rgba(11, 28, 48, 0.04);
  --shadow-md: 0 4px 12px -2px rgba(11, 28, 48, 0.08), 0 2px 4px -1px rgba(11, 28, 48, 0.03);
  --shadow-lg: 0 10px 20px -3px rgba(11, 28, 48, 0.08);
  --shadow-modal: 0 20px 25px -5px rgba(11, 28, 48, 0.12), 0 8px 10px -6px rgba(11, 28, 48, 0.06);

  --transition-fast: 0.15s ease-in-out;
  --transition-normal: 0.25s ease-in-out;
}

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

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, .font-heading {
  font-family: 'Outfit', sans-serif;
  letter-spacing: -0.015em;
  color: var(--text-primary);
  font-weight: 600;
}

.tabular-nums {
  font-family: 'Inter', sans-serif;
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum' on, 'zero' on;
}

/* ==========================================================================
   TOPBAR NAVIGATION (Stitch Command Bar)
   ========================================================================== */

.app-header {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-light);
  box-shadow: 0 1px 4px rgba(11, 28, 48, 0.03);
  position: sticky;
  top: 0;
  z-index: 50;
  width: 100%;
}

.top-nav-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 64px;
  gap: 16px;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

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

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

.brand-title {
  font-family: 'Outfit', sans-serif;
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.brand-title span {
  color: var(--primary);
  margin-left: 2px;
}

.brand-subtitle {
  font-family: 'Inter', sans-serif;
  font-size: 10px;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  margin-top: 1px;
}

/* Segmented Navigation Bar */
.nav-links-row {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--surface-container-low);
  padding: 4px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(109, 122, 119, 0.12);
}

.nav-link-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  font-size: 12.5px;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--transition-fast);
  user-select: none;
}

.nav-link-btn:hover {
  background: var(--surface-container-high);
  color: var(--text-primary);
}

.nav-link-btn.active {
  background: var(--primary-container);
  color: var(--on-primary-container);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0, 104, 95, 0.2);
}

.nav-link-btn.active .nav-svg-icon {
  color: var(--on-primary-container);
  stroke: var(--on-primary-container);
}

.nav-svg-icon {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 1.75;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
  color: var(--text-secondary);
  transition: color var(--transition-fast);
}

/* Header Right Actions */
.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.search-box-wrapper {
  position: relative;
}

.search-input {
  background: var(--surface-container-low);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 6px 12px 6px 32px;
  color: var(--text-primary);
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 12.5px;
  width: 220px;
  transition: all var(--transition-fast);
}

.search-input:focus {
  outline: none;
  background: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--coco-green-glow);
  width: 270px;
}

.search-icon-svg {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  stroke: var(--text-muted);
  stroke-width: 2;
  fill: none;
  pointer-events: none;
}

/* Live Supabase Pulse Indicator */
.live-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  background: #ffffff;
  border: 1px solid var(--border-light);
  padding: 5px 9px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
}

.live-pulse-container {
  position: relative;
  display: flex;
  width: 8px;
  height: 8px;
}

.live-pulse-ping {
  position: absolute;
  display: inline-flex;
  height: 100%;
  width: 100%;
  border-radius: 50%;
  background-color: var(--emerald-live);
  opacity: 0.75;
  animation: ping 1.5s cubic-bezier(0, 0, 0.2, 1) infinite;
}

.live-pulse-dot {
  position: relative;
  display: inline-flex;
  border-radius: 50%;
  height: 8px;
  width: 8px;
  background-color: var(--emerald-live);
}

@keyframes ping {
  75%, 100% {
    transform: scale(2);
    opacity: 0;
  }
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 13px;
  border-radius: var(--radius-sm);
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 12.5px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--transition-fast);
  text-decoration: none;
}

.btn-primary {
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 1px 2px rgba(0, 104, 95, 0.2);
}

.btn-primary:hover {
  background: var(--primary-container);
  box-shadow: 0 2px 5px rgba(0, 104, 95, 0.3);
}

.btn-secondary {
  background: #ffffff;
  border-color: var(--border-light);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
  background: var(--surface-container-high);
  border-color: var(--border-strong);
}

.btn-danger-outline {
  background: var(--coco-red-light);
  border-color: var(--coco-red);
  color: var(--coco-red);
}

.btn-danger-outline:hover {
  background: var(--coco-red);
  color: white;
}

.btn-success {
  background: #10b981;
  color: white;
}

.btn-success:hover {
  background: #059669;
}

.btn-sm {
  padding: 5px 9px;
  font-size: 11.5px;
}

.btn-icon-svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ==========================================================================
   SUB-NAV / OPERATIONAL BANNER
   ========================================================================== */
.subnav-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.breadcrumb-lockup {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  color: var(--text-muted);
}

.breadcrumb-crumb {
  color: var(--text-muted);
  font-weight: 500;
}

.breadcrumb-active {
  color: var(--text-primary);
  font-weight: 600;
}

.badge-tag-micro {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  background: var(--surface-container-high);
  color: var(--text-secondary);
  font-family: 'Inter', sans-serif;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.banner-right-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.live-feed-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  background: #ffffff;
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
  font-family: 'Inter', sans-serif;
  font-size: 11.5px;
  color: var(--text-secondary);
}

.live-feed-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--emerald-live);
}

/* ==========================================================================
   MAIN CONTENT WORKSPACE
   ========================================================================== */
.main-content {
  flex: 1;
  padding: 16px 24px;
  width: 100%;
  max-width: 1920px;
  margin: 0 auto;
  box-sizing: border-box;
}

.view-section {
  display: none;
  animation: fadeIn 0.2s ease-in-out;
}

.view-section.active {
  display: block;
}

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

/* ==========================================================================
   KPI SUMMARY CARDS (High-Density Modern Stitch System)
   ========================================================================== */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.kpi-card {
  background: #ffffff;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-normal);
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

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

.kpi-top-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.kpi-title-col {
  display: flex;
  flex-direction: column;
}

.kpi-title {
  font-family: 'Inter', sans-serif;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.kpi-value-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-top: 4px;
}

.kpi-value {
  font-family: 'Outfit', sans-serif;
  font-size: 28px;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.kpi-micro-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  font-family: 'Inter', sans-serif;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.kpi-badge-teal {
  background: rgba(0, 104, 95, 0.1);
  color: var(--primary);
}

.kpi-badge-amber {
  background: #fffbeb;
  color: #b45309;
  border: 1px solid #fde68a;
}

.kpi-badge-error {
  background: var(--error-container);
  color: var(--on-error-container);
}

.kpi-icon-box {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: var(--surface-container-high);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  flex-shrink: 0;
}

.kpi-icon-box.amber {
  background: #fffbeb;
  color: #d97706;
}

.kpi-icon-box.teal {
  background: var(--surface-container-high);
  color: var(--primary-container);
}

.kpi-icon-box.error {
  background: rgba(186, 26, 26, 0.1);
  color: var(--error);
}

.kpi-footer-row {
  margin-top: 12px;
  padding-top: 8px;
  border-top: 1px solid rgba(109, 122, 119, 0.1);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  color: var(--text-muted);
}

.kpi-footer-left {
  display: flex;
  align-items: center;
  gap: 4px;
}

.kpi-footer-right {
  font-weight: 600;
  color: var(--text-primary);
}

/* ==========================================================================
   FILTER BAR & SEARCH CONSOLE
   ========================================================================== */
.filter-bar {
  background: #ffffff;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 12px 16px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.filter-item-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.filter-select {
  background: var(--surface-container-low);
  border: 1px solid var(--border-light);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  padding: 6px 28px 6px 10px;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 12.5px;
  outline: none;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  transition: all var(--transition-fast);
}

.filter-select:focus {
  background: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--coco-green-glow);
}

.filter-chevron-svg {
  position: absolute;
  right: 8px;
  pointer-events: none;
  width: 12px;
  height: 12px;
  stroke: var(--text-muted);
  stroke-width: 2;
  fill: none;
}

/* Data Table (Light Design) */
.table-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
}

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

.data-table th {
  background: #f8fafc;
  color: var(--text-secondary);
  font-weight: 600;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-light);
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

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

.data-table tr:hover td {
  background: #f8fafc;
}

/* Compact Table Layout for Operations (Excel Pro) - Normalized & Clean */
.data-table.table-compact {
  font-size: 11.5px;
  border-collapse: separate;
  border-spacing: 0;
}

.data-table.table-compact th {
  padding: 6px 8px;
  font-size: 10px;
  background: #f1f5f9;
  font-weight: 700;
  color: var(--text-secondary);
  border-bottom: 2px solid var(--border-strong);
  vertical-align: middle;
  line-height: 1.2;
}

.data-table.table-compact td.col-origen {
  min-width: 110px;
  max-width: 155px;
  line-height: 1.25;
  word-break: normal;
}

.data-table.table-compact td.col-destino {
  min-width: 120px;
  max-width: 170px;
  line-height: 1.25;
  word-break: normal;
}

.data-table.table-compact td.col-cliente {
  min-width: 125px;
  max-width: 175px;
  line-height: 1.25;
  word-break: normal;
}

.data-table.table-compact td.col-time {
  text-align: center;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.data-table.table-compact td {
  padding: 6px 9px;
  font-size: 11.5px;
  font-weight: 400;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-light);
  line-height: 1.35;
  vertical-align: middle;
}

.data-table.table-compact tr.clickable-row {
  cursor: pointer;
  user-select: none;
  transition: background-color 0.15s ease;
}

/* Row Tinting by Transportista / Suplidor (Delimited to Tipo -> Transportista) */
.row-transp-agona td.col-tinted { background-color: #f0fdf4; }
.row-transp-agona:hover td.col-tinted { background-color: #dcfce7 !important; }

.row-transp-jade td.col-tinted { background-color: #f0f9ff; }
.row-transp-jade:hover td.col-tinted { background-color: #e0f2fe !important; }

.row-transp-jhonmael td.col-tinted { background-color: #fdf2f8; }
.row-transp-jhonmael:hover td.col-tinted { background-color: #fce7f3 !important; }

.row-transp-manolin td.col-tinted { background-color: #ecfeff; }
.row-transp-manolin:hover td.col-tinted { background-color: #cffafe !important; }

.row-transp-pujrenta td.col-tinted { background-color: #fffbeb; }
.row-transp-pujrenta:hover td.col-tinted { background-color: #fef3c7 !important; }

.row-transp-rentamax td.col-tinted { background-color: #faf5ff; }
.row-transp-rentamax:hover td.col-tinted { background-color: #f3e8ff !important; }

.row-transp-silvestre td.col-tinted { background-color: #f7fee7; }
.row-transp-silvestre:hover td.col-tinted { background-color: #ecfccb !important; }

.row-transp-sti td.col-tinted { background-color: #f5f3ff; }
.row-transp-sti:hover td.col-tinted { background-color: #ede9fe !important; }

.row-transp-frank td.col-tinted { background-color: #ecfdf5; }
.row-transp-frank:hover td.col-tinted { background-color: #d1fae5 !important; }

.row-transp-cocotours td.col-tinted { background-color: #f0fdf4; }
.row-transp-cocotours:hover td.col-tinted { background-color: #dcfce7 !important; }

.row-transp-default td.col-tinted { background-color: #ffffff; }
.row-transp-default:hover td.col-tinted { background-color: #f8fafc !important; }

/* Neutral Columns (Notas, Estado Conf, Status keep clean white background) */
.data-table.table-compact td.col-neutral {
  background-color: #ffffff !important;
}
.data-table.table-compact tr:hover td.col-neutral {
  background-color: #f8fafc !important;
}

/* Stylish Transportista Pill / Selector */
.suplidor-badge-btn {
  display: inline-flex;
  align-items: center;
  padding: 3px 22px 3px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid rgba(0, 0, 0, 0.12);
  background-color: rgba(255, 255, 255, 0.85);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='5' viewBox='0 0 8 5'%3E%3Cpath fill='%23475569' d='M0 0l4 4 4-4z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 6px center;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  color: var(--text-primary);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  transition: all 0.15s ease;
  white-space: nowrap;
  outline: none;
}

.suplidor-badge-btn:hover, .suplidor-badge-btn:focus {
  background-color: #ffffff;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  border-color: var(--coco-green);
}

.suplidor-badge-btn.unassigned {
  background-color: transparent;
  background-image: none;
  padding: 3px 8px;
  border: 1px dashed #94a3b8;
  color: var(--text-muted);
  font-weight: 600;
}
.suplidor-badge-btn.unassigned:hover {
  background-color: #ffffff;
  border-color: var(--coco-green);
  color: var(--coco-green);
}

/* Estado Conf: Single Clean Summary Badge in Table */
.badge-conf-trigger {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease;
  user-select: none;
  white-space: nowrap;
}

.badge-conf-trigger svg, .popover-canal-btn svg {
  flex-shrink: 0;
  vertical-align: middle;
}

.badge-conf-trigger.uncontacted {
  background: #f1f5f9;
  color: #94a3b8;
  border-color: #e2e8f0;
}
.badge-conf-trigger.uncontacted:hover {
  background: #e2e8f0;
  color: var(--text-primary);
}

.badge-conf-trigger.sent {
  background: #eff6ff;
  color: #1d4ed8;
  border-color: #bfdbfe;
  font-weight: 600;
}
.badge-conf-trigger.sent:hover {
  background: #dbeafe;
}

.badge-conf-trigger.confirmed {
  background: #fef08a !important;
  color: #854d0e !important;
  border-color: #eab308 !important;
  font-weight: 800 !important;
  box-shadow: 0 1px 4px rgba(234, 179, 8, 0.4);
}
.badge-conf-trigger.confirmed:hover {
  background: #fde047 !important;
}

.col-conf {
  width: 104px;
  min-width: 104px;
  max-width: 104px;
  text-align: center;
}

.conf-channel-summary,
.conf-channel-icons {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  max-width: 100%;
}

.conf-channel-icons { gap: 2px; }

.conf-channel-icon {
  width: 13px;
  height: 13px;
  flex: 0 0 13px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.badge-conf-trigger.sent .conf-channel-icon {
  color: #64748b;
}

.conf-channel-agent {
  white-space: nowrap;
}

/* Floating Popover Card for Estado Conf */
.popover-conf-card {
  position: fixed;
  background: #ffffff;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  box-shadow: 0 12px 30px -4px rgba(0, 0, 0, 0.22);
  padding: 14px 16px;
  z-index: 10000;
  width: 290px;
  display: none;
  animation: popoverFadeIn 0.15s ease-out;
}

@keyframes popoverFadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.popover-conf-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-light);
  padding-bottom: 8px;
  margin-bottom: 10px;
}

.popover-conf-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
}

.popover-conf-close {
  background: none;
  border: none;
  font-size: 13px;
  cursor: pointer;
  color: var(--text-muted);
}
.popover-conf-close:hover { color: var(--text-primary); }

.popover-section-label {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 5px;
  letter-spacing: 0.03em;
}

.popover-channels-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 12px;
}

.popover-canal-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 5px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border-light);
  background: #f1f5f9;
  color: #64748b;
  border-color: #cbd5e1;
  transition: all 0.12s ease;
}

.popover-canal-btn:hover {
  background: #e2e8f0;
  color: #334155;
}

.popover-canal-btn.active {
  background: #eff6ff;
  color: #1d4ed8;
  border-color: #3b82f6;
  font-weight: 700;
}

.popover-canal-btn.confirmed-active {
  background: #fef08a !important;
  color: #854d0e !important;
  border-color: #eab308 !important;
  font-weight: 800 !important;
}

.popover-agents-row {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
}

.popover-agent-btn {
  flex: 1;
  padding: 4px 6px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  border: 1px solid var(--border-light);
  background: var(--bg-subtle);
  cursor: pointer;
  color: var(--text-secondary);
  transition: all 0.12s ease;
}

.popover-agent-btn:hover {
  background: #e2e8f0;
}

.popover-agent-btn.active {
  background: #0f172a;
  color: #ffffff;
  border-color: #0f172a;
}

/* Inline Suplidor Quick Dropdown */
.select-suplidor-inline {
  padding: 3px 6px;
  font-size: 11px;
  border-radius: 4px;
  border: 1px solid var(--border-strong);
  background: #ffffff;
  color: var(--text-primary);
  font-weight: 600;
  cursor: pointer;
  outline: none;
  max-width: 135px;
}

.select-suplidor-inline:focus {
  border-color: var(--coco-green);
  box-shadow: 0 0 0 2px var(--coco-green-glow);
}

.expand-btn {
  background: none;
  border: 1px solid var(--border-light);
  border-radius: 4px;
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition-fast);
}

.expand-btn:hover {
  background: var(--coco-green-light);
  color: var(--coco-green);
  border-color: var(--coco-green);
}

.expand-btn.expanded {
  background: var(--coco-green);
  color: white;
  border-color: var(--coco-green);
}

/* Sub-row Collapsible Drawer */
.subrow-detail-tr td {
  background: #f8fafc !important;
}

.subrow-detail-box {
  padding: 12px 18px;
  background: #ffffff;
  border: 1px solid var(--border-light);
  border-left: 4px solid var(--coco-green);
  border-radius: var(--radius-sm);
  margin: 4px 0;
  box-shadow: var(--shadow-sm);
}

.subrow-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px 20px;
  font-size: 12px;
}

.subrow-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

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

.subrow-value {
  font-weight: 600;
  color: var(--text-primary);
}

/* Búsqueda de reservas dentro del hub de despacho */
.dispatch-search-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 12px;
}

.dispatch-search-input-wrap {
  position: relative;
  flex: 0 1 430px;
  min-width: min(100%, 280px);
}

.dispatch-search-input {
  width: 100%;
  padding: 9px 36px 9px 36px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  background: #fff;
  color: var(--text-primary);
  font: inherit;
  font-size: 13px;
  box-shadow: var(--shadow-sm);
}

.dispatch-search-input:focus {
  outline: 2px solid color-mix(in srgb, var(--primary) 24%, transparent);
  border-color: var(--primary);
}

.dispatch-search-icon {
  position: absolute;
  left: 11px;
  top: 50%;
  width: 16px;
  height: 16px;
  transform: translateY(-50%);
  fill: none;
  stroke: var(--text-muted);
  stroke-width: 2;
  stroke-linecap: round;
}

.dispatch-search-clear {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  border: 0;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
}

.dispatch-search-hint {
  color: var(--text-muted);
  font-size: 11px;
}

@media (max-width: 640px) {
  .dispatch-search-bar {
    align-items: stretch;
    flex-direction: column;
  }

  .dispatch-search-input-wrap {
    flex-basis: auto;
    min-width: 0;
  }
}

/* Hub Operation Tabs */
.hub-controls-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}

.hub-tabs {
  display: flex;
  align-items: center;
  background: var(--surface-container-low);
  padding: 4px;
  border-radius: var(--radius-md);
  gap: 4px;
  border: 1px solid rgba(109, 122, 119, 0.12);
}

.hub-tab-btn {
  background: transparent;
  border: none;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.hub-tab-btn:hover {
  background: var(--surface-container-high);
  color: var(--text-primary);
}

.hub-tab-btn.active {
  background: #ffffff;
  color: var(--primary);
  box-shadow: 0 1px 3px rgba(11, 28, 48, 0.08);
  font-weight: 700;
}

.quick-sort-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.sort-btn {
  background: #ffffff;
  border: 1px solid var(--border-light);
  color: var(--text-secondary);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  box-shadow: var(--shadow-sm);
}

.sort-btn:hover {
  background: var(--surface-container-high);
  color: var(--text-primary);
  border-color: var(--border-strong);
}

.sort-btn.active {
  background: #ffffff;
  color: var(--primary);
  border-color: var(--primary);
  box-shadow: 0 1px 4px rgba(0, 104, 95, 0.15);
  font-weight: 700;
}

/* Status Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  border: 1px solid transparent;
  white-space: nowrap;
}

.badge-pendiente {
  background: var(--status-pendiente-bg);
  color: var(--status-pendiente-text);
  border-color: var(--status-pendiente-border);
}

.badge-asignado {
  background: var(--status-asignado-bg);
  color: var(--status-asignado-text);
  border-color: var(--status-asignado-border);
}

.badge-trayecto {
  background: var(--status-trayecto-bg);
  color: var(--status-trayecto-text);
  border-color: var(--status-trayecto-border);
}

.badge-completado {
  background: var(--status-completado-bg);
  color: var(--status-completado-text);
  border-color: var(--status-completado-border);
}

.badge-revisar {
  background: var(--status-revisar-bg);
  color: var(--status-revisar-text);
  border-color: var(--status-revisar-border);
}

.badge-zone {
  background: #f0f9ff;
  color: #0369a1;
  border: 1px solid #bae6fd;
}

/* Operational Status Badges (Ampliación Flota & Incidencias) */
.badge-status-asignado { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; font-weight: 600; }
.badge-status-enviado { background: #ecfeff; color: #0891b2; border-color: #a5f3fc; font-weight: 600; }
.badge-status-aceptado { background: #ecfdf5; color: #047857; border-color: #a7f3d0; font-weight: 600; }
.badge-status-encamino { background: #e0f2fe; color: #0369a1; border-color: #bae6fd; font-weight: 700; }
.badge-status-enpunto { background: #fae8ff; color: #86198f; border-color: #f5d0fe; font-weight: 700; }
.badge-status-enespera { background: #fffbeb; color: #b45309; border-color: #fde68a; font-weight: 600; }
.badge-status-abordo { background: #f5f3ff; color: #6d28d9; border-color: #ddd6fe; font-weight: 700; }
.badge-status-finalizado { background: #f1f5f9; color: #475569; border-color: #cbd5e1; font-weight: 600; }
.badge-status-rechazado { background: #fff1f2; color: #e11d48; border-color: #fecdd3; font-weight: 800; border-width: 1.5px; }
.badge-status-noshow { background: #fef2f2; color: #b91c1c; border-color: #fecaca; font-weight: 700; }
.badge-status-norealizado { background: #fee2e2; color: #991b1b; border-color: #fca5a5; font-weight: 700; }
.badge-status-cancelado { background: #f8fafc; color: #64748b; border-color: #e2e8f0; font-weight: 600; text-decoration: line-through; }

/* Closed Services Section & Divider in Dispatch */
.closed-services-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 24px 0 12px 0;
}

.closed-services-divider::before,
.closed-services-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-light);
}

.closed-divider-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  background: var(--surface-container-high);
  color: var(--text-secondary);
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border: 1px solid var(--border-light);
}

.table-closed-services {
  opacity: 0.88;
}

.table-closed-services tr td {
  color: var(--text-muted);
}

.card-closed-service {
  opacity: 0.78;
  border-left: 3px solid #94a3b8 !important;
}

/* Mantenimiento: Suplidores Color Configuration */
.color-picker-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.color-input-styled {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  width: 34px;
  height: 28px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  cursor: pointer;
  background: #ffffff;
  padding: 2px;
  transition: all var(--transition-fast);
}

.color-input-styled:hover {
  border-color: var(--primary);
}

.color-input-styled::-webkit-color-swatch-wrapper {
  padding: 0;
}

.color-input-styled::-webkit-color-swatch {
  border-radius: 2px;
  border: 1px solid rgba(0,0,0,0.1);
}

.color-sample-preview {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--radius-sm);
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  border: 1px solid rgba(0,0,0,0.1);
  min-width: 90px;
  justify-content: center;
}

/* ==========================================================================
   HUB DE DESPACHO (Extended Logistics Grid)
   ========================================================================== */

.dispatch-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 18px;
}

.zone-column {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.dispatch-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(310px, 1fr));
  gap: 16px;
  align-items: start;
}

.dispatch-cards-general-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(285px, 1fr));
  gap: 12px;
  width: 100%;
}

.zone-column {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.zone-header {
  padding: 10px 14px;
  background: #f8fafc;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.zone-title {
  font-size: 13.5px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
}

.zone-count {
  background: #e2e8f0;
  color: var(--text-secondary);
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 700;
}

.zone-cards {
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 680px;
  overflow-y: auto;
}

/* Compact Dispatch Card */
.dispatch-card {
  background: #ffffff;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 10px 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  transition: all 0.15s ease;
  cursor: pointer;
  user-select: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.dispatch-card:hover {
  border-color: var(--coco-green);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  transform: translateY(-1px);
}

.card-header-compact {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.card-time-main {
  font-size: 13px;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.01em;
}

.card-booking-code {
  font-size: 11px;
  font-weight: 700;
  color: #64748b;
  font-family: monospace;
}

.badge-status-sm {
  font-size: 10px;
  padding: 2px 6px;
  font-weight: 700;
  border-radius: 4px;
}

.card-route-compact {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.25;
  overflow: hidden;
}

.card-airport-code {
  background: #0f172a;
  color: #ffffff;
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}

.card-route-arrow {
  color: var(--coco-green);
  font-weight: 900;
  font-size: 12px;
  flex-shrink: 0;
}

.card-hotel-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-primary);
  max-width: 190px;
}

.card-client-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 11.5px;
  color: var(--text-secondary);
}

.card-client-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
  color: var(--text-primary);
}

.card-meta-compact {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px 8px;
  font-size: 11px;
  color: #64748b;
  background: #f8fafc;
  padding: 5px 8px;
  border-radius: 5px;
  border: 1px solid #f1f5f9;
}

.badge-zone-tag {
  background: #e2e8f0;
  color: #334155;
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 3px;
  font-weight: 600;
}

.card-footer-compact {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 6px;
  border-top: 1px solid #f1f5f9;
}

.card-transp-info {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.card-transp-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  color: var(--text-primary);
}

.card-transp-badge.unassigned {
  background: transparent;
  border: 1px dashed #cbd5e1;
  color: #94a3b8;
  font-weight: 500;
}

.btn-whatsapp-direct {
  background: #e9f8ef;
  color: #087443;
  border: 1px solid #9ddbb7;
}

.btn-whatsapp-direct:hover,
.btn-whatsapp-direct:focus-visible {
  background: #d2f2df;
  border-color: #50b77b;
  color: #065f36;
}

.card-driver-tag {
  font-size: 10.5px;
  font-weight: 600;
  color: #475569;
}

.card-driver-tag.unassigned-driver {
  color: #b45309;
  background: #fffbeb;
  padding: 1px 5px;
  border-radius: 3px;
  border: 1px solid #fde68a;
  font-size: 10px;
}

.btn-card-edit {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 5px;
  padding: 3px 7px;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.12s ease;
  color: var(--text-secondary);
}

.btn-card-edit:hover {
  background: #ffffff;
  border-color: var(--coco-green);
  color: var(--coco-green);
}

/* ==========================================================================
   MODALS (Clean Light Style)
   ========================================================================== */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: var(--transition-normal);
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-box {
  background: var(--bg-modal);
  border-radius: var(--radius-xl);
  width: 90%;
  max-width: 620px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-modal);
  transform: scale(0.96);
  transition: var(--transition-normal);
}

.modal-overlay.active .modal-box {
  transform: scale(1);
}

.modal-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f8fafc;
}

.modal-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
}

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

.modal-close:hover {
  color: var(--coco-red);
}

.modal-body {
  padding: 22px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 14px 22px;
  border-top: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  background: #f8fafc;
}

.import-reservas-modal { max-width: 980px; width: 94%; }
.import-agencies { display:flex; flex-wrap:wrap; gap:8px; margin-bottom:12px; }
.import-agency { border:1px solid var(--border-light); background:var(--bg-subtle); color:var(--text-primary); padding:7px 12px; border-radius:8px; font-weight:700; cursor:pointer; }
.import-agency.active { background:var(--coco-red); border-color:var(--coco-red); color:#fff; }
.import-agency:disabled { opacity:.45; cursor:not-allowed; }
.import-help { margin:0 0 12px; color:var(--text-secondary); font-size:13px; }
.import-reservas-input { min-height:180px; resize:vertical; font-family:var(--font-mono, monospace); font-size:12px; }
.import-actions { display:flex; justify-content:flex-end; margin-top:10px; }
.import-reservas-preview { border-top:1px solid var(--border-light); margin-top:18px; padding-top:16px; }
.import-reservas-preview h3 { margin:0 0 12px; font-size:16px; }
.import-warning,.import-ok { padding:10px 12px; border-radius:8px; font-size:12px; margin-bottom:14px; }
.import-warning { background:#fff7ed; border:1px solid #fed7aa; color:#9a3412; }
.import-warning ul { margin:5px 0 0; padding-left:20px; }
.import-ok { background:#f0fdf4; border:1px solid #bbf7d0; color:#166534; }
.import-fields-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:10px; }
.import-field { display:block; min-width:0; font-size:11px; font-weight:600; color:var(--text-secondary); }
.import-field > span { display:block; margin:0 0 4px; }
.import-field .form-control { width:100%; min-width:0; font-size:12px; }
.import-comments-field { grid-column:1 / -1; }
.import-comments-field textarea { min-height:96px; resize:vertical; white-space:pre-wrap; }
.reservation-service-tabs { display:grid; grid-template-columns:repeat(auto-fit,minmax(260px,1fr)); gap:6px; margin:0 0 14px; padding:8px; background:var(--bg-subtle); border:1px solid var(--border-light); border-radius:var(--radius-sm); }
.reservation-service-tabs > strong { grid-column:1 / -1; display:block; width:auto !important; }
.reservation-service-tab { width:100%; min-width:0; border:1px solid var(--border-light); background:#fff; color:var(--text-secondary); border-radius:6px; padding:6px 9px; font-size:11px; cursor:pointer; text-align:left; white-space:normal; }
.reservation-service-tab.active { border-color:var(--primary); background:var(--primary-light, #eff6ff); color:var(--primary); font-weight:700; }
.import-parent-fields { margin-bottom:14px; padding:12px; background:var(--bg-subtle); border-radius:8px; }
.import-service-card { padding:12px; border:1px solid var(--border-light); border-radius:9px; margin:10px 0; }
.import-service-card h4 { display:flex; justify-content:space-between; margin:0 0 10px; font-size:13px; }
.import-service-card h4 span { color:var(--text-muted); font-size:11px; }
@media (max-width:700px) { .import-fields-grid { grid-template-columns:repeat(2,minmax(0,1fr)); } }

.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 5px;
}

.form-control {
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  color: var(--text-primary);
  font-size: 13.5px;
  outline: none;
  transition: var(--transition-fast);
}

.form-control:focus {
  border-color: var(--coco-green);
  box-shadow: 0 0 0 3px var(--coco-green-glow);
}

/* ==========================================================================
   FORMAL INVOICE PRINTABLE SHEET
   ========================================================================== */

.invoice-sheet {
  background: white;
  color: #0f172a;
  padding: 36px;
  border-radius: var(--radius-md);
  font-family: 'Inter', sans-serif;
  margin: 0 auto;
  max-width: 800px;
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-md);
}

.invoice-header {
  display: flex;
  justify-content: space-between;
  border-bottom: 2px solid var(--border-light);
  padding-bottom: 18px;
  margin-bottom: 20px;
}

.invoice-logo-title {
  font-size: 26px;
  font-weight: 800;
  color: var(--coco-green);
}

.invoice-logo-title span {
  color: var(--coco-red);
}

.invoice-table {
  width: 100%;
  border-collapse: collapse;
  margin: 18px 0;
}

.invoice-table th {
  background: #f8fafc;
  color: #334155;
  padding: 9px;
  text-align: left;
  font-size: 11.5px;
  border-bottom: 1px solid #cbd5e1;
}

.invoice-table td {
  padding: 9px;
  border-bottom: 1px solid #e2e8f0;
  font-size: 12.5px;
}

.invoice-total-box {
  margin-top: 20px;
  display: flex;
  justify-content: flex-end;
}

.invoice-total-table {
  width: 260px;
}

.invoice-total-table td {
  padding: 5px 0;
}

/* Print Optimization */
@media print {
  body {
    background: white !important;
    color: black !important;
  }
  .app-header, .filter-bar, .nav-links-row, .btn, .modal-footer, .no-print {
    display: none !important;
  }
  .main-content {
    padding: 0 !important;
    margin: 0 !important;
    max-width: 100% !important;
  }
  .invoice-sheet {
    box-shadow: none !important;
    border: none !important;
    padding: 0 !important;
    max-width: 100% !important;
  }
}

/* ==========================================================================
   SUPABASE AUTH LOGIN SCREEN & USER PROFILE
   ========================================================================== */

.login-view-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 120px);
  padding: 24px 16px;
}

.login-card {
  width: 100%;
  max-width: 440px;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  padding: 36px 32px;
  position: relative;
  overflow: hidden;
}

.login-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--primary) 0%, var(--emerald-live) 100%);
}

.login-brand-header {
  text-align: center;
  margin-bottom: 28px;
}

.login-logo-img {
  height: 48px;
  width: auto;
  margin-bottom: 12px;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.06));
}

.login-title {
  font-family: 'Outfit', sans-serif;
  font-size: 22px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.login-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.login-field-wrap {
  position: relative;
}

.login-field-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  pointer-events: none;
}

.login-input {
  width: 100%;
  height: 44px;
  padding: 0 14px 0 38px;
  font-family: 'Inter', sans-serif;
  font-size: 13.5px;
  color: var(--text-primary);
  background: var(--bg-subtle);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  outline: none;
  transition: all var(--transition-fast);
}

.login-input:focus {
  background: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0, 104, 95, 0.15);
}

.login-btn-submit {
  width: 100%;
  height: 44px;
  margin-top: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 700;
  border-radius: var(--radius-md);
  background: var(--primary);
  color: #ffffff;
  border: none;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-fast);
}

.login-btn-submit:hover:not(:disabled) {
  background: var(--primary-dark);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.login-btn-submit:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.login-error-alert {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}

/* User Profile Header Lockup */
.user-profile-lockup {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 10px 4px 6px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-full);
}

.user-avatar-dot {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary) 0%, var(--emerald-live) 100%);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Outfit', sans-serif;
  font-size: 11.5px;
  font-weight: 800;
  text-transform: uppercase;
  box-shadow: var(--shadow-xs);
}

.user-email-text {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  max-width: 150px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-logout-header {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11.5px;
  font-weight: 600;
  transition: all var(--transition-fast);
}

.btn-logout-header:hover {
  background: #fee2e2;
  color: #dc2626;
}

/* ==============================================================================
 * COCOTOURS ERP - ESTADOS SEPARADOS & DESPACHO WHATSAPP
 * ============================================================================== */

/* Badges Estado Cliente */
.badge-cliente-enviado {
  background: #e0f2fe;
  color: #0369a1;
  border: 1px solid #bae6fd;
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.badge-cliente-confirmado {
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.badge-cliente-noenviado {
  background: #f1f5f9;
  color: #94a3b8;
  border: 1px dashed #cbd5e1;
  font-size: 10px;
  font-weight: 500;
  padding: 1px 6px;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

/* Badges Estado Suplidor */
.badge-suplidor-pendiente {
  background: #fffbeb;
  color: #b45309;
  border: 1px solid #fde68a;
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.badge-suplidor-enviado {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.badge-suplidor-aceptado {
  background: #ecfdf5;
  color: #059669;
  border: 1px solid #a7f3d0;
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.badge-suplidor-rechazado {
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid #fecaca;
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

/* Batch Action Bar in Dispatch */
.dispatch-batch-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: var(--radius-md);
  margin-bottom: 12px;
  animation: fadeIn 0.2s ease-out;
}

.dispatch-batch-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.batch-count-pill {
  font-family: 'Outfit', sans-serif;
  font-size: 12.5px;
  font-weight: 700;
  color: #15803d;
  background: #dcfce7;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  border: 1px solid #86efac;
}

/* WhatsApp Timeline Sequence in Modal */
.wa-timeline-wrap {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 400px;
  overflow-y: auto;
  padding: 8px 4px;
}

.wa-step-card {
  display: flex;
  gap: 12px;
  background: #ffffff;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  box-shadow: var(--shadow-xs);
  position: relative;
  transition: all var(--transition-fast);
}

.wa-step-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.wa-step-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--surface-container-high);
  color: var(--text-primary);
  font-family: 'Outfit', sans-serif;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.wa-step-content {
  flex: 1;
}

.wa-msg-bubble {
  background: #e7fedb;
  border: 1px solid #c5f2b3;
  border-radius: 8px 8px 8px 0;
  padding: 8px 12px;
  font-size: 12px;
  color: #1f2937;
  line-height: 1.4;
  margin-top: 6px;
  font-family: monospace;
  white-space: pre-wrap;
}

.wa-pdf-attachment {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 8px 12px;
  margin-top: 6px;
}

.wa-pdf-icon {
  font-size: 20px;
  color: #ef4444;
}

/* Multi-service selector in modal */
.service-tab-selector {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--border-light);
  padding-bottom: 8px;
  overflow-x: auto;
}

.service-tab-btn {
  padding: 6px 12px;
  border-radius: var(--radius-md);
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all var(--transition-fast);
}

.service-tab-btn.active {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
  box-shadow: var(--shadow-xs);
}

/* WhatsApp Batch Selection Toggle Button */
.btn-wa-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 9px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 13px;
  border: 1px solid var(--border-light, #e2e8f0);
}

.btn-wa-toggle.inactive {
  background: #f1f5f9;
  color: #94a3b8;
  border-color: #cbd5e1;
}

.btn-wa-toggle.inactive:hover {
  background: #e2e8f0;
  color: #64748b;
  border-color: #94a3b8;
}

.btn-wa-toggle.active {
  background: #25D366;
  color: #ffffff;
  border-color: #22c55e;
  box-shadow: 0 0 10px rgba(37, 211, 102, 0.4);
}

.btn-wa-toggle.active:hover {
  background: #20ba59;
  border-color: #16a34a;
}

/* ==========================================================================
   MÓDULO CRM COMERCIAL (PIPELINE, LEADS & CARDS)
   ========================================================================== */

.crm-subnav-btn {
  background: var(--bg-surface, #ffffff);
  border: 1px solid var(--border-strong, #cbd5e1);
  color: var(--text-secondary, #475569);
  font-weight: 500;
  border-radius: var(--radius-sm, 6px);
  padding: 6px 12px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.crm-subnav-btn:hover {
  background: var(--bg-subtle, #f8fafc);
  color: var(--text-primary, #0f172a);
}

.crm-subnav-btn.active {
  background: var(--primary, #0ea5e9);
  color: #ffffff;
  border-color: var(--primary, #0ea5e9);
  box-shadow: 0 1px 3px rgba(14, 165, 233, 0.3);
}

.crm-grid-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 16px;
}

.crm-card {
  background: var(--bg-surface, #ffffff);
  border: 1px solid var(--border-light, #e2e8f0);
  border-radius: var(--radius-md, 10px);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.crm-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.08);
  border-color: var(--border-strong, #cbd5e1);
}

.crm-card-closed {
  background: #f8fafc;
  opacity: 0.85;
  border-left: 4px solid #94a3b8;
}

.crm-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.crm-client-lockup {
  display: flex;
  align-items: center;
  gap: 10px;
}

.crm-client-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0284c7, #38bdf8);
  color: #ffffff;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
}

.crm-card-closed .crm-client-avatar {
  background: #94a3b8;
}

.crm-client-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary, #0f172a);
}

.crm-client-meta {
  font-size: 11.5px;
  color: var(--text-muted, #64748b);
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 2px;
}

.crm-dot-sep {
  color: #cbd5e1;
}

.crm-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  text-transform: capitalize;
  white-space: nowrap;
}

.badge-crm-en-proceso {
  background: #e0f2fe;
  color: #0369a1;
  border: 1px solid #bae6fd;
}

.badge-crm-seguimiento {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
}

.badge-crm-quote {
  background: #e0e7ff;
  color: #3730a3;
  border: 1px solid #c7d2fe;
}

.badge-crm-pago {
  background: #fae8ff;
  color: #86198f;
  border: 1px solid #f5d0fe;
}

.badge-crm-completado {
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #bbf7d0;
}

.badge-crm-cancelada {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.crm-card-body {
  flex: 1;
  margin-bottom: 14px;
}

.crm-reason-text {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary, #1e293b);
  margin-bottom: 6px;
  line-height: 1.4;
}

.crm-comment-text {
  font-size: 12px;
  color: var(--text-secondary, #475569);
  background: var(--bg-subtle, #f8fafc);
  padding: 6px 10px;
  border-radius: var(--radius-sm, 6px);
  margin-bottom: 10px;
  border-left: 2px solid var(--border-strong, #cbd5e1);
  font-style: italic;
}

.crm-card-props {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  background: var(--bg-subtle, #f8fafc);
  padding: 8px 10px;
  border-radius: var(--radius-sm, 6px);
  border: 1px solid var(--border-light, #e2e8f0);
}

.crm-prop-item {
  display: flex;
  flex-direction: column;
}

.crm-prop-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted, #64748b);
  font-weight: 600;
  margin-bottom: 2px;
}

.crm-prop-val {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-primary, #1e293b);
}

.crm-agent-tag {
  color: #0284c7;
}

.crm-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 10px;
  border-top: 1px solid var(--border-light, #f1f5f9);
}

.crm-footer-date {
  font-size: 11px;
  color: var(--text-muted, #64748b);
}

.crm-empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 48px 24px;
  background: var(--bg-surface, #ffffff);
  border: 1px dashed var(--border-strong, #cbd5e1);
  border-radius: var(--radius-md, 10px);
}

/* CRM Referencias Oficiales */
.crm-refs-container {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dashed var(--border-light, #f1f5f9);
}

.crm-refs-header {
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted, #64748b);
  margin-bottom: 6px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.crm-refs-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.crm-ref-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 8px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-size: 11.5px;
}

.crm-ref-left {
  display: flex;
  align-items: center;
  gap: 6px;
}

.crm-ref-code {
  font-family: var(--font-mono, monospace);
  font-weight: 700;
  color: #0f172a;
}

.crm-badge-tipo-quote {
  font-size: 9.5px;
  padding: 1.5px 5px;
  border-radius: 3px;
  background: #e0f2fe;
  color: #0369a1;
  font-weight: 700;
  text-transform: uppercase;
}

.crm-badge-tipo-reservation {
  font-size: 9.5px;
  padding: 1.5px 5px;
  border-radius: 3px;
  background: #fef3c7;
  color: #b45309;
  font-weight: 700;
  text-transform: uppercase;
}

.badge-concil-esperando_correo {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #cbd5e1;
}

.badge-concil-conciliado {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  background: #dcfce7;
  color: #15803d;
  font-weight: 600;
  border: 1px solid #86efac;
}

.badge-concil-conflicto {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  background: #fee2e2;
  color: #b91c1c;
  font-weight: 600;
  border: 1px solid #fca5a5;
}

.badge-concil-correo_sin_oportunidad {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  background: #ffedd5;
  color: #c2410c;
  border: 1px solid #fed7aa;
}

.crm-card-actions-group {
  display: flex;
  gap: 4px;
  align-items: center;
}
