/* ============================================================
   Sistema de Controle de Domínios — Design System
   ============================================================ */

/* ── Design Tokens ─────────────────────────────────────────── */
:root {
  --primary:         #2563eb;
  --primary-dark:    #1d4ed8;
  --primary-light:   #eff6ff;
  --primary-subtle:  #dbeafe;

  --success:         #16a34a;
  --success-light:   #f0fdf4;
  --warning:         #d97706;
  --warning-light:   #fffbeb;
  --danger:          #dc2626;
  --danger-light:    #fef2f2;
  --info:            #0891b2;
  --info-light:      #ecfeff;

  --bg-body:         #f1f5f9;
  --bg-card:         #ffffff;
  --bg-muted:        #f8fafc;

  --text-primary:    #0f172a;
  --text-secondary:  #334155;
  --text-muted:      #64748b;
  --text-faint:      #94a3b8;

  --border:          #e2e8f0;
  --border-light:    #f1f5f9;

  --radius-xs:       6px;
  --radius-sm:       8px;
  --radius:          12px;
  --radius-lg:       16px;
  --radius-xl:       20px;

  --shadow-xs:       0 1px 2px rgba(0,0,0,.05);
  --shadow-sm:       0 1px 3px rgba(0,0,0,.07), 0 1px 2px rgba(0,0,0,.04);
  --shadow:          0 4px 6px -1px rgba(0,0,0,.07), 0 2px 4px -1px rgba(0,0,0,.04);
  --shadow-md:       0 6px 16px -2px rgba(0,0,0,.10), 0 3px 6px -2px rgba(0,0,0,.05);
  --shadow-lg:       0 10px 24px -4px rgba(0,0,0,.10), 0 4px 8px -2px rgba(0,0,0,.06);

  --transition:      .18s ease;
  --navbar-height:   60px;
}

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

html { scroll-behavior: smooth; }

body {
  background-color: var(--bg-body);
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: .9375rem;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

/* ── Scrollbar (Webkit) ────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ── Loading Bar ───────────────────────────────────────────── */
#loading-bar {
  position: fixed;
  top: 0; left: 0;
  height: 3px;
  width: 0;
  background: linear-gradient(90deg, var(--primary), #60a5fa);
  z-index: 9999;
  transition: width .3s ease, opacity .3s ease;
  pointer-events: none;
}
#loading-bar.done { width: 100%; opacity: 0; }

/* ── Navbar ────────────────────────────────────────────────── */
.navbar {
  height: var(--navbar-height);
  background: linear-gradient(135deg, #1e3a8a 0%, #1d4ed8 100%) !important;
  border-bottom: none;
  box-shadow: 0 2px 8px rgba(30,58,138,.35);
  padding-top: 0;
  padding-bottom: 0;
}

.navbar-brand {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -.01em;
  color: #fff !important;
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: 0;
}
.navbar-brand i {
  font-size: 1.35rem;
  opacity: .9;
}

.navbar-nav .nav-link {
  font-size: .835rem;
  font-weight: 500;
  color: rgba(255,255,255,.75) !important;
  padding: .45rem .75rem !important;
  border-radius: var(--radius-xs);
  transition: background var(--transition), color var(--transition);
  display: flex;
  align-items: center;
  gap: .3rem;
  white-space: nowrap;
}
.navbar-nav .nav-link:hover {
  color: #fff !important;
  background: rgba(255,255,255,.12);
}
.navbar-nav .nav-link.active {
  color: #fff !important;
  background: rgba(255,255,255,.18);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.2);
}

.navbar-toggler {
  border: 1px solid rgba(255,255,255,.25);
  padding: .3rem .6rem;
  border-radius: var(--radius-xs);
}
.navbar-toggler:focus { box-shadow: none; }
.navbar-toggler-icon {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255%2c255%2c255%2c0.9%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
  width: 1.2em; height: 1.2em;
}

/* Dropdowns do navbar (usuário + Configurações) */
.navbar .dropdown-menu {
  border: none;
  box-shadow: var(--shadow-md);
  border-radius: var(--radius-sm);
  padding: .5rem;
  min-width: 200px;
}
.navbar .dropdown-item {
  border-radius: var(--radius-xs);
  font-size: .875rem;
  padding: .45rem .75rem;
  transition: background var(--transition), color var(--transition);
  display: flex;
  align-items: center;
}
.navbar .dropdown-item:hover {
  background: var(--primary-light);
  color: var(--primary);
}
.navbar .dropdown-item.active,
.navbar .dropdown-item:active {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
}
.navbar .dropdown-item.active i,
.navbar .dropdown-item:hover i {
  color: var(--primary) !important;
}
.navbar .dropdown-item.text-danger:hover { background: var(--danger-light); color: var(--danger); }
.navbar .dropdown-divider { border-color: var(--border); margin: .3rem 0; }

/* Mobile navbar collapse */
@media (max-width: 991.98px) {
  .navbar { height: auto; padding: .65rem 1rem; }
  .navbar-collapse {
    background: rgba(15,23,42,.97);
    border-radius: var(--radius-sm);
    margin-top: .5rem;
    padding: .75rem;
    box-shadow: var(--shadow-lg);
  }
  .navbar-nav .nav-link {
    padding: .6rem .75rem !important;
    border-radius: var(--radius-xs);
  }
}

/* ── Layout ────────────────────────────────────────────────── */
.container-fluid.py-4 {
  flex: 1;
  padding-top: 1.75rem !important;
  padding-bottom: 2rem !important;
}

/* ── Page Header ───────────────────────────────────────────── */
.page-header-row {
  margin-bottom: 1.75rem;
}
.page-header-row h4 {
  color: var(--text-primary);
  letter-spacing: -.02em;
}
.breadcrumb {
  margin-bottom: 0;
  padding: 0;
}
.breadcrumb-item + .breadcrumb-item::before {
  color: var(--text-faint);
  font-size: .8rem;
}
.breadcrumb-item a {
  color: var(--primary);
  text-decoration: none;
  font-size: .8rem;
  opacity: .8;
  transition: opacity var(--transition);
}
.breadcrumb-item a:hover { opacity: 1; }
.breadcrumb-item.active { font-size: .8rem; color: var(--text-muted); }

/* ── Page Header (responsive) ─────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .75rem;
  margin-bottom: 1.5rem;
}
.page-header h4 { margin-bottom: 0; }
.page-header-actions {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
  flex-shrink: 0;
}

/* ── Cards ─────────────────────────────────────────────────── */
.card {
  border-radius: var(--radius) !important;
  border: 1px solid var(--border) !important;
  background: var(--bg-card);
  box-shadow: var(--shadow-sm) !important;
}
.card.shadow-sm { box-shadow: var(--shadow-sm) !important; }

.card-header {
  border-bottom: 1px solid var(--border) !important;
  background: var(--bg-card) !important;
  border-radius: var(--radius) var(--radius) 0 0 !important;
  padding: .85rem 1.25rem !important;
}
.card-header h6 {
  font-size: .85rem;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: -.005em;
  margin: 0;
}

.card-body { padding: 1.25rem; }

/* Stat cards */
.card-stat {
  border-radius: var(--radius) !important;
  box-shadow: var(--shadow-sm) !important;
  transition: transform var(--transition), box-shadow var(--transition);
  cursor: default;
}
.card-stat:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md) !important;
}
.card-stat .card-body {
  padding: 1.1rem 1.25rem;
}
.card-stat .stat-value {
  font-size: 1.9rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -.03em;
  color: var(--text-primary);
}
.card-stat .stat-label {
  font-size: .78rem;
  color: var(--text-muted);
  margin-top: .2rem;
}

/* ── Icon Circle ───────────────────────────────────────────── */
.icon-circle {
  width: 42px;
  height: 42px;
  min-width: 42px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}
.card-stat .icon-circle {
  width: 50px;
  height: 50px;
  min-width: 50px;
  font-size: 1.35rem;
}
.icon-circle-sm {
  width: 32px;
  height: 32px;
  min-width: 32px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: .85rem;
  flex-shrink: 0;
}

/* ── Tables ────────────────────────────────────────────────── */
.table {
  font-size: .875rem;
  color: var(--text-secondary);
  --bs-table-hover-bg: var(--primary-light);
}
.table > thead > tr > th {
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-faint);
  border-bottom: 1px solid var(--border) !important;
  padding: .65rem 1rem;
  white-space: nowrap;
  vertical-align: middle;
}
.table > tbody > tr > td {
  padding: .7rem 1rem;
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
}
.table > tbody > tr:last-child > td { border-bottom: none; }
.table-hover tbody tr {
  transition: background var(--transition);
}
.table-light {
  --bs-table-bg: var(--bg-muted);
  border-bottom: 1px solid var(--border);
}
.table-success { --bs-table-bg: #f0fdf4; }

/* DataTables toolbar — aparece fora do table-responsive */
.dataTables_wrapper .dt-top {
  padding: .85rem 1.25rem .65rem;
  border-bottom: 1px solid var(--border);
}
.dataTables_wrapper .dt-bottom {
  padding: .6rem 1.25rem .85rem;
  border-top: 1px solid var(--border);
}

/* DataTables overrides */
.dataTables_wrapper .dataTables_length select {
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  padding: .3rem 1.75rem .3rem .5rem;
  font-size: .8rem;
  appearance: none;
  -webkit-appearance: none;
  background-color: #fff;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right .55rem center;
  background-size: 12px 9px;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.dataTables_wrapper .dataTables_length select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.1);
  outline: none;
}
/* Label "Exibir X resultados por página" */
.dataTables_wrapper .dataTables_length label {
  display: flex;
  align-items: center;
  gap: .4rem;
  margin: 0;
  font-size: .8rem;
  color: var(--text-muted);
  white-space: nowrap;
}

/* Search box: wrapper + ícone de lupa via pseudo-elemento */
.dataTables_wrapper .dataTables_filter .dt-search-box {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.dataTables_wrapper .dataTables_filter .dt-search-box::before {
  content: '';
  position: absolute;
  left: .6rem;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' fill='%2394a3b8' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.099zm-5.242 1.656a5.5 5.5 0 1 1 0-11 5.5 5.5 0 0 1 0 11z'/%3E%3C%2Fsvg%3E");
  background-repeat: no-repeat;
  background-size: contain;
  pointer-events: none;
}
.dataTables_wrapper .dataTables_filter input {
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  padding: .35rem .65rem .35rem 2rem;
  font-size: .85rem;
  min-width: 200px;
  background-color: #fff;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.dataTables_wrapper .dataTables_filter input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.1);
  outline: none;
}
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_length { font-size: .8rem; color: var(--text-muted); }
.dataTables_wrapper .dataTables_paginate .paginate_button {
  border-radius: var(--radius-xs) !important;
  font-size: .8rem !important;
  padding: .3rem .6rem !important;
  transition: background var(--transition) !important;
}
.dataTables_wrapper .dataTables_paginate .paginate_button.current,
.dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
  background: var(--primary) !important;
  color: #fff !important;
  border-color: var(--primary) !important;
}
.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
  background: var(--primary-light) !important;
  color: var(--primary) !important;
  border-color: var(--border) !important;
}

/* ── Badges ────────────────────────────────────────────────── */
.badge {
  font-size: .72rem;
  font-weight: 600;
  padding: .3em .6em;
  border-radius: var(--radius-xs);
  letter-spacing: .01em;
}
.badge.rounded-pill { border-radius: 99px; }
.badge.bg-light { color: var(--text-secondary) !important; }

/* ── Buttons ───────────────────────────────────────────────── */
.btn {
  font-size: .875rem;
  font-weight: 500;
  border-radius: var(--radius-xs);
  transition: all var(--transition);
  letter-spacing: -.005em;
}
.btn:focus-visible {
  box-shadow: 0 0 0 3px rgba(37,99,235,.25) !important;
  outline: none;
}
.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  box-shadow: 0 1px 3px rgba(37,99,235,.3);
}
.btn-primary:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
  box-shadow: 0 3px 8px rgba(37,99,235,.35);
  transform: translateY(-1px);
}
.btn-sm { font-size: .8rem; padding: .3rem .7rem; border-radius: var(--radius-xs); }
.btn-xs { font-size: .75rem; padding: .2rem .5rem; }
.btn-lg { font-size: .95rem; padding: .6rem 1.5rem; border-radius: var(--radius-sm); }

.btn-outline-secondary:hover { background: #f1f5f9; color: var(--text-secondary); }
.btn-outline-primary:hover { background: var(--primary-light); }
.btn-outline-danger:hover { background: var(--danger-light); }
.btn-outline-success:hover { background: var(--success-light); }

.btn-group .btn { border-radius: 0 !important; }
.btn-group .btn:first-child { border-radius: var(--radius-xs) 0 0 var(--radius-xs) !important; }
.btn-group .btn:last-child { border-radius: 0 var(--radius-xs) var(--radius-xs) 0 !important; }
.btn-group .btn:only-child { border-radius: var(--radius-xs) !important; }

/* ── Forms ─────────────────────────────────────────────────── */
.form-control, .form-select {
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  font-size: .875rem;
  color: var(--text-primary);
  background-color: var(--bg-card);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.form-control:focus, .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
  background-color: var(--bg-card);
}
.form-control::placeholder { color: var(--text-faint); }
.form-control-lg { font-size: .95rem; }
.form-label {
  font-size: .83rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: .35rem;
}
.form-text { font-size: .78rem; color: var(--text-muted); margin-top: .3rem; }
.form-check-input:checked {
  background-color: var(--primary);
  border-color: var(--primary);
}
.form-check-input:focus { box-shadow: 0 0 0 3px rgba(37,99,235,.15); }
.form-switch .form-check-input { width: 2.2em; }

.form-section {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 1.4rem 1.5rem;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
  margin-bottom: 1.25rem;
}
.form-section > h6 {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-faint);
  margin-bottom: 1rem;
  padding-bottom: .6rem;
  border-bottom: 1px solid var(--border);
}

/* Required star */
.text-danger { color: #dc2626 !important; }

/* ── Alerts & Flash ────────────────────────────────────────── */
.alert {
  border-radius: var(--radius-sm);
  font-size: .875rem;
  border: none;
  padding: .85rem 1.1rem;
}
.alert-success {
  background: var(--success-light);
  color: var(--success);
  border-left: 3px solid var(--success);
}
.alert-warning {
  background: var(--warning-light);
  color: #92400e;
  border-left: 3px solid var(--warning);
}
.alert-danger {
  background: var(--danger-light);
  color: var(--danger);
  border-left: 3px solid var(--danger);
}
.alert-info {
  background: var(--info-light);
  color: #155e75;
  border-left: 3px solid var(--info);
}
.alert-light {
  background: var(--bg-muted);
  border: 1px solid var(--border);
  color: var(--text-secondary);
}
.alert-secondary {
  background: #f8fafc;
  color: var(--text-secondary);
  border-left: 3px solid #94a3b8;
}
.alert-dismissible .btn-close { padding: .9rem 1.1rem; }
.alert-link { font-weight: 600; }

/* ── List Groups ───────────────────────────────────────────── */
.list-group-flush .list-group-item {
  border-left: none;
  border-right: none;
  padding: .75rem 1.25rem;
  font-size: .875rem;
  border-color: var(--border-light);
  transition: background var(--transition);
}
.list-group-flush .list-group-item:hover { background: var(--bg-muted); }
.list-group-flush .list-group-item:first-child { border-top: none; }

/* ── Timeline ──────────────────────────────────────────────── */
.timeline {
  position: relative;
  padding-left: 1.6rem;
}
.timeline::before {
  content: '';
  position: absolute;
  left: .62rem;
  top: 6px;
  bottom: 0;
  width: 2px;
  background: var(--border);
  border-radius: 99px;
}
.timeline-item {
  position: relative;
  padding-bottom: 1.4rem;
}
.timeline-item:last-child { padding-bottom: 0; }
.timeline-item::before {
  content: '';
  position: absolute;
  left: -1.6rem;
  top: 5px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--primary);
  border: 2px solid var(--bg-card);
  box-shadow: 0 0 0 2px var(--primary);
  z-index: 1;
}
.timeline-item.status-pendente::before     { background: #f59e0b; box-shadow: 0 0 0 2px #f59e0b; }
.timeline-item.status-em_andamento::before { background: #06b6d4; box-shadow: 0 0 0 2px #06b6d4; }
.timeline-item.status-concluido::before    { background: var(--success); box-shadow: 0 0 0 2px var(--success); }
.timeline-item.status-cancelado::before    { background: #94a3b8; box-shadow: 0 0 0 2px #94a3b8; }

/* ── Status Dots ───────────────────────────────────────────── */
.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  min-width: 8px;
  border-radius: 50%;
  margin-right: 5px;
  vertical-align: middle;
}
.status-dot.disponivel   { background: #22c55e; box-shadow: 0 0 0 3px rgba(34,197,94,.2); }
.status-dot.indisponivel { background: #94a3b8; }
.status-dot.em_liberacao { background: #f59e0b; animation: pulse-dot .9s infinite; }
.status-dot.sunrise      { background: #06b6d4; animation: pulse-dot .9s infinite; }
.status-dot.reserva      { background: #6366f1; animation: pulse-dot .9s infinite; }
.status-dot.quarentena   { background: #f97316; animation: pulse-dot .9s infinite; }

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: .5; transform: scale(.85); }
}

/* ── Empty States ──────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 3rem 2rem;
  color: var(--text-muted);
}
.empty-state i {
  font-size: 2.5rem;
  opacity: .2;
  display: block;
  margin-bottom: .75rem;
  color: var(--text-secondary);
}
.empty-state p { font-size: .875rem; margin-bottom: 1rem; }

/* ── Bulk Action Bar ───────────────────────────────────────── */
#barra-lote {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%) !important;
  border-top: 3px solid var(--primary) !important;
  box-shadow: 0 -4px 20px rgba(0,0,0,.25) !important;
  z-index: 1055;
  animation: slideUp .25s ease;
}
@keyframes slideUp {
  from { transform: translateY(100%); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

/* ── Sticky Table Hack (for bulk bar) ──────────────────────── */
body.has-barra-lote { padding-bottom: 70px; }

/* ── Verificar disponibilidade — chips de extensão ─────────── */
.disp-ext-chip {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .3rem .7rem;
  border: 1.5px solid var(--border);
  border-radius: 99px;
  font-size: .82rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition), color var(--transition);
  user-select: none;
  color: var(--text-secondary);
}
.disp-ext-chip input[type="checkbox"] { display: none; }
.disp-ext-chip:has(input:checked) {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary);
}
.disp-ext-chip:hover { border-color: var(--primary); }

/* Linhas de resultado */
.disp-result-row { transition: background var(--transition); }

/* ── Domain Tags ───────────────────────────────────────────── */
.domain-tag {
  display: inline-flex;
  align-items: center;
  padding: .15rem .55rem;
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #e2e8f0;
  border-radius: 99px;
  font-size: .7rem;
  font-weight: 500;
  line-height: 1.4;
  white-space: nowrap;
}

/* ── Dropdown Menus ────────────────────────────────────────── */
.dropdown-menu {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  padding: .4rem;
  font-size: .875rem;
}
.dropdown-item {
  border-radius: var(--radius-xs);
  padding: .4rem .75rem;
  transition: background var(--transition);
}
.dropdown-item:hover { background: var(--primary-light); color: var(--primary); }
.dropdown-divider { border-color: var(--border); margin: .3rem 0; }

/* ── Login ─────────────────────────────────────────────────── */
.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 60%, #06b6d4 100%);
  padding: 1rem;
}
.login-card {
  width: 100%;
  max-width: 400px;
  border-radius: var(--radius-lg) !important;
  border: none !important;
  box-shadow: 0 24px 64px rgba(0,0,0,.35) !important;
  overflow: hidden;
}
.login-card .card-body { padding: 2.25rem !important; }

/* ── Footer ────────────────────────────────────────────────── */
.app-footer {
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  padding: .85rem 1.5rem;
  font-size: .78rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .5rem;
  margin-top: auto;
}
.app-footer a { color: var(--text-muted); text-decoration: none; }
.app-footer a:hover { color: var(--primary); }

/* ── Modals ────────────────────────────────────────────────── */
.modal-content {
  border: none;
  border-radius: var(--radius) !important;
  box-shadow: var(--shadow-lg);
}
.modal-header {
  border-bottom: 1px solid var(--border);
  padding: 1rem 1.25rem;
}
.modal-footer {
  border-top: 1px solid var(--border);
  padding: .85rem 1.25rem;
}

/* ── Tooltips ──────────────────────────────────────────────── */
.tooltip .tooltip-inner {
  font-size: .78rem;
  border-radius: var(--radius-xs);
  padding: .3rem .65rem;
}

/* ── Tables w ─── */
.table-card .card-body { padding: 0; }

/* ── Popovers ──────────────────────────────────────────────── */
.popover {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  font-size: .85rem;
}

/* ── Page Transitions ──────────────────────────────────────── */
.container-fluid {
  animation: fadeUp .22s ease backwards;
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; }
}

/* ── Progress Bar on Tables ────────────────────────────────── */
.progress {
  border-radius: 99px;
  height: 6px;
  background: var(--border);
}
.progress-bar { border-radius: 99px; }

/* ── Scrollable containers ─────────────────────────────────── */
[style*="max-height"][style*="overflow-y:auto"],
[style*="max-height"][style*="overflow-y: auto"] {
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 transparent;
}

/* ── Utility ───────────────────────────────────────────────── */
.text-primary-emphasis { color: #1e40af !important; }
.bg-primary-subtle { background-color: var(--primary-subtle) !important; }
.fw-semibold { font-weight: 600 !important; }
.font-monospace { font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace; }
.rounded-card { border-radius: var(--radius) !important; }
.gap-sm { gap: .5rem !important; }
.text-faint { color: var(--text-faint) !important; }

/* ── Back-to-top button ────────────────────────────────────── */
#btn-top {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 1040;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .9rem;
  box-shadow: 0 4px 12px rgba(37,99,235,.4);
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease, transform .25s ease;
  cursor: pointer;
}
#btn-top:hover { transform: translateY(-2px); }

/* Hover lift */
.hover-lift {
  transition: transform var(--transition), box-shadow var(--transition);
}
.hover-lift:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md) !important;
}

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 767.98px) {
  .container-fluid.py-4 {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
    padding-top: 1.25rem !important;
  }

  .card-body { padding: 1rem; }
  .card-header { padding: .75rem 1rem !important; }

  /* Stack action buttons */
  .d-flex.gap-2.flex-wrap .btn { font-size: .8rem; }

  /* Table horizontal scroll indicator */
  .table-responsive::after {
    display: none;
  }

  /* Stat cards on mobile */
  .card-stat .stat-value { font-size: 1.6rem; }
  .card-stat .icon-circle { width: 42px; height: 42px; font-size: 1.1rem; }

  /* Bulk bar on mobile */
  #barra-lote .d-flex { flex-direction: column; align-items: stretch !important; gap: .5rem !important; }
  #barra-lote select, #barra-lote .btn { width: 100%; }

  /* DataTables on mobile */
  .dataTables_wrapper .dataTables_filter,
  .dataTables_wrapper .dataTables_length {
    text-align: left;
    margin-bottom: .5rem;
  }

  /* Alert compact */
  .alert { font-size: .85rem; }

  /* Form section tighter on tablet */
  .form-section { padding: 1.1rem 1.2rem; }
}

@media (max-width: 575.98px) {
  h4.fw-bold { font-size: 1.1rem; }

  /* ── Page header: stack on phone ─── */
  .page-header { align-items: flex-start; gap: .5rem; }
  .page-header-actions {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }
  .page-header-actions > .btn,
  .page-header-actions > a,
  .page-header-actions > button {
    width: 100%;
    justify-content: center;
    display: flex;
    align-items: center;
    text-align: center;
  }

  /* ── DataTables: full-width controls ─── */
  .dataTables_wrapper .dt-top {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: .4rem !important;
  }
  .dataTables_wrapper .dt-top .dataTables_length,
  .dataTables_wrapper .dt-top .dataTables_filter { width: 100%; }
  .dataTables_wrapper .dt-top .dataTables_filter .dt-search-box { width: 100%; }
  .dataTables_wrapper .dt-top .dataTables_filter input { flex: 1; min-width: 0; width: 100%; }
  .dataTables_wrapper .dt-bottom {
    flex-direction: column !important;
    align-items: center !important;
    gap: .35rem;
  }
  .dataTables_wrapper .dt-bottom .dataTables_info { text-align: center; font-size: .75rem; }

  /* ── Modal full-width on phone ─── */
  .modal-dialog { margin: .5rem; max-width: calc(100vw - 1rem); }

  /* ── Form section tighter ─── */
  .form-section { padding: .9rem 1rem; }

  /* ── Table more compact ─── */
  .table { font-size: .82rem; }
  .table > thead > tr > th { font-size: .68rem; padding: .5rem .75rem; }
  .table > tbody > tr > td { padding: .55rem .75rem; }

  /* ── Card header compact ─── */
  .card-header { padding: .65rem .9rem !important; }
  .card-header h6 { font-size: .8rem; }

  /* ── Stat cards smaller on phone ─── */
  .card-stat .card-body { padding: .85rem .9rem; }
  .card-stat .stat-value { font-size: 1.4rem; }

  /* ── Breadcrumb smaller ─── */
  .breadcrumb-item, .breadcrumb-item.active, .breadcrumb-item a { font-size: .73rem; }

  /* ── Filter/status pill buttons ─── */
  .mb-3.d-flex.gap-2.flex-wrap .btn-sm,
  .mb-3.d-flex.gap-2.flex-wrap .btn { font-size: .75rem; padding: .25rem .55rem; }

  /* ── Alerts ─── */
  .alert { font-size: .83rem; padding: .7rem .9rem; }
}

/* ── Print ─────────────────────────────────────────────────── */
@media print {
  .navbar, .app-footer, #barra-lote, .btn, .breadcrumb { display: none !important; }
  .card { box-shadow: none !important; border: 1px solid #ddd !important; }
  body { background: #fff; }
}
