/* =============================================================================
   EXXPOS ERP - SISTEMA DE DISEÑO ESTILO ODOO EMPRESARIAL
   Colores: Púrpura Odoo (#714B67), Acentos Teal (#008784), Slate y Bimonetario
   Archivo: public/css/odoo-theme.css
   ============================================================================= */

:root {
  --odoo-purple: #714B67;
  --odoo-purple-dark: #583a50;
  --odoo-purple-light: #8e6283;
  --odoo-teal: #008784;
  --odoo-teal-dark: #006a68;
  --bg-workspace: #f8fafc;
  --bg-surface: #ffffff;
  --bg-sidebar: #1e293b;
  --text-main: #1e293b;
  --text-muted: #64748b;
  --border-light: #e2e8f0;
  --border-dark: #cbd5e1;
  --success-color: #10b981;
  --warning-color: #f59e0b;
  --danger-color: #ef4444;
  --info-color: #0ea5e9;
  --topbar-height: 48px;
  --sidebar-width: 260px;
  --sidebar-collapsed-width: 64px;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg-workspace);
  color: var(--text-main);
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

/* =============================================================================
   A. BARRA SUPERIOR GLOBAL (NAVBAR SUPERIOR - 48PX)
   ============================================================================= */
.odoo-topbar {
  height: var(--topbar-height);
  background-color: var(--odoo-purple);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 100;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
  user-select: none;
}

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

.app-switcher-btn {
  background: transparent;
  border: none;
  color: #ffffff;
  cursor: pointer;
  padding: 6px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  transition: background-color 0.15s;
}

.app-switcher-btn:hover {
  background-color: rgba(255, 255, 255, 0.15);
}

.brand-container {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.brand-logo {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.brand-logo span {
  color: #38bdf8;
}

.brand-tag {
  font-size: 0.65rem;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.2);
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: 0.5px;
}

.topbar-module-crumb {
  font-size: 0.88rem;
  font-weight: 500;
  color: #f1f5f9;
  border-left: 1px solid rgba(255, 255, 255, 0.25);
  padding-left: 14px;
  margin-left: 6px;
}

.topbar-center {
  flex: 1;
  max-width: 540px;
  margin: 0 20px;
}

.global-search-box {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.global-search-box .search-icon {
  position: absolute;
  left: 12px;
  color: rgba(255, 255, 255, 0.6);
  pointer-events: none;
}

.global-search-box input {
  width: 100%;
  height: 32px;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 6px;
  padding: 0 60px 0 34px;
  color: #ffffff;
  font-size: 0.85rem;
  transition: all 0.2s ease;
}

.global-search-box input::placeholder {
  color: rgba(255, 255, 255, 0.65);
}

.global-search-box input:focus {
  background: #ffffff;
  color: var(--text-main);
  outline: none;
  border-color: #38bdf8;
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.3);
}

.global-search-box input:focus + .search-kbd {
  color: #94a3b8;
  border-color: #cbd5e1;
}

.search-kbd {
  position: absolute;
  right: 8px;
  font-size: 0.7rem;
  padding: 2px 6px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 4px;
  color: rgba(255, 255, 255, 0.7);
  pointer-events: none;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.bcv-ticker-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(15, 23, 42, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.bcv-ticker-badge:hover {
  background: rgba(15, 23, 42, 0.6);
  border-color: #38bdf8;
}

.ticker-pulse {
  width: 7px;
  height: 7px;
  background-color: #10b981;
  border-radius: 50%;
  box-shadow: 0 0 8px #10b981;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.8; }
}

.ticker-label {
  color: #cbd5e1;
}

.ticker-rate {
  color: #38bdf8;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
}

.ticker-curr {
  font-size: 0.7rem;
  color: #94a3b8;
}

.branch-selector {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.12);
  padding: 3px 8px;
  border-radius: 6px;
}

.branch-selector select {
  width: 180px;
  min-width: 0;
  background: transparent;
  border: none;
  color: #ffffff;
  font-size: 0.8rem;
  font-weight: 500;
  outline: none;
  cursor: pointer;
}

.branch-selector select option {
  background: #1e293b;
  color: #ffffff;
}

#locations-message {
  margin-top: 6px;
  font-size: 0.75rem;
  color: var(--text-muted, #64748b);
}

@media (max-width: 1400px) {
  .topbar-module-crumb, .user-profile-badge .user-meta { display: none; }
}

.contingency-bell-btn {
  position: relative;
  background: transparent;
  border: none;
  color: #ffffff;
  cursor: pointer;
  padding: 6px;
  border-radius: 4px;
}

.badge-count {
  position: absolute;
  top: 0;
  right: 0;
  background-color: var(--warning-color);
  color: #000000;
  font-size: 0.65rem;
  font-weight: 800;
  padding: 1px 5px;
  border-radius: 10px;
}

.user-profile-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 6px;
}

.user-profile-badge:hover {
  background: rgba(255, 255, 255, 0.1);
}

.avatar-circle {
  width: 28px;
  height: 28px;
  background: #0284c7;
  color: #ffffff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
}

.user-meta {
  display: flex;
  flex-direction: column;
}

.user-name {
  font-size: 0.78rem;
  font-weight: 600;
}

.user-role {
  font-size: 0.65rem;
  color: #cbd5e1;
}

/* =============================================================================
   ESTRUCTURA PRINCIPAL Y SIDEBAR (260px -> 64px)
   ============================================================================= */
.odoo-main-container,
.odoo-body-wrapper {
  display: flex !important;
  flex-direction: row !important;
  flex: 1;
  height: calc(100vh - var(--topbar-height));
  max-height: calc(100vh - var(--topbar-height));
  overflow: hidden;
  position: relative;
  width: 100vw;
  box-sizing: border-box;
}

.odoo-sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  max-width: var(--sidebar-width);
  background-color: var(--bg-sidebar);
  color: #cbd5e1;
  display: flex;
  flex-direction: column;
  border-right: 1px solid #334155;
  transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  overflow-y: auto;
  user-select: none;
  flex-shrink: 0;
  height: 100%;
}

.sidebar-scrollable {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 8px 0 24px 0;
}

.odoo-content-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  background-color: var(--bg-workspace);
  position: relative;
  padding: 16px 24px 80px 24px;
  min-width: 0;
  box-sizing: border-box;
}

.odoo-sidebar.collapsed {
  width: var(--sidebar-collapsed-width);
}

.odoo-sidebar.collapsed .sidebar-company-title,
.odoo-sidebar.collapsed .nav-text,
.odoo-sidebar.collapsed .nav-shortcut,
.odoo-sidebar.collapsed .nav-badge,
.odoo-sidebar.collapsed .section-title {
  display: none !important;
}

.odoo-sidebar.collapsed .nav-link {
  justify-content: center;
  padding: 10px 0;
}

.sidebar-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid #334155;
}

.sidebar-toggle-btn {
  background: transparent;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
}

.sidebar-toggle-btn:hover {
  color: #ffffff;
  background-color: #334155;
}

.sidebar-company-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: #94a3b8;
  letter-spacing: 0.5px;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  padding: 8px 0;
}

.nav-section {
  margin-bottom: 12px;
}

.section-title {
  padding: 8px 16px 4px 16px;
  font-size: 0.68rem;
  font-weight: 700;
  color: #64748b;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  color: #94a3b8;
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 500;
  transition: all 0.15s;
  position: relative;
}

.nav-link:hover {
  background-color: rgba(255, 255, 255, 0.05);
  color: #ffffff;
}

.nav-link.active {
  background-color: rgba(113, 75, 103, 0.35);
  color: #ffffff;
  border-left: 3px solid #38bdf8;
  font-weight: 600;
}

.nav-icon {
  font-size: 1rem;
  width: 20px;
  text-align: center;
}

.nav-text {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-shortcut {
  font-size: 0.68rem;
  background: #334155;
  color: #94a3b8;
  padding: 1px 5px;
  border-radius: 3px;
  font-family: monospace;
}

.nav-badge {
  font-size: 0.7rem;
  background: #0284c7;
  color: #ffffff;
  padding: 1px 6px;
  border-radius: 10px;
  font-weight: 700;
}

/* =============================================================================
   C. MAIN WORKSPACE Y CONTROL PANEL ODOO
   ============================================================================= */
.odoo-main-workspace {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background-color: var(--bg-workspace);
  position: relative;
}

.odoo-control-panel {
  min-height: 48px;
  background: #ffffff;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 18px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
  z-index: 10;
  flex-wrap: wrap;
  gap: 10px;
}

.control-panel-left {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.action-buttons-group,
.fiscal-actions-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.control-panel-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* Statusbar tipo Odoo con flechas de flujo */
.odoo-statusbar {
  display: flex;
  align-items: center;
  background: #f1f5f9;
  border-radius: 20px;
  padding: 2px 4px;
  border: 1px solid var(--border-light);
}

.status-step {
  font-size: 0.74rem;
  font-weight: 600;
  padding: 4px 10px;
  color: var(--text-muted);
  border-radius: 16px;
  cursor: default;
}

.status-step.active {
  background: var(--odoo-purple);
  color: #ffffff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.status-arrow {
  width: 0;
  height: 0;
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  border-left: 5px solid #cbd5e1;
  margin: 0 2px;
}

/* Conmutador de Vistas */
.view-switchers {
  display: flex;
  border: 1px solid var(--border-light);
  border-radius: 6px;
  overflow: hidden;
}

.view-btn {
  background: #ffffff;
  border: none;
  padding: 6px 8px;
  cursor: pointer;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  transition: all 0.15s;
}

.view-btn:hover {
  background: #f1f5f9;
  color: var(--text-main);
}

.view-btn.active {
  background: #e2e8f0;
  color: var(--odoo-purple);
}

/* Botones Estándar Odoo */
.btn {
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 5px;
  border: 1px solid transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
  user-select: none;
}

.btn-sm {
  font-size: 0.74rem;
  padding: 4px 8px;
}

.btn-lg {
  font-size: 0.95rem;
  padding: 10px 20px;
}

.btn-primary {
  background-color: var(--odoo-purple);
  color: #ffffff;
  border-color: var(--odoo-purple-dark);
}

.btn-primary:hover {
  background-color: var(--odoo-purple-dark);
}

.btn-secondary {
  background-color: #ffffff;
  color: var(--text-main);
  border-color: var(--border-dark);
}

.btn-secondary:hover {
  background-color: #f8fafc;
}

.btn-discard {
  background: transparent;
  color: var(--text-muted);
  border: none;
}

.btn-discard:hover {
  color: var(--danger-color);
  background: rgba(239, 68, 68, 0.08);
}

.btn-outline {
  background: #ffffff;
  color: var(--odoo-purple);
  border-color: var(--odoo-purple);
}

.btn-outline:hover {
  background: rgba(113, 75, 103, 0.08);
}

.btn-hka {
  background-color: #0284c7;
  color: #ffffff;
  border-color: #0369a1;
}

.btn-hka:hover {
  background-color: #0369a1;
}

.btn-success {
  background-color: var(--success-color);
  color: #ffffff;
}

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

/* =============================================================================
   D. ÁREA SCROLL Y PANELES DE VISTA
   ============================================================================= */
.workspace-content-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px 90px 20px; /* Margen inferior para sticky footer */
}

.view-pane {
  display: none;
  width: 100%;
}

.view-pane.active {
  display: block;
  width: 100%;
  animation: fadeInPane 0.15s ease-in-out;
}

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

/* Sheet tipo Form View Odoo */
.odoo-sheet {
  background: #ffffff;
  border-radius: 8px;
  border: 1px solid var(--border-light);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  padding: 24px;
  max-width: 1400px;
  margin: 0 auto;
}

.sheet-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 18px;
}

.sheet-kicker {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--odoo-purple);
  letter-spacing: 0.5px;
}

.sheet-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-main);
  margin-top: 2px;
}

.fiscal-channel-toggle-box {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.toggle-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
}

.channel-pill-selector {
  display: flex;
  background: #f1f5f9;
  padding: 3px;
  border-radius: 6px;
  border: 1px solid var(--border-light);
}

.channel-option input {
  display: none;
}

.channel-option .pill-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 4px;
  cursor: pointer;
  color: var(--text-muted);
  transition: all 0.15s;
}

.channel-option input:checked + .pill-btn {
  background: #ffffff;
  color: var(--text-main);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.channel-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.hka-dot { background-color: #0284c7; }
.forma-dot { background-color: #10b981; }

/* Form Grid */
.odoo-form-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px 18px;
  margin-bottom: 22px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.form-group.span-2 { grid-column: span 2; }
.form-group.span-3 { grid-column: span 3; }
.form-group.span-4 { grid-column: span 4; }

.form-group label {
  font-size: 0.75rem;
  font-weight: 600;
  color: #475569;
}

.form-control {
  height: 32px;
  border: 1px solid var(--border-dark);
  border-radius: 5px;
  padding: 0 10px;
  font-size: 0.82rem;
  color: var(--text-main);
  background: #ffffff;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.form-control:focus {
  outline: none;
  border-color: var(--odoo-purple);
  box-shadow: 0 0 0 2px rgba(113, 75, 103, 0.15);
}

.form-control.readonly-field {
  background-color: #f8fafc;
  color: #64748b;
  cursor: not-allowed;
}

/* Grilla Editable Densa Odoo */
.sheet-table-section {
  margin-top: 14px;
}

.table-header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.table-header-bar h3 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
}

.editable-table-container {
  border: 1px solid var(--border-light);
  border-radius: 6px;
  overflow-x: auto;
}

.odoo-dense-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
  background: #ffffff;
}

.odoo-dense-table th {
  background-color: #f1f5f9;
  color: #475569;
  font-weight: 700;
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-dark);
  border-right: 1px solid var(--border-light);
}

.odoo-dense-table td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--border-light);
  border-right: 1px solid var(--border-light);
  vertical-align: middle;
}

.odoo-dense-table input,
.odoo-dense-table select {
  width: 100%;
  height: 28px;
  font-size: 0.8rem;
  border: 1px solid transparent;
  border-radius: 4px;
  padding: 0 4px;
  background: transparent;
}

.odoo-dense-table tr:hover td {
  background-color: #fdfaf0;
}

.odoo-dense-table input:focus,
.odoo-dense-table select:focus {
  background: #ffffff;
  border-color: var(--odoo-purple);
  outline: none;
}

.btn-remove-line {
  background: transparent;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  font-size: 1.1rem;
  font-weight: bold;
  padding: 0 4px;
}

.btn-remove-line:hover {
  color: var(--danger-color);
}

/* =============================================================================
   BARRA INFERIOR FIJA DE TOTALES (STICKY TOTALS BAR)
   ============================================================================= */
.odoo-sticky-totals {
  position: fixed;
  bottom: 0;
  left: var(--sidebar-width);
  right: 0;
  height: 70px;
  background: #ffffff;
  border-top: 1px solid var(--border-dark);
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.06);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 50;
  transition: left 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.odoo-sidebar.collapsed ~ .odoo-main-workspace .odoo-sticky-totals {
  left: var(--sidebar-collapsed-width);
}

.totals-col-summary {
  display: flex;
  gap: 20px;
  font-size: 0.8rem;
}

.summary-line {
  display: flex;
  flex-direction: column;
}

.summary-line .lbl {
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.72rem;
}

.summary-line .val {
  font-weight: 700;
  color: var(--text-main);
  font-family: 'JetBrains Mono', monospace;
}

.totals-col-highlight {
  display: flex;
  gap: 24px;
  align-items: center;
}

.grand-total-usd-box,
.grand-total-ves-box {
  display: flex;
  flex-direction: column;
  text-align: right;
}

.grand-lbl {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.grand-total-usd-box .grand-val {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--odoo-purple);
  font-family: 'JetBrains Mono', monospace;
}

.grand-total-ves-box .grand-val {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--odoo-teal);
  font-family: 'JetBrains Mono', monospace;
}

.grand-sub {
  font-size: 0.68rem;
  color: #64748b;
  font-weight: 600;
}

/* =============================================================================
   LIST VIEW, TABLAS Y CARDS
   ============================================================================= */
.list-view-card {
  background: #ffffff;
  border-radius: 8px;
  border: 1px solid var(--border-light);
  padding: 16px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.list-filters-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.filter-pills {
  display: flex;
  gap: 6px;
}

.filter-pill {
  background: #f1f5f9;
  border: 1px solid var(--border-light);
  padding: 4px 10px;
  border-radius: 14px;
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
}

.filter-pill.active {
  background: var(--odoo-purple);
  color: #ffffff;
  border-color: var(--odoo-purple-dark);
}

.filter-pill.warn {
  border-color: var(--warning-color);
  color: #b45309;
}

.odoo-list-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.odoo-list-table th {
  background: #f8fafc;
  color: #475569;
  font-weight: 700;
  padding: 10px 12px;
  border-bottom: 2px solid var(--border-light);
  text-align: left;
}

.odoo-list-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-main);
}

.odoo-list-table tr:hover td {
  background-color: #f8fafc;
}

/* Badges de Estado */
.badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
}

.badge-success { background: #dcfce7; color: #15803d; }
.badge-warning { background: #fef3c7; color: #b45309; }
.badge-danger { background: #fee2e2; color: #b91c1c; }
.badge-info { background: #e0f2fe; color: #0369a1; }
.badge-secondary { background: #f1f5f9; color: #475569; }

/* KPI Cards */
.kpi-cards-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.kpi-card {
  background: #f8fafc;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 16px;
  display: flex;
  flex-direction: column;
}

.kpi-title {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
}

.kpi-value {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-main);
  font-family: 'JetBrains Mono', monospace;
  margin: 4px 0;
}

.kpi-sub {
  font-size: 0.72rem;
  color: #64748b;
}

/* Modales */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(2px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-backdrop.open {
  display: flex;
}

.modal-dialog {
  background: #ffffff;
  border-radius: 10px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2);
  width: 90%;
  max-width: 600px;
  overflow: hidden;
}

.modal-dialog.modal-lg { max-width: 820px; }
.modal-dialog.modal-xl { max-width: 1000px; }

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

.modal-header h3 {
  font-size: 1.15rem;
  font-weight: 700;
}

.modal-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.close-modal-btn {
  background: transparent;
  border: none;
  font-size: 1.5rem;
  color: #94a3b8;
  cursor: pointer;
}

.close-modal-btn:hover { color: var(--danger-color); }

.modal-body {
  padding: 20px;
  max-height: 75vh;
  overflow-y: auto;
}

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

/* Cobro Mixto */
.payment-invoice-banner {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  background: #f1f5f9;
  padding: 12px;
  border-radius: 6px;
  font-size: 0.8rem;
}

.payment-methods-box {
  margin-top: 16px;
  border: 1px solid var(--border-light);
  border-radius: 6px;
  padding: 12px;
}

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

.fx-preview-box {
  margin-top: 16px;
  background: #fefce8;
  border: 1px solid #fef08a;
  border-radius: 6px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.82rem;
}

.fx-line {
  display: flex;
  justify-content: space-between;
}

.fx-line.fx-result {
  font-weight: bold;
  border-top: 1px dashed #fde047;
  padding-top: 6px;
}

/* Waffle App Switcher */
.app-switcher-overlay {
  position: fixed;
  top: var(--topbar-height);
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(4px);
  display: none;
  z-index: 999;
  justify-content: center;
  align-items: flex-start;
  padding-top: 40px;
}

.app-switcher-overlay.open {
  display: flex;
}

.app-switcher-dialog {
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  width: 90%;
  max-width: 700px;
  padding: 24px;
}

.app-switcher-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border-light);
  padding-bottom: 12px;
}

.apps-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.app-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 18px 12px;
  border-radius: 8px;
  border: 1px solid var(--border-light);
  cursor: pointer;
  transition: all 0.2s;
}

.app-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  border-color: var(--odoo-purple);
}

.app-card.active {
  background: rgba(113, 75, 103, 0.05);
  border-color: var(--odoo-purple);
}

.app-icon {
  font-size: 2.2rem;
  margin-bottom: 8px;
}

.app-name {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-main);
}

.app-desc {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.config-sections-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  margin-top: 16px;
}

.config-box {
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 18px;
  background: #f8fafc;
}

.config-box h3 {
  font-size: 0.95rem;
  margin-bottom: 12px;
  color: var(--odoo-purple);
}

.aging-cards-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-top: 16px;
}

/* =============================================================================
   E. SUB-PESTAÑAS (TABS) Y REPORTES FINANCIEROS / FISCALES
   ============================================================================= */
.sub-tabs-bar {
  display: flex;
  gap: 8px;
  border-bottom: 2px solid var(--border-light);
  margin-bottom: 18px;
  padding-bottom: 2px;
}

.sub-tab-btn {
  background: none;
  border: none;
  padding: 8px 16px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -4px;
  transition: all 0.2s;
  border-radius: 4px 4px 0 0;
}

.sub-tab-btn:hover {
  color: var(--odoo-purple);
  background: rgba(113, 75, 103, 0.04);
}

.sub-tab-btn.active {
  color: var(--odoo-purple);
  border-bottom-color: var(--odoo-purple);
  font-weight: 700;
  background: rgba(113, 75, 103, 0.08);
}

.kpi-cards-grid-5 {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}

.kpi-cards-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 18px;
}

.financial-table {
  width: 100%;
  border-collapse: collapse;
}

.financial-table th, .financial-table td {
  padding: 8px 12px;
  font-size: 0.85rem;
  border-bottom: 1px solid var(--border-light);
}

.financial-table .row-category {
  background: #f1f5f9;
  font-weight: 700;
  color: var(--odoo-purple);
  font-size: 0.9rem;
}

.financial-table .row-subtotal {
  background: #f8fafc;
  font-weight: 600;
  border-top: 1px solid var(--border-dark);
}

.financial-table .row-grand-total {
  background: #e2e8f0;
  font-weight: 800;
  font-size: 0.95rem;
  border-top: 2px solid var(--odoo-purple);
  border-bottom: 2px solid var(--odoo-purple);
}

.balance-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 700;
}

.balance-status-badge.balanced {
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #86efac;
}

.balance-status-badge.unbalanced {
  background: #fee2e2;
  color: #b91c1c;
  border: 1px solid #fca5a5;
}

.hka-status-pill {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
}

.hka-status-pill.TRANSMITIDO {
  background: #dcfce7;
  color: #166534;
}

.hka-status-pill.CONTINGENCIA {
  background: #fef3c7;
  color: #92400e;
  animation: pulse-warn 2s infinite;
}

.hka-status-pill.RECHAZADO {
  background: #fee2e2;
  color: #991b1b;
}

@keyframes pulse-warn {
  0% { opacity: 1; }
  50% { opacity: 0.6; }
  100% { opacity: 1; }
}

/* =============================================================================
   ALERTAS Y NOTIFICACIONES DE FORMULARIO
   ============================================================================= */
.alert {
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  display: block;
  margin-bottom: 12px;
  line-height: 1.4;
}

.alert-danger {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #f87171;
}

.alert-warning {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fcd34d;
}

.alert-success {
  background: #dcfce7;
  color: #166534;
  border: 1px solid #86efac;
}
/* La visibilidad funcional prevalece sobre display:inline-flex de los botones. */
#pane-customer-credits [hidden] { display: none !important; }
#cc-form label { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
#cc-form input, #cc-form select { width: 100%; min-width: 0; box-sizing: border-box; }

/* Formulario de merma: evitar que los nombres de lote/almacén desborden el modal. */
#modal-waste-destruction .odoo-form-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
#modal-waste-destruction .form-group { min-width: 0; }
#modal-waste-destruction .form-control { width: 100%; min-width: 0; box-sizing: border-box; }
#modal-waste-destruction textarea.form-control { min-height: 64px; padding: 8px 10px; }
@media (max-width: 600px) {
  #modal-waste-destruction .odoo-form-grid { grid-template-columns: minmax(0,1fr); }
  #modal-waste-destruction .form-group.span-2 { grid-column: span 1; }
}

#modal-lot .odoo-form-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
#modal-lot .form-group { min-width: 0; }
#modal-lot .span-4, #modal-lot fieldset { grid-column: 1 / -1; min-width: 0; }
#modal-lot .form-control { width:100%; min-width:0; box-sizing:border-box; }
#modal-lot textarea { min-height:64px; padding:8px; }
#modal-lot fieldset:disabled { opacity:.65; }
@media(max-width:600px){
  #modal-lot .odoo-form-grid { grid-template-columns:minmax(0,1fr); }
  #modal-lot .form-group.span-2 { grid-column:span 1; }
}
.wms-cancellation-panel { margin: 16px 0; padding: 16px; border: 1px solid #d1d5db; border-radius: 8px; }
.wms-cancellation-panel summary { cursor: pointer; font-weight: 700; }
.wms-cancellation-panel p { margin: 10px 0; overflow-wrap: anywhere; }
#wms-cancellation-form { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
#wms-cancellation-form select, #wms-cancellation-form textarea { width: 100%; min-width: 0; padding: 9px; border: 1px solid #cbd5e1; border-radius: 5px; font: inherit; }

.receipt-registration-panel { margin: 16px 0; padding: 16px; border: 1px solid #cbd5e1; border-radius: 8px; }
.receipt-registration-panel summary { font-weight: 700; cursor: pointer; }
.receipt-registration-panel p, #receipt-command-status { margin: 12px 0; overflow-wrap: anywhere; }
.receipt-form-fields { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; margin: 16px 0; }
.receipt-form-fields label { display: flex; flex-direction: column; gap: 6px; }
#receipt-registration-form input, #receipt-registration-form select { width: 100%; min-width: 95px; padding: 8px; border: 1px solid #cbd5e1; border-radius: 4px; font: inherit; }
#receipt-items td:first-child { min-width: 240px; }
#receipt-items td:nth-child(2), #receipt-items td:nth-child(3) { min-width: 170px; }
#receipt-detail { margin: 16px 0; overflow-wrap: anywhere; }
@media(max-width:720px) { .receipt-form-fields { grid-template-columns: minmax(0,1fr); } }

#purchase-return-form { display: grid; gap: 14px; }
#purchase-return-form .form-row { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 14px; }
#purchase-return-form label { display: flex; flex-direction: column; gap: 6px; min-width: 0; font-weight: 600; }
#purchase-return-form input, #purchase-return-form textarea { width: 100%; box-sizing: border-box; border: 1px solid #cbd5e1; border-radius: 4px; padding: 9px; font: inherit; font-weight: 400; }
#purchase-return-form textarea { min-height: 80px; resize: vertical; }
#purchase-return-submit { justify-self: start; }
@media(max-width: 800px) { #purchase-return-form .form-row { grid-template-columns: minmax(0,1fr); } }

/* Supplier credit forms must contain long invoice and bank labels within the grid. */
#vc-form { min-width: 0; margin: 0; }
#vc-form label { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
#vc-form label[hidden] { display: none; }
#vc-form input, #vc-form select { width: 100%; max-width: 100%; min-width: 0; box-sizing: border-box; }
#vc-title { max-width: 100%; overflow-wrap: anywhere; }

#vc-reversal-form { min-width: 0; margin: 0; }
#vc-reversal-form label { display: flex; flex-direction: column; gap: 6px; }
#vc-reversal-form textarea { width: 100%; box-sizing: border-box; }
#pane-vendor-credits [hidden] { display: none !important; }

#pane-bank-corrections [hidden] { display: none !important; }
#pane-bank-corrections label { display:flex; flex-direction:column; gap:6px; min-width:0; margin-bottom:12px; }
#pane-bank-corrections input, #pane-bank-corrections textarea, #pane-bank-corrections select { width:100%; max-width:100%; min-width:0; box-sizing:border-box; }
#bc-form { min-width:0; margin:0; }

#pane-bank-statements [hidden] { display:none !important; }
#bi-form > label { display:block; margin-bottom:14px; max-width:720px; }
#bi-rows input { min-width:125px; width:100%; }
#bi-rows input[data-field="description"] { min-width:210px; }
#pane-bank-statements .table-responsive { overflow:auto; }
#bi-form > label > .form-control { display:block; width:100%; margin-top:5px; }
#bi-rows input[data-field="external_line_id"] { min-width:175px; }
#bi-form { min-width:0; max-width:100%; box-sizing:border-box; }
#pane-bank-statements .list-view-card { min-width:0; }

#pane-bank-matching [hidden] { display:none !important; }
#bm-form { min-width:0; max-width:100%; box-sizing:border-box; }
#bm-form > label { display:block; margin-bottom:14px; max-width:720px; }
#bm-form > label > .form-control { display:block; width:100%; margin-top:5px; }
#pane-bank-matching .table-responsive { overflow:auto; }
#bm-pairs td { overflow-wrap:anywhere; }

/* Reviewed customer collection, including small screens. */
#modal-mixed-payment fieldset { min-width:0; border:0; padding:0; }
#modal-mixed-payment .cp-fields { display:grid; grid-template-columns:repeat(auto-fit,minmax(180px,1fr)); gap:12px; }
#modal-mixed-payment .cp-table { max-width:100%; overflow-x:auto; margin:16px 0; }
#modal-mixed-payment .cp-table table { min-width:800px; width:100%; }
#modal-mixed-payment .cp-table input { min-width:95px; }
#modal-mixed-payment .cp-table select { min-width:165px; }
#modal-mixed-payment [hidden] { display:none !important; }
#cp-message { white-space:pre-wrap; }
#cp-proposal { margin-top:16px; padding:12px; background:#f1f5f9; border-radius:6px; }
#modal-mixed-payment .cp-fields label, #modal-mixed-payment #cp-form > label { display:flex; flex-direction:column; gap:4px; }
#modal-mixed-payment .cp-fields input, #modal-mixed-payment #cp-notes { width:100%; }
#modal-mixed-payment .cp-table table { table-layout:fixed; min-width:900px; }
#modal-mixed-payment .cp-table td, #modal-mixed-payment .cp-table th { padding:6px 4px; text-align:left; }
#modal-mixed-payment .cp-table :is(input,select) { width:100%; min-width:0; }
#modal-mixed-payment .cp-table th:nth-child(1) { width:18%; }
#modal-mixed-payment .cp-table th:nth-child(2) { width:26%; }
#modal-mixed-payment .cp-table th:nth-child(3), #modal-mixed-payment .cp-table th:nth-child(4) { width:12%; }
#modal-mixed-payment .cp-table th:nth-child(5) { width:22%; }
#modal-mixed-payment .cp-table th:nth-child(6) { width:10%; }

#cp-proposal:empty { display:none; }
#modal-mixed-payment button:disabled { opacity:.55; cursor:not-allowed; }
#pane-collection-tax-rules [hidden] { display: none !important; }

/* Administración de reglas: campos legibles y evidencia completa. */
#pane-collection-tax-rules label { display: grid; gap: 6px; margin-bottom: 14px; font-size: 14px; font-weight: 600; }
#pane-collection-tax-rules .form-control { width: 100%; min-width: 0; box-sizing: border-box; padding: 9px 10px; }
#pane-collection-tax-rules #ctr-creation { display: grid; grid-template-columns: minmax(200px, 2fr) minmax(155px, 1fr) minmax(140px, 1fr); gap: 16px; }
#pane-collection-tax-rules #ctr-message { margin-top: 12px; overflow-wrap: anywhere; }
#pane-collection-tax-rules #ctr-title { margin-bottom: 16px; }
#pane-collection-tax-rules button:disabled { opacity: .5; cursor: not-allowed; }
#pane-collection-tax-rules #ctr-quote:empty { display: none; }
@media (max-width: 900px) { #pane-collection-tax-rules #ctr-creation { grid-template-columns: 1fr; gap: 0; } }

#pane-bank-ledger #bl-form { display: flex; gap: 16px; flex-wrap: wrap; align-items: end; }
#pane-bank-ledger label { display: grid; gap: 6px; font-size: 14px; font-weight: 600; }
#pane-bank-ledger label:first-child { flex: 1 1 300px; }
#pane-bank-ledger .form-control { padding: 9px 10px; min-width: 0; width: 100%; box-sizing: border-box; }
#pane-bank-ledger #bl-blockers { margin: 14px 0 0 18px; line-height: 1.6; }
#pane-bank-ledger #bl-rows td { white-space: normal; overflow-wrap: anywhere; }
#pane-bank-ledger button:disabled { opacity: .5; cursor: not-allowed; }
/* Pending recovery is an action only when a durable opening is actually pending. */
#pane-party-openings [hidden] { display: none !important; }
#pane-party-openings label { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
#pane-party-openings .form-control { width: 100%; min-width: 0; box-sizing: border-box; }
#pane-party-openings pre { margin: 16px 0; line-height: 1.5; }
#pane-party-openings table { width: 100%; border-collapse: collapse; }
#pane-party-openings th, #pane-party-openings td { padding: 10px 8px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--border-color, #e2e8f0); }
#pane-party-openings td { overflow-wrap: anywhere; }
#pane-party-openings td:nth-child(4), #pane-party-openings td:nth-child(5),
#pane-party-openings td:nth-child(6), #pane-party-openings td:nth-child(7),
#pane-party-openings td:nth-child(8) { white-space: nowrap; overflow-wrap: normal; }
#pane-party-openings button:disabled { opacity: .5; cursor: not-allowed; }

/* Consolidated obligations: scroll tables inside the pane, keep amounts legible. */
#pane-receivables-aging [hidden] { display: none !important; }
#aging-filters label { display: flex; flex-direction: column; gap: 6px; min-width: 0; max-width: 100%; }
#aging-filters label:last-child { flex-direction: row; align-items: center; }
#aging-filters select { width: 100%; max-width: 380px; }
#pane-receivables-aging p { margin: 10px 0; line-height: 1.45; }
#pane-receivables-aging table { width: 100%; border-collapse: collapse; font-size: 14px; }
#pane-receivables-aging th, #pane-receivables-aging td { padding: 10px 8px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--border-color, #e2e8f0); }
#pane-receivables-aging th { background: var(--bg-light, #f8fafc); }
#aging-rows td:nth-child(3), #aging-rows td:nth-child(4), #aging-rows td:nth-child(5),
#aging-trace-rows td:nth-child(1), #aging-trace-rows td:nth-child(2), #aging-trace-rows td:nth-child(4), #aging-trace-rows td:nth-child(5) { white-space: nowrap; }
#aging-trace-rows td:nth-child(6) { overflow-wrap: anywhere; }
#pane-receivables-aging button:disabled { opacity: .5; cursor: not-allowed; }

#por-rows td:nth-child(2) { min-width: 200px; }
#por-rows td:nth-child(3) { min-width: 170px; }
#por-rows td:nth-child(9) { min-width: 130px; }
#por-rows td:nth-child(10) { min-width: 140px; }
#por-rows td:nth-child(11) { min-width: 180px; }
#por-rows td:nth-child(11) button { display: block; margin-bottom: 6px; }

/* Documented reference rates and fiscal configuration visibility. */
#pane-config-bcv [hidden], #pane-config [hidden] { display: none !important; }
#bcv-rate-display { white-space: nowrap; }
#rate-form { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; padding: 16px; margin: 12px 0; border: 1px solid #d9dfe8; border-radius: 8px; }
#rate-form legend { padding: 0 6px; font-weight: 600; }
#rate-form .form-group { margin: 0; }
#rate-form .rate-source-field { grid-column: 1 / -1; }
#rate-form .form-control { width: 100%; }
#rate-publish { justify-self: start; }
#rate-history td { white-space: normal; overflow-wrap: anywhere; max-width: 360px; }
#rate-history td:nth-child(1), #rate-history td:nth-child(2), #rate-history td:nth-child(6) { white-space: nowrap; overflow-wrap: normal; }
#rate-history td:nth-child(2) { font-variant-numeric: tabular-nums; }
#pane-config-bcv p { margin: 10px 0; }
@media (max-width: 640px) { #rate-form { grid-template-columns: minmax(0,1fr); } }

/* Review and recovery of ordinary supplier payments. */
#vp-panel [hidden] { display: none !important; }
#vp-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
#vp-form label { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
#vp-form .form-control { width: 100%; box-sizing: border-box; }
#vp-review { grid-column: 1 / -1; }
#vp-quote { margin: 16px 0; line-height: 1.5; }
@media (max-width: 700px) { #vp-form { grid-template-columns: 1fr; } }

/* =============================================================================
   SUB-NAVEGACIÓN HORIZONTAL CONTEXTUAL (Estilo WMS-cero / Odoo Enterprise)
   ============================================================================= */
.odoo-subnavbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #ffffff;
  border-bottom: 1px solid #cbd5e1;
  padding: 10px 20px;
  margin: -16px -24px 18px -24px;
  position: sticky;
  top: -16px;
  z-index: 30;
  backdrop-filter: blur(10px);
  background-color: rgba(255, 255, 255, 0.95);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.03);
  flex-wrap: wrap;
  gap: 12px;
}

.subnavbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.subnavbar-crumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  font-weight: 800;
  color: #1e293b;
}

.subnavbar-crumbs .parent-module-icon {
  font-size: 18px;
}

.subnavbar-crumbs .crumb-divider {
  color: #94a3b8;
  font-weight: 400;
}

.subnavbar-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.subnavbar-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12.5px;
  font-weight: 700;
  color: #475569;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  cursor: pointer;
  transition: all 0.15s ease-in-out;
  text-decoration: none;
  white-space: nowrap;
}

.subnavbar-pill:hover {
  background: #e2e8f0;
  color: #0f172a;
  border-color: #cbd5e1;
}

.subnavbar-pill.active {
  background: #714B67;
  color: #ffffff;
  border-color: #593b51;
  box-shadow: 0 2px 5px rgba(113, 75, 103, 0.3);
}

.subnavbar-pill .pill-badge {
  font-size: 10.5px;
  padding: 1px 6px;
  border-radius: 10px;
  font-weight: 800;
  background: rgba(0, 0, 0, 0.15);
  color: inherit;
}

.subnavbar-pill.active .pill-badge {
  background: rgba(255, 255, 255, 0.25);
  color: #ffffff;
}

/* =============================================================================
   SWITCH DE MODO OPERATIVO (Planta vs Supervisión)
   ============================================================================= */
.operating-mode-container {
  padding: 8px 12px;
  background: rgba(15, 23, 42, 0.85);
  border-bottom: 1px solid #334155;
  display: flex;
  gap: 6px;
}

.mode-toggle-btn {
  flex: 1;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 800;
  border: 1px solid transparent;
  background: transparent;
  color: #94a3b8;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  transition: all 0.2s;
}

.mode-toggle-btn:hover {
  color: #f8fafc;
  background: rgba(255, 255, 255, 0.05);
}

.mode-toggle-btn.active {
  background: #38bdf8;
  color: #0f172a;
  box-shadow: 0 1px 4px rgba(56, 189, 248, 0.4);
}

/* =============================================================================
   ESCÁNER UNIVERSAL EN TOPBAR (Ctrl + K)
   ============================================================================= */
.topbar-scan-wrapper {
  position: relative;
  width: 100%;
  max-width: 460px;
}

.topbar-scan-input {
  width: 100%;
  height: 36px;
  padding: 0 75px 0 34px;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 8px;
  color: #ffffff;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-sizing: border-box;
}

.topbar-scan-input::placeholder {
  color: rgba(255, 255, 255, 0.7);
  font-weight: 500;
}

.topbar-scan-input:focus {
  background: #ffffff;
  color: #0f172a;
  outline: none;
  border-color: #38bdf8;
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.4);
}

.topbar-scan-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: rgba(255, 255, 255, 0.7);
  pointer-events: none;
  font-size: 14px;
}

.topbar-scan-input:focus ~ .topbar-scan-icon {
  color: #64748b;
}

.topbar-scan-badge {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0, 0, 0, 0.25);
  color: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.35);
  padding: 2px 7px;
  border-radius: 5px;
  font-size: 10.5px;
  font-weight: 800;
  font-family: monospace;
  pointer-events: none;
}

.topbar-scan-input:focus ~ .topbar-scan-badge {
  background: #e2e8f0;
  color: #334155;
  border-color: #cbd5e1;
}

/* =============================================================================
   VISTA: TORRE TV DE DESPACHO & PANTALLA DE PLANTA
   ============================================================================= */
.tower-tv-wrapper {
  background: #090d16;
  color: #f8fafc;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.5);
  border: 1px solid #1e293b;
  min-height: calc(100vh - 140px);
}

.tower-tv-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #1e293b;
  padding-bottom: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 14px;
}

.tower-tv-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.tower-tv-title h1 {
  font-size: 24px;
  font-weight: 900;
  color: #ffffff;
  margin: 0;
  letter-spacing: -0.5px;
}

.tower-tv-clock {
  font-family: 'JetBrains Mono', monospace;
  font-size: 26px;
  font-weight: 800;
  color: #38bdf8;
  background: #0f172a;
  padding: 4px 14px;
  border-radius: 8px;
  border: 1px solid #334155;
  letter-spacing: 1px;
}

.tower-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 22px;
}

.tower-kpi-card {
  background: #0f172a;
  border: 1px solid #1e293b;
  border-radius: 10px;
  padding: 16px 18px;
}

.tower-kpi-label {
  font-size: 11px;
  font-weight: 800;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.tower-kpi-val {
  font-size: 32px;
  font-weight: 900;
  margin-top: 4px;
  letter-spacing: -1px;
}

.tower-main-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.tower-panel {
  background: #0f172a;
  border: 1px solid #1e293b;
  border-radius: 10px;
  padding: 18px;
}

.tower-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #334155;
  padding-bottom: 10px;
  margin-bottom: 14px;
}

.tower-panel-header h3 {
  font-size: 15px;
  font-weight: 800;
  color: #f1f5f9;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.tower-order-card {
  background: #1e293b;
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 10px;
  border-left: 4px solid #38bdf8;
  transition: transform 0.15s;
}

.tower-order-card:hover {
  transform: translateX(4px);
}

.tower-order-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 6px;
}

.tower-order-num {
  font-family: monospace;
  font-weight: 900;
  font-size: 14px;
  color: #38bdf8;
}

.tower-order-dest {
  font-size: 12.5px;
  font-weight: 700;
  color: #cbd5e1;
}

.tower-progress-bg {
  background: #334155;
  height: 8px;
  border-radius: 4px;
  overflow: hidden;
  margin: 8px 0;
}

.tower-progress-fill {
  background: linear-gradient(90deg, #38bdf8, #10b981);
  height: 100%;
  border-radius: 4px;
  transition: width 0.3s;
}

.tower-pkg-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #1e293b;
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 8px;
  border-left: 4px solid #10b981;
}

/* =============================================================================
   CONTEOS CÍCLICOS & AUDITORÍA CIEGA DE INVENTARIO
   ============================================================================= */
.cc-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.cc-kpi-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 16px 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.cc-kpi-val {
  font-size: 26px;
  font-weight: 800;
  color: #1e293b;
  margin-top: 4px;
}

.cc-kpi-lbl {
  font-size: 11.5px;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.cc-badge-blind {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.cc-badge-open {
  background: #e0f2fe;
  color: #0369a1;
  border: 1px solid #bae6fd;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.cc-execution-box {
  background: #f8fafc;
  border: 2px solid #cbd5e1;
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 20px;
}

.cc-location-display {
  font-size: 28px;
  font-weight: 900;
  color: #0369a1;
  letter-spacing: 1px;
  font-family: monospace;
}

.cc-count-input {
  font-size: 26px;
  font-weight: 800;
  text-align: center;
  width: 180px;
  padding: 8px 12px;
  border: 2px solid #3b82f6;
  border-radius: 8px;
  color: #1e293b;
}

.cc-diff-positive {
  color: #16a34a;
  font-weight: 800;
}

.cc-diff-negative {
  color: #dc2626;
  font-weight: 800;
}

.cc-diff-zero {
  color: #64748b;
  font-weight: 600;
}


