/* ============================================================
   OCR Facturas Megalabs — Main Stylesheet
   ============================================================ */

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

:root {
  --primary:       #006D57;
  --primary-light: #009B77;
  --primary-dark:  #004D3D;
  --accent:        #00B88C;
  --accent-hover:  #009E79;
  --danger:        #ef4444;
  --danger-light:  #fef2f2;
  --warning:       #f59e0b;
  --blue:          #3b82f6;
  --green:         #10b981;
  --text:          #1e293b;
  --text-light:    #64748b;
  --border:        #e2e8f0;
  --bg:            #f1f5f9;
  --bg-card:       #ffffff;
  --shadow-sm:     0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md:     0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
  --shadow-lg:     0 10px 15px rgba(0,0,0,.07), 0 4px 6px rgba(0,0,0,.05);
  --radius:        8px;
  --input-h:       36px;
  --font:          system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

html, body {
  height: 100%;
  font-family: var(--font);
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
}

/* ============================================================
   UTILITY
   ============================================================ */
.hidden { display: none !important; }

/* ============================================================
   FORSETI LOGO
   ============================================================ */
.login-logo-img {
  width: 200px;
  height: auto;
  max-height: 110px;
  object-fit: contain;
}

.sidebar-logo-img {
  width: 34px;
  height: 34px;
  object-fit: contain;
  border-radius: 7px;
  flex-shrink: 0;
}

/* ============================================================
   ML CIRCLE LOGO (fallback)
   ============================================================ */
.ml-circle {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 60%, var(--accent) 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 1px;
  box-shadow: var(--shadow-md);
}

.ml-circle-sm {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-light) 0%, var(--accent) 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}

/* ============================================================
   LOGIN VIEW
   ============================================================ */
.login-view {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, var(--primary-dark) 0%, var(--primary) 50%, var(--primary-light) 100%);
  padding: 20px;
}

.login-card {
  background: var(--bg-card);
  border-radius: 16px;
  padding: 40px 36px 36px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-lg);
  text-align: center;
}

.login-logo {
  display: flex;
  justify-content: center;
  margin-bottom: 20px;
}

.login-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 6px;
}

.login-subtitle {
  font-size: 13px;
  color: var(--text-light);
  margin-bottom: 28px;
}

.login-card .form-group {
  text-align: left;
  margin-bottom: 14px;
}

.error-msg {
  background: var(--danger-light);
  color: var(--danger);
  border: 1px solid #fecaca;
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 14px;
  text-align: left;
}

/* ============================================================
   MAIN VIEW LAYOUT
   ============================================================ */
.main-view {
  display: flex;
  flex-direction: row;
  height: 100vh;
  overflow: hidden;
}

/* ============================================================
   TOPBAR
   ============================================================ */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

.topbar {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  height: 54px;
  display: flex;
  align-items: center;
  padding: 0 24px;
  flex-shrink: 0;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
  z-index: 5;
}

.topbar-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--primary);
  flex: 1;
}

/* ============================================================
   TAB AREA & CONTENT
   ============================================================ */
.tab-area {
  flex: 1;
  overflow: auto;
  padding: 24px;
}

.tab-content { display: none; }
.tab-content.active { display: block; }

/* ============================================================
   CARD
   ============================================================ */
.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}

/* ============================================================
   FORM ELEMENTS
   ============================================================ */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.form-group label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.label-optional {
  font-weight: 400;
  text-transform: none;
  font-size: 11px;
  letter-spacing: 0;
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="email"],
select,
textarea {
  height: var(--input-h);
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 13px;
  color: var(--text);
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
  width: 100%;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 155, 119, .15);
}

textarea {
  height: auto;
  padding: 8px 10px;
  resize: vertical;
}

select { cursor: pointer; }

.form-grid {
  display: grid;
  gap: 12px;
}
.form-grid.two-col {
  grid-template-columns: 1fr 1fr;
}

/* ============================================================
   BUTTONS
   ============================================================ */
button {
  font-family: var(--font);
  font-size: 13px;
  cursor: pointer;
  border: none;
  border-radius: var(--radius);
  transition: background .15s, opacity .15s, box-shadow .15s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
button:disabled { opacity: .45; cursor: not-allowed; }

.btn-primary {
  background: var(--primary);
  color: #fff;
  padding: 0 16px;
  height: var(--input-h);
  font-weight: 600;
}
.btn-primary:hover:not(:disabled) {
  background: var(--primary-light);
  box-shadow: var(--shadow-sm);
}

.btn-primary.btn-green,
.btn-green {
  background: var(--accent);
  color: #fff;
}
.btn-primary.btn-green:hover:not(:disabled),
.btn-green:hover:not(:disabled) {
  background: var(--accent-hover);
}

.btn-primary.btn-blue,
.btn-blue {
  background: var(--blue);
  color: #fff;
}
.btn-primary.btn-blue:hover:not(:disabled),
.btn-blue:hover:not(:disabled) {
  background: #2563eb;
}

.btn-secondary {
  background: #f1f5f9;
  color: var(--text);
  border: 1px solid var(--border);
  padding: 0 14px;
  height: var(--input-h);
}
.btn-secondary:hover:not(:disabled) { background: #e2e8f0; }

.btn-danger {
  background: var(--danger);
  color: #fff;
  padding: 0 14px;
  height: var(--input-h);
  font-weight: 600;
}
.btn-danger:hover:not(:disabled) { background: #dc2626; }

.btn-outline-danger {
  background: transparent;
  color: var(--danger);
  border: 1.5px solid var(--danger);
  padding: 0 14px;
  height: var(--input-h);
  font-weight: 600;
}
.btn-outline-danger:hover:not(:disabled) {
  background: var(--danger-light);
}

.btn-sm {
  height: 30px;
  padding: 0 12px;
  font-size: 12px;
}

.btn-block { width: 100%; justify-content: center; }

.btn-icon {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: var(--text-light);
  cursor: pointer;
  transition: background .15s, color .15s;
}
.btn-icon:hover { background: var(--bg); color: var(--primary); }

/* ============================================================
   DROP ZONE
   ============================================================ */
.drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  padding: 28px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color .2s, background .2s;
  margin-bottom: 16px;
}
.drop-zone:hover,
.drop-zone.drag-over {
  border-color: var(--accent);
  background: rgba(0, 155, 119, .04);
}
.drop-zone-icon { font-size: 2.2rem; margin-bottom: 8px; opacity: .6; }
.drop-zone-text { font-size: 14px; color: var(--text); margin-bottom: 4px; }
.drop-zone-hint { font-size: 12px; color: var(--text-light); }

/* ============================================================
   STATS ROW
   ============================================================ */
.stats-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  box-shadow: var(--shadow-sm);
  min-width: 80px;
}
.stat-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--primary);
  line-height: 1;
}
.stat-label {
  font-size: 11px;
  color: var(--text-light);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.stat-actions { margin-left: auto; }

/* ============================================================
   SCAN AREA (queue + detail)
   ============================================================ */
.scan-area {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

/* Queue panel */
.queue-panel {
  width: 260px;
  flex-shrink: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.panel-title {
  background: var(--primary);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  padding: 10px 14px;
}

.queue-list {
  max-height: calc(100vh - 280px);
  overflow-y: auto;
  padding: 8px 0;
}

.queue-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: background .1s;
}
.queue-item:hover { background: var(--bg); }
.queue-item.active {
  background: rgba(0, 155, 119, .06);
  border-left-color: var(--accent);
}
.queue-item-name {
  flex: 1;
  font-size: 12px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.queue-item-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
  white-space: nowrap;
  flex-shrink: 0;
}
.badge-pending  { background: #fef3c7; color: #92400e; }
.badge-processing { background: #dbeafe; color: #1e40af; }
.badge-ready    { background: #d1fae5; color: #065f46; }
.badge-saved    { background: #dcfce7; color: #14532d; }
.badge-discarded { background: #fee2e2; color: #7f1d1d; }
.badge-error    { background: #fee2e2; color: #7f1d1d; }

.empty-msg {
  padding: 20px 14px;
  font-size: 12px;
  color: var(--text-light);
  text-align: center;
}

/* Detail panel */
.detail-panel {
  flex: 1;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 20px;
  min-width: 0;
}

.detail-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: var(--text-light);
  gap: 12px;
  text-align: center;
}

.detail-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.nav-btn-arrow {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  width: 30px;
  height: 30px;
  border-radius: 6px;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background .15s;
}
.nav-btn-arrow:hover:not(:disabled) { background: var(--border); }

.nav-label {
  font-size: 12px;
  color: var(--text-light);
  min-width: 40px;
  text-align: center;
}

.file-name-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
  margin-left: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 300px;
}

.detail-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

/* ============================================================
   SECTION TITLES
   ============================================================ */
.section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-light);
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.section-h2 {
  font-size: 18px;
  font-weight: 700;
  color: var(--primary);
}

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

/* ============================================================
   TABLES
   ============================================================ */
.table-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

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

.data-table thead th {
  background: var(--primary);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  padding: 10px 12px;
  text-align: left;
  white-space: nowrap;
  border-right: 1px solid rgba(255,255,255,.12);
}
.data-table thead th:last-child { border-right: none; }

.data-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background .1s;
}
.data-table tbody tr:last-child { border-bottom: none; }
.data-table tbody tr:nth-child(even) { background: #f8fafc; }
.data-table tbody tr:hover { background: rgba(0, 155, 119, .05); }

.data-table td {
  padding: 9px 12px;
  vertical-align: middle;
  border-right: 1px solid rgba(0,0,0,.045);
}
.data-table td:last-child { border-right: none; }

.empty-row {
  text-align: center;
  color: var(--text-light);
  padding: 32px !important;
  font-size: 13px;
}

/* Compact lineas table */
.lineas-table td,
.lineas-table th {
  padding: 6px 8px;
}
.lineas-table input,
.lineas-table select {
  height: 30px;
  font-size: 12px;
  padding: 0 6px;
}

/* ============================================================
   STATUS BADGES
   ============================================================ */
.status-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
  text-transform: capitalize;
  cursor: pointer;
  transition: opacity .15s;
}
.status-badge:hover { opacity: .8; }
.status-pendiente  { background: #fef3c7; color: #92400e; }
.status-enviado    { background: #dbeafe; color: #1e40af; }
.status-pagado     { background: #d1fae5; color: #065f46; }
.status-rechazado  { background: #fee2e2; color: #7f1d1d; }

/* ============================================================
   FILTER BAR (Relación tab)
   ============================================================ */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  box-shadow: var(--shadow-sm);
}
.filter-bar input,
.filter-bar select {
  height: 32px;
  font-size: 13px;
}

.relation-stats {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.relation-stat-badge {
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}

/* ============================================================
   FORMULARIO TAB
   ============================================================ */
.edit-badge {
  background: var(--blue);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 12px;
}

.total-label {
  font-size: 14px;
  color: var(--text);
}
.total-label strong {
  color: var(--primary);
  font-size: 16px;
}

.status-msg {
  margin-top: 12px;
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 13px;
}
.status-msg.success {
  background: #d1fae5;
  color: #065f46;
  border: 1px solid #6ee7b7;
}
.status-msg.error {
  background: var(--danger-light);
  color: var(--danger);
  border: 1px solid #fecaca;
}

/* ============================================================
   MODAL
   ============================================================ */
body:not(.authenticated) .modal-overlay { display: none !important; }

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(2px);
}

.modal {
  background: var(--bg-card);
  border-radius: 12px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.modal-header {
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
}

.modal-title {
  font-size: 15px;
  font-weight: 700;
}

.modal-close {
  background: none;
  border: none;
  color: rgba(255,255,255,.7);
  font-size: 16px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  transition: background .15s;
}
.modal-close:hover { background: rgba(255,255,255,.15); }

.modal-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

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

/* ============================================================
   CONFIG TAB
   ============================================================ */
.config-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 20px;
  margin-bottom: 20px;
}

.cfg-status {
  font-size: 12px;
  margin-top: 6px;
  min-height: 18px;
}

/* Catalog sub-tabs */
.catalog-subtabs {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
}

.subtab-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-light);
  font-size: 12px;
  padding: 5px 12px;
  height: auto;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.subtab-btn:hover { background: var(--bg); color: var(--primary); }
.subtab-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  font-weight: 600;
}

.catalog-content {
  min-height: 80px;
}

/* Action icon buttons in tables */
.tbl-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-light);
  transition: background .15s, color .15s, border-color .15s;
}
.tbl-btn:hover { background: var(--bg); }
.tbl-btn.edit:hover  { color: var(--blue); border-color: var(--blue); }
.tbl-btn.print:hover { color: var(--primary); border-color: var(--primary); }
.tbl-btn.del:hover   { color: var(--danger); border-color: var(--danger); }

/* --- PSP Sub-tabs --- */
.psp-subtab {
  padding: 7px 18px;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-light);
  margin-bottom: -2px;
  transition: color .15s, border-color .15s;
}
.psp-subtab:hover { color: var(--primary); }
.psp-subtab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 700; }

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
  width: 220px;
  background: #002d23;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 2px 0 14px rgba(0,0,0,.2);
  z-index: 20;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 20px 18px 17px;
  border-bottom: 1px solid rgba(255,255,255,.07);
  flex-shrink: 0;
}

.sidebar-brand {
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
}

.sidebar-sub {
  color: rgba(255,255,255,.38);
  font-size: 11px;
  font-weight: 500;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0 6px;
  scrollbar-width: none;
}
.sidebar-nav::-webkit-scrollbar { display: none; }

.sidebar-section-label {
  display: block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: rgba(255,255,255,.25);
  padding: 14px 18px 4px;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 18px;
  color: rgba(255,255,255,.58);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  border-radius: 0;
  border-left: 3px solid transparent;
  transition: color .15s, background .15s, border-color .15s;
  white-space: nowrap;
  height: auto;
  line-height: 1.4;
}
.sidebar-item:hover {
  color: rgba(255,255,255,.88);
  background: rgba(255,255,255,.06);
}
.sidebar-item.active {
  color: #fff;
  background: rgba(0,184,140,.14);
  border-left-color: var(--accent);
  font-weight: 600;
}
.sidebar-item svg {
  flex-shrink: 0;
  opacity: .65;
  transition: opacity .15s;
}
.sidebar-item:hover svg,
.sidebar-item.active svg { opacity: 1; }

.sidebar-footer {
  padding: 11px 14px;
  border-top: 1px solid rgba(255,255,255,.07);
  display: flex;
  align-items: center;
  gap: 9px;
  flex-shrink: 0;
}

.sidebar-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(0,184,140,.22);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--accent);
}

.sidebar-user-info {
  flex: 1;
  min-width: 0;
}

.sidebar-user-name {
  color: rgba(255,255,255,.82);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-role {
  color: rgba(255,255,255,.35);
  font-size: 11px;
  text-transform: capitalize;
  margin-top: 1px;
}

.btn-sidebar-logout {
  background: rgba(255,255,255,.06);
  border: none;
  color: rgba(255,255,255,.42);
  border-radius: 7px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background .15s, color .15s;
  padding: 0;
}
.btn-sidebar-logout:hover {
  background: rgba(239,68,68,.22);
  color: #f87171;
}


/* ============================================================
   MEGALABS EXCEL IMPORT BAR
   ============================================================ */
.megalabs-import-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: linear-gradient(90deg, #f0fdf4 0%, #f8fafc 100%);
  border: 1px dashed #86efac;
  border-radius: 8px;
  margin: 12px 0 20px;
}
.megalabs-import-label {
  font-size: 13px;
  font-weight: 700;
  color: #166534;
  white-space: nowrap;
}
.megalabs-import-hint {
  font-size: 12px;
  color: #64748b;
  flex: 1;
}

.th-sort {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
.th-sort:hover {
  background: rgba(0,0,0,0.06);
}

/* Required field indicators */
.req {
  color: #e53e3e;
  font-size: 13px;
  margin-left: 2px;
  font-weight: 700;
}
.required-note {
  font-size: 11px;
  color: #718096;
  margin-top: 8px;
  margin-bottom: 4px;
}
.required-note .req {
  font-size: 12px;
}
.form-group.field-invalid input,
.form-group.field-invalid select,
.form-group.field-invalid textarea {
  border-color: #e53e3e !important;
  background: #fff5f5 !important;
  box-shadow: 0 0 0 2px rgba(229,62,62,0.15) !important;
}
.form-group.field-invalid label {
  color: #c53030 !important;
}

/* ── Proveedor combobox ───────────────────────────────── */
.pv-combo { position: relative; }
.pv-combo input { width: 100%; box-sizing: border-box; padding-right: 28px; }
.pv-clear-btn {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer; color: #888; font-size: 13px;
  line-height: 1; padding: 2px 4px;
}
.pv-clear-btn:hover { color: #333; }
.pv-dropdown {
  position: absolute; z-index: 900; width: 100%;
  background: #fff; border: 1px solid #d1d5db;
  border-top: none; border-radius: 0 0 6px 6px;
  max-height: 220px; overflow-y: auto;
  box-shadow: 0 6px 16px rgba(0,0,0,.12);
}
.pv-dropdown.hidden { display: none; }
.pv-dropdown-item {
  padding: 8px 12px; cursor: pointer; font-size: 13px;
  border-bottom: 1px solid #f3f4f6;
}
.pv-dropdown-item:last-child { border-bottom: none; }
.pv-dropdown-item:hover, .pv-dropdown-item.pv-focused {
  background: #eff6ff; color: #1e40af;
}
.pv-dropdown-empty {
  padding: 10px 12px; font-size: 13px; color: #9ca3af; font-style: italic;
}
