/* Consola del proveedor: mismos colores y formas que Infinity Web (tema Infinity), con modo oscuro del sistema. */
:root {
  --bg: #ecf0f5; --surface: #fbfcfd; --surface-alt: #f4f6f9;
  --border: #d6dde6; --border-strong: #b7c2cf;
  --text: #182434; --text-2: #485769; --text-3: #687688;
  --accent: #1c59a0; --accent-hover: #164b8a; --accent-soft: #e1ebf7; --accent-text: #195091;
  --ok-soft: #e4f3d8; --ok-text: #2c6810;
  --warn-soft: #fdf0d9; --warn-text: #875000;
  --bad-soft: #fbe8e6; --bad-text: #ac2418;
  --neutral-soft: #e2e7ee; --neutral-text: #445264;
  --input: #ffffff; --on-accent: #ffffff;
  --velo: rgba(15, 23, 32, .45);
  --shadow: 0 1px 3px rgba(29, 45, 62, .12), 0 4px 16px rgba(29, 45, 62, .06);
  --sombra-suave: 0 1px 2px rgba(15, 27, 45, .06);
  --radius: 8px; --radius-lg: 14px; --control-h: 36px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f141b; --surface: #171e27; --surface-alt: #1d2530;
    --border: #2b3542; --border-strong: #3d4958;
    --text: #e3e8ef; --text-2: #a9b4c2; --text-3: #7f8b9a;
    --accent: #5b9be6; --accent-hover: #74acec; --accent-soft: #1b2b40; --accent-text: #8bbcf2;
    --ok-soft: #1c3121; --ok-text: #8fd19a;
    --warn-soft: #3a2c12; --warn-text: #f0c069;
    --bad-soft: #3d1c1a; --bad-text: #f19a90;
    --neutral-soft: #26303c; --neutral-text: #b6c0cc;
    --input: #121820; --on-accent: #0b1520;
    --velo: rgba(0, 0, 0, .6);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 14px/1.45 "Inter", "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Ubuntu", "Noto Sans", sans-serif;
}
button, input, select { font: inherit; color: inherit; }
.oculto { display: none !important; }

/* ---------- Barra superior ---------- */
.barra {
  display: flex; align-items: center; gap: 16px; padding: 0 20px; height: 56px;
  background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10;
}
.marca { font-weight: 700; font-size: 16px; display: flex; align-items: baseline; gap: 8px; white-space: nowrap; }
.marca .logo { color: var(--accent); font-size: 20px; }
.marca .sub { font-weight: 500; font-size: 13px; color: var(--text-3); }
nav { display: flex; gap: 4px; flex: 1; }
.pestana {
  border: 0; background: none; padding: 8px 12px; border-radius: var(--radius); font-weight: 600; color: var(--text-2); cursor: pointer;
}
.pestana:hover { background: var(--surface-alt); }
.pestana.activa { background: var(--accent-soft); color: var(--accent-text); }
.cuenta { display: flex; align-items: center; gap: 8px; color: var(--text-2); margin-left: auto; white-space: nowrap; }

main { max-width: 1240px; margin: 0 auto; padding: 20px; }

/* ---------- Controles ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: var(--control-h);
  border: 1px solid var(--border-strong); background: var(--surface); padding: 0 14px; border-radius: var(--radius);
  font-weight: 600; cursor: pointer; white-space: nowrap;
}
.btn:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primario { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primario:hover:not(:disabled) { background: var(--accent-hover); color: var(--on-accent); }
.btn.peligro { color: var(--bad-text); }
.btn.peligro:hover:not(:disabled) { border-color: var(--bad-text); background: var(--bad-soft); color: var(--bad-text); }
.btn.enlace { border: 0; background: none; color: var(--accent); padding: 4px 6px; min-height: 0; }
.btn.chico { min-height: 30px; padding: 0 10px; font-size: 13px; }
:is(.btn, .pestana, .tabla tbody tr, input):focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

input[type=text], input[type=password], input[type=number], input[type=date] {
  width: 100%; border: 1px solid var(--border-strong); border-radius: var(--radius); padding: 6px 10px; background: var(--input);
  min-height: var(--control-h);
}
input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.campo { display: grid; gap: 4px; margin-bottom: 12px; }
.campo label { font-size: 13px; color: var(--text-2); font-weight: 600; }
.campo .ayuda { font-size: 12.5px; color: var(--text-3); }

.badge {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; border-radius: 999px; padding: 2px 10px;
  white-space: nowrap;
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.badge.ok { background: var(--ok-soft); color: var(--ok-text); }
.badge.warn { background: var(--warn-soft); color: var(--warn-text); }
.badge.bad { background: var(--bad-soft); color: var(--bad-text); }
.badge.neutral { background: var(--neutral-soft); color: var(--neutral-text); }

/* ---------- Tarjetas y tablas ---------- */
.tarjeta {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 18px 20px; margin-bottom: 16px;
  box-shadow: var(--sombra-suave);
}
.tarjeta h2 { margin: 0; font-size: 18px; letter-spacing: -.01em; }
.tarjeta h3 { margin: 0 0 12px; font-size: 15px; }
.cabeza { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-bottom: 14px; }
.cabeza .flex { flex: 1; }
.datos { display: flex; flex-wrap: wrap; gap: 8px 28px; margin: 4px 0 0; color: var(--text-2); }
.datos b { color: var(--text); font-weight: 600; }

.tabla-wrap { border: 1px solid var(--border); border-radius: var(--radius); overflow: auto; }
.tabla { width: 100%; border-collapse: collapse; }
.tabla th {
  background: var(--surface-alt); text-align: left; font-size: 12px; font-weight: 600; color: var(--text-2);
  text-transform: uppercase; letter-spacing: .04em; padding: 10px 14px; border-bottom: 1px solid var(--border); white-space: nowrap;
}
.tabla td { padding: 9px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.tabla tbody tr:last-child td { border-bottom: 0; }
.tabla.elegible tbody tr { cursor: pointer; }
.tabla.elegible tbody tr:hover { background: var(--surface-alt); }
.tabla tbody tr.sel { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.tabla tr.revocado td { color: var(--text-3); }
.tabla .num { text-align: right; font-variant-numeric: tabular-nums; }
.tabla .acciones { text-align: right; }
.tabla .acciones .btn + .btn { margin-left: 6px; }
.tabla .vacio { text-align: center; color: var(--text-3); padding: 24px; }
.tenue { color: var(--text-3); font-size: 12.5px; }
.columnas { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ---------- Diálogos ---------- */
.velo { position: fixed; inset: 0; background: var(--velo); display: grid; place-items: center; z-index: 100; padding: 16px; }
.dialogo { background: var(--surface); border-radius: 12px; box-shadow: var(--shadow); width: min(460px, 100%); padding: 22px; max-height: calc(100vh - 32px); overflow: auto; }
.dialogo h3 { margin: 0 0 6px; font-size: 17px; }
.dialogo p { margin: 0 0 14px; color: var(--text-2); }
.dialogo .botones { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; }
.codigo {
  font: 600 30px/1.2 "Cascadia Mono", Consolas, ui-monospace, monospace; letter-spacing: .08em; text-align: center;
  padding: 14px; border-radius: var(--radius); background: var(--accent-soft); color: var(--accent-text); margin: 6px 0 10px;
  user-select: all;
}
.opciones { display: grid; gap: 8px; }
.opcion {
  display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--border-strong);
  border-radius: var(--radius); cursor: pointer;
}
.opcion:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.opcion input { margin-top: 3px; accent-color: var(--accent); }
.opcion > span { display: grid; gap: 2px; }
.dialogo .aviso { margin-bottom: 12px; }
.aviso { background: var(--warn-soft); color: var(--warn-text); border-radius: var(--radius); padding: 10px 12px; font-size: 13px; }
.error { color: var(--bad-text); min-height: 1.4em; font-size: 13px; margin-top: 4px; }

/* ---------- Entrada y alta ---------- */
.entrada { max-width: 420px; margin: 8vh auto 0; }
.entrada .qr { display: grid; place-items: center; background: #fff; border-radius: var(--radius); padding: 12px; margin: 8px 0; }
.entrada .qr svg { width: 200px; height: 200px; }
.secreto { font-family: Consolas, ui-monospace, monospace; word-break: break-all; font-size: 13px; }

#toasts { position: fixed; right: 16px; bottom: 16px; display: grid; gap: 8px; z-index: 200; max-width: min(420px, calc(100% - 32px)); }
.toast { background: var(--surface); border-left: 4px solid var(--accent); box-shadow: var(--shadow); border-radius: 6px; padding: 10px 14px; }
.toast.mal { border-left-color: var(--bad-text); }

@media (max-width: 760px) {
  .barra { padding: 0 16px; gap: 6px; }
  .marca .sub, #usuario { display: none; }
  .pestana { padding: 6px 8px; }
  main { padding: 16px; }
  .columnas { grid-template-columns: 1fr; }
  .tarjeta { padding: 16px; }
}
