:root {
  --bg: #f5f4f2;
  --panel: #ffffff;
  --ink: #1e1e24;
  --muted: #5f5d66;
  --line: #e4e1dc;
  --line-soft: #f0eeea;
  --brand: #f05b08;
  --brand-dark: #c44606;
  --brand-ink: #ffffff;
  --brand-soft: #fdebe0;
  --brand-hover: #fdf3ec;   /* fila o enlace bajo el mouse: mas suave que --brand-soft */
  --brand-line: #f7c3a3;    /* borde de lo que va sobre --brand-soft */
  --brand-off: #f7b48c;     /* boton de color deshabilitado */
  --brand-rgb: 240, 91, 8;  /* --brand para sombras y halos: rgba(var(--brand-rgb), .3) */
  --brand-text: var(--brand); /* el color de marca como letra o contorno sobre blanco (un color claro lo oscurece) */
  --sel: #fcd9c3;
  --ok: #1f7a4a;
  --ok-soft: #e1f3e8;
  --err: #b42318;
  --err-soft: #fde8e6;
  --warn: #9a6700;
  --mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  font-size: 14px;
  color: var(--ink);
}
/* Color del sistema que escoge cada negocio (Opciones -> Color, db_modules/colores.py; base.html pone data-color en
   <html>). Solo cambian los tonos de la marca: el resto de la paleta es la misma. El celeste tiene el mismo contraste
   con la letra blanca que el naranja (3,3) y su oscuro el de los enlaces (5,1); el rosado, 3,5 y 5,6 */
:root[data-color="celeste"] {
  --brand: #0496d4;
  --brand-dark: #0774b0;
  --brand-soft: #e2f3fc;
  --brand-hover: #eef8fd;
  --brand-line: #a6d6f2;
  --brand-off: #8ccbeb;
  --brand-rgb: 4, 150, 212;
  --sel: #c4e6f8;
}
:root[data-color="rosado"] {
  --brand: #ec4899;
  --brand-dark: #c02670;
  --brand-soft: #fde7f2;
  --brand-hover: #fef2f8;
  --brand-line: #f6b8d6;
  --brand-off: #f5a3cb;
  --brand-rgb: 236, 72, 153;
  --sel: #fbcfe5;
}
/* Morado (entre lila y morado): aguanta la letra blanca mejor que los otros (4,2); enlaces 7,1 */
:root[data-color="morado"] {
  --brand: #8b5cf6;
  --brand-dark: #6d28d9;
  --brand-soft: #f1ebfe;
  --brand-hover: #f8f5ff;
  --brand-line: #d4c4fb;
  --brand-off: #c4b0fa;
  --brand-rgb: 139, 92, 246;
  --sel: #e2d6fd;
}
/* Rosa pastel: claro, no aguanta letra blanca encima (1,9) ni sirve de letra sobre blanco. Encima lleva letra oscura
   (--brand-ink, 6,7) y como letra o contorno, un rosa mas fuerte (--brand-text, 4,7) */
:root[data-color="rosa_pastel"] {
  --brand: #f4a7c4;
  --brand-dark: #a8326a;
  --brand-ink: #5c1a3c;
  --brand-text: #c2457e;
  --brand-soft: #fdeef4;
  --brand-hover: #fef6f9;
  --brand-line: #f8c6d9;
  --brand-off: #f9d0df;
  --brand-rgb: 244, 167, 196;
  --sel: #fbd6e4;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); }
/* El naranja de fondo (--brand) no alcanza el contraste para letra pequena sobre blanco: los enlaces van en el oscuro */
a { color: var(--brand-dark); }
.muted { color: var(--muted); }
.num { text-align: right; font-variant-numeric: tabular-nums; }

/* Barra superior: la paleta de fiushPOS (naranja) pero sobre blanco en vez de oscuro */
.topbar {
  display: flex; align-items: center; gap: 20px; height: 42px; padding: 0 14px;
  background: var(--panel); color: var(--ink); border-bottom: 1px solid var(--line); box-shadow: inset 0 3px 0 var(--brand);
}
.topbar .brand { color: var(--brand-text); font-weight: 800; text-decoration: none; letter-spacing: .5px; }
.topbar nav { display: flex; gap: 2px; }
.topbar nav a { color: inherit; text-decoration: none; padding: 6px 12px; border-radius: 4px; opacity: .8; }
.topbar nav a:hover { background: var(--line-soft); opacity: 1; }
.topbar nav a.on { background: var(--brand-soft); color: var(--brand-dark); font-weight: 600; opacity: 1; }
.topbar .who { margin-left: auto; display: flex; align-items: center; gap: 8px; font-size: 13px; }
.topbar .who form { margin: 0; }
.topbar .sep { opacity: .6; }

/* "Opciones" de la barra: lleva a la vista de pestanas (modules/opciones) */
.topbar .who a.opciones { color: inherit; text-decoration: none; padding: 6px 12px; border-radius: 4px; opacity: .8; }
.topbar .who a.opciones:hover { background: var(--line-soft); opacity: 1; }
.topbar .who a.opciones.on { background: var(--brand-soft); color: var(--brand-dark); font-weight: 600; opacity: 1; }
button.link { background: none; border: 0; color: inherit; text-decoration: underline; cursor: pointer; font: inherit; }

/* ---------- Celular: barra de arriba compacta y menu abajo, como una app (PWA, modules/pwa) ---------- */
.barra-movil { display: none; }
@media (max-width: 760px) {
  .topbar { gap: 10px; padding: 0 12px; padding-top: env(safe-area-inset-top); height: calc(46px + env(safe-area-inset-top)); }
  .topbar nav, .topbar .who > span, .topbar .who > form, .topbar .who > a.opciones, .topbar .pantalla-completa { display: none; }
  .topbar .who { gap: 6px; }
  body:has(.barra-movil) { padding-bottom: calc(62px + env(safe-area-inset-bottom)); }
  .barra-movil {
    display: grid; grid-template-columns: repeat(4, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
    background: var(--panel); border-top: 1px solid var(--line); box-shadow: 0 -4px 14px rgba(0,0,0,.06);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .barra-movil > a, .barra-movil summary {
    display: grid; justify-items: center; gap: 2px; padding: 8px 0 7px; font-size: 11.5px; color: var(--muted);
    text-decoration: none; list-style: none; cursor: pointer; -webkit-tap-highlight-color: transparent;
  }
  .barra-movil summary::-webkit-details-marker { display: none; }
  .barra-movil svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
  .barra-movil svg circle { fill: currentColor; stroke: none; }
  .barra-movil > a.on, .barra-movil-mas[open] summary { color: var(--brand-text); font-weight: 600; }
  .barra-movil-menu {
    position: absolute; right: 8px; bottom: calc(100% + 8px); min-width: 220px; background: var(--panel);
    border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,.18); padding: 6px; display: grid;
  }
  .barra-movil-menu a, .barra-movil-menu button {
    display: block; padding: 12px 14px; border-radius: 8px; color: var(--ink); text-decoration: none; font: inherit;
    font-size: 15px; background: none; border: 0; text-align: left; width: 100%;
  }
  .barra-movil-menu a:active, .barra-movil-menu button:active { background: var(--line-soft); }
  .barra-movil-menu form { margin: 0; border-top: 1px solid var(--line-soft); }
  .barra-movil-menu button { color: var(--err); }
  .barra-movil-quien { display: grid; padding: 8px 14px 10px; border-bottom: 1px solid var(--line-soft); font-size: 13px; }
  .barra-movil-quien span { color: var(--muted); }
  .flashes { top: auto; bottom: calc(72px + env(safe-area-inset-bottom)); left: 12px; right: 12px; }
}

/* Mensajes */
.flashes { position: fixed; top: 50px; right: 14px; z-index: 50; display: grid; gap: 6px; }
.flash { padding: 10px 14px; border-radius: 6px; background: var(--panel); border: 1px solid var(--line); box-shadow: 0 4px 14px rgba(0,0,0,.08); }
.flash.error { background: var(--err-soft); border-color: #f4b8b1; color: var(--err); }
.flash.ok { background: var(--ok-soft); border-color: #a9dcbd; color: var(--ok); }

/* Controles */
input, select, textarea {
  font: inherit; color: inherit; background: #fff; border: 1px solid var(--line);
  border-radius: 4px; padding: 6px 8px; min-width: 0;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand-text); outline-offset: -1px; border-color: var(--brand); }
label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
.btn {
  font: inherit; border: 1px solid var(--line); background: #fff; color: var(--ink);
  border-radius: 4px; padding: 7px 14px; cursor: pointer; text-decoration: none; display: inline-block;
}
.btn:hover { background: #f8f6f3; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); font-weight: 600; }
.btn.primary:hover { filter: brightness(1.07); }
.btn.danger { color: var(--err); border-color: #f4b8b1; }
.btn.danger-solid { background: var(--err); border-color: var(--err); color: #fff; font-weight: 600; }
.btn.danger-solid:hover { filter: brightness(1.08); background: var(--err); }
.advertencia { background: var(--err-soft); border: 1px solid #f4b8b1; color: var(--err); border-radius: 6px; padding: 10px 12px; font-size: 14px; }
.btn:disabled { opacity: .5; cursor: default; }
kbd { font-family: var(--mono); font-size: 11px; padding: 1px 4px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 3px; background: #fff; color: var(--muted); }

/* Login */
/* Fondo: la pantalla de venta ya desenfocada en el archivo (no hace falta filter: blur en el navegador).
   El velo oscuro hace que la tarjeta blanca no se pierda sobre una imagen casi toda blanca. */
/* min-height (no height): con alto fijo, una tarjeta mas alta que la pantalla (registro en celular) se
   sale por arriba al centrarla y esa parte no se puede desplazar */
.login-page {
  display: grid; place-items: center; padding: 16px; height: auto; min-height: 100%;
  background: linear-gradient(rgba(23, 23, 27, .5), rgba(23, 23, 27, .5)),
              url("../auth/fondo-login.jpg") center / cover no-repeat, var(--bg);
}
.login-card { width: min(360px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 28px; display: grid; gap: 14px;
              box-shadow: 0 20px 50px rgba(10, 20, 40, .35); }
.login-negocio { margin: -6px 0 2px; font-size: 17px; font-weight: 600; color: var(--ink); }
.login-nota { margin: 0; font-size: 12.5px; }
.login-pie { display: flex; justify-content: space-between; align-items: center; gap: 12px; font-size: 13px; }
.login-pie .link { font-size: 13px; color: var(--muted); }
.topbar .licencia-dias { background: var(--brand-soft); color: var(--brand-dark); text-decoration: none; font-weight: 600;
                         padding: 3px 10px; border-radius: 999px; font-size: 12.5px; }
.topbar .licencia-dias:hover { background: var(--sel); }
.topbar .licencia-dias.aviso { background: #fff3cd; color: #7a5600; }
.topbar .pantalla-completa { background: transparent; color: inherit; border: 1px solid var(--line); cursor: pointer;
                             padding: 3px 10px; border-radius: 999px; font: inherit; font-size: 12.5px; }
.topbar .pantalla-completa:hover, .topbar .pantalla-completa.on { background: var(--line-soft); }
.topbar .pantalla-completa[hidden] { display: none; }
.login-card h1 { margin: 0; color: var(--brand-text); }
.login-card p { margin: -8px 0 4px; font-size: 13px; }
/* Primer ingreso de un ADMIN: escanear su QR de Google Authenticator (y el que se le muestra al crearlo) */
.login-configurar { width: min(420px, 100%); }
.login-pasos { margin: 0; padding-left: 18px; display: grid; gap: 8px; font-size: 13px; line-height: 1.45; }
.login-qr svg, .qr-admin svg { display: block; width: 180px; height: 180px; margin: 8px auto; background: #fff; }
.login-pasos code, .qr-admin code { font-size: 12px; word-break: break-all; }

/* Paginas de administracion */
.page { max-width: 1200px; margin: 0 auto; padding: 18px 16px 40px; }
.page h1 { font-size: 20px; margin: 0 0 14px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; margin-bottom: 12px; }
.toolbar .grow { flex: 1; min-width: 200px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 16px; }
.table-wrap { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; }
table.data th, table.data td { padding: 7px 10px; border-bottom: 1px solid var(--line-soft); text-align: left; white-space: nowrap; }
table.data th { background: #f8f7f5; font-weight: 600; font-size: 13px; color: var(--muted); position: sticky; top: 0; }
table.data tr.anulado td { color: var(--muted); text-decoration: line-through; }
table.data td.wrap { white-space: normal; }
table.data th.num, table.data td.num { text-align: right; }   /* .num sola pierde contra el left de arriba */
.tag { display: inline-block; font-size: 11px; padding: 1px 6px; border-radius: 10px; background: var(--line-soft); color: var(--muted); }
.tag.err { background: var(--err-soft); color: var(--err); }
.tag.warn { background: #fff4d6; color: var(--warn); }
.tag.ok { background: var(--ok-soft); color: var(--ok); }
.pager { display: flex; gap: 8px; align-items: center; margin-top: 10px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px 16px; }
.form-grid .span2 { grid-column: span 2; }
.form-grid { align-items: start; }   /* un campo mas alto no estira los demas de la fila */
/* minmax(0,1fr): sin esto la lista toma el ancho de su opcion mas larga y se sale de la columna */
.dep-campo { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; align-content: start; min-width: 0; }
.dep-campo label { grid-template-columns: minmax(0, 1fr); }
.dep-campo label select { width: 100%; min-width: 0; }
.dep-nuevo { display: flex; gap: 6px; }
.dep-nuevo input { flex: 1; min-width: 0; }
.dep-nuevo .btn { padding: 6px 10px; }
/* Campo de clave con ojito para mostrar/ocultar (data-ver-clave en utils.js) */
.pass-field { position: relative; display: block; }
.pass-field input { width: 100%; padding-right: 30px; }
.pass-toggle {
  position: absolute; right: 2px; top: 50%; transform: translateY(-50%); display: flex;
  border: 0; background: none; padding: 4px; margin: 0; cursor: pointer; color: var(--muted); border-radius: 4px;
}
.pass-toggle:hover { color: var(--ink); background: var(--line-soft); }
.pass-toggle .i-ojo-cerrado { display: none; }
.pass-toggle.on .i-ojo { display: none; }
.pass-toggle.on .i-ojo-cerrado { display: block; }
.checks { display: flex; flex-wrap: wrap; gap: 18px; margin: 14px 0; }
.checks label { display: flex; align-items: center; gap: 6px; color: var(--ink); }
.actions { display: flex; gap: 8px; margin-top: 16px; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; margin-bottom: 14px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 12px 14px; }
.stat .k { font-size: 12px; color: var(--muted); }
.stat .v { font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; }

/* ============ Documentos: informe a un lado, representacion al otro ============ */
.docs-page { height: 100vh; display: flex; flex-direction: column; overflow: hidden; }
/* --ancho-vista lo pone el usuario arrastrando el borde izquierdo del panel (.vista-resize, informes.js) */
.docs { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) var(--ancho-vista, 580px); gap: 8px; padding: 8px; }
.docs-list { display: flex; flex-direction: column; gap: 6px; min-height: 0; min-width: 0; }
.docs-filtros { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; background: var(--brand-soft); border: 1px solid var(--line); padding: 8px 10px; }
.docs-filtros .grow { flex: 1; min-width: 160px; }
.docs-filtros input, .docs-filtros select { padding: 4px 6px; }
.docs-filtros .btn { padding: 5px 14px; }
.docs-grid-wrap { flex: 1; min-height: 0; overflow: auto; background: #fff; border: 1px solid #bdb8b1; }
table.docs-grid { width: 100%; border-collapse: collapse; font-size: 13px; }
table.docs-grid th {
  position: sticky; top: 0; z-index: 1; background: #fff; text-align: left; font-weight: 400; font-size: 13px;
  padding: 5px 8px; border-bottom: 1px solid #bdb8b1; border-right: 1px solid var(--line); white-space: nowrap;
}
table.docs-grid th.num { text-align: right; }
table.docs-grid td { padding: 3px 8px; border-bottom: 1px solid var(--line-soft); white-space: nowrap; font-variant-numeric: tabular-nums; }
table.docs-grid td.ell { max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
table.docs-grid tr.doc { cursor: default; }
table.docs-grid tr.doc:hover td { background: var(--brand-hover); }
table.docs-grid tr.doc.on td { background: var(--brand); color: var(--brand-ink); }
table.docs-grid tr.doc.on .tag { background: rgba(255,255,255,.85); }
table.docs-grid tr.anulado td { color: var(--muted); text-decoration: line-through; }
table.docs-grid tr.anulado td:last-child { text-decoration: none; }
table.docs-grid tr.doc.on.anulado td { color: rgba(255,255,255,.75); }
table.docs-grid tfoot td { position: sticky; bottom: 0; background: #f8f7f5; font-weight: 600; border-top: 1px solid #bdb8b1; padding: 5px 8px; }
.docs-hint { font-size: 12px; }
.docs-preview { display: flex; flex-direction: column; gap: 6px; min-height: 0; position: relative; }
.vista-resize { position: absolute; left: -8px; top: 0; bottom: 0; width: 8px; cursor: col-resize; touch-action: none; z-index: 2; }
.vista-resize::after { content: ""; position: absolute; top: 50%; left: 2px; width: 4px; height: 56px; margin-top: -28px;
  border-radius: 2px; background: var(--line); }
.vista-resize:hover::after, .vista-resize.arrastrando::after { background: var(--brand); }
body.redimensionando-ancho { cursor: col-resize; user-select: none; }
body.redimensionando-ancho iframe { pointer-events: none; }
.docs-actions { display: flex; align-items: center; gap: 6px; background: #fff; border: 1px solid var(--line); padding: 6px 8px; }
.docs-actions .docs-num { font-weight: 600; margin-right: auto; }
.docs-actions .btn { padding: 5px 12px; }
.docs-preview iframe { flex: 1; min-height: 0; width: 100%; border: 1px solid var(--line); background: #e9ecef; }
/* Celular (is-phone-ui, templates/informes/index.html): el documento se abre en un modal a pantalla completa al tocar la
   fila, encima del menu de abajo; se cierra con la X o con "atras" del celular (informes.js) */
.pv-cerrar { display: none; }
.docs-modal .docs-preview, .docs-modal .vista-resize { display: none; }
body.detalle-abierto { overflow: hidden; }
body.detalle-abierto .docs-modal .docs-preview {
  display: flex; position: fixed; inset: 0; z-index: 70; background: var(--panel); padding: 8px;
  padding-top: calc(8px + env(safe-area-inset-top)); padding-bottom: calc(8px + env(safe-area-inset-bottom));
}
body.detalle-abierto .posbot-flotante { display: none; }
.docs-modal .docs-actions { flex-wrap: wrap; border-radius: 8px; }
.docs-modal .docs-actions .docs-num { flex: 1 1 calc(100% - 64px); font-size: 16px; }
.docs-modal .docs-actions .pv-cerrar { display: inline-flex; align-items: center; justify-content: center; width: 48px;
  font-size: 18px; padding: 0; }
.docs-modal .docs-actions .btn:not(.pv-cerrar) { flex: 1 1 40%; min-height: 42px; }
body.detalle-abierto .docs-modal .docs-preview iframe { height: auto; flex: 1; border-radius: 8px; }

/* Cartera */
.cartera-det { overflow-y: auto; }
.cart-nombre { font-size: 16px; font-weight: 600; }
.cart-saldo { font-size: 20px; font-weight: 700; color: var(--brand-text); }
.vencido { color: var(--err); font-weight: 600; }
table.docs-grid tr.doc.on .vencido { color: #ffd7d3; }
table.mini { width: 100%; border-collapse: collapse; font-size: 13px; }
table.mini th { text-align: left; font-weight: 600; color: var(--muted); font-size: 12px; padding: 3px 4px; border-bottom: 1px solid var(--line); }
table.mini td { padding: 4px; border-bottom: 1px solid var(--line-soft); white-space: nowrap; }
table.mini th.num { text-align: right; }
table.mini tr.anulado td { color: var(--muted); text-decoration: line-through; }
.abono-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.abono-grid input, .abono-grid select { width: 100%; }
#f-abono .btn.primary { margin-top: 8px; width: 100%; }

/* Tarjetas laterales y totales (POS, cartera) */
.side-card { background: #fff; border: 1px solid var(--line); padding: 12px 14px; }
.side-card h3 { margin: 0 0 8px; font-size: 12px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); font-weight: 600; }
.totals { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; font-variant-numeric: tabular-nums; }
.totals .grand { font-size: 26px; font-weight: 700; color: var(--brand-text); padding-top: 6px; border-top: 1px solid var(--line); margin-top: 4px; }
.totals .grand-l { align-self: end; padding-bottom: 4px; font-weight: 600; border-top: 1px solid var(--line); margin-top: 4px; padding-top: 6px; }
.side-card.total-band { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.side-card.total-band .t { font-size: 13px; opacity: .85; }
.side-card.total-band .v { font-size: 38px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.1; word-break: break-all; }

/* Lista desplegable de busqueda (planilla, informes) */
.field { position: relative; display: block; min-width: 0; }
.dropdown {
  position: absolute; top: calc(100% + 2px); left: 0; right: 0; z-index: 30; background: #fff;
  border: 1px solid var(--line); border-radius: 4px; box-shadow: 0 8px 24px rgba(0,0,0,.12);
  max-height: 340px; overflow-y: auto; display: none;
}
.dropdown.open { display: block; }
.dropdown .opt { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 6px 10px; cursor: pointer; border-bottom: 1px solid var(--line-soft); }
.dropdown .opt .n { font-weight: 500; }
.dropdown .opt .c { grid-column: 1; font-size: 12px; color: var(--muted); font-family: var(--mono); }
.dropdown .opt .p { grid-row: 1 / span 2; grid-column: 2; align-self: center; text-align: right; font-variant-numeric: tabular-nums; }
.dropdown .opt .p small { display: block; color: var(--muted); font-size: 11px; }
.dropdown .opt.on { background: var(--sel); }
.dropdown .empty { padding: 10px; color: var(--muted); }
.dropdown .new { padding: 8px 10px; color: var(--brand-text); cursor: pointer; }

/* Informes */
.docs.solo-lista { grid-template-columns: minmax(0, 1fr); }
.informe-pick { min-width: 260px; flex: 1.2; }
.informe-pick input { width: 100%; font-weight: 600; }
.informe-pick input::placeholder { color: var(--ink); opacity: .75; }
.informe-titulo { font-size: 14px; padding: 0 2px; }
.informe-accion { float: right; padding: 3px 10px; font-size: 13px; }
/* Documento en ventana modal (VP.abrirDocumento) */
.doc-modal { width: min(440px, 100%); height: min(88vh, 900px); display: flex; flex-direction: column; overflow: hidden; }
.doc-modal header { flex-shrink: 0; }
.doc-modal:focus { outline: none; }
.doc-modal-acciones { display: flex; gap: 6px; }
.doc-modal-frame { flex: 1; width: 100%; border: 0; background: #e9ecef; }

/* Modales */
.modal-back { position: fixed; inset: 0; background: rgba(15, 25, 40, .45); display: none; align-items: center; justify-content: center; z-index: 60; padding: 16px; }
.modal-back.open { display: flex; }
.modal { background: #fff; border-radius: 8px; width: min(480px, 100%); max-height: 100%; overflow: auto; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.modal header { padding: 14px 18px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; }
.modal header h2 { margin: 0; font-size: 16px; }
.modal .body { padding: 16px 18px; display: grid; gap: 10px; }
.modal footer { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; }
.pay-total { text-align: center; font-size: 34px; font-weight: 700; color: var(--brand-text); font-variant-numeric: tabular-nums; }
.pay-row { display: grid; grid-template-columns: 150px 1fr 1fr 34px; gap: 8px; align-items: center; }
.pay-filas { display: grid; gap: 8px; }
.pay-row select { font-size: 14px; }
.pay-row .p-quitar { padding: 6px 0; color: var(--muted); }
.pay-agregar { justify-self: start; border-style: dashed; color: var(--brand-text); }
.pay-row input { text-align: right; font-size: 16px; }
.pay-row input.ref { text-align: left; font-size: 13px; }
.pay-change { display: flex; justify-content: space-between; font-size: 20px; padding: 10px 12px; background: var(--ok-soft); border-radius: 6px; font-variant-numeric: tabular-nums; }
.pay-change.falta { background: var(--err-soft); color: var(--err); }
.form-err { color: var(--err); font-size: 13px; min-height: 18px; }

/* Formulario de articulos: presentacion (existencia y costo vienen del articulo base) */
input.solo-lectura { background: var(--line-soft, #f2f0ed); color: var(--muted); }
.presentacion-info { font-size: 13px; margin: 6px 0 0; min-height: 18px; }
.presentaciones { margin-top: 10px; display: grid; gap: 6px; }

/* Interruptor (input type=checkbox class=switch): Opciones > Permisos */
input.switch { appearance: none; -webkit-appearance: none; width: 44px; height: 24px; border-radius: 12px; flex-shrink: 0;
  background: #cdc8c2; position: relative; cursor: pointer; transition: background .15s; border: 0; margin: 0; }
input.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform .15s; }
input.switch:checked { background: var(--brand); }
input.switch:checked::after { transform: translateX(20px); }
input.switch:focus-visible { outline: 2px solid var(--brand-text); outline-offset: 2px; }
input.switch:disabled { opacity: .6; cursor: wait; }
/* Pestanas (Opciones): la elegida se une con la tarjeta de abajo */
.tabs { display: flex; flex-wrap: wrap; gap: 2px; max-width: 760px; border-bottom: 1px solid var(--line); }
/* Opciones usa todo el ancho: los eventos de un rol caben sin bajar; los interruptores no se estiran de mas */
.opciones-page { max-width: none; }
.opciones-page .tabs, .opciones-page .permisos { max-width: none; }
.opciones-page .permiso, .opciones-page .permisos-head { max-width: 900px; }
.tab { padding: 8px 16px; border: 1px solid transparent; border-bottom: 0; border-radius: 6px 6px 0 0; background: none;
  color: var(--muted); font: inherit; font-weight: 500; cursor: pointer; margin-bottom: -1px; }
.tab:hover { color: var(--ink); background: var(--brand-soft); }
.tab[aria-selected="true"] { background: var(--panel); color: var(--ink); border-color: var(--line); border-bottom: 1px solid var(--panel); }
.tab:focus-visible { outline: 2px solid var(--brand-text); outline-offset: -2px; }
.tabs + .card, .tabs ~ .card { border-top-left-radius: 0; border-top: 0; }
.permisos { display: grid; padding: 4px 18px; max-width: 760px; }
.permisos-head { padding: 14px 0 6px; border-bottom: 1px solid var(--line-soft); }
.permisos-head h2 { margin: 0; font-size: 16px; }
.permisos-head p { margin: 3px 0 0; font-size: 13px; }
.opciones-barra { display: flex; justify-content: flex-end; padding: 12px 0 8px; }
/* Opciones > Ventas > Metodos de pago */
.negocio-datos { max-width: 700px; }
/* Opciones -> Color: cada opcion es una pantalla en miniatura con su color (--muestra), no el del sistema */
.colores-form { display: grid; gap: 14px; padding: 12px 0 16px; }
.colores { display: flex; flex-wrap: wrap; gap: 12px; }
.color-opcion { display: grid; gap: 8px; width: 180px; padding: 10px; border: 2px solid var(--line);
  border-radius: 12px; background: var(--panel); cursor: pointer; }
.color-opcion:hover { border-color: var(--muestra); }
.color-opcion:has(input:checked) { border-color: var(--muestra); box-shadow: 0 0 0 3px var(--muestra-suave); }
.color-opcion input { margin: 0; accent-color: var(--muestra); }
.color-opcion input:focus-visible { outline: 2px solid var(--muestra); outline-offset: 2px; }
.color-vista { display: grid; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--bg); }
.color-barra { display: flex; gap: 5px; padding: 7px 8px; background: var(--panel); box-shadow: inset 0 3px 0 var(--muestra); }
.color-barra i { height: 6px; width: 22px; border-radius: 3px; background: var(--line); }
.color-barra i:first-child { background: var(--muestra); }
.color-cuerpo { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 12px 8px; }
.color-etiqueta { height: 14px; width: 54px; border-radius: 7px; background: var(--muestra-suave); }
.color-boton { height: 22px; width: 58px; border-radius: 6px; background: var(--muestra); }
.color-nombre { display: flex; align-items: center; gap: 6px; font-weight: 600; font-size: 14px; color: var(--ink); }
@media (max-width: 420px) { .color-opcion { width: calc(50% - 6px); } }
.metodos-pago { max-width: 900px; margin-top: 18px; display: grid; gap: 10px; }
.metodos-pago .permisos-head h3 { margin: 0; font-size: 15px; }
.metodos-nuevo { display: flex; align-items: end; gap: 8px; flex-wrap: wrap; }
.metodos-nuevo label { flex: 1; min-width: 220px; }
.permisos table.data { margin-bottom: 12px; }
.rol-usuario select { padding: 3px 6px; }
.rol-usuario { display: inline-block; margin: 0 0 0 6px; }
.rol-usuario .btn { padding: 2px 8px; font-size: 12px; }
.qr-admin { max-width: 560px; display: grid; gap: 10px; }
.qr-admin .actions { align-items: end; margin-top: 4px; }
.qr-admin .actions label { display: grid; gap: 4px; font-size: 13px; font-weight: 600; }
/* Diseño del ticket: ajustes a la izquierda, vista previa (el ticket real) a la derecha */
.ticket-diseno { display: grid; grid-template-columns: minmax(280px, 520px) auto; gap: 28px; padding: 14px 0; align-items: start; }
.ticket-form { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 18px; }
.ticket-form label { display: grid; gap: 4px; font-weight: 600; font-size: 13px; }
.ticket-form label .muted { font-weight: 400; }
.ticket-form textarea { grid-column: 1 / -1; resize: vertical; font: inherit; font-weight: 400; padding: 6px 8px; }
.ticket-form label:has(textarea) { grid-column: 1 / -1; }
.ticket-rango { display: grid; grid-template-columns: 1fr 64px; gap: 8px; align-items: center; }
.ticket-rango input[type=number] { padding: 4px 6px; }
.ticket-check { display: flex !important; align-items: center; gap: 8px; font-weight: 400 !important; grid-column: 1 / -1; }
.ticket-diseno .actions form { margin: 0; }
.ticket-vista p { margin: 0 0 6px; font-size: 12px; }
.ticket-vista iframe { width: 340px; height: 640px; border: 1px solid var(--line); border-radius: 6px; background: #e9ecef; }
@media (max-width: 900px) { .ticket-diseno { grid-template-columns: 1fr; } .ticket-form { grid-template-columns: 1fr; } }
/* Roles y eventos: lista de roles a la izquierda, eventos del elegido a la derecha (como fiushPOS) */
.roles { display: grid; grid-template-columns: 200px 1fr; gap: 18px; padding: 14px 0; }
.roles-lista { display: flex; flex-direction: column; gap: 2px; }
.roles-lista a { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; padding: 7px 10px;
  border-radius: 4px; color: var(--ink); text-decoration: none; font-weight: 500; }
.roles-lista a small { color: var(--muted); font-weight: 400; font-size: 11px; }
.roles-lista a:hover { background: var(--brand-hover); }
.roles-lista a.on { background: var(--sel); }
.roles-lista a.nuevo { color: var(--brand-text); margin-top: 6px; }
.roles-editor h3 { margin: 4px 0; }
.roles-cabeza { display: flex; flex-wrap: wrap; align-items: end; gap: 10px 12px; padding-bottom: 12px;
  border-bottom: 1px solid var(--line-soft); }
.roles-cabeza label { display: grid; gap: 4px; width: min(320px, 100%); font-weight: 600; font-size: 13px; }
.roles-cabeza form { margin: 0; }
.roles-cabeza .muted { font-size: 12px; align-self: center; }
.roles-grupos { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 4px 28px; align-items: start; }
.roles-grupo { border: 0; margin: 12px 0 0; padding: 0; display: grid; gap: 6px; min-width: 0; }
.roles-grupo legend { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 0 6px 0 0; }
.roles-grupo label { display: flex; align-items: flex-start; gap: 8px; }
.roles-grupo label input { margin-top: 3px; }
.roles-grupo label:has(input:disabled) { color: var(--muted); }
@media (max-width: 640px) { .roles { grid-template-columns: 1fr; } }
.permiso { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 14px 0;
  border-bottom: 1px solid var(--line-soft); cursor: pointer; }
.permiso:last-child { border-bottom: 0; }
.permiso-texto { display: grid; gap: 3px; }
.permiso-texto .muted { font-size: 13px; }

/* Ventana de confirmacion propia (static/core/dialogo.js) en lugar de alert/confirm/prompt */
.dialogo { z-index: 80; }
.dialogo-caja { width: min(440px, 100%); }
.dialogo-cabeza { display: grid; grid-template-columns: auto 1fr; gap: 14px; align-items: start; padding: 20px 20px 4px; }
.dialogo-cabeza h2 { margin: 2px 0 0; font-size: 17px; line-height: 1.3; }
.dialogo-cabeza p { margin: 6px 0 0; color: var(--muted); font-size: 14px; line-height: 1.45; }
.dialogo-icono { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 18px;
  background: var(--brand-soft); color: var(--brand-text); }
.dialogo-icono.peligro { background: var(--err-soft); color: var(--err); box-shadow: 0 0 0 6px #fef4f3; }
.dialogo-icono.aviso { background: #fff4d6; color: var(--warn); }
/* Aviso que solo se lee (VPDialogo.informar): centrado, icono grande y un solo boton (sin letra de atajo) */
.dialogo-caja.dialogo-informa { width: min(400px, 100%); }
.dialogo-informa .dialogo-cabeza { grid-template-columns: 1fr; justify-items: center; text-align: center; padding: 28px 26px 8px; gap: 14px; }
.dialogo-informa .dialogo-icono { width: 64px; height: 64px; font-size: 26px; box-shadow: 0 0 0 8px #fffaeb; }
.dialogo-informa .dialogo-cabeza h2 { font-size: 20px; margin: 0; }
.dialogo-informa .dialogo-error { min-height: 0; margin: 6px 20px; }
.dialogo-informa footer { justify-content: center; padding: 14px 20px 22px; background: none; border-top: 0; }
.dialogo-informa footer .btn { min-width: 160px; padding: 11px 0; font-size: 16px; font-weight: 600; border-radius: 8px; }
.dialogo-campo { display: grid; gap: 6px; margin: 14px 20px 0; font-size: 13px; color: var(--muted); }
.dialogo-campo input { font-size: 15px; padding: 9px 10px; color: var(--ink); }
.dialogo-error { color: var(--err); font-size: 13px; min-height: 18px; margin: 8px 20px 10px; }
.dialogo-caja footer { background: #f8f7f5; border-radius: 0 0 8px 8px; }
/* Pregunta corta Si / No (VPDialogo.preguntar): centrada, icono grande y botones anchos */
.dialogo-caja.dialogo-pregunta { width: min(360px, 100%); }
.dialogo-pregunta .dialogo-cabeza { grid-template-columns: 1fr; justify-items: center; text-align: center; padding: 30px 26px 8px; gap: 16px; }
.dialogo-pregunta .dialogo-icono { width: 64px; height: 64px; font-size: 26px; box-shadow: 0 0 0 8px var(--brand-soft); }
.dialogo-pregunta .dialogo-cabeza h2 { font-size: 20px; margin: 0; }
.dialogo-pregunta .dialogo-error { min-height: 0; margin: 6px 20px; }
.dialogo-pregunta footer { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 16px 20px 20px; background: none; border-top: 0; }
.dialogo-pregunta footer .btn { padding: 11px 0; font-size: 16px; font-weight: 600; border-radius: 8px; }
.dialogo-pregunta footer .btn::after { margin-left: 8px; font-size: 11px; font-weight: 400; opacity: .65; }
/* El boton elegido (Tab o flechas) se ve claro, tambien el rojo */
.dialogo-caja footer .btn:focus-visible { outline: 3px solid var(--brand-text); outline-offset: 2px; }
/* Primero No, despues Si (este puede ser rojo: no se mira la clase) */
.dialogo-pregunta footer .btn:last-child::after { content: "S"; }
.dialogo-pregunta footer .btn:first-child::after { content: "N"; }

@media (max-width: 900px) {
  .docs-page { height: auto; overflow: visible; }
  .docs { grid-template-columns: minmax(0, 1fr); }
  .vista-resize { display: none; }
  .docs-grid-wrap { max-height: 55vh; }
  .docs-preview iframe { height: 70vh; flex: none; }
  table.docs-grid .h-sm { display: none; }
  .topbar { gap: 6px; padding: 0 8px; }
  .topbar nav a { padding: 6px 8px; }
  .topbar .who span { display: none; }
}

/* Estado de un pago de licencia (pagina de licencia y Plataforma) */
.pago-aprobado { color: var(--ok); font-weight: 600; }
.pago-pendiente { color: var(--warn); font-weight: 600; }
.pago-rechazado, .pago-anulado, .pago-error { color: var(--err); font-weight: 600; }

/* Soporte desde Plataforma: siempre visible que se esta dentro del negocio de un cliente */
.soporte-barra { background: #fff3cd; color: #6b4e00; border-bottom: 1px solid #f0d58a; padding: 7px 14px; font-size: 13.5px; text-align: center; }
.soporte-barra a { color: #6b4e00; font-weight: 700; margin-left: 10px; }

/* ---------- Celular (fase 3 de la app, modules/pwa): las mismas pantallas, comodas para el dedo ---------- */
@media (max-width: 760px) {
  .page { padding: 12px 12px 20px; }
  .page h1 { font-size: 18px; line-height: 1.3; }
  .btn { min-height: 40px; }
  input, select, textarea { font-size: 16px; }          /* menos de 16 px: el celular hace zoom al escribir */
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .stat { padding: 10px 12px; }
  .stat .v { font-size: 18px; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .form-grid .span2 { grid-column: auto; }
  .actions { flex-wrap: wrap; }
  .actions > .btn, .actions > a.btn, .actions > form { flex: 1 1 auto; text-align: center; }
  .card { padding: 14px 12px; }
  .table-wrap { -webkit-overflow-scrolling: touch; }
  table.data th, table.data td { padding: 9px 10px; }

  /* Lista + detalle (informes, cartera, articulos): filtros en dos columnas, filas altas, detalle debajo */
  .docs { padding: 8px 10px; gap: 12px; }
  .docs-filtros { display: grid !important; grid-template-columns: 1fr 1fr; gap: 8px; }
  .docs-filtros > label, .docs-filtros > .field { min-width: 0; }
  .docs-filtros .informe-pick, .docs-filtros .grow, .docs-filtros > .btn, .docs-filtros .chk { grid-column: 1 / -1; }
  .docs-filtros > .btn { width: 100%; margin: 0; }
  .docs-grid-wrap { max-height: 60vh; border-radius: 8px; }
  table.docs-grid td, table.docs-grid th { padding: 9px 8px; font-size: 13.5px; }
  /* Fechas y nombres en dos lineas si hace falta: asi el valor (la columna que importa) siempre cabe */
  table.docs-grid td, table.docs-grid th { white-space: normal; }
  table.docs-grid td.ell { max-width: none; }
  /* El estado sobra: la fila anulada ya se ve tachada */
  table.docs-grid .estado { display: none; }
  table.docs-grid { width: 100%; }
  /* Totales: sus celdas estan armadas para las columnas del computador; en el celular, en una sola fila */
  table.docs-grid tfoot { display: table-caption; caption-side: bottom; background: #f8f7f5; border-top: 1px solid var(--line); }
  table.docs-grid tfoot tr { display: flex; justify-content: space-between; gap: 10px; }
  table.docs-grid tfoot td { display: block; border: 0; }
  table.docs-grid tfoot td:empty { display: none; }
  table.docs-grid td.num, table.docs-grid th.num { white-space: nowrap; }
  .docs-hint { display: none; }
  .docs-preview { scroll-margin-top: 8px; }
  .docs-preview iframe { height: 78vh; border-radius: 8px; }

  /* Opciones: las pestanas se deslizan de lado en vez de partirse en varias lineas */
  .tabs { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .tab { white-space: nowrap; padding: 10px 14px; }
  .permiso { gap: 12px; }
}

/* Opciones > Factura electronica (PDF): formulario a la izquierda y el PDF de muestra a la derecha */
.fpdf-diseno { display: grid; grid-template-columns: minmax(320px, 560px) minmax(0, 1fr); gap: 24px; align-items: start; }
.fpdf { display: grid; gap: 14px; margin-top: 12px; }
.fpdf-imagen { border: 1px solid var(--line); border-radius: 6px; padding: 8px 12px 12px; margin: 0; display: grid;
  gap: 8px; min-width: 0; }
.fpdf-imagen legend { font-weight: 600; font-size: 13px; padding: 0 4px; }
.fpdf-imagen label { display: grid; gap: 4px; font-size: 13px; }
.fpdf-imagen input[type=file] { max-width: 100%; }
.fpdf-check { display: flex !important; align-items: flex-start; gap: 6px; }
.fpdf-vista { position: sticky; top: 10px; margin-top: 12px; }
.fpdf-vista p { margin: 0 0 6px; font-size: 12px; }
.fpdf-vista iframe { width: 100%; height: min(86vh, 1000px); border: 1px solid var(--line); border-radius: 6px;
  background: #e9ecef; }
@media (max-width: 1100px) { .fpdf-diseno { grid-template-columns: 1fr; } .fpdf-vista { position: static; } }
.fpdf-imagenes { display: flex; flex-wrap: wrap; gap: 14px; }
.fpdf-img { margin: 0; border: 1px solid var(--line); border-radius: 6px; padding: 10px; display: grid; gap: 8px;
  justify-items: center; }
.fpdf-img img { max-width: 180px; max-height: 110px; object-fit: contain; }
.fpdf-img figcaption { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.fpdf-img form { margin: 0; }

/* Opciones > Documentos electronicos (templates/opciones/_facturacion.html) */
.fe { max-width: 900px; display: grid; gap: 14px; margin-top: 12px; }
.fe-bloque { border: 1px solid var(--line); border-radius: 6px; padding: 12px 14px; display: grid; gap: 10px; }
.fe-bloque h3 { margin: 4px 0 0; font-size: 14px; }
.fe-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 14px; }
.fe-grid .fe-ancho { grid-column: 1 / -1; }
.fe-grid .fe-check { display: flex; align-items: center; gap: 6px; color: var(--ink); }
.fe-nota { margin: 0; font-size: 12.5px; }
.fe-tutorial { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.fe-produccion p { margin: 0; }
.fe-produccion form { margin: 0; }
.fe-requisitos { margin: 0; padding-left: 18px; color: var(--err); font-size: 13px; display: grid; gap: 4px; }
.fe-cert { margin: 0; }
.fe-habilitar { padding: 12px 22px; font-size: 15px; }
.fe-estado p { margin: 6px 0; }
.fe-motivo { color: var(--err); }
.fe-docs td { vertical-align: top; }
.tag.fe-aceptado { background: var(--ok-soft); color: var(--ok); }
.tag.fe-rechazado, .tag.fe-omitido { background: var(--err-soft); color: var(--err); }
.tag.fe-enviado, .tag.fe-error { background: #fff4d6; color: var(--warn); }
/* Estados de una factura de venta (fe_documentos) */
.tag.fe-validada { background: var(--ok-soft); color: var(--ok); }
.tag.fe-rechazada { background: var(--err-soft); color: var(--err); }
.tag.fe-pendiente { background: #fff4d6; color: var(--warn); }

/* Informes > Ver logs: historial de un documento electronico ante la DIAN (static/informes/informes.js) */
.fe-logs { width: min(720px, calc(100vw - 32px)); max-height: 86vh; border: 1px solid var(--line); border-radius: 8px;
  padding: 0; color: var(--ink); background: var(--panel); }
.fe-logs::backdrop { background: rgba(20, 28, 40, .45); }
/* Abonar / cancelar un apartado (informe Apartados) */
.ap-dialogo { width: min(460px, calc(100vw - 32px)); padding: 0; border: 0; border-radius: 8px; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.ap-dialogo::backdrop { background: rgba(20, 28, 40, .45); }
.ap-dialogo header { padding: 14px 18px; border-bottom: 1px solid var(--line); }
.ap-dialogo header h2 { margin: 0; font-size: 16px; }
.ap-dialogo .body { padding: 16px 18px; display: grid; gap: 10px; }
.ap-dialogo footer { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; }
.ap-info { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; font-size: 14px; }
.ap-info .b { font-weight: 600; }
.ap-fila { display: flex; gap: 6px; }
.ap-fila input { flex: 1; min-width: 0; }
.fe-logs-cabeza { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 16px;
  border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--panel); }
.fe-logs-cabeza h3 { margin: 0; font-size: 15px; }
.fe-logs-cabeza form { margin: 0; }
.fe-logs-resumen { padding: 10px 16px 4px; font-size: 13px; }
.fe-logs-resumen p { margin: 0 0 8px; }
.fe-logs-mensaje { padding: 8px 10px; background: var(--bg); border-radius: 6px; overflow-wrap: anywhere; }
.fe-logs-cufe { font-family: var(--mono); font-size: 11px; overflow-wrap: anywhere; }
.fe-logs-lista { list-style: none; margin: 0; padding: 4px 16px 16px; display: grid; gap: 8px; font-size: 13px; }
.fe-logs-lista > li { border-left: 3px solid var(--line); padding: 4px 0 4px 10px; overflow-wrap: anywhere; }
.fe-logs-lista > li.ev-validada { border-left-color: var(--ok); }
.fe-logs-lista > li.ev-rechazada { border-left-color: var(--err); }
.fe-logs-lista > li.ev-error { border-left-color: var(--warn); }
.fe-logs-ev { display: flex; justify-content: space-between; gap: 10px; }
.fe-logs-corregir { border: 1px solid var(--err); background: var(--err-soft); border-radius: 6px; padding: 10px 12px;
  margin-bottom: 8px; }
.fe-logs-corregir h4 { margin: 0 0 6px; color: var(--err); font-size: 14px; }
.fe-logs-corregir ul, .fe-logs-avisos ul { margin: 0 0 6px; padding-left: 18px; display: grid; gap: 6px; }
.fe-logs-corregir p { margin: 4px 0 0; }
.fe-logs-ok { padding: 8px 10px; background: var(--ok-soft); color: var(--ok); border-radius: 6px; font-weight: 600; }
.fe-logs-avisos { margin-bottom: 8px; }
.fe-logs-avisos summary, .fe-logs-dian summary { cursor: pointer; color: var(--warn); font-weight: 600; }
.fe-logs-dian summary { color: var(--muted); font-weight: 400; font-size: 12px; }
.fe-logs-dian ul { margin: 4px 0 0; padding-left: 18px; font-size: 12px; color: var(--muted); }

/* Revalidar pendientes: una pastilla por factura, abajo a la derecha, mientras la DIAN responde */
.fe-pastillas { position: fixed; right: 14px; bottom: 14px; z-index: 60; display: grid; gap: 8px;
  width: min(340px, calc(100vw - 28px)); max-height: 70vh; overflow-y: auto; }
.fe-pastilla { padding: 10px 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel);
  box-shadow: 0 6px 18px rgba(0,0,0,.12); font-size: 13px; display: grid; gap: 4px; }
.fe-pastilla.espera { border-left: 4px solid var(--warn); }
.fe-pastilla.ok { border-left: 4px solid var(--ok); background: var(--ok-soft); }
.fe-pastilla.err { border-left: 4px solid var(--err); background: var(--err-soft); }
.fe-pastilla-cab { display: flex; align-items: center; gap: 8px; }
.fe-pastilla-cab .muted { flex: 1; font-size: 12px; }
.fe-pastilla-x { border: 0; background: none; font-size: 18px; line-height: 1; cursor: pointer; color: var(--muted); padding: 0 2px; }
.fe-pastilla-logs { justify-self: start; padding: 4px 10px; font-size: 12px; }
.fe-zip { display: flex; gap: 8px; }
.fe-zip input { flex: 1; }
.fe-zip-res { margin: 0; font-weight: 600; }
@media (max-width: 700px) { .fe-grid { grid-template-columns: minmax(0, 1fr); } }

/* ---------- PosBot (templates/_posbot.html, static/core/posbot.js): en todas las pantallas con sesion ----------
   El chat abajo a la derecha; las ventanas (cobro, confirmaciones) lo tapan. */
.asis-chat { position: fixed; right: 14px; bottom: 14px; z-index: 55; width: min(360px, calc(100vw - 28px));
  height: min(470px, calc(100vh - 90px)); display: flex; flex-direction: column; background: var(--panel);
  border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 12px 34px rgba(15, 25, 40, .28); overflow: hidden;
  animation: asis-chat-entra .2s ease-out; }
.asis-chat[hidden] { display: none; }
@keyframes asis-chat-entra { from { opacity: 0; transform: translateY(12px) scale(.97); } to { opacity: 1; transform: none; } }
.asis-chat-cab { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--brand); color: var(--brand-ink); }
.asis-chat-cara { font-size: 26px; line-height: 1; }
.asis-chat-cab div { flex: 1; display: grid; }
.asis-chat-cab small { font-size: 11.5px; opacity: .85; }
.asis-chat-x { background: none; border: 0; color: inherit; font-size: 22px; line-height: 1; cursor: pointer; padding: 2px 6px;
  border-radius: 6px; }
.asis-chat-x:hover { background: rgba(255, 255, 255, .18); }
.asis-chat-limpiar { background: none; border: 1px solid rgba(255, 255, 255, .55); color: inherit; font: inherit;
  font-size: 12px; padding: 3px 10px; border-radius: 999px; cursor: pointer; }
.asis-chat-limpiar:hover { background: rgba(255, 255, 255, .18); }
.asis-chat-msgs { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 8px; background: var(--bg); }
.asis-msg { max-width: 85%; padding: 8px 11px; border-radius: 12px; font-size: 13.5px; line-height: 1.4; word-wrap: break-word;
  animation: asis-msg-entra .18s ease-out; }
.asis-msg.bot { align-self: flex-start; background: var(--panel); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.asis-msg.yo { align-self: flex-end; background: var(--brand); color: var(--brand-ink); border-bottom-right-radius: 4px; }
.asis-msg a { color: var(--brand-text); font-weight: 600; }
@keyframes asis-msg-entra { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
/* "Escribiendo…": tres puntos que saltan */
.asis-msg.escribiendo { display: flex; gap: 4px; padding: 11px 13px; }
.asis-msg.escribiendo span { width: 7px; height: 7px; border-radius: 50%; background: var(--muted);
  animation: asis-punto 1s ease-in-out infinite; }
.asis-msg.escribiendo span:nth-child(2) { animation-delay: .15s; }
.asis-msg.escribiendo span:nth-child(3) { animation-delay: .3s; }
@keyframes asis-punto { 0%, 60%, 100% { transform: none; opacity: .5; } 30% { transform: translateY(-4px); opacity: 1; } }
/* La respuesta: "Entendi: ...", el contacto de soporte y sus botones (opciones: otra pregunta; acciones: una pantalla) */
.asis-msg.bot > div + div { margin-top: 4px; }
/* Un evento en la respuesta ([[COT|Cotización]]): pastilla con el color del evento en la planilla (static/pos/pos.css) */
.asis-ev { --ev: var(--brand-text); display: inline-block; padding: 1px 9px; margin-right: 4px; border-radius: 999px;
  background: var(--ev); color: #fff; font-size: 12px; font-weight: 600; line-height: 1.5; white-space: nowrap; }
.asis-ev[data-ev="FEP"] { --ev: #0369a1; }
/* Cantidades (el top de lo vendido): pastilla clara, que no se confunda con un evento */
.asis-ev[data-ev="UND"] { background: var(--brand-soft); color: var(--brand-text); border: 1px solid var(--brand-line); margin: 0 0 0 4px; }
.asis-ev[data-ev="COM"], .asis-ev[data-ev="CNO"] { --ev: #9a6700; }
.asis-ev[data-ev="COT"] { --ev: #6f42c1; }
.asis-ev[data-ev="DEV"] { --ev: #b42318; }
.asis-ev[data-ev="DCO"] { --ev: #c2410c; }
.asis-ev[data-ev="AJU"] { --ev: #0f766e; }
.asis-ev[data-ev="GAS"] { --ev: #5f5d66; }
.asis-ev[data-ev="RPE"], .asis-ev[data-ev="APE"], .asis-ev[data-ev="RAR"], .asis-ev[data-ev="AAR"] { --ev: #2f6fae; }
.asis-entendido { font-size: 12px; color: var(--muted); font-style: italic; }
.asis-soporte { margin-top: 6px; font-size: 12.5px; color: var(--muted); }
.asis-botones { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.asis-op, .asis-ir { font: inherit; font-size: 12.5px; padding: 5px 10px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--brand-line); background: var(--brand-soft); color: var(--brand-text); text-decoration: none; line-height: 1.3; }
.asis-op:hover, .asis-ir:hover { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.asis-ir { font-weight: 600; }
.asis-chat-form { display: flex; gap: 6px; padding: 10px; border-top: 1px solid var(--line); background: var(--panel); }
.asis-chat-form input { flex: 1; min-width: 0; }
/* Boton redondo que lo abre fuera de la planilla (alli lo abre el robot animado) */
.posbot-flotante { position: fixed; right: 16px; bottom: 16px; z-index: 54; width: 58px; height: 58px; padding: 7px;
  border-radius: 50%; border: 2px solid var(--brand-line); background: var(--panel); cursor: pointer;
  box-shadow: 0 6px 18px rgba(15, 25, 40, .22); animation: posbot-flota 3.2s ease-in-out infinite; }
.posbot-flotante[hidden] { display: none; }
.posbot-flotante svg { width: 100%; height: 100%; display: block; }
.posbot-flotante:hover { border-color: var(--brand); }
.posbot-flotante:focus-visible { outline: 2px solid var(--brand-text); outline-offset: 2px; }
.posbot-flotante.abierto { visibility: hidden; }   /* el chat queda encima */
.posbot-luz { animation: posbot-luz 1.6s ease-in-out infinite; }
@keyframes posbot-flota { 0%, 100% { translate: 0 0; } 50% { translate: 0 -4px; } }
@keyframes posbot-luz { 50% { opacity: .55; } }
@media (max-width: 760px) {
  /* Encima de la barra de abajo del celular */
  .posbot-flotante { bottom: calc(74px + env(safe-area-inset-bottom)); }
  .asis-chat { bottom: calc(70px + env(safe-area-inset-bottom)); height: min(470px, calc(100vh - 150px)); }
}
@media (prefers-reduced-motion: reduce) { .posbot-flotante, .posbot-luz { animation: none; } }
