/* Factutek · Marco de la aplicación (etapa 1.6): encabezado con la pastilla del punto, menú lateral retráctil (abajo en el
   celular), ingreso con la Cuenta Contitek, avisos y ventanas. Sistema de diseño de Contitek: azul #164684, noche #0F2C5C,
   turquesa #4EC7E8, dorado #F6C94C solo de acento; Inter e IBM Plex Mono.
   © 2026 Rody Velez Mendoza. Uso exclusivo con licencia. */
:root {
  --azul: #164684; --azul2: #1b5fa7; --noche: #0f2c5c; --turquesa: #4ec7e8; --dorado: #f6c94c;
  --tinta: #0f2440; --tinta2: #3d4d63; --gris: #5a6b82; --gris2: #8a99ad; --borde: #dde7f2; --borde2: #c9d7e8; --linea: #edf2f8;
  --suave: #eef3f9; --fondo: #f3f7fb; --panel: #e9eef5;
  --ok: #1f9a4c; --ok-t: #14643a; --ok-f: #e7f7ee; --mal: #b42318; --mal-f: #fdecea;
  --esp: #b54708; --esp-t: #5c3a12; --esp-f: #fff8ef; --esp-b: #f3d3a8; --sri-f: #fff8e1; --sri-b: #f3e2a6; --sri-t: #5c4a12;
  --radio: 12px; --sombra: 0 20px 60px rgba(6, 22, 51, .28); --sombra2: 0 4px 14px rgba(15, 44, 92, .10);
  --menu: 56px; --menu-abierto: 208px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: Inter, "Segoe UI", system-ui, sans-serif; color: var(--tinta); background: var(--fondo); -webkit-font-smoothing: antialiased; font-size: 14px; display: flex; flex-direction: column; }
.mono { font-family: "IBM Plex Mono", Consolas, monospace; font-size: 12.5px; }
[hidden] { display: none !important; }
a { color: var(--azul); }
a:hover { color: var(--noche); }
button { font: inherit; }
:focus-visible { outline: 2px solid var(--azul2); outline-offset: 2px; }

/* ---------- Encabezado ---------- */
.barra { height: 52px; flex: none; background: var(--azul); border-bottom: 2px solid var(--turquesa); display: flex; align-items: center; justify-content: space-between; padding: 0 20px 0 14px; position: sticky; top: 0; z-index: 40; }
.marca { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-size: 18px; font-weight: 800; letter-spacing: -.01em; }
.marca:hover { color: #fff; }
.barra-der { display: flex; align-items: center; gap: 12px; position: relative; }
.caja-menu { position: relative; }
.pastilla { height: 32px; display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 600; color: #fff; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.35); border-radius: 999px; padding: 0 14px; cursor: pointer; max-width: 46vw; }
.pastilla:hover { background: rgba(255,255,255,.16); }
.pastilla .nombre { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pastilla .mono { color: #7fdcf5; white-space: nowrap; }
.pastilla .flecha { color: #a9cdec; }
.etiqueta-amb { font-size: 11px; font-weight: 700; color: var(--noche); background: var(--turquesa); border-radius: 999px; padding: 3px 10px; letter-spacing: .03em; }
.etiqueta-amb.prod { background: var(--dorado); color: #3d2e00; }
.btn-emitir-barra { height: 32px; padding: 0 14px; border-radius: 9px; border: 1px solid rgba(255,255,255,.55); background: #fff; color: var(--azul); font-size: 12.5px; font-weight: 700; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
.btn-emitir-barra:hover { background: #eaf3fc; color: var(--noche); }
.avatar { width: 32px; height: 32px; border-radius: 50%; border: 1px solid rgba(255,255,255,.5); background: var(--noche); color: #fff; font-size: 12px; font-weight: 700; cursor: pointer; }
.menu { position: absolute; top: 40px; right: 0; min-width: 260px; max-height: 70vh; overflow: auto; background: #fff; border: 1px solid var(--borde); border-radius: var(--radio); box-shadow: var(--sombra); padding: 6px; z-index: 50; }
.menu button { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; text-align: left; font-size: 13px; color: var(--tinta); background: none; border: 0; border-radius: 9px; padding: 9px 10px; cursor: pointer; }
.menu button:hover, .menu button:focus-visible { background: var(--suave); outline: none; }
.menu button.activo { color: var(--azul); font-weight: 700; }
.menu button .mono { color: var(--azul2); font-weight: 600; }
.menu button small { display: block; color: var(--gris); font-size: 11.5px; font-weight: 500; }
.menu .titulo-menu { font-size: 11px; font-weight: 700; letter-spacing: .08em; color: var(--gris); padding: 8px 10px 4px; }
.menu .separa { border-top: 1px solid var(--borde); margin: 6px 4px; }
.menu-correo { font-size: 12px; color: var(--gris); padding: 8px 10px 6px; }

/* ---------- Menú lateral (retráctil) ---------- */
.marco { flex: 1; display: flex; min-height: 0; }
.lateral { width: var(--menu); flex: none; background: #fff; border-right: 1px solid var(--borde); display: flex; flex-direction: column; gap: 4px; padding: 8px; position: sticky; top: 54px; height: calc(100vh - 54px); transition: width .18s ease; z-index: 30; overflow: hidden; }
.lateral.abierto { width: var(--menu-abierto); }
.lateral .opc { height: 40px; min-width: 40px; border: 0; border-radius: 9px; background: transparent; color: var(--gris); display: flex; align-items: center; gap: 12px; padding: 0 9px; text-decoration: none; font-size: 13.5px; font-weight: 600; white-space: nowrap; cursor: pointer; }
.lateral .opc svg { flex: none; }
.lateral .opc span { opacity: 0; transition: opacity .12s; }
.lateral.abierto .opc span { opacity: 1; }
.lateral .opc:hover { background: var(--suave); color: var(--azul); }
.lateral .opc.activo { background: var(--suave); color: var(--azul); }
.lateral .alternar { margin-bottom: 6px; }
.contenido { flex: 1; min-width: 0; padding: 16px 20px 28px; }

/* ---------- Componentes ---------- */
h1 { margin: 0; font-size: 24px; font-weight: 800; letter-spacing: -.02em; }
h2 { margin: 0; font-size: 15px; font-weight: 700; }
.sub { color: var(--gris); margin: 6px 0 18px; line-height: 1.5; }
.card { background: #fff; border: 1px solid var(--borde); border-radius: var(--radio); padding: 16px; }
.lbl { font-size: 12px; font-weight: 600; color: var(--gris); }
.campo { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.inp { height: 34px; border: 1px solid var(--borde); border-radius: 9px; padding: 0 10px; font: inherit; font-size: 13.5px; color: var(--tinta); background: #fff; width: 100%; transition: border-color .15s, box-shadow .15s; }
select.inp { padding-right: 6px; }
.inp:focus { outline: none; border-color: var(--azul); box-shadow: 0 0 0 3px rgba(22, 70, 132, .14); }
.inp[readonly] { background: var(--fondo); }
.inp[aria-invalid="true"] { border-color: #c4473a; box-shadow: 0 0 0 3px rgba(196, 71, 58, .12); }
.inp.num { text-align: right; font-variant-numeric: tabular-nums; }
.inp.codigo { font-size: 20px; letter-spacing: .4em; text-align: center; height: 44px; font-family: "IBM Plex Mono", Consolas, monospace; }
.btn { height: 36px; padding: 0 18px; border-radius: 9px; font-size: 13px; font-weight: 700; cursor: pointer; border: 1px solid transparent; display: inline-flex; align-items: center; justify-content: center; gap: 8px; white-space: nowrap; text-decoration: none; transition: background .15s, transform .05s; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-prim { background: var(--azul); color: #fff; }
.btn-prim:hover { background: #12396b; color: #fff; }
.btn-noche { background: var(--noche); color: #fff; }
.btn-noche:hover { background: #0a2147; color: #fff; }
.btn-noche:disabled { background: var(--borde2); color: var(--tinta2); opacity: 1; }
.btn-sec { background: #fff; color: var(--azul); border-color: var(--borde); }
.btn-sec:hover { background: var(--suave); }
.btn-wa { background: #fff; color: var(--tinta); border-color: var(--borde); }
.btn-wa svg { color: #1f9a4c; }
.btn-texto { background: none; border: 0; color: var(--gris); font-size: 13px; font-weight: 600; cursor: pointer; padding: 6px 2px; text-decoration: none; }
.btn-texto:hover { color: var(--azul); }
.btn-texto.rojo { color: var(--mal); }
.enlace { background: none; border: 0; padding: 0; color: var(--azul); font-size: 12.5px; font-weight: 600; cursor: pointer; }
.enlace:hover { text-decoration: underline; }
.con-pegar { display: flex; gap: 8px; }
.btn-pegar { height: 44px; padding: 0 14px; border-radius: 9px; border: 1px solid var(--borde); background: #fff; color: var(--azul); font-size: 13px; font-weight: 700; cursor: pointer; }
.btn-pegar:hover { background: var(--suave); }
.aviso-sri { min-height: 30px; display: flex; align-items: center; gap: 8px; padding: 6px 12px; background: var(--sri-f); border: 1px solid var(--sri-b); border-radius: 9px; font-size: 12.5px; color: var(--sri-t); }

/* ---------- Pantalla de estado (nada básico) ---------- */
.estado-pantalla { max-width: 560px; margin: 48px auto; background: #fff; border: 1px solid var(--borde); border-radius: 14px; overflow: hidden; }
.estado-pantalla .franja { height: 88px; background: var(--azul); position: relative; overflow: hidden; }
.estado-pantalla .franja::before { content: ""; position: absolute; inset: 0; background-image: linear-gradient(rgba(255,255,255,.07) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.07) 1px, transparent 1px); background-size: 28px 28px; }
.estado-pantalla .franja::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: var(--turquesa); }
.estado-pantalla .icono { width: 64px; height: 64px; margin: -32px auto 0; position: relative; border-radius: 50%; background: #fff; border: 1px solid var(--borde); display: flex; align-items: center; justify-content: center; color: var(--azul); }
.estado-pantalla .cuerpo { padding: 14px 32px 30px; text-align: center; display: flex; flex-direction: column; gap: 10px; align-items: center; }
.estado-pantalla h2 { font-size: 20px; font-weight: 800; }
.estado-pantalla p { margin: 0; color: var(--tinta2); line-height: 1.55; font-size: 13.5px; }

/* ---------- Ingreso ---------- */
.entrar { max-width: 400px; margin: 9vh auto 0; background: #fff; border: 1px solid var(--borde); border-radius: 14px; padding: 32px; text-align: center; }
.entrar img { display: block; margin: 0 auto 14px; }
.entrar form { display: flex; flex-direction: column; gap: 14px; text-align: left; }
.entrar .btn { height: 42px; }
.pie-entrar { text-align: center; font-size: 12px; color: var(--gris); margin-top: 18px; }

/* ---------- Avisos y ventanas ---------- */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--noche); color: #fff; border-radius: 10px; padding: 12px 18px; font-size: 13px; font-weight: 600; box-shadow: var(--sombra); z-index: 100; max-width: min(560px, calc(100vw - 32px)); }
.toast.mal { background: #7a1d14; }
.toast ul { margin: 6px 0 0; padding-left: 18px; font-weight: 500; }
.modal { border: 0; border-radius: 14px; padding: 0; width: min(460px, calc(100vw - 24px)); box-shadow: var(--sombra); color: var(--tinta); }
.modal::backdrop { background: rgba(6, 22, 51, .45); }
.modal .modal-cab { background: var(--azul); color: #fff; padding: 16px 22px; border-bottom: 2px solid var(--turquesa); }
.modal .modal-cab h2 { font-size: 16px; }
.modal .modal-cuerpo { padding: 18px 22px; display: flex; flex-direction: column; gap: 12px; }
.modal .modal-cuerpo p { margin: 0; color: var(--tinta2); line-height: 1.5; }
.modal .modal-pie { display: flex; justify-content: flex-end; gap: 10px; padding: 0 22px 18px; }
.modal .modal-pie .btn { min-width: 128px; }
.archivo { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.archivo input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.archivo-nombre { font-size: 12.5px; color: var(--gris); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Celular: pestañas abajo ---------- */
@media (max-width: 760px) {
  .barra { padding: 0 12px; }
  .marca span { display: none; }
  .btn-emitir-barra { display: none; }
  .pastilla { max-width: 52vw; }
  .lateral, .lateral.abierto { position: fixed; top: auto; bottom: 0; left: 0; right: 0; width: auto; height: 64px; flex-direction: row; justify-content: space-around; border-right: 0; border-top: 1px solid var(--borde); padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); }
  .lateral .alternar { display: none; }
  .lateral .opc { flex-direction: column; justify-content: center; gap: 2px; height: 52px; min-width: 64px; font-size: 11px; padding: 0 6px; }
  .lateral .opc span { opacity: 1; }
  .contenido { padding: 12px 12px 92px; }
  .inp, .btn, select.inp { min-height: 40px; }
  .entrar { margin: 0; border: 0; border-radius: 0; min-height: calc(100vh - 54px); padding-top: 48px; }
}
.fila-lbl { display: flex; justify-content: space-between; align-items: center; }
