/* Portal del contribuyente — misma línea gráfica del portal de Canela Soluciones,
   pero pensado para el dueño del negocio: pocas pantallas, letra grande y
   lenguaje llano. Sin barra lateral: pestañas arriba, que se entienden en el
   teléfono. */
:root {
  --canela-celeste: #06ace6;
  --canela-celeste-claro: #e3f6fd;
  --canela-verde: #5fb84b;
  --oscuro: #05293c;
  --oscuro-2: #073349;
  --azul: #0895ce;
  --azul-hover: #067cac;
  --verde: #4a9a38;
  --rojo: #dc2626;
  --naranja: #d97706;
  --fondo: #eff5f8;
  --carta: #ffffff;
  --texto: #0f2733;
  --texto-suave: #5b7280;
  --borde: #dde8ee;
  --radio: 14px;
}
* { box-sizing: border-box; margin: 0; }
body {
  font-family: "Source Sans 3", -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--fondo); color: var(--texto); font-size: 15.5px;
}
h1, h2, h3 { font-family: "Baloo 2", "Source Sans 3", sans-serif; }
[hidden] { display: none !important; }

/* ---------- Acceso ---------- */
#vista-login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px;
  background: linear-gradient(150deg, #05293c 0%, #075a80 55%, #0a83b4 100%); position: relative; overflow: hidden; }
#vista-login::before, #vista-login::after { content: ""; position: absolute; border-radius: 50%; }
#vista-login::before { width: 420px; height: 420px; background: rgba(6,172,230,.18); top: -140px; right: -120px; }
#vista-login::after { width: 340px; height: 340px; background: rgba(95,184,75,.16); bottom: -120px; left: -100px; }
.login-caja { background: var(--carta); border-radius: 18px; padding: 34px; width: 100%; max-width: 410px;
  box-shadow: 0 24px 60px rgba(3,30,44,.5); position: relative; z-index: 1; }
.login-enlace-otro { display: block; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--borde); text-align: center; font-size: 14px; font-weight: 600; color: #2563eb; text-decoration: none; }
.login-enlace-otro:hover { text-decoration: underline; }
.login-logo { display: block; width: 220px; margin: 0 auto 14px; }
.login-caja h1 { font-size: 22px; text-align: center; color: var(--oscuro); }
.login-caja p { color: var(--texto-suave); margin-bottom: 20px; font-size: 13.5px; text-align: center; }
.login-caja label { font-weight: 600; font-size: 13px; display: block; margin: 12px 0 6px; }
.login-caja input { width: 100%; padding: 12px; border: 1px solid var(--borde); border-radius: 10px; font-size: 15px; }
.login-caja input.codigo { text-align: center; letter-spacing: 6px; font-size: 18px; }
.login-caja button { width: 100%; margin-top: 20px; }
.login-error { color: var(--rojo); font-size: 13.5px; margin-top: 12px; min-height: 18px; }
.login-pie { margin-top: 16px !important; font-size: 12.5px; }

/* ---------- Estructura ---------- */
header.topbar { background: var(--oscuro); color: #fff; display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 12px 20px; border-bottom: 3px solid var(--canela-celeste); flex-wrap: wrap; }
.topbar .marca { display: flex; align-items: center; gap: 10px; font-family: "Baloo 2", sans-serif; }
.topbar .marca img { height: 32px; display: block; }
.topbar .marca .sufijo { color: var(--canela-celeste); font-weight: 600; font-size: 15px; }
.topbar-derecha { display: flex; align-items: center; gap: 12px; }
.cliente-chip { text-align: right; font-size: 13px; line-height: 1.35; }
.cliente-chip b { display: block; font-size: 14px; }
.cliente-chip small { color: #8fb3c5; }
.btn-salir { background: transparent; color: #fff; border: 1px solid rgba(255,255,255,.35); border-radius: 10px;
  padding: 7px 16px; font-weight: 600; cursor: pointer; font-family: inherit; }
.btn-salir:hover { background: rgba(255,255,255,.1); }

nav.tabs { background: var(--oscuro-2); display: flex; gap: 4px; padding: 0 14px; overflow-x: auto; }
nav.tabs .tab { color: #c6dbe6; text-decoration: none; padding: 13px 16px; font-weight: 600; font-size: 14.5px;
  white-space: nowrap; border-bottom: 3px solid transparent; }
nav.tabs .tab:hover { color: #fff; }
nav.tabs .tab.activo { color: #fff; border-bottom-color: var(--canela-celeste); background: rgba(6,172,230,.12); }

main.contenido { max-width: 1180px; margin: 0 auto; padding: 24px 18px 40px; min-height: 60vh; }
.pie { max-width: 1180px; margin: 0 auto; padding: 0 18px 34px; color: var(--texto-suave); font-size: 12.5px; }
.encabezado { margin-bottom: 18px; }
.encabezado h2 { font-size: 24px; font-weight: 800; }
.encabezado p { color: var(--texto-suave); font-size: 13.5px; margin-top: 2px; }

/* ---------- Tarjetas ---------- */
.tarjetas { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 20px; }
.tarjeta { border-radius: var(--radio); padding: 16px 18px; background: var(--carta);
  box-shadow: 0 1px 3px rgba(15,23,42,.07); position: relative; overflow: hidden; }
.tarjeta small { font-size: 11.5px; font-weight: 700; letter-spacing: .8px; color: var(--texto-suave); text-transform: uppercase; }
.tarjeta .valor { font-size: 30px; font-weight: 800; margin-top: 4px; line-height: 1.15; }
.tarjeta .pie-tarjeta { font-size: 12.5px; color: var(--texto-suave); margin-top: 4px; }
.tarjeta.color { color: #fff; }
.tarjeta.color small, .tarjeta.color .pie-tarjeta { color: rgba(255,255,255,.85); }
.tarjeta.color::after { content: ""; position: absolute; right: -30px; top: -35px; width: 130px; height: 130px;
  background: rgba(255,255,255,.14); border-radius: 50%; }
.tarjeta.azul { background: linear-gradient(135deg, #06ace6, #067097); }
.tarjeta.verde { background: linear-gradient(135deg, #5fb84b, #3c8a2c); }
.tarjeta.rojo { background: linear-gradient(135deg, #dc2626, #b91c1c); }
.tarjeta.naranja { background: linear-gradient(135deg, #ea8b0c, #c2620b); }

/* ---------- Paneles y tablas ---------- */
.panel { background: var(--carta); border-radius: var(--radio); box-shadow: 0 1px 3px rgba(15,23,42,.07);
  padding: 18px 20px; margin-bottom: 20px; }
.panel-titulo { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.panel-titulo h3 { font-size: 16.5px; }
.panel-titulo .meta { color: var(--texto-suave); font-size: 12.5px; }
table.tabla { width: 100%; border-collapse: collapse; font-size: 14px; }
table.tabla thead th { background: var(--oscuro-2); color: #fff; text-align: left; padding: 10px 12px; font-size: 12.5px; }
table.tabla thead th:first-child { border-radius: 8px 0 0 8px; }
table.tabla thead th:last-child { border-radius: 0 8px 8px 0; }
table.tabla tbody td { padding: 10px 12px; border-bottom: 1px solid var(--borde); vertical-align: middle; }
table.tabla tbody tr:hover { background: #f8fafc; }
table.tabla tbody tr.atencion { background: #fff7f7; }
.tabla-scroll { overflow-x: auto; }
.monto { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
th.monto { text-align: right; }
/* Campos dentro de una tabla (precio y cantidad de «Registrar compra»): mismo aspecto
   que los filtros; las cifras van a la derecha como en los reportes, y lo que no sea
   un número se marca en rojo */
table.tabla input:not([type="checkbox"]) { padding: 8px 10px; border: 1px solid var(--borde);
  border-radius: 8px; font-size: 14px; font-family: inherit; color: inherit; background: #fff; }
table.tabla input.monto { text-align: right; }
table.tabla input.invalido { border-color: var(--rojo); background: #fff5f5; }

/* ---------- Filtros y botones ---------- */
.filtros { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.campo { display: flex; flex-direction: column; gap: 5px; min-width: 145px; }
.campo.crece { flex: 1; min-width: 220px; }
.campo label { font-weight: 700; font-size: 12.5px; }
.campo input, .campo select { padding: 10px 12px; border: 1px solid var(--borde); border-radius: 10px;
  font-size: 14px; background: #fff; font-family: inherit; color: inherit; }
.boton { background: var(--azul); border: none; color: #fff; font-weight: 700; padding: 11px 20px;
  border-radius: 10px; cursor: pointer; font-size: 14.5px; font-family: inherit; text-decoration: none; display: inline-block; }
.boton:hover { background: var(--azul-hover); }
.boton:disabled { opacity: .55; cursor: default; }
.boton.secundario { background: #fff; color: var(--azul); border: 1px solid var(--azul); }
.boton.secundario:hover { background: var(--canela-celeste-claro); }
.boton.verde { background: var(--verde); }
.boton.rojo { background: var(--rojo); }
.boton.mini { padding: 6px 11px; font-size: 12.5px; border-radius: 8px; }
.acciones-fila { white-space: nowrap; }
/* Reporte IT-1: fila de totales y cifras negativas (notas de crédito) */
table.tabla tr.total td { font-weight: 800; border-top: 2px solid var(--oscuro-2); background: #f8fafc; }
table.tabla td.negativo { color: #b91c1c; }
/* Enlace a otro comprobante (la sustituta / la sustituida) */
.enlace-ver { color: #075a80; text-decoration: underline; cursor: pointer; }
.acciones-fila .boton + .boton { margin-left: 5px; }

/* ---------- Avisos y estados ---------- */
/* Registrar compra: los tres tipos como opciones grandes */
.opciones-tipo { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.opcion-tipo { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; border: 2px solid #e2e8f0;
  border-radius: 10px; cursor: pointer; }
.opcion-tipo input { margin: 0 0 4px; }
.opcion-tipo small { color: var(--texto-suave); font-size: 12.5px; }
.opcion-tipo:has(input:checked) { border-color: #06ace6; background: var(--canela-celeste-claro); }
.aviso { border-radius: 10px; padding: 13px 16px; font-size: 14px; margin-bottom: 14px; }
.aviso.ok { background: #e2f4dc; color: #2f7222; }
.aviso.info { background: var(--canela-celeste-claro); color: #075a80; }
.aviso.alerta { background: #fef3c7; color: #92400e; }
.aviso.error { background: #fee2e2; color: #991b1b; }
.badge { display: inline-block; border-radius: 999px; padding: 4px 11px; font-size: 11.5px; font-weight: 700;
  letter-spacing: .3px; background: #e2e8f0; color: #334155; text-transform: uppercase; white-space: nowrap; }
.badge.verde { background: #e2f4dc; color: #2f7222; }
.badge.rojo { background: #fee2e2; color: #991b1b; }
.badge.amarillo { background: #fef3c7; color: #92400e; }
.badge.azul { background: var(--canela-celeste-claro); color: #067cac; }
.badge.gris { background: #cbd5e1; color: #334155; }
.nota { font-size: 12.5px; color: var(--texto-suave); }
.vacio { text-align: center; color: var(--texto-suave); padding: 26px 10px; }

/* ---------- Modal (detalle del comprobante) ---------- */
.modal-fondo { position: fixed; inset: 0; background: rgba(2,6,23,.55); z-index: 40; display: flex;
  align-items: flex-start; justify-content: center; padding: 40px 14px; }
.modal { background: #fff; border-radius: 16px; width: 100%; max-width: 680px; padding: 24px 26px;
  box-shadow: 0 30px 80px rgba(2,6,23,.4); max-height: calc(100vh - 80px); overflow-y: auto; }
.modal h3 { font-size: 19px; margin-bottom: 16px; display: flex; justify-content: space-between; gap: 10px; }
.modal h3 .cerrar-x { cursor: pointer; color: var(--texto-suave); font-weight: 400; }
.modal .acciones { display: flex; justify-content: flex-end; gap: 9px; margin-top: 20px; flex-wrap: wrap; }
.kv { border: 1px solid var(--borde); border-radius: 10px; }
.kv div { display: flex; justify-content: space-between; gap: 14px; padding: 10px 14px; border-bottom: 1px solid var(--borde); font-size: 14px; }
.kv div:last-child { border-bottom: none; }
.kv b { text-align: right; }

/* ---------- 2FA ---------- */
.qr-2fa { text-align: center; margin: 14px 0; }
.qr-2fa img { border: 1px solid var(--borde); border-radius: 12px; }
.pasos-2fa { margin: 0 0 14px 20px; line-height: 1.7; }

#toast { position: fixed; bottom: 22px; right: 22px; z-index: 60; background: var(--oscuro); color: #fff;
  padding: 13px 18px; border-radius: 12px; font-size: 14px; display: none; max-width: 420px;
  box-shadow: 0 16px 40px rgba(2,6,23,.4); }

@media (max-width: 640px) {
  .topbar { flex-direction: column; align-items: flex-start; }
  .topbar-derecha { width: 100%; justify-content: space-between; }
  .cliente-chip { text-align: left; }
  main.contenido { padding: 18px 12px 30px; }
  .tarjeta .valor { font-size: 26px; }
}
