/* ============================================================
   Sistema de Gestión — Diseño empresarial profesional
   Inter (local) + Bootstrap Icons + sidebar corporativo
   ============================================================ */

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('../fonts/inter/inter.woff2') format('woff2');
}

/* ---------- Design Tokens ---------- */
:root {
  --bs-body-font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff4ff;
  --bg-body: #f8f9fb;
  --bg-surface: #ffffff;
  --bg-surface-alt: #fafbfc;
  --bg-surface-hover: #f4f6f8;
  --border-color: #e5e7eb;
  --border-light: #f0f1f3;
  --text-primary: #111827;
  --text-secondary: #6b7280;
  --text-tertiary: #9ca3af;
  --text-muted: #9ca3af;
  --sidebar-bg: #111827;
  --sidebar-hover: #1f2937;
  --sidebar-active-bg: rgba(37, 99, 235, 0.12);
  --sidebar-active-border: #2563eb;
  --sidebar-text: #9ca3af;
  --sidebar-text-active: #f9fafb;
  --success: #059669;
  --success-bg: #ecfdf5;
  --warning: #d97706;
  --warning-bg: #fffbeb;
  --danger: #dc2626;
  --danger-bg: #fef2f2;
  --info: #0284c7;
  --info-bg: #f0f9ff;
  --radius-sm: 0.375rem;
  --radius: 0.5rem;
  --radius-lg: 0.75rem;
  --shadow-xs: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
}

/* ---------- Base ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  background-color: var(--bg-body);
  color: var(--text-primary);
  font-family: var(--bs-body-font-family);
  font-size: 11px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  margin: 0;
}

h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text-primary);
  margin: 0;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); }

::selection {
  background: var(--primary);
  color: #fff;
}

/* ---------- Navbar ---------- */
.navbar-app {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  z-index: 1040;
  padding: 0 1rem;
  height: 48px;
}

.navbar-app .navbar-brand {
  font-weight: 600;
  font-size: 11px;
  color: var(--text-primary);
  letter-spacing: 0.2px;
  padding: 0;
  margin: 0;
  min-width: 0;
}

.navbar-app .navbar-brand i {
  color: var(--primary);
  font-size: 14px;
  flex-shrink: 0;
}

.navbar-app .navbar-brand .brand-text {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex-shrink: 1;
  min-width: 0;
}

.navbar-app .brand-group {
  min-width: 0;
  flex-shrink: 1;
}

.navbar-app .navbar-brand .empresa-logo {
  max-height: 26px;
  max-width: 110px;
  width: auto;
  height: auto;
  object-fit: contain;
  flex-shrink: 0;
}

.navbar-app .navbar-text {
  font-size: 10px;
  color: var(--text-secondary);
}

.navbar-app .dropdown-menu {
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 4px;
  min-width: 180px;
}

.navbar-app .dropdown-item {
  font-size: 11px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-primary);
}

.navbar-app .dropdown-item:hover {
  background: var(--bg-surface-hover);
  color: var(--text-primary);
}

.navbar-app .dropdown-item i {
  width: 16px;
  font-size: 12px;
  color: var(--text-tertiary);
  margin-right: 8px;
}

.navbar-app .dropdown-divider {
  border-color: var(--border-light);
  margin: 4px 0;
}

.navbar-app .btn-outline-light {
  border-color: var(--border-color);
  color: var(--text-secondary);
  font-size: 10px;
  padding: 4px 10px;
}

.navbar-app .btn-outline-light:hover {
  background: var(--bg-surface-hover);
  color: var(--text-primary);
  border-color: var(--border-color);
}

.navbar-app .user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 600;
  flex-shrink: 0;
}

/* ---------- Sidebar ---------- */
.sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--sidebar-bg);
  min-height: calc(100vh - 48px);
  border-right: none;
  overflow-y: auto;
}

.sidebar-nav .nav-link {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--sidebar-text);
  padding: 0.55rem 1rem;
  border-left: 3px solid transparent;
  font-weight: 500;
  font-size: 11px;
  transition: background-color 0.15s ease, color 0.15s ease;
  text-decoration: none;
}

.sidebar-nav .nav-link i {
  font-size: 14px;
  width: 18px;
  text-align: center;
  flex-shrink: 0;
}

.sidebar-nav .nav-link:hover {
  background-color: var(--sidebar-hover);
  color: var(--sidebar-text-active);
}

.sidebar-nav .nav-link.active {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-text-active);
  border-left-color: var(--sidebar-active-border);
  font-weight: 600;
}

.offcanvas-lg.sidebar {
  width: 220px;
}

.offcanvas-lg.sidebar .offcanvas-header {
  background: var(--sidebar-bg);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  padding: 0.75rem 1rem;
}

.offcanvas-lg.sidebar .offcanvas-title {
  color: var(--sidebar-text-active);
  font-weight: 600;
  font-size: 11px;
}

/* ---------- Main Content ---------- */
.main-content {
  flex: 1;
  min-width: 0;
  padding: 1.25rem 1.5rem;
}

.main-content > h1:first-child {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 1rem;
}

/* ---------- Page Header ---------- */
.page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.page-header h1 {
  margin-bottom: 0;
  font-size: 15px;
}

.page-header .page-count {
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 400;
}

.page-header .page-actions {
  margin-left: auto;
  display: flex;
  gap: 0.375rem;
  align-items: center;
}

/* ---------- Breadcrumbs ---------- */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  margin-bottom: 1rem;
  font-size: 10px;
  list-style: none;
  padding: 0;
}

.breadcrumb-item {
  color: var(--text-muted);
}

.breadcrumb-item a {
  color: var(--text-secondary);
  text-decoration: none;
}

.breadcrumb-item a:hover {
  color: var(--primary);
}

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

.breadcrumb-item + .breadcrumb-item::before {
  content: '/';
  color: var(--text-tertiary);
  margin-right: 0.375rem;
}

/* ---------- Cards ---------- */
.card {
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xs);
  background: var(--bg-surface);
}

.card-header {
  background: var(--bg-surface-alt);
  border-bottom: 1px solid var(--border-color);
  border-radius: calc(var(--radius) - 1px) calc(var(--radius) - 1px) 0 0;
  padding: 0.65rem 1rem;
}

.card-header h2,
.card-header h3,
.card-header h4 {
  font-size: 11px;
  font-weight: 600;
  margin: 0;
}

.card-body {
  padding: 1rem;
}

.card-footer {
  background: var(--bg-surface-alt);
  border-top: 1px solid var(--border-color);
  padding: 0.65rem 1rem;
}

/* ---------- Stat Cards ---------- */
.stat {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  height: 100%;
  box-shadow: var(--shadow-xs);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.stat-icon {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.stat-icon.blue   { background: #dbeafe; color: #1d4ed8; }
.stat-icon.green  { background: #dcfce7; color: #15803d; }
.stat-icon.orange { background: #ffedd5; color: #c2410c; }
.stat-icon.red    { background: #fee2e2; color: #b91c1c; }
.stat-icon.indigo { background: #e0e7ff; color: #4338ca; }

.stat .stat-value {
  font-size: 17px;
  font-weight: 700;
  line-height: 1.1;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.stat .stat-label {
  color: var(--text-muted);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-top: 1px;
  font-weight: 500;
}

/* ---------- Tables ---------- */
.table {
  font-size: 11px;
  color: var(--text-primary);
  --bs-table-border-color: var(--border-light);
}

.table thead th {
  font-weight: 600;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  background-color: var(--bg-surface-alt);
  border-bottom: 1px solid var(--border-color);
  padding: 0.5rem 0.6rem;
  white-space: nowrap;
  user-select: none;
}

.table > :not(caption) > * > * {
  padding-top: 0.45rem;
  padding-bottom: 0.45rem;
}

.table tbody tr:nth-child(even) {
  background-color: var(--bg-surface-alt);
}

.table tbody tr:nth-child(odd) {
  background-color: var(--bg-surface);
}

.table-hover tbody tr:hover {
  background-color: var(--bg-surface-hover);
  transition: background-color 0.12s ease;
}

.table tbody td {
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
}

.table tbody td.num,
.table td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--text-primary);
}

.table .cell-num {
  font-variant-numeric: tabular-nums;
  font-size: 10px;
  color: var(--text-secondary);
}

.table tbody tr:last-child td {
  border-bottom: none;
}

.table .flex-actions {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.table .link-name {
  font-weight: 500;
  color: var(--primary);
  text-decoration: none;
}

.table .link-name:hover {
  color: var(--primary-hover);
  text-decoration: underline;
}

.table .text-muted {
  color: var(--text-muted) !important;
}

/* Empty states */
.empty-state {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--text-muted);
}

.empty-state i {
  font-size: 28px;
  color: var(--text-tertiary);
  display: block;
  margin-bottom: 0.5rem;
}

.empty-state .empty-title {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 0.25rem;
}

.empty-state .empty-desc {
  font-size: 10px;
  color: var(--text-muted);
}

/* ---------- Buttons ---------- */
.btn {
  font-size: 11px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  padding: 0.375rem 0.75rem;
  line-height: 1.4;
  transition: all 0.15s ease;
}

.btn-sm {
  font-size: 10px;
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-sm);
}

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

.btn-primary:hover,
.btn-primary:focus {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
  color: #fff;
}

.btn-outline-primary {
  color: var(--primary);
  border-color: var(--border-color);
}

.btn-outline-primary:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.btn-outline-secondary {
  color: var(--text-secondary);
  border-color: var(--border-color);
}

.btn-outline-secondary:hover {
  background: var(--bg-surface-hover);
  border-color: var(--border-color);
  color: var(--text-primary);
}

.btn-outline-danger {
  color: var(--danger);
  border-color: var(--border-color);
}

.btn-outline-danger:hover {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}

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

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

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-secondary);
}

.btn-ghost:hover {
  background: var(--bg-surface-hover);
  color: var(--text-primary);
}

/* ---------- Forms ---------- */
.form-control,
.form-select {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 11px;
  padding: 0.375rem 0.6rem;
  color: var(--text-primary);
  background: var(--bg-surface);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
  outline: none;
}

.form-control::placeholder {
  color: var(--text-tertiary);
}

.form-select {
  padding-right: 2rem;
}

.form-label {
  font-size: 10px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 0.25rem;
}

.form-text {
  font-size: 10px;
  color: var(--text-muted);
}

.form-check-input:checked {
  background-color: var(--primary);
  border-color: var(--primary);
}

.form-check-label {
  font-size: 11px;
  color: var(--text-primary);
}

.input-group-text {
  font-size: 11px;
  background: var(--bg-surface-alt);
  border: 1px solid var(--border-color);
  color: var(--text-tertiary);
  padding: 0.375rem 0.6rem;
}

textarea.form-control {
  min-height: 60px;
}

/* ---------- Badges ---------- */
.badge {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 4px;
  letter-spacing: 0.2px;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.badge i {
  font-size: 10px;
}

.text-bg-success { background: var(--success-bg) !important; color: var(--success) !important; }
.text-bg-warning { background: var(--warning-bg) !important; color: var(--warning) !important; }
.text-bg-danger  { background: var(--danger-bg) !important;  color: var(--danger) !important;  }
.text-bg-info    { background: var(--info-bg) !important;    color: var(--info) !important;    }
.text-bg-secondary { background: #f3f4f6 !important; color: #6b7280 !important; }
.text-bg-primary { background: var(--primary-light) !important; color: var(--primary) !important; }
.text-bg-light   { background: #f9fafb !important; color: #374151 !important; }

/* ---------- Alerts ---------- */
.alert {
  border: none;
  border-radius: var(--radius);
  font-size: 11px;
  padding: 0.6rem 0.85rem;
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
}

.alert::before {
  font-family: 'bootstrap-icons';
  font-size: 13px;
  flex-shrink: 0;
  margin-top: 1px;
}

.alert-success { background: var(--success-bg); color: var(--success); border-left: 3px solid var(--success); }
.alert-success::before { content: '\f26a'; }
.alert-danger  { background: var(--danger-bg); color: var(--danger); border-left: 3px solid var(--danger); }
.alert-danger::before  { content: '\f33a'; }
.alert-warning { background: var(--warning-bg); color: var(--warning); border-left: 3px solid var(--warning); }
.alert-warning::before { content: '\f33b'; }
.alert-info    { background: var(--info-bg); color: var(--info); border-left: 3px solid var(--info); }
.alert-info::before    { content: '\f431'; }

/* ---------- Nav Tabs ---------- */
.nav-tabs {
  border-bottom: 2px solid var(--border-color);
  gap: 0;
}

.nav-tabs .nav-link {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  border: none;
  border-bottom: 2px solid transparent;
  padding: 0.5rem 1rem;
  margin-bottom: -2px;
  border-radius: 0;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.nav-tabs .nav-link:hover {
  color: var(--text-primary);
  border-color: transparent;
  background: transparent;
}

.nav-tabs .nav-link.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  background: transparent;
}

/* ---------- DataTables ---------- */
.dataTables_wrapper .dataTables_filter {
  margin-bottom: 0;
}

.dataTables_wrapper .dataTables_filter label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-weight: 500;
  font-size: 10px;
  color: var(--text-secondary);
}

.dataTables_wrapper .dataTables_filter input {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.35rem 0.6rem 0.35rem 2rem;
  font-size: 11px;
  margin-left: 0;
  background: var(--bg-surface);
  color: var(--text-primary);
}

.dataTables_wrapper .dataTables_filter input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
  outline: none;
}

.dataTables_wrapper .dataTables_length {
  margin-bottom: 0;
}

.dataTables_wrapper .dataTables_length label {
  font-weight: 500;
  font-size: 10px;
  color: var(--text-secondary);
}

.dataTables_wrapper .dataTables_length select {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.25rem 0.5rem;
  font-size: 11px;
  margin: 0 0.25rem;
}

.dataTables_wrapper .dataTables_info {
  font-size: 10px;
  color: var(--text-muted);
  padding-top: 0.5rem;
}

.dataTables_wrapper .dataTables_paginate {
  display: flex;
  justify-content: flex-end;
  gap: 2px;
  padding-top: 0.5rem;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.3rem 0.6rem;
  color: var(--text-secondary);
  background: var(--bg-surface);
  cursor: pointer;
  font-size: 10px;
  margin-left: 2px;
  transition: all 0.15s ease;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover:not(.current):not(.disabled) {
  background: var(--bg-surface-hover);
  border-color: var(--border-color);
  color: var(--text-primary);
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  font-weight: 600;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.disabled {
  color: var(--text-tertiary);
  cursor: default;
  background: var(--bg-surface);
  opacity: 0.6;
}

.dataTables_wrapper .dataTables_filter .position-relative i {
  position: absolute;
  left: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-tertiary);
  font-size: 11px;
  z-index: 5;
  pointer-events: none;
}

/* ---------- Definition List (fichas) ---------- */
.def-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.25rem 1.25rem;
}

.def-list div {
  border-bottom: 1px dashed var(--border-color);
  padding: 0.3rem 0;
}

.def-list .k {
  color: var(--text-muted);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}

.def-list .v {
  font-weight: 500;
  color: var(--text-primary);
  font-size: 11px;
}

/* ---------- Footer ---------- */
.app-footer {
  color: var(--text-muted);
  background: var(--bg-surface);
  border-top: 1px solid var(--border-color);
  font-size: 10px;
  padding: 0.6rem 1.5rem;
}

/* ---------- Login ---------- */
.login-body {
  background: var(--bg-body);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

.login-card {
  max-width: 380px;
  width: 100%;
  margin: 1rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.login-card .card-body {
  padding: 2rem;
}

/* ---------- Login ---------- */
.login-logo {
  width: 48px;
  height: 48px;
  border-radius: var(--radius);
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  margin: 0 auto 0.75rem;
  overflow: hidden;
}
.login-logo img {
  max-width: 100%;
  max-height: 48px;
  width: auto;
  height: auto;
}

/* ---------- Empresa logo ---------- */
.empresa-logo-preview {
  max-width: 200px;
  height: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 4px;
}

/* ---------- Comprobante 80mm ---------- */
@page { size: 80mm auto; margin: 0; }
@media print {
  body.receipt-body { background: #fff; margin: 0 !important; padding: 0 !important; }
  .no-print, .receipt-actions, .app-footer { display: none !important; }
  .receipt { box-shadow: none !important; margin: 0 auto !important; width: 72mm !important; padding: 2mm 3mm !important; min-height: auto !important; height: auto !important; }
  .receipt, .receipt * { color: #000 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

.receipt-body { background: #f8f9fb; margin: 0; padding: 0; }

.receipt {
  width: 72mm;
  max-width: 100%;
  min-height: auto;
  height: auto;
  margin: 0 auto;
  background: #fff;
  box-shadow: 0 2px 12px rgba(0,0,0,.15);
  padding: 3mm;
  box-sizing: border-box;
  font-family: "Courier New", Courier, monospace;
  font-size: 11px;
  line-height: 1.45;
  color: #000;
  font-weight: 700;
  -webkit-font-smoothing: none;
}

.receipt, .receipt * { color: #000 !important; }
.receipt .center { text-align: center; font-weight: 700; }
.receipt .receipt-logo { max-width: 100px; max-height: 40px; margin-bottom: 4px; }
.receipt h1 { font-size: 14px; margin: 0 0 2px; font-weight: 800; }
.receipt .divider { border-top: 2px solid #000; margin: 8px 0; }
.receipt .row { display: flex; justify-content: space-between; font-weight: 700; }
.receipt .row .l { white-space: nowrap; font-weight: 700; }
.receipt .row .r { text-align: right; white-space: nowrap; font-weight: 700; }
.receipt .amount { font-size: 17px; font-weight: 800; text-align: center; margin: 6px 0; }
.receipt .b-box { border: 2px solid #000; padding: 2mm; text-align: center; margin: 3mm 0; }
.receipt .b-box-title { font-size: 13px; font-weight: 800; }
.receipt .b-box-num { font-size: 13px; font-weight: 800; }
.receipt .b-box-date { font-size: 11px; font-weight: 700; }
.receipt .b-data { margin: 2mm 0; }
.receipt .b-data .row { gap: 2mm; margin-bottom: 1mm; }
.receipt .b-data .row .l { flex: 0 0 auto; }
.receipt .b-data .row .r { flex: 1 1 auto; white-space: normal !important; overflow-wrap: anywhere; }
.receipt .b-data .row .r.wrap { text-align: left; }
.receipt .b-table { width: 100%; border-collapse: collapse; margin-top: 2mm; font-size: 11px; }
.receipt .b-table th, .receipt .b-table td { border-top: 2px solid #000; border-bottom: 2px solid #000; padding: 1.5mm 1mm; text-align: left; vertical-align: top; }
.receipt .b-table th.c, .receipt .b-table td.c { text-align: center; width: 12mm; }
.receipt .b-table th.r, .receipt .b-table td.r { text-align: right; white-space: nowrap; }
.receipt .b-totals { margin-top: 2mm; font-size: 11px; }
.receipt .b-totals .row { display: flex; justify-content: space-between; font-weight: 700; }
.receipt .b-total { display: flex; justify-content: space-between; font-size: 17px; font-weight: 800; margin: 2mm 0; border-top: 2px solid #000; padding-top: 2mm; }
.receipt .receipt-next, .receipt .receipt-next .row, .receipt .receipt-next span, .receipt .receipt-next div { color: #000 !important; font-weight: 800 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.receipt .footer { text-align: center; margin-top: 10px; font-size: 10px; font-weight: 700; }

/* Receipt action bar */
.receipt-actions {
  text-align: center;
  padding: 12px 0;
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
}

.receipt-actions .btn-mini {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 11px;
  cursor: pointer;
  text-decoration: none;
  border: 1px solid #e5e7eb;
  background: #fff;
  color: #374151;
  margin: 0 4px;
  transition: all 0.15s ease;
}

.receipt-actions .btn-mini:hover {
  background: #f4f6f8;
}

.receipt-actions .btn-mini.primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.receipt-actions .btn-mini.primary:hover {
  background: var(--primary-hover);
}

/* ---------- Utility: Loading ---------- */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255,255,255,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  backdrop-filter: blur(2px);
}

.loading-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border-color);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ---------- Utility: Confirmation Modal ---------- */
.modal-backdrop-custom {
  background: rgba(0,0,0,0.3);
}

.modal-confirm .modal-content {
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
}

.modal-confirm .modal-header {
  border-bottom: 1px solid var(--border-light);
  padding: 0.75rem 1rem;
}

.modal-confirm .modal-title {
  font-size: 12px;
  font-weight: 600;
}

.modal-confirm .modal-body {
  font-size: 11px;
  padding: 1rem;
  color: var(--text-secondary);
}

.modal-confirm .modal-footer {
  border-top: 1px solid var(--border-light);
  padding: 0.75rem 1rem;
}

/* ---------- Responsive ---------- */

/* Laptop / small desktop */
@media (max-width: 1199px) {
  .main-content {
    padding: 1rem 1.25rem;
  }
}

/* Tablet */
@media (max-width: 991px) {
  .main-content {
    padding: 1rem;
  }
  
  .stat {
    padding: 0.7rem 0.85rem;
  }
  
  .stat-icon {
    width: 2.2rem;
    height: 2.2rem;
    font-size: 0.9rem;
  }
  
  .stat .stat-value {
    font-size: 15px;
  }
  
  .table {
    font-size: 10px;
  }
  
  .table thead th {
    font-size: 9px;
  }
}

/* Mobile */
@media (max-width: 575px) {
  .main-content {
    padding: 0.75rem;
  }
  
  .page-header h1 {
    font-size: 14px;
  }
  
  .stat {
    padding: 0.6rem 0.75rem;
    gap: 0.5rem;
  }
  
  .stat-icon {
    width: 2rem;
    height: 2rem;
    font-size: 0.8rem;
    border-radius: var(--radius-sm);
  }
  
  .stat .stat-value {
    font-size: 14px;
  }
  
  .stat .stat-label {
    font-size: 9px;
  }
  
  .card-body {
    padding: 0.75rem;
  }
  
  .def-list {
    grid-template-columns: 1fr;
    gap: 0;
  }
  
  .btn {
    font-size: 10px;
    padding: 0.3rem 0.6rem;
  }
  
  .form-control,
  .form-select {
    font-size: 11px;
  }
  
  .table .flex-actions {
    flex-direction: column;
  }

  .table .flex-actions .btn {
    width: 100%;
    text-align: left;
    justify-content: flex-start;
  }

  #customersTable th:last-child,
  #customersTable td:last-child {
    position: sticky;
    right: 0;
    z-index: 3;
    box-shadow: -4px 0 8px rgba(0,0,0,.06);
  }
  #customersTable thead th:last-child { background: var(--bg-surface-alt) !important; }
  #customersTable tbody td:last-child { background: var(--bg-surface) !important; }
  #customersTable tbody tr:nth-child(even) td:last-child { background: var(--bg-surface-alt) !important; }
  #customersTable tbody tr:hover td:last-child { background: var(--bg-surface-hover) !important; }
  
  .navbar-app {
    height: 44px;
    padding: 0 0.75rem;
  }
  
  .navbar-app .navbar-brand {
    font-size: 10px;
  }
  
  .navbar-app .navbar-brand .empresa-logo {
    max-height: 22px;
    max-width: 80px;
  }
  
  .navbar-app .navbar-brand .brand-text {
    max-width: 90px;
  }
}

#customersTable th.col-always-hide,
#customersTable td.col-always-hide { display: none !important; }

#customersTable { table-layout: auto; width: 100% !important; }
#paymentsTable { table-layout: auto; width: 100% !important; }
#paymentsTable th { white-space: nowrap; }
#paymentsTable td:nth-child(2) { max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#paymentsTable .col-acciones { min-width: 130px; }
@media (max-width: 1199px) {
  #paymentsTable td:nth-child(2) { max-width: 180px; }
}
#customersTable th { white-space: nowrap; }
#customersTable td:nth-child(3) { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#customersTable td:nth-child(4) { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#customersTable td:nth-child(8) { white-space: nowrap; }
#customersTable .col-acciones { min-width: 210px; }
#customersTable .flex-actions .btn { padding: 0.2rem 0.45rem; font-size: 10px; }
#customersTable .flex-actions .btn i { margin-right: 2px !important; }

@media (max-width: 1400px) {
  #customersTable td:nth-child(4) { max-width: 150px; }
  #customersTable td:nth-child(3) { max-width: 140px; }
  #customersTable .flex-actions { gap: 2px; }
  #customersTable .flex-actions .btn span,
  #customersTable .flex-actions .btn { font-size: 0; }
  #customersTable .flex-actions .btn i { font-size: 10px; margin-right: 0 !important; }
  #customersTable .flex-actions .btn i::after { content: none; }
}

@media (max-width: 1200px) {
  #customersTable th.col-hide-xl,
  #customersTable td.col-hide-xl { display: none; }
}

@media (max-width: 992px) {
  #customersTable th.col-hide-lg,
  #customersTable td.col-hide-lg { display: none; }
  #customersTable td:nth-child(4) { max-width: 120px; }
  #paymentsTable th.col-hide-lg,
  #paymentsTable td.col-hide-lg { display: none !important; }
}

/* Print */
@media print {
  .sidebar, .navbar-app, .app-footer, .no-print {
    display: none !important;
  }
  
  .main-content {
    padding: 0;
  }
  
  .card {
    box-shadow: none;
    border: 1px solid #ddd;
  }
}
