/* ==========================================================================
   EXPENSE & INVOICE ANALYZER - DESIGN SYSTEM & STYLES
   Modern, sleek, functional interface with high legibility & responsiveness
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  /* Color Palette - High-Contrast Refined Slate & Emerald theme */
  --bg-app: #0b1329;
  --bg-card: #1a233a;
  --bg-card-hover: #263352;
  --bg-card-alt: #131b2e;
  --bg-input: #0f172a;
  
  --border-color: #3b4f6e;
  --border-light: #475569;

  --text-main: #ffffff;
  --text-muted: #e2e8f0;
  --text-dim: #cbd5e1;

  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: rgba(37, 99, 235, 0.25);

  --accent-green: #10b981;
  --accent-green-bg: rgba(16, 185, 129, 0.2);
  --accent-amber: #f59e0b;
  --accent-amber-bg: rgba(245, 158, 11, 0.2);
  --accent-red: #ef4444;
  --accent-red-bg: rgba(239, 68, 68, 0.2);
  --accent-cyan: #06b6d4;
  --accent-cyan-bg: rgba(6, 182, 212, 0.2);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.4);
  --shadow-md: 0 4px 14px rgba(0,0,0,0.5);
  --shadow-lg: 0 10px 30px rgba(0,0,0,0.6);

  --font-main: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

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

select, option, input, textarea {
  color-scheme: dark;
}

select option {
  background-color: #1a233a !important;
  color: #ffffff !important;
  font-size: 0.95rem !important;
  padding: 10px !important;
}

select option:hover, select option:focus, select option:checked {
  background-color: #2563eb !important;
  color: #ffffff !important;
}

body {
  font-family: var(--font-main);
  background-color: var(--bg-app);
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

html.login-required,
body.login-required {
  overflow: hidden;
}

/* Acceso FacturaAnalytix */
.login-dialog {
  width: min(440px, calc(100% - 32px));
  max-width: none;
  padding: 0;
  margin: auto;
  color: var(--text-main);
  background: transparent;
  border: 0;
  overflow: visible;
}

.login-dialog::backdrop {
  background: rgba(3, 7, 18, 0.78);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.login-sheet {
  width: 100%;
  padding: 28px;
  background:
    radial-gradient(circle at top right, rgba(37, 99, 235, 0.16), transparent 38%),
    var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 24px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.62);
  animation: loginModalIn 220ms ease-out both;
}

.login-sheet-handle {
  display: none;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.login-brand-logo {
  width: 52px;
  height: 52px;
  padding: 5px;
  object-fit: contain;
  background: #fff;
  border-radius: 14px;
  box-shadow: var(--shadow-sm);
}

.login-eyebrow {
  margin-bottom: 2px;
  color: #93c5fd;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.login-brand h1 {
  font-size: 1.45rem;
  line-height: 1.22;
  letter-spacing: -0.025em;
}

.login-description {
  margin: 16px 0 20px;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.login-form,
.login-field {
  display: flex;
  flex-direction: column;
}

.login-form {
  gap: 14px;
}

.login-field {
  gap: 7px;
}

.login-field label {
  color: var(--text-muted);
  font-size: 0.88rem;
  font-weight: 700;
}

.login-field input {
  width: 100%;
  min-height: 48px;
  padding: 11px 14px;
  color: var(--text-main);
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  outline: none;
  font: 500 1rem/1.4 var(--font-main);
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.login-field input:focus {
  border-color: #60a5fa;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.28);
}

.login-error {
  min-height: 0;
  color: #fca5a5;
  font-size: 0.88rem;
}

.login-error:empty {
  display: none;
}

.login-submit {
  min-height: 48px;
  margin-top: 2px;
  color: #fff;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  border: 0;
  border-radius: 12px;
  font: 800 1rem/1 var(--font-main);
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.28);
}

.login-submit:hover {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
}

.login-submit:focus-visible,
.quick-access-card:focus-visible {
  outline: 3px solid rgba(96, 165, 250, 0.72);
  outline-offset: 2px;
}

.login-submit:disabled {
  cursor: wait;
  opacity: 0.7;
}

.quick-access {
  margin-top: 22px;
  padding-top: 20px;
  border-top: 1px solid var(--border-color);
}

.quick-access-title {
  margin-bottom: 10px;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.quick-access-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.quick-access-card {
  min-height: 52px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-main);
  background: rgba(15, 23, 42, 0.72);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  font: 700 0.9rem/1.2 var(--font-main);
  text-align: left;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 150ms ease, border-color 150ms ease, background 150ms ease;
}

.quick-access-card:hover {
  background: var(--bg-card-hover);
  border-color: #60a5fa;
  transform: translateY(-1px);
}

.quick-access-card:active {
  transform: scale(0.98);
}

.quick-access-icon {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  display: grid;
  place-items: center;
  color: #bfdbfe;
  background: rgba(37, 99, 235, 0.24);
  border-radius: 9px;
  font-size: 0.78rem;
}

@keyframes loginModalIn {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  .login-sheet { animation: none; }
  .quick-access-card { transition: none; }
}

@media (max-width: 600px) {
  .login-dialog {
    width: 100dvw;
    max-width: 100dvw;
    max-height: 94dvh;
    margin: auto 0 0;
    overflow-y: auto;
  }

  .login-sheet {
    min-height: 0;
    padding: 10px 20px calc(20px + env(safe-area-inset-bottom));
    border-width: 1px 1px 0;
    border-radius: 24px 24px 0 0;
    animation-name: loginSheetIn;
  }

  .login-sheet-handle {
    width: 44px;
    height: 5px;
    margin: 0 auto 16px;
    display: block;
    background: #64748b;
    border-radius: 999px;
  }

  .login-brand-logo {
    width: 46px;
    height: 46px;
    border-radius: 12px;
  }

  .login-brand h1 {
    font-size: 1.25rem;
  }

  .login-description {
    margin: 12px 0 16px;
  }

  .login-field input,
  .login-submit {
    min-height: 48px;
    font-size: 16px;
  }

  .quick-access {
    margin-top: 18px;
    padding-top: 16px;
  }

  .quick-access-card {
    min-height: 54px;
    padding: 8px 10px;
    border-radius: 14px;
  }
}

@keyframes loginSheetIn {
  from { opacity: 0; transform: translateY(100%); }
  to { opacity: 1; transform: translateY(0); }
}

/* Layout Header */
.app-header {
  background-color: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.header-container {
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: 12px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

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

.brand-logo svg {
  color: var(--accent-green);
}

.brand-logo h1 {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-main);
}

.brand-logo span {
  font-size: 0.75rem;
  background: var(--primary-light);
  color: var(--primary);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  text-transform: uppercase;
}

/* Navigation Tabs */
.nav-tabs {
  display: flex;
  gap: 8px;
  background-color: var(--bg-app);
  padding: 4px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  flex: 1 1 auto;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.nav-tabs::-webkit-scrollbar {
  display: none;
}

.nav-tab {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-main);
  font-weight: 600;
  font-size: 0.875rem;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
  flex: 0 0 auto;
  white-space: nowrap;
}

.nav-tab:hover {
  color: var(--text-main);
  background-color: rgba(255,255,255,0.04);
}

.nav-tab.active {
  background-color: var(--primary);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.4);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 0 0 auto;
}

.mobile-nav-stack {
  display: none;
}

.mobile-dashboard-summary-heading {
  display: none;
}

.mobile-budget-mini {
  display: none;
}

.mobile-dashboard-config {
  display: none;
}

/* Compact desktop header: keep every action inside common laptop widths. */
@media (min-width: 1025px) and (max-width: 1600px) {
  .header-container {
    padding-inline: 18px;
    gap: 8px;
  }

  .brand-logo {
    gap: 8px;
  }

  .brand-title {
    font-size: 1rem !important;
  }

  .nav-tabs {
    gap: 3px;
  }

  .nav-tab {
    padding: 8px 10px;
    gap: 6px;
    font-size: 0.8rem;
  }

  .nav-tab svg {
    width: 17px;
    height: 17px;
  }

  .header-actions {
    gap: 7px;
  }

  .btn-add-main {
    padding: 8px 12px;
    gap: 6px;
    font-size: 0.84rem;
  }
}

/* Add Button Dropdown Menu */
.add-menu-dropdown {
  position: relative;
  display: inline-block;
}

.btn-add-main {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, #0284c7, #0ea5e9);
  color: #ffffff;
  border: 1px solid rgba(56, 189, 248, 0.4);
  font-weight: 700;
  font-size: 0.9rem;
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.35);
  transition: all 0.2s ease;
}

.btn-add-main:hover {
  background: linear-gradient(135deg, #0369a1, #0284c7);
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.5);
  transform: translateY(-1px);
}

.btn-add-main .dropdown-caret {
  transition: transform 0.2s ease;
}

.add-menu-dropdown.open .btn-add-main .dropdown-caret {
  transform: rotate(180deg);
}

.add-menu-dropdown-content {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 290px;
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.05);
  padding: 6px;
  z-index: 1000;
  display: none;
  flex-direction: column;
  gap: 4px;
}

.add-menu-dropdown.open .add-menu-dropdown-content {
  display: flex;
  animation: fadeInDown 0.15s ease forwards;
}

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

.add-menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  border: none;
  background: transparent;
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s ease;
}

.add-menu-item:hover {
  background: rgba(56, 189, 248, 0.12);
}

.add-menu-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.add-menu-icon.blue {
  background: rgba(14, 165, 233, 0.15);
  color: #38bdf8;
}

.add-menu-icon.green {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
}

.add-menu-icon.purple {
  background: rgba(168, 85, 247, 0.15);
  color: #c084fc;
}

.add-menu-info {
  display: flex;
  flex-direction: column;
}

.add-menu-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: #f1f5f9;
}

.add-menu-subtitle {
  font-size: 0.72rem;
  color: #94a3b8;
  margin-top: 1px;
}

/* Main Container */
.main-content {
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: 24px 32px;
}

.tab-pane {
  display: none;
  animation: fadeIn 0.25s ease-out;
}

.tab-pane.active {
  display: block;
}

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

/* Page Titles */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 24px;
}

.page-title {
  font-size: 1.65rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 4px;
}

.page-subtitle {
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Split Screen PDF Reviewer Card */
.extraction-review-card {
  background: #0f172a !important;
  border: 1px solid #334155 !important;
  border-radius: 12px !important;
  padding: 24px !important;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4) !important;
  color: #f8fafc !important;
  width: 100% !important;
  box-sizing: border-box !important;
}

.extraction-review-card .form-control {
  background: #1e293b !important;
  border: 1px solid #334155 !important;
  color: #ffffff !important;
  border-radius: 6px !important;
  font-size: 0.88rem !important;
}

.extraction-review-card .form-control:focus {
  border-color: #38bdf8 !important;
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.25) !important;
}

/* Buttons */
.btn {
  font-family: var(--font-main);
  font-weight: 600;
  font-size: 0.875rem;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
}

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

.btn-primary:hover {
  background-color: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
}

.btn-secondary {
  background-color: var(--bg-card);
  color: var(--text-main);
  border: 1px solid var(--border-color);
}

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

.btn-success {
  background-color: var(--accent-green);
  color: #000000;
  font-weight: 700;
}

.btn-success:hover {
  filter: brightness(1.1);
}

.btn-icon {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 6px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
}

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

.btn-view:hover { color: var(--accent-cyan); }
.btn-delete:hover { color: var(--accent-red); }

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

.kpi-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.kpi-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-light);
}

.kpi-card-clickable {
  cursor: pointer;
  position: relative;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s ease, border-color 0.2s ease, filter 0.2s ease;
}

.kpi-card-clickable:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3), 0 8px 10px -6px rgba(0, 0, 0, 0.2);
  filter: brightness(1.04);
}

.kpi-card-clickable:active {
  transform: translateY(-1px);
}

.kpi-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.kpi-icon.blue { background: var(--primary-light); color: var(--primary); }
.kpi-icon.green { background: var(--accent-green-bg); color: var(--accent-green); }
.kpi-icon.amber { background: var(--accent-amber-bg); color: var(--accent-amber); }
.kpi-icon.cyan { background: var(--accent-cyan-bg); color: var(--accent-cyan); }

.kpi-content {
  flex: 1;
}

.kpi-label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 4px;
}

.kpi-value {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.02em;
}

.kpi-subtext {
  font-size: 0.8rem;
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.kpi-subtext.up { color: var(--accent-green); }
.kpi-subtext.down { color: var(--accent-red); }

/* Category Treemap Grid */
.category-treemap-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.treemap-tile {
  background: var(--bg-group);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.treemap-tile::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--primary);
}

.treemap-tile:hover {
  transform: translateY(-2px);
  border-color: var(--primary-light);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.treemap-tile-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.treemap-tile-amount {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--accent-green);
}

.treemap-tile-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Dole PowerBI Split Layout (Full Width Edge-to-Edge Design) */
.dole-filter-bar {
  width: 100%;
  display: flex;
  flex-direction: row;
  align-items: flex-end;
  gap: 10px 12px;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 16px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
  flex-wrap: wrap;
}

.filter-item {
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex-shrink: 0;
}

.filter-item label {
  font-size: 0.72rem !important;
  color: #94a3b8 !important;
  text-transform: uppercase !important;
  font-weight: 700 !important;
  letter-spacing: 0.03em !important;
  white-space: nowrap;
  margin: 0 0 2px 0 !important;
  line-height: 1.2 !important;
  display: block;
}

.filter-item-year { min-width: 90px; }
.filter-item-plant { min-width: 130px; }
.filter-item-cenco { min-width: 170px; }
.filter-item-cei { min-width: 110px; }
.filter-item-reception { min-width: 150px; }
.filter-item-doc-type { min-width: 155px; }
.filter-item-search { flex: 1 1 220px; min-width: 200px; }
.filter-item-supplier { flex: 1 1 180px; min-width: 170px; }

.filter-item-actions {
  display: flex;
  flex-direction: row;
  align-items: flex-end;
  gap: 8px;
  margin-left: auto;
  flex-shrink: 0;
}

.form-control-sm {
  background-color: #0f172a !important;
  border: 1px solid #334155 !important;
  color: #ffffff !important;
  padding: 4px 8px !important;
  font-size: 0.8rem !important;
  height: 32px !important;
  line-height: 1.2 !important;
  border-radius: 6px !important;
  font-weight: 500 !important;
  transition: all 0.2s ease;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.form-control-sm:hover {
  border-color: #475569 !important;
}

.form-control-sm:focus {
  border-color: #38bdf8 !important;
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.25) !important;
  outline: none;
}

.btn-icon-only {
  width: 34px;
  height: 34px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: #1e293b;
  border: 1px solid #334155;
  color: #94a3b8;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-icon-only:hover {
  background: #334155;
  color: #38bdf8;
  border-color: #38bdf8;
}

.btn-icon-only.active {
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  border-color: #38bdf8;
}

.btn-move-card {
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid #334155;
  color: #94a3b8;
  border-radius: 4px;
  font-size: 0.7rem;
  padding: 2px 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  line-height: 1;
  font-weight: bold;
}

.btn-move-card:hover {
  background: rgba(56, 189, 248, 0.25);
  color: #38bdf8;
  border-color: #38bdf8;
}

/* Custom Right-Click Context Menu */
.custom-context-menu {
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 8px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(56, 189, 248, 0.2);
  padding: 6px;
  min-width: 195px;
  font-size: 0.88rem;
  color: #f8fafc;
  user-select: none;
  backdrop-filter: blur(8px);
}

.context-menu-item {
  width: 100%;
  padding: 8px 12px;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  color: inherit;
  background: transparent;
  font: inherit;
  font-weight: 500;
  text-align: left;
  transition: background 0.15s ease, color 0.15s ease;
}

.context-menu-item:hover {
  background: rgba(56, 189, 248, 0.18);
  color: #38bdf8;
}

.context-menu-item.text-danger:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
}

.context-menu-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.08);
  margin: 4px 0;
}

.context-menu-section-label {
  padding: 4px 12px 3px;
  color: #7f91aa;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.context-status-item.is-current,
.context-status-item:disabled {
  color: #6ee7b7;
  background: rgba(16, 185, 129, 0.12);
  cursor: default;
  opacity: 1;
}

#ctxMenuMarkPending.is-current,
#ctxMenuMarkPending:disabled {
  color: #fcd34d;
  background: rgba(245, 158, 11, 0.12);
}

/* Master Dual Column System (Table on Left, All Charts Fluid on Right) */
.dashboard-widgets-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  width: 100%;
  align-items: flex-start;
  margin-top: 8px;
}

.dashboard-left-column {
  flex: 0 0 calc(66.666% - 11px);
  width: calc(66.666% - 11px);
  max-width: calc(66.666% - 11px);
  display: flex;
  flex-direction: column;
  gap: 16px;
  transition: all 0.25s ease;
}

.dashboard-left-column .dashboard-widget-card {
  width: 100% !important;
  max-width: 100% !important;
}

.dashboard-right-column {
  flex: 0 0 calc(33.333% - 11px);
  width: calc(33.333% - 11px);
  max-width: calc(33.333% - 11px);
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-start;
  transition: all 0.25s ease;
}

/* Expansión real al 100% para la tabla: Columna izquierda a ancho total y widgets de la derecha reubicados abajo */
.dashboard-widgets-grid.table-expanded-100 .dashboard-left-column {
  flex: 0 0 100% !important;
  width: 100% !important;
  max-width: 100% !important;
}

.dashboard-widgets-grid.table-expanded-100 .dashboard-right-column {
  flex: 0 0 100% !important;
  width: 100% !important;
  max-width: 100% !important;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 8px;
}

.dashboard-widgets-grid.table-expanded-100 .dashboard-right-column .dashboard-widget-card {
  flex: 1 1 calc(33.333% - 16px) !important;
  min-width: 280px;
  max-width: 100% !important;
}

.dashboard-right-column .dashboard-widget-card {
  box-sizing: border-box;
}

.dashboard-right-column .dashboard-widget-card[data-width="w-full"],
.dashboard-right-column .dashboard-widget-card[data-width="w-two-thirds"],
.dashboard-right-column .dashboard-widget-card[data-width="w-third"],
.dashboard-right-column .dashboard-widget-card.w-full,
.dashboard-right-column .dashboard-widget-card.w-two-thirds,
.dashboard-right-column .dashboard-widget-card.w-third {
  width: 100% !important;
  max-width: 100% !important;
  flex: 0 0 100% !important;
}

.dashboard-right-column .dashboard-widget-card[data-width="w-half"],
.dashboard-right-column .dashboard-widget-card.w-half,
.dashboard-right-column .dashboard-widget-card[data-width="w-quarter"],
.dashboard-right-column .dashboard-widget-card.w-quarter,
.dashboard-right-column .dashboard-widget-card[data-width="w-eighth"],
.dashboard-right-column .dashboard-widget-card.w-eighth {
  width: calc(50% - 6px) !important;
  max-width: calc(50% - 6px) !important;
  flex: 0 0 calc(50% - 6px) !important;
  min-width: 130px;
}

@media (max-width: 1100px) {
  .dashboard-left-column,
  .dashboard-right-column {
    flex: 0 0 100% !important;
    width: 100% !important;
    max-width: 100% !important;
  }
}

/* Global Dark Custom Scrollbars (No White OS Scrollbars) */
*::-webkit-scrollbar {
  width: 6px !important;
  height: 6px !important;
}

*::-webkit-scrollbar-track {
  background: #0f172a !important;
  border-radius: 4px !important;
}

*::-webkit-scrollbar-thumb {
  background: #334155 !important;
  border-radius: 4px !important;
}

*::-webkit-scrollbar-thumb:hover {
  background: #38bdf8 !important;
}

.dashboard-widget-card {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  position: relative;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  margin-bottom: 0 !important;
  resize: vertical;
  overflow: hidden;
  min-height: 200px;
  max-height: 1400px;
  width: 100% !important;
}

.dashboard-widget-card[data-height="h-sm"],
.dashboard-widget-card.h-sm {
  height: 240px !important;
}

.dashboard-widget-card[data-height="h-md"],
.dashboard-widget-card.h-md {
  height: 380px !important;
}

.dashboard-widget-card[data-height="h-lg"],
.dashboard-widget-card.h-lg {
  height: 520px !important;
}

.dashboard-widget-card[data-height="h-xl"],
.dashboard-widget-card.h-xl {
  height: 850px !important;
}

/* Responsive Inner Scaling for Small Card Heights (h-sm = 240px) */
.dashboard-widget-card.h-sm .widget-header {
  margin-bottom: 4px !important;
  padding-bottom: 4px !important;
}

.dashboard-widget-card.h-sm .widget-title-area .panel-title,
.dashboard-widget-card.h-sm .widget-title-area .panel-title-sm {
  font-size: 0.85rem !important;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dashboard-widget-card.h-sm .btn-size,
.dashboard-widget-card.h-sm .btn-height {
  padding: 1px 4px !important;
  font-size: 0.68rem !important;
}

.dashboard-widget-card.h-sm .dole-details-body {
  padding-top: 2px !important;
  padding-bottom: 2px !important;
  justify-content: space-evenly !important;
}

.dashboard-widget-card.h-sm .dole-details-body .detail-label {
  font-size: 0.7rem !important;
  margin-bottom: 1px !important;
}

.dashboard-widget-card.h-sm .dole-details-body .detail-value-main {
  font-size: 1.15rem !important;
  line-height: 1.1 !important;
}

.dashboard-widget-card.h-sm .dole-details-body .detail-value-sub {
  font-size: 0.95rem !important;
  line-height: 1.1 !important;
}

.dashboard-widget-card.h-sm .dole-details-body div[style*="border-top"] {
  font-size: 0.75rem !important;
  padding-top: 4px !important;
  margin-top: 2px !important;
}

.dashboard-widget-card.h-sm #doleGaugePercentText {
  font-size: 1.25rem !important;
}

.dashboard-widget-card.h-sm .widget-body-content {
  min-height: 0 !important;
  margin-top: 2px !important;
}

/* 12-Column Spans for Masonry Grid */
.dashboard-widget-card[data-width="w-full"],
.dashboard-widget-card.w-full {
  grid-column: span 12 !important;
}

.dashboard-widget-card[data-width="w-two-thirds"],
.dashboard-widget-card.w-two-thirds {
  grid-column: span 8 !important;
}

.dashboard-widget-card[data-width="w-half"],
.dashboard-widget-card.w-half {
  grid-column: span 6 !important;
}

.dashboard-widget-card[data-width="w-third"],
.dashboard-widget-card.w-third {
  grid-column: span 4 !important;
}

.dashboard-widget-card[data-width="w-quarter"],
.dashboard-widget-card.w-quarter {
  grid-column: span 3 !important;
}

.dashboard-widget-card[data-width="w-eighth"],
.dashboard-widget-card.w-eighth {
  grid-column: span 2 !important;
}

/* Proveedor asignado: lectura ejecutiva y detalle interactivo en escritorio. */
.supplier-chart-body {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.supplier-chart-toolbar {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 8px;
  padding: 0 3px;
}

.supplier-chart-toolbar > div {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.supplier-chart-eyebrow {
  color: var(--text-dim);
  font-size: 0.63rem;
  font-weight: 800;
  letter-spacing: 0.055em;
  text-transform: uppercase;
}

.supplier-chart-toolbar strong {
  color: var(--text-main);
  font-size: 0.82rem;
  line-height: 1.2;
}

.supplier-chart-action-hint {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 5px 9px;
  color: var(--primary);
  background: rgba(14, 165, 233, 0.08);
  border: 1px solid rgba(14, 165, 233, 0.26);
  border-radius: 999px;
  font-size: 0.66rem;
  font-weight: 750;
  line-height: 1.15;
  text-align: center;
}

.supplier-chart-canvas-wrap {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
}

.supplier-chart-canvas-wrap canvas {
  width: 100% !important;
  height: 100% !important;
}

@media (max-width: 1024px) {
  .dashboard-widget-card {
    grid-column: span 12 !important;
  }
}

/* Tema Solutions: misma atmósfera oscura del hub, aplicado también a FacturaAnalytix. */
body.solutions-theme {
  background: #061426 url('/assets/dashboard-bg-solutions-4k.png') center / cover fixed no-repeat !important;
  color: #e8f1ff;
}
body.solutions-theme::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(90deg, rgba(3,12,25,.68), rgba(3,12,25,.30));
  z-index: -1;
}
body.solutions-theme .app-header {
  background: rgba(5,18,35,.88) !important;
  border-bottom-color: #24517d;
}
body.solutions-theme .panel-card,
body.solutions-theme .dashboard-widget-card,
body.solutions-theme .dole-filter-bar {
  background: rgba(9,29,53,.88) !important;
  border-color: #28547f;
  box-shadow: 0 12px 28px rgba(0,0,0,.30);
}
body.solutions-theme .form-control-sm,
body.solutions-theme .form-control {
  background: rgba(7,24,45,.88) !important;
  border-color: #35638e !important;
  color: #eff7ff !important;
}

.dashboard-widget-card[data-width="w-third"],
.dashboard-widget-card.w-third {
  width: calc(33.333% - 11px) !important;
  max-width: calc(33.333% - 11px) !important;
  flex: 0 0 calc(33.333% - 11px) !important;
}

@media (max-width: 1024px) {
  .dashboard-widget-card.w-third,
  .dashboard-widget-card.w-two-thirds,
  .dashboard-widget-card.w-half {
    width: 100% !important;
    flex: 0 0 100% !important;
  }
}

.widget-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  width: 100%;
  box-sizing: border-box;
}

.widget-title-area {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
}

.widget-title-area .panel-title,
.widget-title-area .panel-title-sm {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.85rem !important;
}

.widget-drag-handle {
  cursor: grab;
  color: #64748b;
  font-size: 1.1rem;
  padding: 2px 4px;
  border-radius: 4px;
  user-select: none;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}

.widget-drag-handle:hover {
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.12);
}

/* Dragging visual states */
.dashboard-widget-card.dragging {
  opacity: 0.4;
  border: 2px dashed #38bdf8 !important;
}

.dashboard-widget-card.drag-over {
  border: 2px solid #38bdf8 !important;
  box-shadow: 0 0 16px rgba(56, 189, 248, 0.4) !important;
  transform: scale(1.01);
}

.dashboard-widget-card.drag-over-top {
  border-top: 4px solid #38bdf8 !important;
  box-shadow: 0 -8px 20px rgba(56, 189, 248, 0.4) !important;
}

.dashboard-widget-card.drag-over-bottom {
  border-bottom: 4px solid #38bdf8 !important;
  box-shadow: 0 8px 20px rgba(56, 189, 248, 0.4) !important;
}

.dashboard-widget-card.drag-over-left {
  border-left: 4px solid #38bdf8 !important;
  box-shadow: -8px 0 20px rgba(56, 189, 248, 0.4) !important;
}

.dashboard-widget-card.drag-over-right {
  border-right: 4px solid #38bdf8 !important;
  box-shadow: 8px 0 20px rgba(56, 189, 248, 0.4) !important;
}

/* Widget Controls & Customization Overlay */
.widget-controls {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 0 0 auto;
  max-width: 100%;
}

.widget-height-selector,
.widget-size-selector {
  display: inline-flex;
  align-items: center;
  gap: 1px;
  background: #0f172a;
  padding: 2px 4px;
  border-radius: 6px;
  border: 1px solid #334155;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  scrollbar-width: none !important;
  -ms-overflow-style: none !important;
}

.widget-height-selector::-webkit-scrollbar,
.widget-size-selector::-webkit-scrollbar,
.widget-controls::-webkit-scrollbar {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
}

.size-label {
  font-size: 0.62rem;
  color: #64748b;
  font-weight: 700;
  padding: 0 2px;
  user-select: none;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.btn-height,
.btn-size {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 5px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-height:hover,
.btn-size:hover {
  color: #f8fafc;
  background: #1e293b;
}

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

.btn-height.active {
  background: #34d399;
  color: #0f172a;
  box-shadow: 0 1px 4px rgba(52, 211, 153, 0.4);
}

.grid-bottom-drop-target {
  display: none;
  width: 100%;
  padding: 16px;
  border: 2px dashed rgba(56, 189, 248, 0.4);
  border-radius: 10px;
  color: #38bdf8;
  font-weight: 700;
  text-align: center;
  font-size: 0.9rem;
  background: rgba(56, 189, 248, 0.05);
  transition: all 0.2s ease;
  margin-top: 8px;
  box-sizing: border-box;
}

.customizing-mode .grid-bottom-drop-target {
  display: block;
}

.grid-bottom-drop-target.drag-over,
.customizing-mode .grid-bottom-drop-target:hover {
  background: rgba(56, 189, 248, 0.2);
  border-color: #38bdf8;
  transform: scale(1.01);
}

.customizing-mode .dashboard-widget-card {
  border: 2px dashed rgba(56, 189, 248, 0.5) !important;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.2);
}

.customizing-mode .widget-drag-handle {
  color: #38bdf8;
  animation: pulseHandle 1.5s infinite alternate;
}

@keyframes pulseHandle {
  0% { transform: scale(1); }
  100% { transform: scale(1.2); }
}

.panel-card {
  background: #1a233a;
  border: 1.5px solid #3b4f6e;
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  transition: border-color 0.2s ease;
}

.panel-card:hover {
  border-color: #38bdf8;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  border-bottom: 1.5px solid #3b4f6e;
  padding-bottom: 10px;
}

.panel-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: #ffffff;
}

.panel-title-sm {
  font-size: 0.88rem;
  font-weight: 800;
  color: #e2e8f0;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Status Badges Premium */
.status-badge-pending {
  background: rgba(245, 158, 11, 0.25) !important;
  color: #fef08a !important;
  border: 1.5px solid #f59e0b !important;
  padding: 6px 14px !important;
  border-radius: 20px !important;
  font-size: 0.85rem !important;
  font-weight: 800 !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
  white-space: nowrap !important;
}

.status-badge-received {
  background: rgba(16, 185, 129, 0.25) !important;
  color: #a7f3d0 !important;
  border: 1.5px solid #10b981 !important;
  padding: 6px 14px !important;
  border-radius: 20px !important;
  font-size: 0.85rem !important;
  font-weight: 800 !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
  white-space: nowrap !important;
}

/* Category Tags */
.category-tag {
  background: rgba(6, 182, 212, 0.2) !important;
  color: #7dd3fc !important;
  border: 1.5px solid #0284c7 !important;
  padding: 5px 12px !important;
  border-radius: 6px !important;
  font-weight: 800 !important;
  font-size: 0.85rem !important;
  white-space: nowrap !important;
}

/* Table Styling */
.dole-table-wrapper {
  overflow-x: auto;
  border-radius: 8px;
}

.dole-table-wrapper table th {
  background-color: #0b1329 !important;
  color: #e2e8f0 !important;
  font-size: 0.85rem !important;
  font-weight: 800 !important;
  padding: 14px 12px !important;
  border-bottom: 2px solid #3b4f6e !important;
  white-space: nowrap !important;
}

.dole-table-wrapper table td {
  padding: 14px 12px !important;
  font-size: 0.95rem !important;
  font-weight: 600 !important;
  color: #ffffff !important;
  border-bottom: 1px solid rgba(59, 79, 110, 0.5) !important;
  vertical-align: middle !important;
}

.dole-date {
  color: #cbd5e1;
  font-size: 0.88rem;
}

.dole-supplier {
  color: #ffffff;
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.25;
}

.dole-rut {
  margin-top: 2px;
  color: #94a3b8;
  font-size: 0.75rem;
}

.dole-amount {
  color: #34d399;
  font-size: 0.95rem;
}

.dole-match-text {
  color: #38bdf8;
  font-size: 0.88rem;
  font-weight: 800;
}

.dole-observation-primary {
  color: #ffffff;
  font-size: 0.88rem;
  font-weight: 600;
  white-space: normal;
  word-break: break-word;
}

.dole-observation-secondary {
  color: #cbd5e1;
  font-size: 0.8rem;
  white-space: normal;
  word-break: break-word;
}

.dole-table-wrapper table tr:hover {
  background-color: rgba(56, 189, 248, 0.12) !important;
}

/* Top Right Grid (Treemap, Details, Gauge) */
.dole-top-right-grid {
  display: grid;
  grid-template-columns: 1.6fr 1.2fr 1fr;
  gap: 16px;
  min-height: 220px;
}

/* Treemap Boxes */
.dole-treemap-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 10px;
  max-height: 160px;
  overflow-y: auto;
}

.dole-treemap-box {
  appearance: none !important;
  width: 100% !important;
  text-align: left !important;
  background: #0b1329 !important;
  border-left: 4px solid #3b82f6 !important;
  border-radius: 8px !important;
  padding: 12px !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
  border-top: 1px solid rgba(255, 255, 255, 0.05) !important;
}

.dole-treemap-box.is-active {
  outline: 2px solid rgba(56, 189, 248, 0.72) !important;
  background: #172554 !important;
}

.dole-treemap-box:hover {
  background: #1e293b !important;
  transform: translateY(-2px) !important;
}

.dole-treemap-title {
  font-size: 0.82rem !important;
  font-weight: 800 !important;
  color: #ffffff !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

.dole-treemap-val {
  font-size: 0.95rem !important;
  font-weight: 800 !important;
  color: #34d399 !important;
  margin-top: 4px !important;
}

/* Details Box */
.dole-details-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.detail-label {
  font-size: 0.72rem;
  color: #cbd5e1;
  font-weight: 700;
}

.detail-value-main {
  font-size: 1.35rem;
  font-weight: 800;
  color: #ffffff;
}

.detail-value-sub {
  font-size: 1.05rem;
  font-weight: 700;
}

.detail-value-sub.green { color: #34d399; }
.detail-value-sub.amber { color: #fbbf24; }

/* Bottom Right Grid (Analytics Chart, Supplier Ranking Chart) */
.dole-bottom-right-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 16px;
  min-height: 280px;
}

/* Qtr Pills */
.qtr-pills {
  display: flex;
  gap: 6px;
}

.mobile-quarter-select {
  display: none;
}

.analytics-cenco-select {
  min-height: 28px;
  max-width: 170px;
  padding: 3px 25px 3px 8px;
  color: var(--text-main);
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 9px;
  font-size: 0.68rem;
  font-weight: 750;
}

.analytics-comparison-label {
  display: inline-block;
  max-width: 240px;
  margin-left: 6px;
  color: var(--primary);
  font-size: 0.68rem;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: bottom;
}

.qtr-pill {
  background: #0f172a;
  border: 1px solid #475569;
  color: #cbd5e1;
  padding: 4px 12px;
  border-radius: 16px;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.qtr-pill:hover {
  color: #ffffff;
  border-color: #38bdf8;
}

.qtr-pill.active {
  background: #3b82f6;
  color: #ffffff;
  border-color: #60a5fa;
  box-shadow: 0 0 12px rgba(59, 130, 246, 0.5);
}

@media (max-width: 1280px) {
  .dole-split-layout {
    grid-template-columns: 1fr;
  }
  .dole-top-right-grid {
    grid-template-columns: 1fr;
  }
  .dole-bottom-right-grid {
    grid-template-columns: 1fr;
  }
  .filter-item.style-grow {
    grid-column: span 1;
  }
}

/* Charts Layout Grid */
.charts-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
  margin-bottom: 28px;
}

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

.chart-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
}

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

.chart-title {
  font-size: 1.1rem;
  font-weight: 700;
}

.chart-container {
  position: relative;
  height: 300px;
  width: 100%;
}

/* Price Search Section */
.search-banner {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 28px;
  margin-bottom: 28px;
}

.search-box-wrapper {
  position: relative;
  margin-top: 16px;
}

.search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}

.search-input {
  width: 100%;
  background-color: var(--bg-app);
  border: 2px solid var(--border-color);
  color: var(--text-main);
  font-family: var(--font-main);
  font-size: 1.05rem;
  padding: 14px 16px 14px 48px;
  border-radius: var(--radius-md);
  outline: none;
  transition: border-color 0.2s ease;
}

.search-input:focus {
  border-color: var(--primary);
}

.product-search-heading > span {
  display: block;
  margin-bottom: 4px;
  color: var(--primary);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.product-search-heading h3 {
  color: var(--text-main);
  font-size: 1.1rem;
}

.search-tags {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
  align-items: center;
}

.tag-label {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.search-tag-chip {
  background: var(--bg-app);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 0.8rem;
  padding: 4px 10px;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.search-tag-chip:hover {
  color: var(--text-main);
  border-color: var(--primary);
  background: var(--primary-light);
}

/* Product Comparison Cards */
.products-comparison-grid {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.product-comparison-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
}

.product-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 16px;
}

.product-title-group h3 {
  font-size: 1.25rem;
  font-weight: 700;
}

.savings-badge {
  background-color: var(--accent-green-bg);
  color: var(--accent-green);
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 6px 12px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Supplier Price Table inside product card */
.supplier-comparison-table {
  width: 100%;
  border-collapse: collapse;
}

.supplier-comparison-table th {
  text-align: left;
  padding: 10px 14px;
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-color);
}

.supplier-comparison-table td {
  padding: 14px;
  border-bottom: 1px solid var(--bg-card-alt);
  font-size: 0.9rem;
}

.supplier-row-best {
  background-color: rgba(16, 185, 129, 0.05);
}

.best-price-tag {
  background-color: var(--accent-green);
  color: #000;
  font-weight: 800;
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  margin-left: 8px;
  text-transform: uppercase;
}

/* Document Database Table */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  background-color: var(--bg-card);
}

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

.data-table th {
  background-color: var(--bg-card-alt);
  padding: 14px 16px;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  font-weight: 700;
  border-bottom: 1px solid var(--border-color);
}

.data-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.875rem;
  vertical-align: middle;
}

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

.supplier-info {
  display: flex;
  flex-direction: column;
}

.supplier-name {
  font-weight: 600;
  color: var(--text-main);
}

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

.amount {
  font-family: var(--font-mono);
  font-size: 0.95rem;
}

.text-right { text-align: right; }
.text-center { text-align: center; }

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 700;
}

.badge-primary { background: var(--primary-light); color: var(--primary); }
.badge-info { background: var(--accent-cyan-bg); color: var(--accent-cyan); }
.badge-warning { background: var(--accent-amber-bg); color: var(--accent-amber); }
.badge-success { background: var(--accent-green-bg); color: var(--accent-green); }
.badge-neutral { background: var(--border-color); color: var(--text-muted); }

.category-tag {
  background-color: var(--bg-app);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 0.75rem;
}

.item-count {
  color: var(--text-muted);
  font-size: 0.8rem;
}

/* Upload AI Scanner Dropzone */
.dropzone-container {
  background-color: var(--bg-card);
  border: 2px dashed var(--border-light);
  border-radius: var(--radius-xl);
  padding: 48px 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.dropzone-container:hover, .dropzone-container.drag-over {
  border-color: var(--primary);
  background-color: var(--primary-light);
}

.dropzone-icon {
  width: 64px;
  height: 64px;
  background-color: var(--bg-app);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px auto;
  color: var(--primary);
}

.dropzone-title {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.dropzone-sub {
  color: var(--text-muted);
  font-size: 0.875rem;
  max-width: 450px;
  margin: 0 auto 20px auto;
}

.file-input-hidden {
  display: none;
}

/* AI Scanning Processing Overlay */
.ai-scan-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 36px;
  text-align: center;
  margin-top: 24px;
}

.scan-progress-bar {
  width: 100%;
  height: 8px;
  background-color: var(--bg-app);
  border-radius: 4px;
  overflow: hidden;
  margin: 20px 0 12px 0;
}

.scan-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent-cyan));
  width: 0%;
  transition: width 0.3s ease;
}

/* Extracted Confirmation Form */
.extraction-review-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 28px;
  margin-top: 24px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

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

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

.form-control {
  background-color: var(--bg-app);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  font-family: var(--font-main);
  font-size: 0.9rem;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  outline: none;
}

.form-control:focus {
  border-color: var(--primary);
}

/* Modals */
.modal-backdrop {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 720px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: modalScale 0.2s ease-out;
}

@keyframes modalScale {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

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

.btn-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
}

.modal-body {
  padding: 24px;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.supplier-dashboard-card {
  max-width: 860px;
  overflow: hidden;
}

.supplier-dashboard-header h2 {
  margin: 4px 0 3px;
  color: var(--text-main);
  font-size: 1.15rem;
  line-height: 1.25;
}

.supplier-dashboard-eyebrow {
  color: var(--primary);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.055em;
  text-transform: uppercase;
}

#supplierDashboardMeta {
  margin: 0;
  color: var(--text-dim);
  font-size: 0.78rem;
}

.supplier-dashboard-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 14px 20px 0;
  padding: 12px 14px;
  color: var(--text-muted);
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.28);
  border-radius: 12px;
  font-size: 0.78rem;
  font-weight: 700;
}

.supplier-dashboard-summary strong {
  color: #059669;
  font-family: var(--font-mono);
  font-size: 1.05rem;
}

.supplier-dashboard-body {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  max-height: 58vh;
  overflow-y: auto;
}

.supplier-document-row {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 7px 12px;
  padding: 12px 14px;
  text-align: left;
  color: var(--text-main);
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 11px;
  cursor: pointer;
}

.supplier-document-row:hover {
  border-color: var(--primary);
  background: var(--bg-card-hover);
}

.supplier-document-id {
  min-width: 0;
  color: var(--primary);
  font-size: 0.82rem;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.analytics-filter-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: flex-end;
  gap: 10px;
}

.analytics-filter-control {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 160px;
}

.analytics-filter-control span {
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 800;
}

.analytics-filter-control .form-control {
  width: 100%;
  min-height: 38px;
}

.analytics-filter-summary {
  margin: -8px 0 18px;
  color: var(--text-muted);
  font-size: 0.86rem;
  font-weight: 650;
}

.analytics-drilldown-panel {
  margin-top: 20px;
  padding: 22px;
  border: 1px solid var(--border-color);
  border-radius: 18px;
  background: var(--bg-panel);
  box-shadow: var(--shadow-card);
}

.analytics-drilldown-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 18px;
}

.analytics-drilldown-title {
  margin: 0;
  color: var(--text-main);
  font-size: 1.15rem;
  font-weight: 850;
}

.analytics-drilldown-subtitle {
  margin: 5px 0 0;
  color: var(--text-muted);
  font-size: 0.86rem;
  font-weight: 650;
}

.analytics-drilldown-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(260px, 0.85fr);
  gap: 16px;
}

.analytics-insight-card,
.analytics-documents-card {
  border: 1px solid var(--border-color);
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.42);
  padding: 16px;
}

.analytics-insight-card h4,
.analytics-documents-card h4 {
  margin: 0 0 12px;
  color: var(--text-main);
  font-size: 0.94rem;
}

.analytics-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.analytics-chip {
  border: 1px solid var(--border-color);
  border-radius: 999px;
  padding: 6px 10px;
  color: var(--text-main);
  background: rgba(30, 41, 59, 0.52);
  font-size: 0.78rem;
  font-weight: 750;
}

.analytics-doc-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(130px, 0.65fr) minmax(190px, 0.85fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px 0;
  border-top: 1px solid var(--border-color);
}

.analytics-doc-row:first-child {
  border-top: 0;
}

.analytics-doc-main strong {
  display: block;
  color: var(--text-main);
  font-size: 0.86rem;
}

.analytics-doc-main span,
.analytics-doc-amount span {
  display: block;
  color: var(--text-muted);
  font-size: 0.72rem;
  margin-top: 3px;
}

.analytics-doc-amount strong {
  color: var(--primary);
  font-size: 0.88rem;
}

.analytics-cenco-edit {
  min-height: 34px;
  font-size: 0.75rem;
  font-weight: 750;
}

.analytics-anomaly {
  color: #fbbf24;
  font-size: 0.72rem;
  font-weight: 750;
  margin-top: 4px;
}

@media (max-width: 1024px) {
  .analytics-drilldown-grid,
  .analytics-doc-row {
    grid-template-columns: 1fr;
  }
}

.supplier-document-date {
  color: var(--text-dim);
  font-size: 0.72rem;
  white-space: nowrap;
}

.supplier-document-note {
  min-width: 0;
  color: var(--text-muted);
  font-size: 0.75rem;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.supplier-document-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.supplier-document-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border: 1px solid;
  border-radius: 999px;
  font-size: 0.65rem;
  font-weight: 800;
  line-height: 1.1;
  white-space: nowrap;
}

.supplier-document-status.is-pending {
  color: #fcd34d;
  background: rgba(245, 158, 11, 0.14);
  border-color: rgba(245, 158, 11, 0.72);
}

.supplier-document-status.is-received {
  color: #6ee7b7;
  background: rgba(16, 185, 129, 0.14);
  border-color: rgba(16, 185, 129, 0.62);
}

.supplier-document-status.is-neutral {
  color: #7dd3fc;
  background: rgba(14, 165, 233, 0.12);
  border-color: rgba(14, 165, 233, 0.52);
}

body.light-theme .supplier-document-status.is-pending {
  color: #92400e;
  background: #fffbeb;
  border-color: #d97706;
}

body.light-theme .supplier-document-status.is-received {
  color: #065f46;
  background: #ecfdf5;
  border-color: #059669;
}

body.light-theme .supplier-document-status.is-neutral {
  color: #075985;
  background: #f0f9ff;
  border-color: #0284c7;
}

.supplier-document-amount {
  color: #059669;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 800;
  white-space: nowrap;
}

@media (max-width: 640px) {
  .supplier-dashboard-modal {
    align-items: flex-end;
    padding: 0;
  }

  .supplier-dashboard-card {
    max-width: none;
    max-height: 82vh;
    border-radius: 18px 18px 0 0;
    animation: supplierSheetUp 0.22s ease-out;
  }

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

  .supplier-dashboard-header {
    padding: 16px 18px 12px;
  }

  .supplier-dashboard-header h2 { font-size: 1rem; }

  .supplier-dashboard-summary {
    margin: 10px 14px 0;
    padding: 10px 12px;
  }

  .supplier-dashboard-body {
    grid-template-columns: 1fr;
    max-height: 57vh;
    padding: 12px 14px 18px;
  }

  .supplier-document-row { padding: 11px 12px; }
}

.doc-meta-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  background-color: var(--bg-app);
  padding: 16px;
  border-radius: var(--radius-md);
}

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

.meta-item label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

.detail-items-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
}

.detail-items-table th {
  text-align: left;
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-color);
}

.detail-items-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--bg-card-alt);
  font-size: 0.85rem;
}

.totals-summary {
  margin-top: 20px;
  margin-left: auto;
  width: 260px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.total-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.grand-total {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text-main);
  border-top: 1px solid var(--border-color);
  padding-top: 8px;
}

.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}

.empty-state svg {
  margin-bottom: 12px;
  opacity: 0.5;
}

/* Responsive View Modes: Desktop Table vs Mobile Cards */
.dole-desktop-table-wrap {
  display: block;
}

/* Mobile Search & Filter Toggle Bar */
.mobile-search-toggle-bar {
  display: none;
}

.mobile-document-count {
  display: none;
}

.mobile-filter-sheet-head {
  display: none;
}

.analytics-drilldown-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0 2px 8px;
  padding: 8px 10px;
  color: var(--text-main);
  background: rgba(14, 165, 233, 0.09);
  border: 1px solid rgba(14, 165, 233, 0.32);
  border-radius: 10px;
  font-size: 0.76rem;
  font-weight: 750;
}

.analytics-drilldown-bar[hidden] {
  display: none !important;
}

.analytics-drilldown-bar button {
  flex: 0 0 auto;
  padding: 5px 9px;
  color: var(--primary);
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font: inherit;
  cursor: pointer;
}

.mobile-search-input-wrap {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
}

.mobile-search-input {
  width: 100%;
  padding: 10px 36px 10px 38px;
  border-radius: 10px;
  background: #0f172a;
  border: 1.5px solid #38bdf8;
  color: #f8fafc;
  font-size: 0.9rem;
  font-weight: 500;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  box-shadow: 0 2px 10px rgba(56, 189, 248, 0.15);
}

.mobile-search-input:focus {
  border-color: #818cf8;
  box-shadow: 0 0 0 3px rgba(129, 140, 248, 0.25);
}

.mobile-search-input-wrap .search-icon {
  position: absolute;
  left: 12px;
  color: #38bdf8;
  pointer-events: none;
}

.btn-clear-search-mobile {
  position: absolute;
  right: 10px;
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
}

.btn-toggle-filters-mobile {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  border-radius: 10px;
  background: #1e293b;
  border: 1px solid #334155;
  color: #e2e8f0;
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  flex-shrink: 0;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.btn-toggle-filters-mobile:active,
.btn-toggle-filters-mobile.active {
  background: #38bdf8;
  color: #0f172a;
  border-color: #38bdf8;
}

.btn-toggle-filters-mobile .active-filters-badge {
  background: #38bdf8;
  color: #0f172a;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 10px;
}

.btn-toggle-filters-mobile.active .active-filters-badge {
  background: #0f172a;
  color: #38bdf8;
}

.dole-mobile-cards-wrap {
  display: none;
}

/* Mobile Card Styling */
.dole-mobile-card {
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 12px;
  padding: 14px 16px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
  display: flex;
  flex-direction: column;
  gap: 10px;
  -webkit-tap-highlight-color: transparent;
}

.dole-mobile-card:hover,
.dole-mobile-card:active {
  background: #253349;
  border-color: #38bdf8;
  transform: translateY(-1px);
}

.dole-mobile-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.dole-mobile-doc-num {
  font-size: 0.92rem;
  font-weight: 800;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.12);
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.dole-mobile-date {
  font-size: 0.8rem;
  color: #94a3b8;
  font-weight: 600;
}

.dole-mobile-supplier {
  font-size: 1.08rem;
  font-weight: 800;
  color: #ffffff;
  line-height: 1.3;
}

.dole-mobile-amount-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(52, 211, 153, 0.08);
  border: 1px solid rgba(52, 211, 153, 0.25);
  border-radius: 8px;
  padding: 8px 12px;
}

.dole-mobile-amount {
  font-family: var(--font-mono);
  font-size: 1.25rem;
  font-weight: 900;
  color: #34d399;
}

.dole-mobile-extra-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.78rem;
  color: #94a3b8;
  margin-top: 2px;
}

.dole-mobile-notes {
  font-size: 0.85rem;
  color: #f1f5f9;
  background: #0f172a;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid #334155;
  white-space: normal;
  word-break: break-word;
  line-height: 1.45;
}

/* Keyframes */
@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   Comprehensive Mobile & Tablet Responsive Rules (Max-width 1024px)
   ========================================================================== */
@media (max-width: 1024px) {
  /* Strict Zero horizontal page overflow */
  html, body {
    overflow-x: hidden !important;
    width: 100% !important;
    max-width: 100vw !important;
  }

  .header-container,
  .main-content,
  .dole-row-corrida,
  .dashboard-widgets-grid,
  .dashboard-left-column,
  .dashboard-right-column,
  .panel-card {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  .header-container {
    padding: 10px 14px;
    flex-wrap: wrap;
    gap: 10px;
  }

  .brand-logo {
    gap: 8px;
  }

  .brand-dole-img {
    height: 24px !important;
  }

  .brand-title {
    font-size: 1.05rem !important;
  }

  /* Navigation Ribbon: smooth horizontal scroll without breaking layout */
  .nav-tabs {
    order: 3;
    width: 100% !important;
    overflow-x: auto !important;
    display: flex !important;
    flex-wrap: nowrap !important;
    gap: 6px;
    padding: 6px 4px;
    background: rgba(15, 23, 42, 0.95);
    border-radius: 10px;
    border: 1px solid #1e293b;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .nav-tabs::-webkit-scrollbar {
    display: none;
  }

  .nav-tab {
    padding: 8px 14px;
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
  }

  .nav-tab.active {
    background: #38bdf8;
    color: #0f172a;
    font-weight: 800;
    box-shadow: 0 2px 8px rgba(56, 189, 248, 0.3);
  }

  .header-actions {
    margin-left: auto;
    gap: 8px;
  }

  .btn-add-main {
    padding: 6px 12px;
    font-size: 0.82rem;
  }

  .add-menu-dropdown-content {
    right: 0;
    width: calc(100vw - 28px);
    max-width: 320px;
  }

  /* Main Container */
  .main-content {
    padding: 10px 6px;
  }

  /* Mobile Search Bar Displayed on Mobile */
  .mobile-search-toggle-bar {
    display: flex !important;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    width: 100% !important;
  }

  /* Filter Bar on Mobile: Collapsed by Default */
  .dole-filter-bar {
    display: none !important;
    padding: 12px;
    gap: 10px;
    background: #111827;
    border: 1px solid #38bdf8;
    border-radius: 12px;
    margin-bottom: 12px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4);
    width: 100% !important;
  }

  .dole-filter-bar.mobile-filters-open {
    display: flex !important;
    position: fixed !important;
    inset: auto 8px 8px !important;
    z-index: 1101;
    max-height: min(76vh, 650px);
    overflow-y: auto;
    flex-direction: column;
    animation: fadeInDown 0.2s ease;
    margin: 0 !important;
    padding: 12px 12px calc(12px + env(safe-area-inset-bottom)) !important;
    overscroll-behavior: contain;
  }

  body.mobile-filters-visible::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 1100;
    background: rgba(2, 6, 23, 0.52);
    backdrop-filter: blur(2px);
  }

  .mobile-filter-sheet-head {
    position: sticky;
    top: -12px;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 44px;
    margin: -12px -12px 2px;
    padding: 10px 12px;
    color: var(--text-main);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
  }

  .mobile-filter-sheet-head strong {
    font-size: 0.9rem;
  }

  .mobile-filter-sheet-head button {
    width: 32px;
    height: 32px;
    padding: 0;
    color: var(--text-main);
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 9px;
    font-size: 1.35rem;
    line-height: 1;
  }

  .filter-item {
    width: 100% !important;
    min-width: 0 !important;
    flex: 1 1 100% !important;
  }

  .filter-item-actions {
    width: 100% !important;
    margin-left: 0;
    display: flex;
    gap: 6px;
  }

  .filter-item-actions .btn {
    flex: 1;
    text-align: center;
    justify-content: center;
  }

  /* Hide Desktop Table, Show Mobile Cards */
  .dole-desktop-table-wrap {
    display: none !important;
  }

  /* Hide Desktop Widget controls & headers on Mobile */
  .widget-controls,
  .widget-drag-handle,
  .panel-card > .panel-header {
    display: none !important;
  }

  .dole-mobile-cards-wrap {
    display: flex !important;
    flex-direction: column;
    gap: 10px;
    width: 100% !important;
    padding: 4px 0;
  }

  /* Mobile Native Clean View: Hide desktop frames and secondary desktop analytics column */
  .dashboard-right-column {
    display: none !important;
  }

  #dashboardLeftColumn .panel-card {
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    box-shadow: none !important;
  }

  #dashboardWidgetsGrid {
    margin-top: 0 !important;
    gap: 0 !important;
  }

  .widget-body-content {
    padding: 0 !important;
  }

  /* Modal responsive on mobile */
  .modal-backdrop {
    padding: 8px;
  }

  .modal-card {
    max-width: 100% !important;
    border-radius: 12px;
  }

  .modal-header {
    padding: 14px 16px;
  }

  .modal-body {
    padding: 14px 16px;
  }

  .doc-meta-grid {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
    padding: 12px !important;
  }

  .totals-summary {
    width: 100% !important;
  }
}

/* ==========================================================================
   DETECTOR DE DUPLICADOS
   ========================================================================== */
.dup-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.dup-actions select { min-width: 210px; }
.dup-filters { display: flex; gap: 18px; margin: 4px 0 14px; color: var(--text-dim); font-size: 0.88rem; }
.dup-filters label { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.dup-nav-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 5px; margin-left: 6px; border-radius: 9px; background: var(--accent-red); color: #fff; font-size: 0.7rem; font-weight: 800; }
.dup-toast { background: var(--accent-green-bg); border: 1px solid var(--accent-green); color: #a7f3d0; padding: 10px 14px; border-radius: var(--radius-md); margin-bottom: 14px; font-weight: 600; }
.dup-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 8px; }
.dup-kpi { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--radius-md); padding: 12px 14px; }
.dup-kpi span { display: block; color: var(--text-dim); font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.04em; }
.dup-kpi strong { display: block; margin-top: 4px; font-size: 1.35rem; color: var(--text-main); }
.dup-kpi-duplicate { border-color: rgba(239,68,68,0.55); } .dup-kpi-duplicate strong { color: #fca5a5; }
.dup-kpi-probable { border-color: rgba(245,158,11,0.55); } .dup-kpi-probable strong { color: #fcd34d; }
.dup-kpi-possible { border-color: rgba(56,189,248,0.45); } .dup-kpi-possible strong { color: #7dd3fc; }
.dup-hint { color: var(--text-dim); font-size: 0.8rem; margin: 6px 0 16px; }
.dup-empty { padding: 26px; text-align: center; color: var(--text-dim); background: var(--bg-card); border: 1px dashed var(--border-color); border-radius: var(--radius-md); }
.dup-bulk { margin-bottom: 14px; }
.dup-group { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--radius-lg); margin-bottom: 14px; overflow: hidden; }
.dup-group-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 14px; border-bottom: 1px solid var(--border-color); background: var(--bg-card-alt); }
.dup-lvl { padding: 3px 10px; border-radius: 999px; font-size: 0.75rem; font-weight: 800; letter-spacing: 0.02em; }
.dup-lvl-duplicate { background: rgba(239,68,68,0.22); color: #fca5a5; border: 1px solid rgba(239,68,68,0.6); }
.dup-lvl-probable { background: rgba(245,158,11,0.22); color: #fcd34d; border: 1px solid rgba(245,158,11,0.6); }
.dup-lvl-possible { background: rgba(56,189,248,0.18); color: #7dd3fc; border: 1px solid rgba(56,189,248,0.5); }
.dup-score { font-family: var(--font-mono); font-size: 0.8rem; color: var(--text-dim); }
.dup-count { font-size: 0.8rem; color: var(--text-dim); }
.dup-conflict { font-size: 0.78rem; color: #fcd34d; font-weight: 700; }
.dup-reasons { display: flex; gap: 6px; flex-wrap: wrap; flex-basis: 100%; }
.dup-reason { font-size: 0.74rem; padding: 2px 8px; border-radius: 6px; background: var(--accent-green-bg); color: #a7f3d0; }
.dup-reason-neg { background: var(--accent-amber-bg); color: #fde68a; }
.dup-table-wrap { overflow-x: auto; }
.dup-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.dup-table th { text-align: left; padding: 8px 12px; color: var(--text-dim); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; border-bottom: 1px solid var(--border-color); }
.dup-table td { padding: 9px 12px; border-bottom: 1px solid rgba(59,79,110,0.4); color: var(--text-main); vertical-align: top; }
.dup-table .text-right { text-align: right; }
.dup-sub { font-size: 0.7rem; color: var(--text-dim); font-family: var(--font-mono); }
.dup-notes { max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dup-diff { background: rgba(245,158,11,0.13); box-shadow: inset 2px 0 0 var(--accent-amber); }
.dup-row-keeper { background: rgba(16,185,129,0.07); }
.dup-tag { font-size: 0.7rem; padding: 2px 8px; border-radius: 6px; background: var(--accent-green-bg); color: #6ee7b7; white-space: nowrap; }
.dup-group-actions { display: flex; gap: 8px; flex-wrap: wrap; padding: 12px 14px; border-top: 1px solid var(--border-color); }
.dup-annulled { margin-top: 22px; background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--radius-md); padding: 12px 14px; }
.dup-annulled summary { cursor: pointer; font-weight: 700; color: var(--text-dim); }
.dup-annulled .dup-table { margin-top: 10px; }
.dup-review-pill { font-size: 0.72rem; font-weight: 800; padding: 2px 8px; border-radius: 999px; }

/* ==========================================================================
   BUSCADOR DE PRODUCTOS (detalle de compras + dónde comprarlo)
   ========================================================================== */
.search-mode-toggle { display: inline-flex; gap: 4px; margin-top: 14px; padding: 4px; background: var(--bg-app); border: 1px solid var(--border-color); border-radius: var(--radius-md); flex-wrap: wrap; }
.search-mode-btn { background: transparent; border: 0; color: var(--text-dim); font: inherit; font-size: 0.84rem; font-weight: 600; padding: 7px 14px; border-radius: 8px; cursor: pointer; }
.search-mode-btn:hover { color: var(--text-main); }
.search-mode-btn.active { background: var(--primary); color: #fff; }

.psv-results { display: flex; flex-direction: column; gap: 22px; }
.psv-note { background: var(--accent-amber-bg); border: 1px solid rgba(245,158,11,0.5); color: #fde68a; padding: 9px 14px; border-radius: var(--radius-md); font-size: 0.88rem; }
.psv-note-filter { background: var(--primary-light); border-color: var(--primary); color: #dbeafe; }
.psv-idle { background: var(--bg-card); border: 1px dashed var(--border-color); border-radius: var(--radius-lg); padding: 34px 26px; text-align: center; color: var(--text-dim); }
.psv-idle h3 { color: var(--text-main); margin-bottom: 8px; }
.psv-idle-count { margin-top: 12px; font-size: 0.8rem; color: var(--text-dim); }
.psv-idle-icon { display: none; }
.psv-empty-small { padding: 18px; text-align: center; color: var(--text-dim); background: var(--bg-card); border-radius: var(--radius-md); }

.psv-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)) auto; gap: 12px; align-items: stretch; }
.psv-kpi { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--radius-md); padding: 12px 14px; min-width: 0; }
.psv-kpi span { display: block; color: var(--text-dim); font-size: 0.72rem; text-transform: uppercase; letter-spacing: .04em; }
.psv-kpi strong { display: block; margin: 3px 0 2px; font-size: 1.2rem; color: var(--text-main); overflow-wrap: anywhere; }
.psv-kpi small { color: var(--text-dim); font-size: 0.76rem; }
.psv-export { align-self: center; white-space: nowrap; }

.psv-section-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.psv-section-head h3 { font-size: 1.05rem; }
.psv-section-head h3 small { font-weight: 500; color: var(--text-dim); font-size: 0.8rem; margin-left: 6px; }
.psv-link { background: none; border: 0; color: #7dd3fc; font: inherit; font-size: 0.84rem; cursor: pointer; padding: 4px 2px; text-decoration: underline; text-underline-offset: 3px; }
.psv-link:hover { color: #bae6fd; }
.psv-controls { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.psv-controls select { background: var(--bg-app); color: var(--text-main); border: 1px solid var(--border-color); border-radius: var(--radius-sm); padding: 6px 8px; font: inherit; font-size: 0.84rem; }
.psv-chip { background: var(--bg-app); border: 1px solid var(--border-color); color: var(--text-muted); font: inherit; font-size: 0.82rem; padding: 5px 11px; border-radius: 20px; cursor: pointer; }
.psv-chip b { margin-left: 4px; color: var(--text-main); }
.psv-chip:hover { border-color: var(--primary); }
.psv-chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }

.psv-suppliers { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; }
.psv-supplier { background: var(--bg-card); border: 1px solid var(--border-color); border-left: 4px solid var(--accent-green); border-radius: var(--radius-md); padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.psv-supplier.active { border-color: var(--primary); border-left-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.psv-supplier header { display: flex; flex-direction: column; gap: 2px; }
.psv-supplier-name { font-size: 1rem; color: var(--text-main); overflow-wrap: anywhere; }
.psv-supplier header small { color: var(--text-dim); font-size: 0.78rem; }
.psv-supplier-meta { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.psv-supplier-meta div { display: flex; flex-direction: column; min-width: 0; }
.psv-supplier-meta span { font-size: 0.68rem; text-transform: uppercase; color: var(--text-dim); letter-spacing: .03em; }
.psv-supplier-meta b { font-size: 0.9rem; color: var(--text-main); }
.psv-supplier-meta small { font-size: 0.72rem; color: var(--text-dim); }
.psv-supplier-products { margin: 0; padding-left: 18px; color: var(--text-muted); font-size: 0.8rem; display: flex; flex-direction: column; gap: 3px; }
.psv-supplier-btn { margin-top: auto; font-size: 0.82rem; padding: 7px 10px; }

.psv-docs { display: flex; flex-direction: column; gap: 14px; }
.psv-doc { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--radius-lg); padding: 16px 18px; display: flex; flex-direction: column; gap: 12px; }
.psv-doc-weak { opacity: .8; border-style: dashed; }
.psv-doc-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; flex-wrap: wrap; }
.psv-doc-head > div:first-child { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.psv-doc-number { font-size: 1.05rem; color: #38bdf8; }
.psv-doc-date { color: var(--text-dim); font-size: 0.85rem; }
.psv-doc-total { text-align: right; }
.psv-doc-total span { display: block; font-size: 0.68rem; text-transform: uppercase; color: var(--text-dim); }
.psv-doc-total b { font-size: 1.05rem; color: var(--accent-green); }
.psv-doc-supplier { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; background: rgba(16,185,129,0.1); border: 1px solid rgba(16,185,129,0.35); border-radius: var(--radius-md); padding: 8px 12px; }
.psv-doc-supplier span { font-size: 0.68rem; text-transform: uppercase; letter-spacing: .04em; color: #6ee7b7; }
.psv-doc-supplier strong { font-size: 1.02rem; color: var(--text-main); overflow-wrap: anywhere; }
.psv-doc-supplier small { color: var(--text-dim); font-size: 0.78rem; }

.psv-lines { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.psv-lines th { text-align: left; font-size: 0.7rem; text-transform: uppercase; color: var(--text-dim); font-weight: 700; padding: 6px 8px; border-bottom: 1px solid var(--border-color); }
.psv-lines th.text-right, .psv-lines td.text-right { text-align: right; }
.psv-lines td { padding: 7px 8px; border-bottom: 1px solid rgba(59,79,110,0.45); color: var(--text-muted); vertical-align: top; }
.psv-lines .psv-col-name { width: 55%; overflow-wrap: anywhere; }
.psv-lines small { color: var(--text-dim); }
.psv-line-hit td { background: rgba(37,99,235,0.14); color: var(--text-main); }
.psv-line-hit td:first-child { box-shadow: inset 3px 0 0 var(--primary); }
.psv-others { display: none; }
.psv-others.open { display: table-row-group; }
mark { background: rgba(250, 204, 21, 0.9); color: #111827; padding: 0 2px; border-radius: 3px; }
.psv-toggle-others { align-self: flex-start; }
.psv-notes { font-size: 0.86rem; color: var(--text-main); background: var(--bg-app); border-left: 3px solid var(--accent-cyan); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; padding: 8px 12px; overflow-wrap: anywhere; }
.psv-notes span { font-size: 0.68rem; text-transform: uppercase; color: var(--text-dim); margin-right: 6px; }
.psv-notes-dim { color: var(--text-dim); border-left-color: var(--border-color); }
.psv-doc-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.psv-refs { display: flex; gap: 6px; flex-wrap: wrap; }
.psv-ref { font-size: 0.76rem; color: var(--text-dim); border: 1px solid var(--border-color); border-radius: 12px; padding: 2px 9px; }
.psv-more { text-align: center; margin-top: 12px; }

@media (max-width: 900px) {
  .psv-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .psv-export { grid-column: 1 / -1; }
  .psv-supplier-meta { grid-template-columns: 1fr 1fr; }
  .psv-lines .psv-col-name { width: auto; }
}

/* ==========================================================================
   LIGHT THEME OVERRIDES (Tema Claro Enterprise)
   ========================================================================== */
body.light-theme {
  background-color: #f1f5f9 !important;
  color: #0f172a !important;
}

body.light-theme .header-container {
  background: #ffffff !important;
  border-bottom-color: #cbd5e1 !important;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06) !important;
}

body.light-theme .brand-title {
  color: #0f172a !important;
}

body.light-theme .nav-tabs {
  background: #e2e8f0 !important;
  border-color: #cbd5e1 !important;
}

body.light-theme .nav-tab {
  color: #475569 !important;
}

body.light-theme .nav-tab:hover {
  color: #0f172a !important;
  background: rgba(255, 255, 255, 0.6) !important;
}

body.light-theme .nav-tab.active {
  background: #ffffff !important;
  color: #0284c7 !important;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1) !important;
}

body.light-theme .panel-card,
body.light-theme .dashboard-widget-card {
  background: #ffffff !important;
  border-color: #cbd5e1 !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04) !important;
}

body.light-theme .dole-filter-bar {
  background: #ffffff !important;
  border-color: #cbd5e1 !important;
}

body.light-theme .filter-item label {
  color: #475569 !important;
}

body.light-theme .form-control {
  background: #f8fafc !important;
  border-color: #cbd5e1 !important;
  color: #0f172a !important;
}

body.light-theme .mobile-search-input {
  background: #ffffff !important;
  border-color: #0284c7 !important;
  color: #0f172a !important;
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.1) !important;
}

body.light-theme .btn-toggle-filters-mobile {
  background: #ffffff !important;
  border-color: #cbd5e1 !important;
  color: #334155 !important;
}

body.light-theme .dole-mobile-card {
  background: #ffffff !important;
  border-color: #cbd5e1 !important;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.05) !important;
}

body.light-theme .dole-mobile-supplier {
  color: #0f172a !important;
}

body.light-theme .dole-mobile-amount-box {
  background: #f0fdf4 !important;
  border-color: #bbf7d0 !important;
}

body.light-theme .dole-mobile-amount {
  color: #16a34a !important;
}

body.light-theme .dole-mobile-card div[style*="background: #0f172a"],
body.light-theme .dole-mobile-notes {
  background: #f8fafc !important;
  border-color: #e2e8f0 !important;
  color: #1e293b !important;
}

body.light-theme .dole-table-wrapper table th {
  background-color: #f1f5f9 !important;
  color: #334155 !important;
  border-bottom-color: #cbd5e1 !important;
}

body.light-theme .dole-table-wrapper table td {
  color: #1e293b !important;
  border-bottom-color: #e2e8f0 !important;
}

body.light-theme .panel-title,
body.light-theme .panel-title-sm,
body.light-theme .widget-title-area .panel-title,
body.light-theme .widget-title-area .panel-title-sm {
  color: #0f172a !important;
}

body.light-theme .widget-header,
body.light-theme .panel-header {
  border-bottom-color: #cbd5e1 !important;
}

body.light-theme .dole-date {
  color: #475569 !important;
}

body.light-theme .dole-supplier,
body.light-theme .dole-observation-primary {
  color: #0f172a !important;
}

body.light-theme .dole-rut,
body.light-theme .dole-observation-secondary {
  color: #475569 !important;
}

body.light-theme .dole-amount {
  color: #047857 !important;
}

body.light-theme .dole-match-text {
  color: #0369a1 !important;
}

body.light-theme .status-badge-pending {
  background: #fffbeb !important;
  color: #92400e !important;
  border-color: #d97706 !important;
}

body.light-theme .status-badge-received {
  background: #ecfdf5 !important;
  color: #065f46 !important;
  border-color: #059669 !important;
}

body.light-theme .category-tag {
  background: #e0f2fe !important;
  color: #075985 !important;
  border-color: #0284c7 !important;
}

body.light-theme .dole-table-wrapper table tr:hover {
  background-color: #f0f9ff !important;
}

body.light-theme .btn-secondary {
  background: #ffffff !important;
  border-color: #cbd5e1 !important;
  color: #334155 !important;
}

/* ==========================================================================
   DASHBOARD POLISH — clean operational view + focused edit mode
   ========================================================================== */

/* Keep configuration chrome out of the day-to-day dashboard. */
.dashboard-widgets-grid:not(.customizing-mode) .widget-drag-handle,
.dashboard-widgets-grid:not(.customizing-mode) .btn-move-card,
.dashboard-widgets-grid:not(.customizing-mode) .widget-height-selector,
.dashboard-widgets-grid:not(.customizing-mode) .widget-size-selector {
  display: none !important;
}

.dashboard-widgets-grid:not(.customizing-mode) .dashboard-widget-card {
  resize: none;
}

.dashboard-widgets-grid.customizing-mode .dashboard-widget-card {
  resize: vertical;
}

.dashboard-widgets-grid:not(.customizing-mode) .widget-header {
  min-height: 38px;
  margin-bottom: 14px;
  padding-bottom: 10px;
}

.dashboard-widgets-grid:not(.customizing-mode) .widget-title-area {
  overflow: visible;
}

.dashboard-widgets-grid:not(.customizing-mode) .widget-title-area .panel-title,
.dashboard-widgets-grid:not(.customizing-mode) .widget-title-area .panel-title-sm {
  overflow: visible;
  text-overflow: clip;
  white-space: normal;
}

/* Balanced 2/3 + 1/3 desktop composition. */
.dashboard-left-column {
  flex-basis: calc(68% - 10px);
  width: calc(68% - 10px);
  max-width: calc(68% - 10px);
}

.dashboard-right-column {
  flex-basis: calc(32% - 10px);
  width: calc(32% - 10px);
  max-width: calc(32% - 10px);
  gap: 16px;
}

.dashboard-widget-card[data-widget-id="table"].h-xl {
  height: 744px !important;
}

.panel-card {
  padding: 18px;
}

.panel-card:hover {
  border-color: #526785;
}

.customizing-mode .panel-card:hover {
  border-color: #38bdf8;
}

.widget-title-area .panel-title {
  letter-spacing: -0.02em;
}

.widget-title-area .panel-title-sm {
  letter-spacing: 0.035em;
}

/* Compact, readable summary card. */
.dashboard-widget-card[data-widget-id="details"] .dole-details-body {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 18px;
  align-content: center;
  justify-content: initial !important;
}

.dashboard-widget-card[data-widget-id="details"] .dole-details-body > div:first-child,
.dashboard-widget-card[data-widget-id="details"] .dole-details-body > div:last-child {
  grid-column: 1 / -1;
}

.dashboard-widget-card[data-widget-id="details"] .detail-value-main {
  margin-top: 2px;
}

/* Table density and predictable truncation. */
.dole-desktop-table-wrap {
  min-width: clamp(1080px, 64vw, 1220px);
}

.dole-table-wrapper table th {
  padding: clamp(9px, 0.65vw, 12px) clamp(7px, 0.55vw, 10px) !important;
  font-size: clamp(0.68rem, 0.62rem + 0.12vw, 0.76rem) !important;
  letter-spacing: 0.045em;
}

.dole-table-wrapper table td {
  padding: clamp(9px, 0.65vw, 12px) clamp(7px, 0.55vw, 10px) !important;
  font-size: clamp(0.77rem, 0.7rem + 0.15vw, 0.88rem) !important;
  line-height: 1.35;
}

.dole-table-wrapper tbody tr {
  height: 82px;
}

.dole-detail-cell {
  min-width: clamp(250px, 17vw, 310px);
}

.dole-detail-content {
  width: 100%;
  padding-right: 8px;
}

.dole-detail-content .dole-observation-primary,
.dole-detail-content .dole-match-text,
.dole-detail-content .dole-observation-secondary {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
}

.dole-detail-content .dole-observation-primary,
.dole-detail-content .dole-match-text {
  -webkit-line-clamp: 2;
}

.dole-detail-content .dole-observation-secondary {
  margin-top: 3px;
  -webkit-line-clamp: 1;
}

/* Horizontal fallback: keep the document identifier visible while inspecting columns. */
.dole-desktop-table-wrap thead th:first-child,
.dole-desktop-table-wrap tbody td:first-child {
  position: sticky;
  left: 0;
}

.dole-desktop-table-wrap thead th:first-child {
  z-index: 4;
}

.dole-desktop-table-wrap tbody td:first-child {
  z-index: 2;
  background: #1a233a;
  box-shadow: 6px 0 10px -10px rgba(2, 6, 23, 0.9);
}

.dole-desktop-table-wrap tbody tr:hover td:first-child {
  background: #20314c;
}

body.light-theme .dole-desktop-table-wrap tbody td:first-child {
  background: #ffffff;
  box-shadow: 6px 0 12px -10px rgba(15, 23, 42, 0.38);
}

body.light-theme .dole-desktop-table-wrap tbody tr:nth-child(even) td:first-child {
  background: #f8fafc;
}

body.light-theme .dole-desktop-table-wrap tbody tr:hover td:first-child {
  background: #eaf5ff;
}

.category-tag {
  display: inline-block !important;
  max-width: 170px;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
}

/* Controls and filters share a consistent 40px rhythm. */
.dole-filter-bar {
  gap: 12px;
  padding: 14px 16px;
  border-radius: 14px;
}

.form-control-sm {
  height: 38px !important;
  padding: 6px 10px !important;
}

.filter-item-actions .btn-sm {
  min-height: 38px;
}

#btnCustomLayout {
  font-weight: 700;
}

/* Light theme: cohesive cards instead of dark islands. */
body.light-theme .dashboard-widget-card[data-widget-id="details"] .detail-label {
  color: #475569 !important;
}

body.light-theme .dashboard-widget-card[data-widget-id="details"] .detail-value-main,
body.light-theme #doleGaugePercentText {
  color: #0f172a !important;
}

body.light-theme .dashboard-widget-card[data-widget-id="details"] .dole-details-body > div:last-child {
  color: #475569 !important;
  border-top-color: #e2e8f0 !important;
}

body.light-theme .dole-treemap-box {
  background: #f8fafc !important;
  border-top-color: #e2e8f0 !important;
  box-shadow: inset 0 0 0 1px #e2e8f0;
}

body.light-theme .dole-treemap-box:hover {
  background: #f0f9ff !important;
  box-shadow: inset 0 0 0 1px #bae6fd, 0 6px 16px rgba(15, 23, 42, 0.08);
}

body.light-theme .dole-treemap-title {
  color: #334155 !important;
}

body.light-theme .dole-treemap-val {
  color: #047857 !important;
}

body.light-theme .panel-card:hover {
  border-color: #94a3b8 !important;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.08) !important;
}

body.light-theme .panel-card,
body.light-theme .dashboard-widget-card {
  background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%) !important;
  border-color: #b9c7d8 !important;
  box-shadow: 0 5px 18px rgba(30, 64, 175, 0.075) !important;
}

body.light-theme .widget-header,
body.light-theme .panel-header {
  border-bottom-color: #b9c7d8 !important;
}

body.light-theme .dole-filter-bar {
  border-color: #b9c7d8 !important;
  box-shadow: 0 5px 18px rgba(30, 64, 175, 0.08) !important;
}

body.light-theme .dole-table-wrapper table th {
  background-color: #e8eef6 !important;
  color: #1e293b !important;
  border-bottom-color: #aebdce !important;
}

body.light-theme .dole-table-wrapper table td {
  border-bottom-color: #d5dee9 !important;
}

body.light-theme .dole-table-wrapper tbody tr:nth-child(even) {
  background: #f8fafc;
}

body.light-theme .dole-table-wrapper table tr:hover {
  background-color: #eaf5ff !important;
  box-shadow: inset 3px 0 0 #0ea5e9;
}

body.light-theme .dole-observation-secondary,
body.light-theme .dole-rut {
  color: #526071 !important;
}

body.light-theme .qtr-pill {
  background: #eef2f7;
  border-color: #cbd5e1;
  color: #475569;
}

body.light-theme .qtr-pill:hover {
  background: #e0f2fe;
  border-color: #7dd3fc;
  color: #075985;
}

body.light-theme .qtr-pill.active {
  background: #2563eb;
  border-color: #2563eb;
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.24);
}

body.light-theme canvas {
  opacity: 1 !important;
}

body.light-theme .customizing-mode .panel-card:hover {
  border-color: #0284c7 !important;
}

body.light-theme .widget-height-selector,
body.light-theme .widget-size-selector {
  background: #f8fafc;
  border-color: #cbd5e1;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.1);
}

body.light-theme .btn-height,
body.light-theme .btn-size {
  color: #64748b;
}

body.light-theme .btn-height:hover,
body.light-theme .btn-size:hover {
  color: #0f172a;
  background: #e2e8f0;
}

body.light-theme *::-webkit-scrollbar-track {
  background: #f1f5f9 !important;
}

body.light-theme *::-webkit-scrollbar-thumb {
  background: #94a3b8 !important;
}

@media (max-width: 1280px) {
  .dashboard-left-column,
  .dashboard-right-column {
    flex: 0 0 100% !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  .dashboard-right-column {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-right-column .dashboard-widget-card {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
  }
}

@media (max-width: 1024px) {
  .dashboard-right-column {
    display: none !important;
  }

  .dashboard-widget-card[data-widget-id="table"].h-xl {
    height: auto !important;
  }

  /* Softer professional light palette for handheld use. */
  body.light-theme {
    background: #e9eef5 !important;
  }

  body.light-theme .header-container {
    background: #f7f9fc !important;
  }

  body.light-theme .main-content {
    background: #e9eef5 !important;
  }

  body.light-theme .mobile-search-input,
  body.light-theme .btn-toggle-filters-mobile,
  body.light-theme .btn-secondary {
    background: #f7f9fc !important;
  }

  body.light-theme .dole-mobile-card {
    background: #f7f9fc !important;
    border-color: #b8c5d4 !important;
    box-shadow: 0 5px 16px rgba(51, 65, 85, 0.10) !important;
  }

  body.light-theme .dole-mobile-card:hover,
  body.light-theme .dole-mobile-card:active {
    background: #f2f6fa !important;
    border-color: #0ea5e9 !important;
  }

  body.light-theme .dole-mobile-date,
  body.light-theme .dole-mobile-extra-info {
    color: #64748b !important;
  }

  body.light-theme .dole-mobile-amount-box {
    background: #edf8f1 !important;
    border-color: #b7dfc5 !important;
  }

  body.light-theme .dole-mobile-amount-box > span,
  body.light-theme .dole-mobile-amount-box div:first-child {
    color: #64748b !important;
  }

  body.light-theme .dole-mobile-items-panel {
    background: #edf2f7 !important;
    border-color: #c2cddd !important;
  }

  body.light-theme .dole-mobile-items-title {
    color: #526071 !important;
  }

  body.light-theme .dole-mobile-item-name {
    color: #27364a !important;
    font-weight: 600 !important;
  }

  body.light-theme .dole-mobile-item-qty {
    color: #0369a1 !important;
    font-weight: 800 !important;
  }

  body.light-theme .dole-mobile-item-price {
    color: #047857 !important;
    font-weight: 800 !important;
  }

  body.light-theme .dole-mobile-item-row.is-match {
    background: #dff3ff !important;
    border-left-color: #0284c7 !important;
  }

  body.light-theme .dole-mobile-item-row.is-match .dole-mobile-item-name {
    color: #075985 !important;
  }

  body.light-theme .dole-mobile-items-more {
    color: #526071 !important;
  }
}

/* Mobile header: compact controls and a swipeable navigation ribbon. */
@media (max-width: 1024px) {
  .header-container {
    padding: 8px 10px 7px !important;
    gap: 7px !important;
    align-items: center !important;
  }

  .brand-logo {
    order: 1;
    gap: 0 !important;
    min-width: 0;
  }

  .brand-title {
    display: none !important;
  }

  .brand-dole-img {
    height: 34px !important;
    padding: 3px 6px !important;
    border-radius: 8px !important;
  }

  .header-actions {
    order: 2;
    margin-left: auto !important;
    gap: 6px !important;
    flex: 0 0 auto;
  }

  .header-actions .btn-icon-only,
  .btn-add-main {
    width: 40px !important;
    min-width: 40px !important;
    height: 40px !important;
    min-height: 40px !important;
    padding: 0 !important;
    border-radius: 10px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
  }

  .btn-add-main .btn-add-text,
  .btn-add-main .dropdown-caret {
    display: none !important;
  }

  .btn-add-main > svg:first-child {
    width: 21px !important;
    height: 21px !important;
  }

  .nav-tabs {
    order: 3;
    flex: 0 0 100%;
    width: 100% !important;
    margin: 0 !important;
    padding: 4px !important;
    gap: 4px !important;
    scroll-snap-type: x proximity;
    overscroll-behavior-x: contain;
  }

  .nav-tab {
    min-height: 40px;
    padding: 8px 12px !important;
    font-size: 0.82rem !important;
    scroll-snap-align: start;
  }

  .add-menu-dropdown-content {
    top: calc(100% + 8px);
  }

  .main-content {
    padding-top: 8px !important;
  }
}

@media (max-width: 380px) {
  .header-container {
    padding-inline: 8px !important;
  }

  .brand-dole-img {
    height: 32px !important;
  }

  .header-actions .btn-icon-only,
  .btn-add-main {
    width: 38px !important;
    min-width: 38px !important;
    height: 38px !important;
    min-height: 38px !important;
  }
}

/* Ajuste 2/3: OC + Documentos deben caber en ventanas medianas sin obligar al 100%. */
.dashboard-left-column .dashboard-widget-card[data-widget-id="table"] {
  min-width: 0;
}

.dashboard-widget-card[data-widget-id="table"] .widget-header {
  gap: 8px;
  margin-bottom: 10px !important;
}

.dashboard-widget-card[data-widget-id="table"] .panel-title {
  font-size: clamp(0.92rem, 0.82rem + 0.22vw, 1.05rem) !important;
}

.dashboard-widget-card[data-widget-id="table"] #doleTableCountBadge {
  flex: 0 0 auto;
  font-size: clamp(0.68rem, 0.62rem + 0.12vw, 0.8rem) !important;
  padding: 3px 8px !important;
}

.dole-table-wrapper {
  overflow-x: hidden !important;
}

.dole-desktop-table-wrap {
  width: 100%;
  min-width: 0 !important;
  max-width: 100%;
}

.dole-oc-documents-table {
  width: 100% !important;
  table-layout: fixed !important;
  font-size: clamp(0.68rem, 0.55rem + 0.5vw, 0.86rem) !important;
}

.dole-oc-documents-table .col-oc { width: 12%; }
.dole-oc-documents-table .col-date { width: 8%; }
.dole-oc-documents-table .col-supplier { width: 19%; }
.dole-oc-documents-table .col-detail { width: 29%; }
.dole-oc-documents-table .col-cenco { width: 14%; }
.dole-oc-documents-table .col-total { width: 9%; }
.dole-oc-documents-table .col-status { width: 9%; }

.dole-table-wrapper .dole-oc-documents-table th {
  padding: clamp(7px, 0.46vw, 10px) clamp(4px, 0.34vw, 8px) !important;
  font-size: clamp(0.58rem, 0.5rem + 0.22vw, 0.72rem) !important;
  letter-spacing: 0.025em !important;
}

.dole-table-wrapper .dole-oc-documents-table td {
  padding: clamp(7px, 0.48vw, 10px) clamp(4px, 0.36vw, 8px) !important;
  font-size: clamp(0.66rem, 0.56rem + 0.35vw, 0.84rem) !important;
  line-height: 1.24 !important;
}

.dole-table-wrapper .dole-oc-documents-table tbody tr {
  height: 72px;
}

.dole-oc-documents-table th,
.dole-oc-documents-table td {
  min-width: 0;
  overflow: hidden;
}

.dole-oc-documents-table .dole-oc-badge {
  max-width: 100%;
  display: inline-block;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: clamp(0.62rem, 0.52rem + 0.3vw, 0.82rem) !important;
  padding: 3px 6px !important;
  letter-spacing: 0.01em !important;
}

.dole-oc-documents-table .dole-date,
.dole-oc-documents-table .dole-supplier,
.dole-oc-documents-table .dole-rut,
.dole-oc-documents-table .dole-amount,
.dole-oc-documents-table .dole-observation-primary,
.dole-oc-documents-table .dole-observation-secondary,
.dole-oc-documents-table .dole-match-text {
  font-size: inherit !important;
}

.dole-oc-documents-table .dole-supplier {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.dole-oc-documents-table .dole-rut {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.84em !important;
}

.dole-oc-documents-table .dole-detail-cell {
  min-width: 0 !important;
}

.dole-oc-documents-table .dole-detail-content {
  padding-right: 0 !important;
}

.dole-oc-documents-table .dole-cenco-tag,
.dole-oc-documents-table .category-tag {
  max-width: 100% !important;
  padding-inline: 8px;
}

.dole-oc-documents-table .status-badge-pending,
.dole-oc-documents-table .status-badge-received {
  max-width: 100%;
  display: inline-block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: clamp(0.58rem, 0.5rem + 0.18vw, 0.72rem) !important;
  padding: 3px 6px !important;
}

.dole-oc-documents-table .dole-marquee-label {
  position: relative;
  vertical-align: middle;
  cursor: help;
}

.dole-oc-documents-table .dole-marquee-label:focus-visible {
  outline: 2px solid rgba(125, 211, 252, 0.72);
  outline-offset: 2px;
}

.dole-oc-documents-table .dole-marquee-text {
  display: inline-block;
  min-width: max-content;
  transform: translateX(0);
  will-change: transform;
}

.dole-oc-documents-table .dole-marquee-label.has-marquee:hover .dole-marquee-text,
.dole-oc-documents-table .dole-marquee-label.has-marquee:focus-visible .dole-marquee-text {
  animation: doleLabelMarquee 4.8s ease-in-out infinite;
}

@keyframes doleLabelMarquee {
  0%, 14% {
    transform: translateX(0);
  }
  48%, 66% {
    transform: translateX(calc(-1 * var(--dole-marquee-distance, 24px)));
  }
  100% {
    transform: translateX(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .dole-oc-documents-table .dole-marquee-label.has-marquee:hover .dole-marquee-text,
  .dole-oc-documents-table .dole-marquee-label.has-marquee:focus-visible .dole-marquee-text {
    animation: none;
    transform: translateX(0);
  }
}

.dole-oc-documents-table .amount {
  white-space: nowrap;
}

/* La pestaña Documentos comparte el mismo criterio: todos los campos visibles. */
#documents-pane .page-header {
  gap: 12px;
}

#documents-pane .page-header > div:last-child {
  flex-wrap: wrap;
  justify-content: flex-end;
}

#documents-pane .search-banner {
  padding: clamp(12px, 1vw, 16px) !important;
}

#databaseTableContainer .table-responsive {
  overflow-x: hidden !important;
}

.documents-database-table {
  width: 100% !important;
  table-layout: fixed;
  font-size: clamp(0.68rem, 0.58rem + 0.34vw, 0.84rem);
}

.documents-database-table .col-type { width: 9%; }
.documents-database-table .col-folio { width: 11%; }
.documents-database-table .col-date { width: 9%; }
.documents-database-table .col-supplier { width: 21%; }
.documents-database-table .col-net { width: 9%; }
.documents-database-table .col-tax { width: 8%; }
.documents-database-table .col-total { width: 10%; }
.documents-database-table .col-year { width: 6%; }
.documents-database-table .col-status { width: 9%; }
.documents-database-table .col-actions { width: 8%; }

.documents-database-table th,
.documents-database-table td {
  min-width: 0;
  overflow: hidden;
  padding: clamp(8px, 0.62vw, 12px) clamp(5px, 0.42vw, 10px) !important;
  font-size: inherit !important;
  line-height: 1.25;
}

.documents-database-table th {
  font-size: clamp(0.58rem, 0.5rem + 0.18vw, 0.72rem) !important;
  letter-spacing: 0.025em !important;
}

.documents-database-table .badge,
.documents-database-table .category-tag {
  max-width: 100%;
  display: inline-block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 3px 7px;
}

.documents-database-table .supplier-info {
  min-width: 0;
}

.documents-database-table .supplier-name,
.documents-database-table .supplier-rut,
.documents-database-table td strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.documents-database-table .supplier-rut {
  font-size: 0.82em;
}

.documents-database-table .amount {
  white-space: nowrap;
}

.documents-database-table .action-buttons {
  display: inline-flex;
  gap: 4px;
  justify-content: center;
  max-width: 100%;
}

.documents-database-table .btn-icon {
  width: clamp(24px, 1.7vw, 30px);
  height: clamp(24px, 1.7vw, 30px);
  min-width: clamp(24px, 1.7vw, 30px);
  padding: 0;
}

.documents-database-table .btn-icon svg {
  width: 15px;
  height: 15px;
}

@media (max-width: 1360px) {
  .dole-oc-documents-table .col-detail { width: 27%; }
  .dole-oc-documents-table .col-supplier { width: 18%; }
  .dole-oc-documents-table .col-cenco { width: 13%; }
  .dole-oc-documents-table .col-total { width: 10%; }
  .dole-oc-documents-table .col-status { width: 12%; }

  .documents-database-table .col-supplier { width: 19%; }
  .documents-database-table .col-actions { width: 9%; }
}

@media (max-width: 1180px) {
  .dashboard-left-column,
  .dashboard-right-column {
    flex: 0 0 100%;
    width: 100%;
    max-width: 100%;
  }
}

/* Solutions PC dashboard: composición compacta y oscura inspirada en la suite comercial */
@media (min-width: 1101px) {
  body:not(.light-theme) { background: radial-gradient(circle at 78% 10%, #12335d 0, transparent 42%), #061426; color: #e8f1ff; }
  body:not(.light-theme) .app-header { background: rgba(6,20,38,.88); border-bottom: 1px solid #1c4168; box-shadow: 0 8px 24px rgba(0,0,0,.28); }
  body:not(.light-theme) .main-content { padding-top: 18px; }
  body:not(.light-theme) .dole-filter-bar,
  body:not(.light-theme) .panel-card,
  body:not(.light-theme) .dashboard-widget-card { background: linear-gradient(145deg, rgba(18,45,78,.94), rgba(7,23,44,.96)); border-color: #21466f; box-shadow: 0 12px 28px rgba(0,0,0,.24); }
  body:not(.light-theme) .dole-filter-bar { margin-top: 0; }
  body:not(.light-theme) .form-control-sm { background: #0a1d35 !important; border-color: #2b527d !important; color: #eaf3ff !important; }
  body:not(.light-theme) .filter-item label { color: #9fbeda !important; }
  body:not(.light-theme) .panel-card h3, body:not(.light-theme) .panel-card h4 { color: #f2f7ff; }
  body:not(.light-theme) .data-table thead th { background: #0b213d; color: #b7d0ea; border-color: #244a74; }
  body:not(.light-theme) .data-table tbody tr { border-color: #1e4168; }
  body:not(.light-theme) .data-table tbody tr:hover { background: rgba(45,126,219,.15); }
  .desktop-filter-toolbar { display:none; }
  .desktop-filter-trigger { border:1px solid #2d74bd; color:#e7f2ff; background:#102c4e; border-radius:9px; padding:7px 12px; font-size:.78rem; font-weight:800; cursor:pointer; white-space:nowrap; }
  .desktop-filter-trigger:hover { background:#174878; border-color:#49a3ff; }
  .desktop-filter-hint { color:#7896b6; font-size:.78rem; }
  .dole-filter-bar { display:none; margin-bottom:8px; padding:10px 12px; }
  body.desktop-filters-open .dole-filter-bar { display:flex; }
  body.desktop-filters-open .desktop-filter-trigger { background:#1d6ab3; border-color:#59b4ff; box-shadow:0 0 0 2px rgba(56,189,248,.12); }
  .dashboard-table-quickbar { margin-left:auto; display:flex; align-items:center; justify-content:flex-end; gap:8px; min-width:260px; flex:1 1 360px; max-width:510px; }
  .dashboard-title-search { flex:1 1 300px; max-width:410px; min-width:210px; }
  .dashboard-title-search .form-control-sm { width:100%; height:34px !important; padding:6px 10px !important; letter-spacing:0; }
  body.light-theme .desktop-filter-toolbar { background: #f4f8fd; border:1px solid #d4e1ef; border-radius:10px; padding:7px 10px; }
  body.light-theme .desktop-filter-trigger { color:#183554; background:#fff; border-color:#9ec3e8; }
}

@media (max-width: 1100px) {
  .desktop-filter-toolbar { display:none; }
  .dashboard-table-quickbar { display:none; }
}

/* Mobile dashboard summary sits above search/results. */
@media (max-width: 1024px) {
  .mobile-dashboard-summary-heading {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    margin: 4px 6px 7px;
    color: var(--text-main);
  }

  .mobile-dashboard-summary-heading strong { font-size: 0.92rem; }
  .mobile-dashboard-summary-heading span {
    color: var(--text-dim);
    font-size: 0.72rem;
    white-space: nowrap;
  }

  #dashboardWidgetsGrid {
    display: flex !important;
    position: relative;
    flex-direction: column;
    flex-wrap: nowrap !important;
    gap: 4px !important;
    margin-top: 0 !important;
    overflow: visible !important;
  }

  #dashboardRightColumn {
    display: flex !important;
    order: 1;
    width: 100% !important;
    max-width: 100% !important;
    flex: 0 0 auto !important;
    flex-flow: row nowrap !important;
    gap: 14px !important;
    padding: 0 6px 1px;
    margin: 0 0 2px !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    scroll-snap-type: x mandatory;
    scroll-padding-inline: 6px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  #dashboardRightColumn::-webkit-scrollbar { display: none; }

  #dashboardLeftColumn {
    order: 2;
    width: 100% !important;
    max-width: 100% !important;
    flex: 0 0 auto !important;
    gap: 4px !important;
  }

  #dashboardRightColumn .dashboard-widget-card {
    display: flex !important;
    flex: 0 0 100% !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 100% !important;
    height: 188px !important;
    min-height: 188px !important;
    max-height: 188px !important;
    padding: 13px !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 13px !important;
    background: var(--bg-card) !important;
    box-shadow: var(--shadow-sm) !important;
    scroll-snap-align: center;
    overflow: hidden;
  }

  #dashboardRightColumn .dashboard-widget-card[data-widget-id="budget"],
  #dashboardRightColumn .dashboard-widget-card[data-widget-id="treemap"],
  #dashboardRightColumn .dashboard-widget-card[data-widget-id="suppliers"],
  #dashboardRightColumn .dashboard-widget-card[data-widget-id="analytics"] {
    display: none !important;
  }

  #dashboardRightColumn .dashboard-widget-card.mobile-dashboard-enabled:not([data-widget-id="budget"]) {
    display: flex !important;
  }

  .mobile-dashboard-config {
    display: block;
    position: absolute;
    top: 8px;
    right: 16px;
    z-index: 30;
  }

  .mobile-dashboard-config-trigger {
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    padding: 0;
    color: #eaf2ff;
    background: #1e3a5f;
    border: 1px solid #4a79aa;
    border-radius: 8px;
    font: 800 1.05rem/1 var(--font-main);
    box-shadow: 0 2px 6px rgba(2, 6, 23, 0.18);
    cursor: pointer;
  }

  .mobile-dashboard-config-panel {
    display: none;
    position: absolute;
    top: 34px;
    right: 0;
    width: 218px;
    padding: 11px;
    color: #e2e8f0;
    background: #111d32;
    border: 1px solid #3b4f6e;
    border-radius: 12px;
    box-shadow: 0 14px 34px rgba(2, 6, 23, 0.38);
  }

  .mobile-dashboard-config.open .mobile-dashboard-config-panel {
    display: grid;
    gap: 8px;
  }

  .mobile-dashboard-config-panel strong {
    margin-bottom: 2px;
    font-size: 0.78rem;
  }

  .mobile-dashboard-config-panel label {
    min-height: 32px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.78rem;
    font-weight: 650;
    cursor: pointer;
  }

  .mobile-dashboard-config-panel input {
    width: 17px;
    height: 17px;
    accent-color: #0284c7;
  }

  #dashboardRightColumn .panel-header {
    display: flex !important;
    min-height: 27px !important;
    margin-bottom: 7px !important;
    padding-bottom: 7px !important;
  }

  #dashboardRightColumn .widget-title-area,
  #dashboardRightColumn .panel-title-sm { display: flex !important; }

  #dashboardRightColumn .panel-title-sm {
    color: var(--text-main);
    font-size: 0.78rem;
    letter-spacing: 0 !important;
    line-height: 1.2;
  }

  #dashboardRightColumn .widget-body-content {
    min-height: 0 !important;
    margin-top: 0 !important;
  }

  #dashboardRightColumn [data-widget-id="details"] .dole-details-body {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px 12px;
    padding-top: 0 !important;
  }

  #dashboardRightColumn [data-widget-id="details"] .dole-details-body > div:first-child {
    grid-column: 1;
  }

  #dashboardRightColumn [data-widget-id="details"] .mobile-budget-mini {
    display: grid !important;
    grid-template-columns: 50px minmax(0, 1fr);
    align-items: center;
    align-self: center;
    gap: 7px;
    min-width: 0;
  }

  .mobile-budget-ring {
    --budget-used: 0%;
    position: relative;
    width: 50px;
    height: 50px;
    display: grid;
    place-items: center;
    flex: 0 0 50px;
    border-radius: 50%;
    background: conic-gradient(#10b981 var(--budget-used), #dce5ec 0);
  }

  .mobile-budget-ring::before {
    content: '';
    position: absolute;
    inset: 7px;
    background: var(--bg-card);
    border-radius: 50%;
  }

  .mobile-budget-ring span {
    position: relative;
    z-index: 1;
    color: var(--text-main);
    font-size: 0.58rem;
    font-weight: 800;
    letter-spacing: -0.025em;
  }

  .mobile-budget-mini small {
    color: var(--text-dim);
    font-size: 0.62rem;
    font-weight: 750;
    line-height: 1.2;
  }

  #dashboardRightColumn [data-widget-id="details"] .detail-label { font-size: 0.65rem; }
  #dashboardRightColumn [data-widget-id="details"] .detail-value-main { font-size: 1.05rem !important; }
  #dashboardRightColumn [data-widget-id="details"] .detail-value-sub { font-size: 0.9rem !important; }
  #dashboardRightColumn [data-widget-id="details"] .dole-details-body > div:last-child {
    padding-top: 4px !important;
    font-size: 0.72rem !important;
  }

  #dashboardRightColumn [data-widget-id="budget"] .widget-body-content { height: 135px; }
  #dashboardRightColumn [data-widget-id="budget"] canvas { max-height: 132px !important; }
  #dashboardRightColumn [data-widget-id="budget"] #doleGaugePercentText { font-size: 1.25rem !important; }
  #dashboardRightColumn [data-widget-id="treemap"],
  #dashboardRightColumn [data-widget-id="suppliers"],
  #dashboardRightColumn [data-widget-id="analytics"] {
    height: 210px !important;
    min-height: 210px !important;
    max-height: 210px !important;
  }

  #dashboardRightColumn [data-widget-id="treemap"] .dole-treemap-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-rows: 58px;
    align-content: start;
    gap: 7px;
    max-height: 152px;
    padding: 1px 2px 3px;
    scrollbar-width: thin;
    scrollbar-color: var(--border-light) transparent;
  }

  #dashboardRightColumn [data-widget-id="treemap"] .dole-treemap-box {
    height: 58px;
    min-height: 0;
    padding: 7px 9px !important;
    border-left-width: 3px !important;
    border-radius: 9px !important;
    overflow: hidden;
  }

  #dashboardRightColumn [data-widget-id="treemap"] .dole-treemap-title {
    font-size: 0.69rem !important;
  }

  #dashboardRightColumn [data-widget-id="treemap"] .dole-treemap-val {
    margin-top: 3px !important;
    font-size: 0.78rem !important;
  }

  #dashboardRightColumn [data-widget-id="suppliers"] .widget-body-content,
  #dashboardRightColumn [data-widget-id="analytics"] .widget-body-content {
    display: flex;
    flex-direction: column;
    height: 160px !important;
    min-height: 0 !important;
    overflow: hidden;
  }

  #dashboardRightColumn [data-widget-id="suppliers"] canvas,
  #dashboardRightColumn [data-widget-id="analytics"] canvas {
    width: 100% !important;
    min-height: 0 !important;
    flex: 1 1 auto;
  }

  .mobile-chart-kicker,
  .mobile-chart-legend {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    min-height: 18px;
    margin-bottom: 3px;
    color: var(--text-dim);
    font-size: 0.61rem;
    font-weight: 700;
  }

  .mobile-chart-legend {
    justify-content: flex-end;
    gap: 12px;
  }

  .mobile-chart-legend span {
    display: inline-flex;
    align-items: center;
    gap: 5px;
  }

  .mobile-chart-legend span::before {
    content: '';
    width: 7px;
    height: 7px;
    border-radius: 2px;
    background: #06b6d4;
  }

  .mobile-chart-legend .current::before { background: #10b981; }

  #dashboardRightColumn [data-widget-id="analytics"] .widget-controls {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) 112px;
    gap: 6px;
    width: 100%;
    margin: 2px 0 0;
  }

  #dashboardRightColumn [data-widget-id="analytics"] .panel-header {
    min-height: 66px !important;
    flex-wrap: wrap;
    align-content: start;
    gap: 3px;
  }

  #dashboardRightColumn [data-widget-id="analytics"] .widget-title-area {
    width: 100%;
    min-width: 0;
  }

  #dashboardRightColumn [data-widget-id="analytics"] .panel-title-sm {
    min-width: 0;
    align-items: center;
  }

  #dashboardRightColumn [data-widget-id="analytics"] .analytics-comparison-label {
    margin-left: auto;
  }

  #dashboardRightColumn [data-widget-id="analytics"] .qtr-pills {
    display: none !important;
  }

  #dashboardRightColumn [data-widget-id="analytics"] .mobile-quarter-select {
    display: block;
    width: 112px;
    min-height: 32px;
    max-width: 112px;
    padding: 4px 25px 4px 9px;
    color: var(--text-main);
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 9px;
    font-size: 0.68rem;
    font-weight: 750;
  }

  #dashboardRightColumn [data-widget-id="analytics"] .analytics-cenco-select {
    width: 100%;
    max-width: none;
    min-height: 32px;
    font-size: 0.66rem;
  }

  #dashboardRightColumn [data-widget-id="analytics"] .widget-body-content {
    height: 132px !important;
  }

  #dashboardRightColumn [data-widget-id="analytics"] .widget-height-selector,
  #dashboardRightColumn [data-widget-id="analytics"] .widget-size-selector {
    display: none !important;
  }

  #dashboardLeftColumn .mobile-search-toggle-bar {
    order: 0;
    margin: 0 !important;
    padding-inline: 2px;
  }

  #dashboardLeftColumn .mobile-search-input {
    padding-right: 78px;
  }

  .mobile-document-count {
    position: absolute;
    right: 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    height: 24px;
    padding: 0 7px;
    color: #bae6fd;
    background: rgba(14, 165, 233, 0.15);
    border: 1px solid rgba(56, 189, 248, 0.35);
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 800;
    line-height: 1;
    pointer-events: none;
  }

  .mobile-search-input-wrap .btn-clear-search-mobile {
    right: 51px;
  }

  body.light-theme .mobile-document-count {
    color: #075985;
    background: #dff3ff;
    border-color: #8fc7e8;
  }

  body.light-theme .mobile-dashboard-config-trigger {
    color: #075985;
    background: #e0f2fe;
    border-color: #8fc7e8;
  }

  body.light-theme .mobile-dashboard-config-panel {
    color: #27364a;
    background: #f8fafc;
    border-color: #aebdcd;
    box-shadow: 0 14px 34px rgba(30, 41, 59, 0.20);
  }
}

/* ========================================================================== 
   LIGHT THEME — complete coverage for every application view
   ========================================================================== */
body.light-theme {
  --bg-app: #e8eef5;
  --bg-card: #f8fafc;
  --bg-card-hover: #edf5fc;
  --bg-card-alt: #eaf0f6;
  --bg-input: #f3f6fa;
  --border-color: #b8c5d4;
  --border-light: #94a3b8;
  --text-main: #111827;
  --text-muted: #475569;
  --text-dim: #64748b;
  --primary: #0369a1;
  --primary-hover: #075985;
  --primary-light: #dbeafe;
  --accent-green: #047857;
  --accent-green-bg: #dff6e9;
  --accent-amber: #a64b08;
  --accent-amber-bg: #fff3d6;
  --accent-red: #b91c1c;
  --accent-red-bg: #fee2e2;
  --accent-cyan: #036f8f;
  --accent-cyan-bg: #d9f3f8;
  --shadow-sm: 0 1px 3px rgba(51, 65, 85, 0.14);
  --shadow-md: 0 6px 18px rgba(51, 65, 85, 0.13);
  --shadow-lg: 0 18px 42px rgba(30, 41, 59, 0.20);
  background: #e8eef5 !important;
}

body.light-theme select,
body.light-theme option,
body.light-theme input,
body.light-theme textarea {
  color-scheme: light;
}

body.light-theme select option {
  background: #f8fafc !important;
  color: #111827 !important;
}

body.light-theme .main-content {
  background: #e8eef5 !important;
}

body.light-theme .page-title,
body.light-theme .chart-title,
body.light-theme .product-title-group h3,
body.light-theme .psv-section-head h3,
body.light-theme .empty-state h3 {
  color: #111827 !important;
}

body.light-theme .page-subtitle,
body.light-theme .empty-state,
body.light-theme .tag-label {
  color: #526174 !important;
}

body.light-theme .search-banner,
body.light-theme .chart-card,
body.light-theme .product-comparison-card,
body.light-theme .table-responsive,
body.light-theme .psv-idle,
body.light-theme .psv-empty-small,
body.light-theme .psv-kpi,
body.light-theme .psv-supplier,
body.light-theme .psv-doc,
body.light-theme .dup-kpi,
body.light-theme .dup-group,
body.light-theme .dup-empty,
body.light-theme .dup-annulled,
body.light-theme .modal-card {
  background: #f8fafc !important;
  border-color: #b8c5d4 !important;
  color: #111827 !important;
  box-shadow: 0 5px 16px rgba(51, 65, 85, 0.09);
}

body.light-theme .search-input,
body.light-theme .search-mode-toggle,
body.light-theme .search-tag-chip,
body.light-theme .psv-controls select,
body.light-theme .psv-chip {
  background: #f1f5f9 !important;
  border-color: #b8c5d4 !important;
  color: #27364a !important;
}

body.light-theme .search-input::placeholder,
body.light-theme .form-control::placeholder {
  color: #718096 !important;
  opacity: 1;
}

body.light-theme .search-tag-chip:hover,
body.light-theme .psv-chip:hover {
  background: #e0f2fe !important;
  border-color: #0284c7 !important;
  color: #075985 !important;
}

body.light-theme .search-mode-btn,
body.light-theme .psv-kpi span,
body.light-theme .psv-kpi small,
body.light-theme .psv-supplier header small,
body.light-theme .psv-supplier-meta span,
body.light-theme .psv-supplier-meta small,
body.light-theme .psv-doc-date,
body.light-theme .psv-doc-total span,
body.light-theme .psv-lines th,
body.light-theme .psv-lines small,
body.light-theme .psv-ref,
body.light-theme .dup-kpi span,
body.light-theme .dup-hint,
body.light-theme .dup-score,
body.light-theme .dup-count,
body.light-theme .dup-sub,
body.light-theme .dup-annulled summary {
  color: #59697d !important;
}

body.light-theme .search-mode-btn.active,
body.light-theme .psv-chip.active {
  background: #0369a1 !important;
  color: #ffffff !important;
}

body.light-theme .psv-link {
  color: #0369a1 !important;
  font-weight: 700;
}

body.light-theme .psv-note {
  background: #fff3d6 !important;
  border-color: #d97706 !important;
  color: #78350f !important;
}

body.light-theme .psv-note-filter {
  background: #dbeafe !important;
  border-color: #0284c7 !important;
  color: #0c4a6e !important;
}

body.light-theme .psv-doc-number,
body.light-theme .psv-doc-supplier span {
  color: #0369a1 !important;
}

body.light-theme .psv-doc-supplier {
  background: #e5f6ec !important;
  border-color: #7fc7a0 !important;
}

body.light-theme .psv-lines td {
  color: #334155 !important;
  border-bottom-color: #d5dee9 !important;
}

body.light-theme .psv-line-hit td {
  background: #e0f2fe !important;
  color: #172033 !important;
}

body.light-theme .psv-notes {
  background: #eef3f8 !important;
  color: #27364a !important;
}

body.light-theme .data-table th,
body.light-theme .supplier-comparison-table th,
body.light-theme .detail-items-table th,
body.light-theme .dup-table th {
  background: #eaf0f6 !important;
  color: #3f4f63 !important;
  border-bottom-color: #b8c5d4 !important;
}

body.light-theme .data-table td,
body.light-theme .supplier-comparison-table td,
body.light-theme .detail-items-table td,
body.light-theme .dup-table td {
  color: #172033 !important;
  border-bottom-color: #d5dee9 !important;
}

body.light-theme .data-table tbody tr:hover,
body.light-theme .supplier-comparison-table tbody tr:hover,
body.light-theme .dup-table tbody tr:hover {
  background: #e8f4fd !important;
}

body.light-theme .supplier-row-best {
  background: #e7f7ee !important;
}

body.light-theme .best-price-tag,
body.light-theme .badge-success {
  background: #dff6e9 !important;
  color: #065f46 !important;
  border: 1px solid #70bd93;
}

body.light-theme .badge-primary,
body.light-theme .badge-info {
  background: #dbeafe !important;
  color: #075985 !important;
  border: 1px solid #8fc7e8;
}

body.light-theme .badge-warning {
  background: #fff3d6 !important;
  color: #78350f !important;
  border: 1px solid #e2aa54;
}

body.light-theme .badge-neutral {
  background: #e2e8f0 !important;
  color: #334155 !important;
  border: 1px solid #b8c5d4;
}

body.light-theme .dup-group-head {
  background: #eaf0f6 !important;
  border-color: #b8c5d4 !important;
}

body.light-theme .dup-kpi-duplicate strong,
body.light-theme .dup-lvl-duplicate {
  color: #991b1b !important;
}

body.light-theme .dup-kpi-probable strong,
body.light-theme .dup-lvl-probable,
body.light-theme .dup-conflict {
  color: #92400e !important;
}

body.light-theme .dup-kpi-possible strong,
body.light-theme .dup-lvl-possible {
  color: #075985 !important;
}

body.light-theme .dup-lvl-duplicate { background: #fee2e2 !important; }
body.light-theme .dup-lvl-probable { background: #fff3d6 !important; }
body.light-theme .dup-lvl-possible { background: #e0f2fe !important; }

body.light-theme .dup-reason,
body.light-theme .dup-tag,
body.light-theme .dup-toast {
  background: #dff6e9 !important;
  color: #065f46 !important;
}

body.light-theme .dup-reason-neg {
  background: #fff3d6 !important;
  color: #78350f !important;
}

body.light-theme .dup-diff { background: #fff7e6 !important; }
body.light-theme .dup-row-keeper { background: #e7f7ee !important; }

body.light-theme .modal-header,
body.light-theme .modal-footer {
  border-color: #b8c5d4 !important;
}

body.light-theme .modal-backdrop {
  background: rgba(30, 41, 59, 0.55) !important;
}

body.light-theme .doc-meta-grid,
body.light-theme .totals-summary {
  background: #edf2f7 !important;
  border-color: #b8c5d4 !important;
}

body.light-theme .doc-meta-grid label,
body.light-theme .doc-meta-grid small {
  color: #59697d !important;
}

body.light-theme .doc-meta-grid strong,
body.light-theme .doc-items-heading {
  color: #172033 !important;
}

body.light-theme #modalDocCostCenter,
body.light-theme .item-cc-select {
  background: #f8fafc !important;
  border-color: #aebdcd !important;
  color: #075985 !important;
}

body.light-theme .doc-observations-panel {
  background: #e7f2fb !important;
  border-color: #8fc7e8 !important;
  border-left-color: #0284c7 !important;
  box-shadow: none !important;
}

body.light-theme .doc-observations-title {
  color: #075985 !important;
}

body.light-theme .doc-observations-content {
  background: #f8fafc !important;
  border-color: #b8c5d4 !important;
  color: #172033 !important;
}

body.light-theme .totals-summary .total-row {
  color: #475569 !important;
}

body.light-theme .totals-summary .grand-total,
body.light-theme .detail-items-table .amount {
  color: #047857 !important;
}

body.light-theme .btn-icon {
  color: #526174 !important;
}

body.light-theme .btn-icon:hover {
  background: #e2e8f0 !important;
  color: #111827 !important;
}

@media (max-width: 1024px) {
  .tab-pane:not(#dashboard-pane) {
    padding: 4px 6px 16px;
  }

  .page-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
  }

  .page-title {
    font-size: 1.35rem;
    line-height: 1.2;
  }

  .page-header > div:last-child {
    width: 100%;
    flex-wrap: wrap;
  }

  .page-header > div:last-child .btn {
    flex: 1 1 auto;
  }

  .search-banner,
  .chart-card,
  .product-comparison-card {
    padding: 16px !important;
    border-radius: 12px;
  }

  #documents-pane .search-banner > div > div {
    flex: 1 1 100% !important;
    width: 100%;
    min-width: 0 !important;
  }

  #documents-pane .search-banner .form-control {
    width: 100%;
  }

  .product-comparison-card {
    overflow-x: auto;
  }

  #productsMasterContainer > div,
  #suppliersMasterContainer > div {
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 12px !important;
  }

  .product-card-header {
    flex-direction: column;
    gap: 10px;
  }

  .supplier-comparison-table,
  .data-table,
  .dup-table,
  .detail-items-table {
    min-width: 760px;
  }

  .charts-grid {
    gap: 12px;
  }

  .chart-container {
    height: 260px;
  }

  .dup-filters,
  .dup-actions {
    flex-wrap: wrap;
  }

  .dup-actions select,
  .dup-actions .btn {
    flex: 1 1 150px;
    min-width: 0;
  }

  .psv-suppliers {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 560px) {
  .psv-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .search-mode-toggle,
  .search-mode-btn {
    width: 100%;
  }

  .modal-footer {
    align-items: stretch !important;
    flex-direction: column;
  }

  .modal-footer .btn {
    width: 100%;
  }
}

/* Buscador móvil: una jerarquía compacta, sin tablas ni tarjetas gigantes */
@media (max-width: 640px) {
  #price-search-pane {
    padding-top: 10px;
  }

  #price-search-pane .price-search-header {
    margin-bottom: 10px;
  }

  #price-search-pane .price-search-header .page-title {
    font-size: 1.18rem;
    line-height: 1.2;
  }

  #price-search-pane .price-search-header .page-subtitle {
    margin-top: 3px;
    font-size: 0.78rem;
    line-height: 1.35;
  }

  #price-search-pane .product-search-panel {
    margin-bottom: 14px;
    padding: 14px;
    border-radius: 15px;
    box-shadow: var(--shadow-sm);
  }

  #price-search-pane .product-search-heading h3 {
    font-size: 0.94rem;
    line-height: 1.25;
  }

  #price-search-pane .search-box-wrapper {
    margin-top: 10px;
  }

  #price-search-pane .search-input {
    min-height: 48px;
    padding: 11px 38px 11px 42px;
    font-size: 0.92rem;
    border-width: 1.5px;
  }

  #price-search-pane .search-icon {
    left: 13px;
    width: 20px;
    height: 20px;
  }

  #price-search-pane .search-mode-toggle {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    margin-top: 10px;
    padding: 3px;
  }

  #price-search-pane .search-mode-btn {
    width: auto;
    min-height: 38px;
    padding: 6px 8px;
    font-size: 0.76rem;
    line-height: 1.15;
  }

  #price-search-pane .search-tags {
    flex-wrap: nowrap;
    gap: 6px;
    margin: 10px -2px -2px;
    padding: 2px;
    overflow-x: auto;
    scrollbar-width: none;
  }

  #price-search-pane .search-tags::-webkit-scrollbar { display: none; }
  #price-search-pane .tag-label { flex: 0 0 auto; }
  #price-search-pane .search-tag-chip {
    flex: 0 0 auto;
    padding: 5px 10px;
    font: inherit;
    font-size: 0.72rem;
  }

  #price-search-pane .psv-results { gap: 16px; }

  #price-search-pane .psv-idle {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 10px 12px;
    padding: 16px;
    text-align: left;
    border-style: solid;
  }

  #price-search-pane .psv-idle-icon {
    display: grid;
    width: 38px;
    height: 38px;
    place-items: center;
    color: var(--primary);
    background: var(--primary-light);
    border-radius: 11px;
    font-size: 1.25rem;
    font-weight: 800;
  }

  #price-search-pane .psv-idle-copy h3 {
    margin: 0 0 3px;
    font-size: 0.92rem;
  }

  #price-search-pane .psv-idle-copy p {
    margin: 0;
    font-size: 0.76rem;
    line-height: 1.4;
  }

  #price-search-pane .psv-idle-count {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    margin: 2px 0 0;
  }

  #price-search-pane .psv-idle-count span {
    min-width: 0;
    padding: 7px 5px;
    text-align: center;
    background: var(--bg-app);
    border-radius: 8px;
    font-size: 0.62rem;
  }

  #price-search-pane .psv-idle-count b {
    display: block;
    color: var(--text-main);
    font-size: 0.86rem;
  }

  #price-search-pane .psv-kpis {
    gap: 8px;
  }

  #price-search-pane .psv-kpi {
    padding: 10px 11px;
    border-radius: 11px;
  }

  #price-search-pane .psv-kpi span { font-size: 0.62rem; }
  #price-search-pane .psv-kpi strong { font-size: 1rem; }
  #price-search-pane .psv-kpi small { font-size: 0.66rem; }
  #price-search-pane .psv-kpi-range { grid-column: 1 / -1; }
  #price-search-pane .psv-kpi-range strong { font-size: 0.94rem; }
  #price-search-pane .psv-export {
    align-self: stretch;
    min-height: 52px;
    white-space: normal;
  }

  #price-search-pane .psv-section-head {
    align-items: flex-end;
    margin-bottom: 9px;
  }

  #price-search-pane .psv-section-head h3 {
    font-size: 0.95rem;
    line-height: 1.25;
  }

  #price-search-pane .psv-section-head h3 small {
    display: block;
    margin: 2px 0 0;
    font-size: 0.68rem;
  }

  #price-search-pane .psv-suppliers {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(272px, 86vw);
    grid-template-columns: none;
    gap: 10px;
    margin: 0 -10px;
    padding: 0 10px 8px;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scroll-snap-type: inline mandatory;
    scrollbar-width: none;
  }

  #price-search-pane .psv-suppliers::-webkit-scrollbar { display: none; }
  #price-search-pane .psv-supplier {
    scroll-snap-align: start;
    padding: 12px;
    gap: 8px;
  }

  #price-search-pane .psv-supplier-name { font-size: 0.9rem; }
  #price-search-pane .psv-supplier-products {
    max-height: 42px;
    overflow: hidden;
    font-size: 0.72rem;
  }

  #price-search-pane .psv-controls {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    gap: 7px;
  }

  #price-search-pane .psv-controls .psv-chip {
    min-width: 0;
    padding: 6px 8px;
    font-size: 0.72rem;
  }

  #price-search-pane .psv-controls select {
    width: 100%;
    min-width: 0;
    padding: 7px 6px;
    font-size: 0.74rem;
  }

  #price-search-pane .psv-docs { gap: 10px; }
  #price-search-pane .psv-doc {
    gap: 9px;
    padding: 12px;
    border-radius: 13px;
  }

  #price-search-pane .psv-doc-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
  }

  #price-search-pane .psv-doc-head > div:first-child { gap: 5px; }
  #price-search-pane .psv-doc-number { font-size: 0.9rem; }
  #price-search-pane .psv-doc-date { font-size: 0.72rem; }
  #price-search-pane .psv-doc-total b { font-size: 0.9rem; }

  #price-search-pane .psv-doc-supplier {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 2px 7px;
    padding: 8px 10px;
  }

  #price-search-pane .psv-doc-supplier strong { font-size: 0.86rem; }
  #price-search-pane .psv-doc-supplier small { grid-column: 2; font-size: 0.68rem; }

  #price-search-pane .psv-lines thead { display: none; }
  #price-search-pane .psv-lines tbody { display: block; }
  #price-search-pane .psv-lines tbody.psv-others { display: none; }
  #price-search-pane .psv-lines tbody.psv-others.open { display: block; }
  #price-search-pane .psv-lines tr {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
  }

  #price-search-pane .psv-lines td {
    display: block;
    padding: 3px 6px;
    border: 0;
    text-align: left !important;
    font-size: 0.74rem;
  }

  #price-search-pane .psv-lines .psv-col-name {
    grid-column: 1 / -1;
    padding-bottom: 7px;
    font-size: 0.8rem;
    line-height: 1.35;
  }

  #price-search-pane .psv-lines td:nth-child(2)::before,
  #price-search-pane .psv-lines td:nth-child(3)::before,
  #price-search-pane .psv-lines td:nth-child(4)::before {
    display: block;
    margin-bottom: 2px;
    color: var(--text-dim);
    font-size: 0.58rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
  }

  #price-search-pane .psv-lines td:nth-child(2)::before { content: 'Cantidad'; }
  #price-search-pane .psv-lines td:nth-child(3)::before { content: 'P. unitario'; }
  #price-search-pane .psv-lines td:nth-child(4)::before { content: 'Total'; }

  #price-search-pane .psv-notes {
    font-size: 0.74rem;
    line-height: 1.4;
  }

  #price-search-pane .psv-doc-foot .btn {
    width: 100%;
  }
}

/* ========================================================================== 
   MOBILE SECTION STACK — compact swipe/tap navigation
   ========================================================================== */
@media (max-width: 1024px) {
  .header-container {
    flex-wrap: nowrap !important;
    padding: 8px 9px !important;
    gap: 7px !important;
  }

  .brand-logo {
    flex: 0 0 auto;
  }

  .brand-dole-img {
    height: 36px !important;
    max-width: 58px;
  }

  .mobile-nav-stack {
    display: block;
    position: relative;
    order: 2;
    flex: 1 1 auto;
    min-width: 0;
    max-width: 168px;
  }

  .mobile-nav-current {
    width: 100%;
    height: 40px;
    padding: 0 8px 0 10px;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) 16px;
    align-items: center;
    gap: 6px;
    color: #eaf2ff;
    background: #152239;
    border: 1px solid #3b4f6e;
    border-radius: 11px;
    font: 700 0.78rem/1 var(--font-main);
    text-align: left;
    box-shadow: 0 2px 7px rgba(2, 6, 23, 0.18);
    cursor: pointer;
    touch-action: pan-x;
    user-select: none;
    -webkit-user-select: none;
  }

  .mobile-nav-current-icon {
    color: #38bdf8;
    font-size: 1.05rem;
  }

  .mobile-nav-current-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mobile-nav-swipe-hint {
    color: #91a4be;
    font-size: 0.66rem;
    line-height: 0.58rem;
    text-align: center;
  }

  .mobile-nav-panel {
    display: none;
    position: absolute;
    top: calc(100% + 9px);
    left: 50%;
    width: min(330px, calc(100vw - 20px));
    max-height: min(480px, calc(100vh - 86px));
    padding: 7px;
    overflow-y: auto;
    transform: translateX(-50%);
    background: #111d32;
    border: 1px solid #3b4f6e;
    border-radius: 14px;
    box-shadow: 0 18px 42px rgba(2, 6, 23, 0.42);
    z-index: 300;
  }

  .mobile-nav-stack.open .mobile-nav-panel {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 5px;
    animation: fadeInDown 150ms ease-out;
  }

  .mobile-nav-panel button {
    min-height: 44px;
    padding: 9px 10px;
    color: #dbe6f4;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 9px;
    font: 650 0.82rem/1.2 var(--font-main);
    text-align: left;
    cursor: pointer;
  }

  .mobile-nav-panel button:hover,
  .mobile-nav-panel button.active {
    color: #ffffff;
    background: #1e3a5f;
    border-color: #3b82f6;
  }

  .nav-tabs {
    display: none !important;
  }

  .header-actions {
    order: 3;
    flex: 0 0 auto;
    gap: 5px !important;
  }

  .header-actions .btn-icon-only,
  .btn-add-main {
    width: 39px !important;
    min-width: 39px !important;
    height: 39px !important;
    min-height: 39px !important;
  }

  .ai-engine-card {
    overflow: hidden;
  }

  .ai-engine-card > div:first-child {
    align-items: stretch !important;
  }

  .ai-api-controls {
    width: 100%;
    min-width: 0;
    flex-direction: column;
    align-items: stretch !important;
  }

  #geminiApiKey,
  #btnSaveApiKey {
    width: 100% !important;
    max-width: 100% !important;
  }

  #btnSaveApiKey {
    min-height: 44px;
  }

  #ai-upload-pane .dropzone-container {
    padding-inline: 16px;
  }
}

body.light-theme .mobile-nav-current {
  color: #172033;
  background: #edf2f7;
  border-color: #aebdcd;
  box-shadow: 0 2px 7px rgba(51, 65, 85, 0.12);
}

body.light-theme .mobile-nav-current-icon {
  color: #0369a1;
}

body.light-theme .mobile-nav-swipe-hint {
  color: #64748b;
}

body.light-theme .mobile-nav-panel {
  background: #f8fafc;
  border-color: #aebdcd;
  box-shadow: 0 18px 42px rgba(30, 41, 59, 0.22);
}

body.light-theme .mobile-nav-panel button {
  color: #334155;
}

body.light-theme .mobile-nav-panel button:hover,
body.light-theme .mobile-nav-panel button.active {
  color: #075985;
  background: #e0f2fe;
  border-color: #38a4d5;
}

.dole-mobile-header-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.dole-mobile-quick-actions {
  width: 28px;
  height: 28px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 28px;
  padding: 0;
  color: var(--text-muted);
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  cursor: pointer;
}

.dole-mobile-quick-actions:hover,
.dole-mobile-quick-actions:focus-visible {
  color: var(--primary);
  border-color: var(--primary);
  outline: none;
}

.quick-status-select {
  color: var(--text-main) !important;
  background: var(--bg-input) !important;
  border-color: var(--border-color) !important;
}

@media (max-width: 1024px) {
  .supplier-chart-toolbar {
    display: none;
  }

  .analytics-comparison-label {
    max-width: 118px;
    margin-left: 4px;
  }
}

@media (max-width: 380px) {
  .header-container {
    padding-inline: 7px !important;
    gap: 5px !important;
  }

  .brand-dole-img {
    height: 34px !important;
    max-width: 53px;
  }

  .mobile-nav-current {
    height: 38px;
    padding-inline: 7px;
    font-size: 0.74rem;
  }

  .header-actions .btn-icon-only,
  .btn-add-main {
    width: 37px !important;
    min-width: 37px !important;
    height: 37px !important;
    min-height: 37px !important;
  }
}

/* Treemap drilldown combinado (Oficial + Solutions, 2026-10-08) */
.dole-treemap-box .dole-treemap-title {
  display: flex !important;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
}

.dole-treemap-box .dole-treemap-title > span:first-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dole-treemap-check {
  flex-shrink: 0;
  font-size: 0.62rem;
  font-weight: 800;
  color: #10b981;
  background: rgba(16, 185, 129, 0.2);
  padding: 1px 6px;
  border-radius: 4px;
}

body.light-theme .dole-treemap-box.is-active {
  background: #e0f2fe !important;
}
