/* ── Variables ── */
:root {
  --primary: #4361ee;
  --primary-light: #eef0ff;
  --success: #06d6a0;
  --success-bg: #e6faf4;
  --warning: #ffd166;
  --warning-bg: #fff8e0;
  --danger: #ef476f;
  --danger-bg: #fde8ed;
  --info: #118ab2;
  --info-bg: #e4f4fa;
  --dark: #073b4c;
  --gray-100: #f8f9fa;
  --gray-200: #e9ecef;
  --gray-300: #dee2e6;
  --gray-400: #ced4da;
  --gray-500: #adb5bd;
  --gray-600: #6c757d;
  --gray-700: #495057;
  --body-bg: #f5f7fb;
  --card-border: rgba(67, 97, 238, 0.08);
  --shadow-sm: 0 1px 3px rgba(0,0,0,.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,.08);
  --shadow-lg: 0 8px 30px rgba(0,0,0,.12);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-xs: 6px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ── Base ── */
body {
  font-family: var(--font);
  font-size: .875rem;
  background: var(--body-bg);
  color: var(--gray-700);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.container-fluid {
  padding: 0 .75rem;
}
@media (min-width: 768px) {
  .container-fluid { padding: 0 1.5rem; }
}

/* ── Navbar ── */
.navbar {
  background: linear-gradient(135deg, #4361ee 0%, #3a0ca3 100%) !important;
  box-shadow: 0 2px 12px rgba(67,97,238,.25);
  padding: .5rem 0;
}
.navbar-brand {
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -.3px;
}
.nav-link {
  font-size: .875rem;
  padding: .4rem .7rem !important;
  border-radius: var(--radius-xs);
  transition: background .15s;
}
.nav-link:hover { background: rgba(255,255,255,.12); }
.nav-link.active { background: rgba(255,255,255,.2); font-weight: 600; }

/* ── Cards ── */
.card {
  border: none;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  background: #fff;
  transition: box-shadow .2s;
}
.card:hover { box-shadow: var(--shadow-md); }
.card-header {
  border-radius: var(--radius) var(--radius) 0 0 !important;
  font-weight: 600;
  padding: .75rem 1rem;
}
.card-body { padding: 1rem; }

/* ── Page titles ── */
.page-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--dark);
  margin-bottom: .75rem;
}
.page-title i { color: var(--primary); margin-right: .5rem; }

/* ── Stats bar ── */
.stats-bar {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
  margin-bottom: .75rem;
}
.stat-badge {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .3rem .65rem;
  border-radius: 50px;
  font-size: .75rem;
  font-weight: 600;
  background: #fff;
  border: 1px solid var(--gray-200);
  color: var(--gray-600);
  box-shadow: var(--shadow-sm);
}
.stat-badge strong { color: var(--dark); }

/* ── Tables ── */
.table {
  margin-bottom: 0;
  font-size: .85rem;
}
.table th {
  font-weight: 600;
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .3px;
  color: var(--gray-600);
  border-bottom: 2px solid var(--gray-200);
  padding: .6rem .5rem !important;
  white-space: nowrap;
  background: transparent;
}
.table td {
  padding: .5rem !important;
  vertical-align: middle;
  border-bottom: 1px solid var(--gray-100);
}
.table-striped > tbody > tr:nth-of-type(odd) { background: var(--gray-100); }
.table-hover > tbody > tr:hover { background: var(--primary-light); }
.table-responsive { min-height: 0; }

/* ── Badges ── */
.badge {
  font-weight: 600;
  font-size: .7rem;
  padding: .25em .55em;
  border-radius: 50px;
}

/* ── Buttons ── */
.btn {
  font-weight: 600;
  font-size: .8rem;
  border-radius: var(--radius-xs);
  padding: .35rem .75rem;
  transition: all .15s;
}
.btn-sm { font-size: .75rem; padding: .25rem .55rem; }
.btn-primary { background: var(--primary); border-color: var(--primary); }
.btn-primary:hover { background: #3651d4; border-color: #3651d4; transform: translateY(-1px); }
.btn-success { background: var(--success); border-color: var(--success); color: #fff; }
.btn-success:hover { background: #05b88a; border-color: #05b88a; }
.btn-outline-primary { color: var(--primary); border-color: var(--primary); }
.btn-outline-primary:hover { background: var(--primary); color: #fff; }
.btn-outline-secondary { color: var(--gray-600); border-color: var(--gray-300); }
.btn-outline-secondary:hover { background: var(--gray-200); color: var(--gray-700); }

/* ── Forms ── */
.form-control, .form-select {
  border-radius: var(--radius-xs);
  border: 1.5px solid var(--gray-200);
  font-size: .85rem;
  padding: .4rem .6rem;
  transition: border-color .15s, box-shadow .15s;
}
.form-control:focus, .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(67,97,238,.15);
}
.form-control-sm, .form-select-sm {
  font-size: .8rem;
  padding: .3rem .5rem;
}
.form-label { font-size: .8rem; font-weight: 600; color: var(--gray-700); margin-bottom: .2rem; }

/* ── DataTables ── */
.dataTables_wrapper .dataTables_info {
  font-size: .78rem;
  color: var(--gray-500);
  padding-top: .75rem !important;
}
.dataTables_wrapper .dataTables_paginate {
  font-size: .78rem;
  padding-top: .65rem !important;
}
.dataTables_paginate .paginate_button {
  padding: .25rem .55rem !important;
  margin: 0 1px;
  border-radius: var(--radius-xs) !important;
  border: 1px solid var(--gray-200) !important;
  background: #fff !important;
  color: var(--gray-600) !important;
}
.dataTables_paginate .paginate_button.current {
  background: var(--primary) !important;
  color: #fff !important;
  border-color: var(--primary) !important;
}
.dataTables_paginate .paginate_button:hover {
  background: var(--primary-light) !important;
  border-color: var(--primary) !important;
  color: var(--primary) !important;
}
table.dataTable thead > tr > th { padding: .6rem .5rem !important; }
table.dataTable tbody > tr > td { padding: .45rem .5rem !important; }

/* ── Buttons in tables ── */
.btn-icon {
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-xs);
  border: 1px solid var(--gray-200);
  background: #fff;
  color: var(--gray-600);
  transition: all .15s;
  cursor: pointer;
}
.btn-icon:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }

/* ── Signature ── */
#canvasFirma, #canvasFirmaEntrega {
  display: block;
  max-width: 100%;
  border-radius: var(--radius-xs);
}
#firmaTrigger, #firmaEntregaTrigger {
  border-radius: var(--radius-sm) !important;
  transition: border-color .2s;
}
#firmaTrigger:hover, #firmaEntregaTrigger:hover {
  border-color: var(--primary) !important;
}

/* ── Modals ── */
.modal-content {
  border: none;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
}
.modal-header {
  border-radius: var(--radius) var(--radius) 0 0 !important;
  padding: .75rem 1rem;
}
.modal-body { padding: 1rem; }
.modal-footer {
  padding: .65rem 1rem;
  border-top: 1px solid var(--gray-100);
}
.modal-fullscreen .modal-content { border-radius: 0; }

/* ── Alerts ── */
.alert { border-radius: var(--radius-sm); border: none; font-size: .82rem; }
.alert-warning { background: var(--warning-bg); color: #856404; }

/* ── Dropdown ── */
.dropdown-menu {
  border: none;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  font-size: .85rem;
  padding: .4rem 0;
}
.dropdown-item {
  padding: .4rem 1rem;
  transition: background .1s;
}
.dropdown-item:hover { background: var(--primary-light); }
.dropdown-item i { width: 1.2rem; text-align: center; }

/* ── Responsive tweaks ── */
@media (max-width: 575.98px) {
  .card-body { padding: .65rem; }
  .page-title { font-size: 1.05rem; }
  .table { font-size: .78rem; }
  .table th, .table td { padding: .35rem .35rem !important; }
  .navbar-brand { font-size: .9rem; }
  .stat-badge { font-size: .68rem; padding: .2rem .5rem; }
}

/* ── Print ── */
@media print {
  body { background: #fff !important; }
  .no-print, .navbar, .dataTables_wrapper .dataTables_paginate,
  .dataTables_wrapper .dataTables_info, .btn, .card-header { display: none !important; }
  .card { box-shadow: none !important; border: 1px solid #000 !important; }
  .table td, .table th { border-color: #000 !important; }
}

/* ── Signature pad fullscreen ── */
#canvasFirmaFull {
  cursor: crosshair;
  border-radius: var(--radius-sm);
}

/* ── Entrega badge ── */
.bg-entregado { background: #4361ee !important; }
