/* ═══════════════════════════════════════════
   Control de Acceso QR — XAMPP v1
   ═══════════════════════════════════════════ */

:root {
  --bg:             #eef0f5;
  --surface:        #ffffff;
  --border:         #e4e6ec;
  --border-subtle:  #f1f2f6;
  --text-primary:   #0f1117;
  --text-secondary: #5c6070;
  --text-muted:     #9ea5b5;

  --indigo:       #5b5ef4;
  --indigo-dark:  #4547d4;
  --indigo-light: #eeeeff;
  --indigo-mid:   #c7c8fc;

  --green:        #15803d;
  --green-bg:     #f0fdf4;
  --green-border: #86efac;
  --green-mid:    #22c55e;
  --green-light:  #dcfce7;

  --red:          #b91c1c;
  --red-bg:       #fef2f2;
  --red-border:   #fca5a5;
  --red-mid:      #ef4444;
  --red-light:    #fee2e2;

  --amber:        #b45309;
  --amber-bg:     #fffbeb;
  --amber-border: #fcd34d;

  --radius-xs: 6px;
  --radius-sm: 9px;
  --radius:    13px;
  --radius-lg: 18px;
  --radius-xl: 22px;

  --shadow-sm: 0 1px 2px rgba(0,0,0,.06);
  --shadow:    0 2px 8px rgba(0,0,0,.07), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md: 0 6px 20px rgba(0,0,0,.09), 0 2px 6px rgba(0,0,0,.05);
  --shadow-lg: 0 12px 40px rgba(0,0,0,.13), 0 4px 12px rgba(0,0,0,.07);
}

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

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }


/* ════════════════════════════
   SCANNER PAGE
════════════════════════════ */

.page {
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 20px 56px;
}

/* ── HEADER ── */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 0 16px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
  gap: 12px;
  flex-wrap: nowrap;
}

.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }

.brand-icon {
  width: 36px; height: 36px;
  background: var(--indigo);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  color: white; flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(91,94,244,.3);
}

.brand-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.brand-name {
  font-size: 0.95rem; font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -.02em;
  white-space: nowrap;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.btn-admin {
  font-size: 0.78rem; font-weight: 500;
  color: var(--text-secondary); text-decoration: none;
  padding: 7px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  transition: all .15s;
  white-space: nowrap;
}
.btn-admin:hover { border-color: var(--indigo-mid); color: var(--indigo); background: var(--indigo-light); }

/* ── MODE BADGE ── */
.mode-badge {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 99px;
  white-space: nowrap;
}
.mode-badge-garita {
  background: var(--amber-bg);
  color: var(--amber);
  border: 1px solid var(--amber-border);
}
.mode-badge-movil {
  background: var(--indigo-light);
  color: var(--indigo);
  border: 1px solid var(--indigo-mid);
}
/* Badge inline bajo el nombre (solo móvil) */
.mode-badge-inline { display: none; }


/* ── MAIN GRID ── */
.main {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  align-items: stretch;
}

/* ── CARD ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 13px;
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.card-title {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ── STATUS PILL ── */
.status-pill {
  font-size: 0.62rem; font-weight: 700;
  letter-spacing: .05em; text-transform: uppercase;
  padding: 3px 9px; border-radius: 99px;
  background: var(--green-light); color: var(--green);
  border: 1px solid var(--green-border);
  transition: background .3s, color .3s, border-color .3s;
  white-space: nowrap;
}
.status-pill.offline { background: var(--red-light); color: var(--red); border-color: var(--red-border); }
.status-pill.loading { background: #f1f5f9; color: #64748b; border-color: #cbd5e1; }

/* ── SCANNER CARD ── */
.scanner-card { min-height: 480px; }

/* ── VIEWPORT (cámara) ── */
.viewport {
  position: relative;
  width: 100%;
  flex: 1;
  min-height: 340px;
  background: #0a0a0f;
  overflow: hidden;
}

.viewport-idle {
  position: absolute; inset: 0;
  background: linear-gradient(160deg, #13141a 0%, #1a1c28 100%);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 12px; z-index: 2;
}

.idle-icon { color: rgba(255,255,255,.18); }

.idle-label {
  font-size: 0.84rem; font-weight: 500;
  color: rgba(255,255,255,.45);
  text-align: center; padding: 0 20px; line-height: 1.5;
}

.btn-retry {
  font-family: inherit; font-size: 0.8rem; font-weight: 600;
  padding: 8px 20px; border-radius: var(--radius-sm);
  border: 1px solid rgba(255,255,255,.15);
  background: rgba(255,255,255,.08); color: rgba(255,255,255,.7);
  cursor: pointer; margin-top: 4px; transition: all .15s;
}
.btn-retry:hover { background: rgba(255,255,255,.14); }

#reader {
  position: absolute; inset: 0;
  width: 100% !important; height: 100% !important;
}
#reader video {
  width: 100% !important; height: 100% !important;
  object-fit: cover !important; display: block !important;
}
#reader img { display: none !important; }

/* ── SCANNER FOOTER ── */
.scanner-footer {
  padding: 11px 20px;
  border-top: 1px solid var(--border-subtle);
  display: flex; justify-content: flex-end;
  min-height: 48px; align-items: center;
  flex-shrink: 0;
}

.btn-ctrl {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: inherit; font-size: 0.78rem; font-weight: 600;
  padding: 7px 15px; border-radius: var(--radius-sm);
  border: none; cursor: pointer; transition: all .15s;
}
.btn-stop  { background: var(--red-light);   color: var(--red);   border: 1px solid var(--red-border); }
.btn-stop:hover  { background: #fecaca; }
.btn-start { background: var(--indigo-light); color: var(--indigo); border: 1px solid var(--indigo-mid); }
.btn-start:hover { background: #dddffe; }


/* ════════════════════════════
   MODO GARITA
════════════════════════════ */

.garita-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 32px 20px 20px;
  min-height: 340px;
}

.garita-icon {
  width: 88px; height: 88px;
  border-radius: 50%;
  background: #f4f5f9;
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  color: var(--indigo);
  margin-bottom: 2px;
}

.garita-title {
  font-size: 0.95rem; font-weight: 700;
  color: var(--text-primary); letter-spacing: -.02em;
  text-align: center;
}

.garita-sub {
  font-size: 0.8rem; color: var(--text-secondary);
  text-align: center; max-width: 220px; line-height: 1.5;
}

/* Indicadores de los dos lectores */
.reader-indicators {
  display: flex;
  align-items: center;
  gap: 0;
  background: #f7f8fc;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 20px;
  margin-top: 4px;
  width: 100%;
  max-width: 260px;
  justify-content: center;
}

.reader-indicator {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  flex: 1;
  padding: 0 10px;
}

.reader-divider {
  width: 1px;
  height: 36px;
  background: var(--border);
  flex-shrink: 0;
}

.ri-dot {
  display: block;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--green-mid);
  box-shadow: 0 0 0 0 rgba(34,197,94,.4);
  animation: pulse-dot 2.2s ease-out infinite;
  transition: background .2s, box-shadow .2s;
}
@keyframes pulse-dot {
  0%   { box-shadow: 0 0 0 0   rgba(34,197,94,.5); }
  70%  { box-shadow: 0 0 0 7px rgba(34,197,94,.0); }
  100% { box-shadow: 0 0 0 0   rgba(34,197,94,.0); }
}
/* Desfase animación para lector 2 */
#dot-2 { animation-delay: 1.1s; }

.ri-label {
  font-size: 0.7rem; font-weight: 600;
  color: var(--text-secondary); text-transform: uppercase;
  letter-spacing: .06em;
}

/* Flash de actividad al escanear */
.reader-indicator.flash .ri-dot {
  background: var(--indigo);
  animation: none;
  box-shadow: 0 0 0 6px rgba(91,94,244,.2);
}
.reader-indicator.flash .ri-label { color: var(--indigo); }

/* Input oculto HID */
.hid-input {
  position: absolute;
  width: 1px; height: 1px;
  opacity: 0; pointer-events: none;
  border: none; outline: none;
  background: transparent; color: transparent;
  caret-color: transparent;
  padding: 0; margin: 0; overflow: hidden;
}

/* Footer garita */
.garita-footer {
  padding: 11px 20px;
  border-top: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.garita-click-area {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 14px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.76rem; cursor: pointer;
  transition: all .15s; user-select: none;
}
.garita-click-area:hover { border-color: var(--indigo-mid); color: var(--indigo); background: var(--indigo-light); }


/* ════════════════════════════
   RESULT CARD
════════════════════════════ */

.result-card { min-height: 480px; }

.result-idle {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 10px; padding: 28px 20px;
}

.idle-graphic {
  width: 76px; height: 76px;
  background: var(--border-subtle);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); margin-bottom: 4px;
}

.idle-title { font-size: 0.9rem; font-weight: 600; color: var(--text-secondary); }
.idle-sub   { font-size: 0.78rem; color: var(--text-muted); text-align: center; }

.result-panel {
  flex: 1; display: flex; flex-direction: column;
  animation: panel-in .22s cubic-bezier(.22,.68,0,1.2);
}
@keyframes panel-in {
  from { opacity: 0; transform: scale(.97); }
  to   { opacity: 1; transform: scale(1); }
}

.result-header {
  display: flex; align-items: center; gap: 14px;
  padding: 18px 20px 16px;
}
.result-header-ok  { background: var(--green-bg);  border-bottom: 1px solid var(--green-border); }
.result-header-err { background: var(--red-bg);    border-bottom: 1px solid var(--red-border); }

.result-check {
  width: 54px; height: 54px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  background: var(--green-light); color: var(--green);
  box-shadow: 0 0 0 4px rgba(34,197,94,.12);
}
.result-check-err {
  background: var(--red-light); color: var(--red);
  box-shadow: 0 0 0 4px rgba(239,68,68,.12);
}

.result-label { font-size: 1.05rem; font-weight: 800; letter-spacing: -.02em; }
.result-header-ok  .result-label { color: var(--green); }
.result-header-err .result-label { color: var(--red); }

.result-body {
  flex: 1; padding: 18px 20px;
  display: flex; flex-direction: column; gap: 4px;
}

.result-name { font-size: 1.25rem; font-weight: 800; color: var(--text-primary); letter-spacing: -.03em; line-height: 1.2; }
.result-sub  { font-size: 0.83rem; font-weight: 500; color: var(--text-secondary); margin-top: 2px; }
.result-divider { height: 1px; background: var(--border); margin: 14px 0; }

.info-grid { display: flex; flex-direction: column; gap: 10px; }

.info-item {
  display: flex; align-items: center;
  justify-content: space-between; gap: 12px;
}

.info-label {
  font-size: 0.7rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-muted); white-space: nowrap;
}

.info-value { font-size: 0.86rem; font-weight: 600; color: var(--text-primary); text-align: right; }

.info-placa {
  font-family: 'Courier New', monospace;
  font-size: 1rem; font-weight: 700; letter-spacing: .08em;
  color: var(--indigo); background: var(--indigo-light);
  padding: 3px 9px; border-radius: var(--radius-xs);
}

.denied-reason {
  font-size: 0.9rem; font-weight: 500; color: var(--red);
  background: var(--red-light); border: 1px solid var(--red-border);
  border-radius: var(--radius-sm); padding: 14px 16px; line-height: 1.5;
}

.progress-wrap { height: 5px; background: var(--border-subtle); margin-top: auto; }
.progress-bar  { height: 100%; width: 100%; }
.progress-ok   { background: var(--green-mid); }
.progress-err  { background: var(--red-mid); }


/* ════════════════════════════
   RESPONSIVE MÓVIL
════════════════════════════ */
@media (max-width: 680px) {
  .page { padding: 0 12px 40px; }

  /* Header compacto en móvil */
  .header { padding: 12px 0 10px; margin-bottom: 16px; flex-wrap: nowrap; }
  .brand-name { font-size: 0.85rem; }
  .brand-icon { width: 32px; height: 32px; }

  /* Badge inline bajo el nombre en móvil */
  .mode-badge-inline { display: inline-block; }
  .mode-badge-header { display: none !important; }

  /* Link admin más pequeño */
  .btn-admin { font-size: 0.72rem; padding: 6px 10px; }

  /* Cards en columna */
  .main { grid-template-columns: 1fr; gap: 12px; }
  .scanner-card, .result-card { min-height: auto; }

  /* Viewport cámara */
  .viewport { min-height: 280px; }

  /* Resultado más compacto */
  .result-check { width: 46px; height: 46px; }
  .result-label { font-size: 0.95rem; }
  .result-name  { font-size: 1.05rem; }

  /* Garita en móvil */
  .garita-panel { padding: 24px 16px 16px; gap: 12px; min-height: 280px; }
  .garita-icon  { width: 72px; height: 72px; }
  .garita-title { font-size: 0.88rem; }
  .garita-sub   { font-size: 0.75rem; max-width: 200px; }
  .reader-indicators { padding: 10px 14px; max-width: 220px; }
}

@media (max-width: 380px) {
  .page { padding: 0 10px 32px; }
  .brand-name { font-size: 0.78rem; }
  .btn-admin  { font-size: 0.68rem; padding: 5px 8px; }
  .result-name { font-size: 0.95rem; }
  .info-placa  { font-size: 0.88rem; }
}


/* ════════════════════════════
   LOGIN
════════════════════════════ */
.login-page {
  min-height: 100vh; display: flex; align-items: center;
  justify-content: center; padding: 20px;
  background: linear-gradient(135deg, #eef0f5 0%, #e8eaf6 100%);
}

.login-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-xl); box-shadow: var(--shadow-lg);
  padding: 40px 36px; width: 100%; max-width: 380px;
}

.login-header { text-align: center; margin-bottom: 32px; }

.login-logo-icon {
  width: 52px; height: 52px; background: var(--indigo);
  border-radius: var(--radius); display: flex; align-items: center;
  justify-content: center; color: white; margin: 0 auto 16px;
  box-shadow: 0 4px 16px rgba(91,94,244,.35);
}

.login-title { font-size: 1.2rem; font-weight: 800; letter-spacing: -.03em; margin-bottom: 4px; }
.login-sub   { font-size: 0.8rem; color: var(--text-secondary); }
.login-error { font-size: 0.8rem; color: var(--red); text-align: center; margin-top: 10px; min-height: 18px; }
.login-back  { display: block; text-align: center; margin-top: 20px; font-size: 0.8rem; color: var(--text-muted); text-decoration: none; }
.login-back:hover { color: var(--indigo); }

.form-group { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.form-label { font-size: 0.76rem; font-weight: 600; color: var(--text-secondary); }

.form-input {
  padding: 10px 13px; border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); font-family: inherit;
  font-size: 0.9rem; color: var(--text-primary); outline: none; width: 100%;
  transition: border-color .15s, box-shadow .15s;
}
.form-input:focus { border-color: var(--indigo); box-shadow: 0 0 0 3px rgba(91,94,244,.12); }
.form-input:disabled { background: var(--border-subtle); color: var(--text-muted); cursor: not-allowed; }

.btn-login {
  width: 100%; display: flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--indigo); color: white;
  padding: 11px; font-size: 0.9rem; font-weight: 600;
  border: none; border-radius: var(--radius-sm); cursor: pointer;
  margin-top: 6px; font-family: inherit;
  transition: background .15s; box-shadow: 0 2px 10px rgba(91,94,244,.28);
}
.btn-login:hover { background: var(--indigo-dark); }


/* ════════════════════════════
   DASHBOARD
════════════════════════════ */
.dash-page { max-width: 1200px; margin: 0 auto; padding: 0 20px 56px; }

.dash-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 0 16px; border-bottom: 1px solid var(--border);
  margin-bottom: 22px; gap: 12px; flex-wrap: wrap;
}
.dash-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.btn-new {
  font-family: inherit; font-size: 0.84rem; font-weight: 600;
  padding: 9px 18px; border: none; border-radius: var(--radius-sm);
  background: var(--indigo); color: white; cursor: pointer;
  display: flex; align-items: center; gap: 7px;
  transition: background .15s; box-shadow: 0 2px 8px rgba(91,94,244,.25);
}
.btn-new:hover { background: var(--indigo-dark); }

.btn-secondary {
  font-family: inherit; font-size: 0.8rem; font-weight: 500;
  color: var(--text-secondary); padding: 8px 14px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; gap: 6px;
  transition: all .15s; box-shadow: var(--shadow-sm);
}
.btn-secondary:hover { border-color: var(--text-secondary); color: var(--text-primary); }

/* Stats */
.stats-row { display: flex; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }

.stat-card {
  flex: 1; min-width: 110px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 20px;
  box-shadow: var(--shadow-sm); position: relative; overflow: hidden;
}
.stat-card::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px; background: var(--border);
}
.stat-card.green::before { background: var(--green-mid); }
.stat-card.red::before   { background: var(--red-mid); }
.stat-card.amber::before { background: #f59e0b; }

.stat-label { font-size: 0.65rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--text-muted); margin-bottom: 6px; }
.stat-value { font-size: 1.85rem; font-weight: 800; color: var(--text-primary); line-height: 1; letter-spacing: -.04em; }
.stat-card.green .stat-value { color: var(--green); }
.stat-card.red   .stat-value { color: var(--red); }
.stat-card.amber .stat-value { color: var(--amber); }

/* Filter bar */
.filter-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }

.search-wrap { position: relative; flex: 1; min-width: 220px; }
.search-icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--text-muted); pointer-events: none; }
.search-input {
  width: 100%; padding: 9px 14px 9px 36px;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  font-family: inherit; font-size: 0.875rem; color: var(--text-primary);
  background: var(--surface); outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.search-input:focus { border-color: var(--indigo); box-shadow: 0 0 0 3px rgba(91,94,244,.12); }
.search-input::placeholder { color: var(--text-muted); }

.filter-group { display: flex; gap: 5px; flex-wrap: wrap; }
.filter-btn {
  font-family: inherit; font-size: 0.77rem; font-weight: 500;
  padding: 7px 13px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text-secondary); cursor: pointer; transition: all .15s; white-space: nowrap;
}
.filter-btn:hover { border-color: var(--indigo-mid); color: var(--indigo); }
.filter-btn.active { background: var(--indigo); border-color: var(--indigo); color: white; }

/* Table */
.table-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow); overflow: hidden; }
.table-wrap  { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; font-size: 0.83rem; white-space: nowrap; }
thead { background: #f7f8fc; }
th { padding: 11px 14px; text-align: left; font-size: 0.64rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--text-muted); border-bottom: 1px solid var(--border); }
td { padding: 11px 14px; border-bottom: 1px solid var(--border-subtle); color: var(--text-secondary); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: #f9f9ff; }

td.col-id    { font-size: 0.76rem; color: var(--indigo); font-weight: 700; font-family: monospace; }
td.col-name  { font-weight: 600; color: var(--text-primary); white-space: normal; min-width: 140px; }
td.col-placa { font-family: monospace; font-weight: 700; font-size: 0.82rem; color: var(--text-primary); letter-spacing: .04em; }

.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 0.68rem; font-weight: 700; padding: 3px 8px; border-radius: 99px; white-space: nowrap; }
.badge::before { content: ''; width: 5px; height: 5px; border-radius: 50%; flex-shrink: 0; }
.badge-activo   { background: var(--green-bg);  color: var(--green);  border: 1px solid var(--green-border); }
.badge-activo::before   { background: var(--green-mid); }
.badge-inactivo { background: var(--red-bg);    color: var(--red);    border: 1px solid var(--red-border); }
.badge-inactivo::before { background: var(--red-mid); }
.badge-vehiculo { background: var(--amber-bg);  color: var(--amber);  border: 1px solid var(--amber-border); }
.badge-vehiculo::before { background: #f59e0b; }

.btn-tbl { font-family: inherit; font-size: 0.74rem; font-weight: 500; padding: 5px 11px; border-radius: var(--radius-xs); border: 1px solid var(--border); background: var(--surface); cursor: pointer; transition: all .14s; }
.btn-tbl + .btn-tbl { margin-left: 5px; }
.btn-tbl-edit:hover    { border-color: var(--indigo-mid); color: var(--indigo); background: var(--indigo-light); }
.btn-tbl-archive:hover { border-color: var(--red-border);  color: var(--red);   background: var(--red-bg); }

.table-empty { text-align: center; padding: 52px 20px; color: var(--text-muted); font-size: 0.875rem; }


/* ════════════════════════════
   MODALES
════════════════════════════ */
.modal-bg {
  position: fixed; inset: 0; background: rgba(10,12,20,.48);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  z-index: 50; padding: 16px; animation: bg-in .16s ease; overflow-y: auto;
}
@keyframes bg-in { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: var(--surface); border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg); padding: 28px; width: 100%; max-width: 460px;
  animation: modal-in .2s cubic-bezier(.22,.68,0,1.15); position: relative; margin: auto;
}
.modal-wide { max-width: 560px; }

@keyframes modal-in {
  from { opacity: 0; transform: translateY(14px) scale(.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-title { font-size: 1rem; font-weight: 800; letter-spacing: -.02em; color: var(--text-primary); margin-bottom: 20px; }

.form-group  { display: flex; flex-direction: column; gap: 5px; margin-bottom: 13px; }
.form-label  { font-size: 0.75rem; font-weight: 600; color: var(--text-secondary); }

.select-input {
  padding: 9px 32px 9px 12px; border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); font-family: inherit; font-size: 0.875rem;
  color: var(--text-primary); outline: none; width: 100%; background: var(--surface); cursor: pointer;
  -webkit-appearance: none; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239ea5b5' stroke-width='2.5'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
  transition: border-color .15s, box-shadow .15s;
}
.select-input:focus { border-color: var(--indigo); box-shadow: 0 0 0 3px rgba(91,94,244,.12); }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 500px) { .form-row { grid-template-columns: 1fr; } }

.form-section { border: 1.5px solid var(--border); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 13px; background: #f9f9fc; }
.form-section-title { font-size: 0.67rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--indigo); margin-bottom: 13px; display: flex; align-items: center; gap: 6px; }

.radio-group { display: flex; gap: 7px; flex-wrap: wrap; }
.radio-label {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  cursor: pointer; font-size: 0.8rem; font-weight: 600; color: var(--text-secondary);
  padding: 7px 12px; border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  transition: all .14s; user-select: none; flex: 1; background: var(--surface);
}
.radio-label:has(input:checked) { border-color: var(--indigo); background: var(--indigo-light); color: var(--indigo); }
.radio-label input { display: none; }

.input-placa { font-family: 'Courier New', monospace; font-size: 1rem; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; }

.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--border); }

.btn-modal-cancel { font-family: inherit; font-size: 0.875rem; font-weight: 500; padding: 9px 18px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface); color: var(--text-secondary); cursor: pointer; transition: all .14s; }
.btn-modal-cancel:hover { border-color: var(--text-secondary); color: var(--text-primary); }

.btn-modal-save { font-family: inherit; font-size: 0.875rem; font-weight: 600; padding: 9px 22px; border-radius: var(--radius-sm); border: none; background: var(--indigo); color: white; cursor: pointer; transition: background .14s; }
.btn-modal-save:hover { background: var(--indigo-dark); }

.btn-modal-danger { font-family: inherit; font-size: 0.875rem; font-weight: 600; padding: 9px 22px; border-radius: var(--radius-sm); border: none; background: var(--red); color: white; cursor: pointer; }
.btn-modal-danger:hover { background: #991b1b; }

/* Toasts */
.toast {
  position: fixed; bottom: 22px; right: 20px;
  font-size: 0.83rem; font-weight: 500; padding: 11px 16px;
  border-radius: var(--radius-sm); box-shadow: var(--shadow-md);
  z-index: 200; animation: toast-in .2s ease;
  display: flex; align-items: center; gap: 9px; max-width: 300px;
}
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.toast-ok  { background: var(--green-bg); color: var(--green); border: 1px solid var(--green-border); }
.toast-err { background: var(--red-bg);   color: var(--red);   border: 1px solid var(--red-border); }

/* Dashboard responsive */
@media (max-width: 700px) {
  .dash-page { padding: 0 12px 40px; }
  .dash-header { padding: 12px 0; margin-bottom: 14px; }
  .stats-row { gap: 8px; }
  .stat-card { padding: 12px 14px; }
  .stat-value { font-size: 1.5rem; }
  th, td { padding: 9px 11px; }
}
