/* ─────────────────────────────────────────────────────────────────────────
   AIQm — Estilos base (mobile-first). Tema AIQ: azul #2f7af0 + naranja #f5a623.
   ───────────────────────────────────────────────────────────────────────── */
:root {
    --aiq-blue: #2f7af0;
    --aiq-blue-dark: #1f5fd0;
    --aiq-blue-top: #5a9bff;
    --aiq-orange: #f5a623;
    --aiq-bg: #f2f7ff;
    --aiq-card: #ffffff;
    --aiq-ink: #1c2740;
    --aiq-muted: #6b7793;
    --aiq-line: #e4ecf7;
    --aiq-danger: #e0483d;
    /* Estados (stock, badges) */
    --ok-bg: #e4f6ea;   --ok-fg: #1f8a4c;
    --warn-bg: #fdf1dc; --warn-fg: #b9791b;
    --bad-bg: #fbe3e1;  --bad-fg: #c23a30;
    --tabbar-h: 62px;
    --topbar-h: 56px;
    font-family: "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--aiq-bg);
    color: var(--aiq-ink);
    overscroll-behavior-y: none;
}

body { min-height: 100dvh; }

button { font-family: inherit; cursor: pointer; }

/* ── Cáscara de la app ─────────────────────────────────────────────────── */
#app { min-height: 100dvh; display: flex; flex-direction: column; }

.topbar {
    height: calc(var(--topbar-h) + env(safe-area-inset-top));
    padding-top: env(safe-area-inset-top);
    background: linear-gradient(180deg, var(--aiq-blue-top), var(--aiq-blue));
    color: #fff;
    display: flex;
    align-items: center;
    gap: 12px;
    padding-left: 16px;
    padding-right: 16px;
    box-shadow: 0 2px 10px rgba(31, 95, 208, .25);
    position: sticky;
    top: 0;
    z-index: 20;
}
.topbar h1 { font-size: 1.15rem; font-weight: 800; margin: 0; letter-spacing: .3px; flex: 1; }
.topbar-logo { height: 30px; width: auto; border-radius: 7px; }
.topbar-spacer { flex: 1; }
.topbar-btn {
    flex-shrink: 0;
    width: 36px; height: 36px; border-radius: 50%;
    background: rgba(255, 255, 255, .18); border: none; color: #fff;
    display: flex; align-items: center; justify-content: center;
}
.topbar-btn:active { background: rgba(255, 255, 255, .34); }
.topbar-btn.girando .icn { animation: girar .8s linear infinite; }
@keyframes girar { to { transform: rotate(360deg); } }
.topbar .user-chip {
    background: rgba(255, 255, 255, .18);
    border: none; color: #fff;
    padding: 6px 12px; border-radius: 999px;
    font-weight: 700; font-size: .85rem;
    display: flex; align-items: center; gap: 6px;
}
.topbar .user-chip .icn { stroke-width: 2; }

/* Accesos rápidos (inicio) */
.qa-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.qa {
    display: flex; flex-direction: column; align-items: center; gap: 8px;
    border: 1px solid var(--aiq-line); background: #fff; border-radius: 14px;
    padding: 18px 10px; font-weight: 800; font-size: .92rem; color: var(--aiq-ink);
}
.qa .qa-ic { color: var(--aiq-blue); display: flex; }
.qa:active { background: var(--aiq-bg); }
/* Si el número de accesos es impar, el último ocupa la fila entera. */
.qa:last-child:nth-child(odd) { grid-column: span 2; }

.content {
    flex: 1;
    padding: 16px;
    padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 16px);
}

/* ── Tab bar inferior ──────────────────────────────────────────────────── */
.tabbar {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    background: #fff;
    border-top: 1px solid var(--aiq-line);
    display: flex;
    z-index: 20;
}
.tabbar button {
    flex: 1;
    background: none; border: none;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 3px;
    color: #9db2d6;                 /* azul apagado (inactivo) */
    font-size: .7rem; font-weight: 700;
}
.tabbar button .ic { display: flex; line-height: 1; }
.tabbar button.active { color: var(--aiq-blue); }

/* Iconos de línea */
.icn { display: inline-block; vertical-align: middle; }

/* ── Tarjetas / secciones ──────────────────────────────────────────────── */
.card {
    background: var(--aiq-card);
    border: 1px solid var(--aiq-line);
    border-radius: 16px;
    padding: 18px;
    box-shadow: 0 1px 4px rgba(28, 39, 64, .04);
}
.card + .card { margin-top: 14px; }
.muted { color: var(--aiq-muted); }
.card-sub { margin: 0; color: var(--aiq-muted); }
.h-sec { font-size: 1.05rem; font-weight: 800; margin: 4px 0 12px; }
.placeholder {
    text-align: center; color: var(--aiq-muted);
    padding: 40px 16px;
}
.placeholder .big { color: var(--aiq-blue); display: flex; justify-content: center; }
.placeholder .h-sec { margin-top: 8px; }

/* ── Buscador ───────────────────────────────────────────────────────────── */
.search {
    display: flex; align-items: center; gap: 10px;
    background: #fff; border: 1px solid var(--aiq-line);
    border-radius: 14px; padding: 0 14px; margin-bottom: 14px;
    box-shadow: 0 1px 4px rgba(28, 39, 64, .04);
}
.search-ic { color: var(--aiq-muted); display: flex; }
.search-input {
    flex: 1; border: none; outline: none; background: none;
    font-family: inherit; font-size: 1rem; color: var(--aiq-ink);
    padding: 14px 0;
}

/* ── Mensajes de estado de listas ───────────────────────────────────────── */
.hint-list { color: var(--aiq-muted); text-align: center; padding: 26px 12px; margin: 0; }
.hint-list.error { color: var(--aiq-danger); }
.list-count { color: var(--aiq-muted); font-size: .78rem; margin: 0; padding: 2px 4px 8px; }

/* ── Tabla de resultados (estilo DataTables) ────────────────────────────── */
.tbl-wrap {
    background: #fff; border: 1px solid var(--aiq-line);
    border-radius: 12px; overflow: hidden;
    box-shadow: 0 1px 4px rgba(28, 39, 64, .04);
}
.tbl { width: 100%; border-collapse: collapse; font-size: .86rem; }

.tbl thead th {
    text-align: left; color: var(--aiq-muted); font-weight: 600;
    padding: 10px 8px; background: #fff;
    border-bottom: 2px solid var(--aiq-line);
    cursor: pointer; user-select: none; white-space: nowrap;
}
.tbl thead th:active { background: var(--aiq-bg); }
.sort-ar { color: var(--aiq-orange); font-size: .7rem; margin-left: 3px; }

.tbl tbody td { padding: 11px 8px; border-bottom: 1px solid var(--aiq-line); vertical-align: middle; }
.tbl tbody tr:nth-child(even) td { background: #f7f9fc; }   /* zebra */
.tbl tbody tr:last-child td { border-bottom: none; }
.tbl tbody tr:active td { background: #eaf1fd; }

/* Columnas */
.c-desc { width: 100%; line-height: 1.3; word-break: break-word; }
.p-name { color: var(--aiq-blue-dark); font-weight: 600; }
.p-code { color: var(--aiq-danger); font-weight: 400; white-space: nowrap; }
.p-short { color: var(--aiq-muted); font-weight: 400; }
.c-gestor { text-align: right; white-space: nowrap; vertical-align: top;
    color: var(--aiq-muted); font-size: .8rem; font-weight: 700; }

/* Celda de stock rellena (gana al zebra por especificidad) */
.c-stock { text-align: center; white-space: nowrap; font-weight: 600; color: var(--aiq-ink); }
.tbl tbody tr td.st-pos { background: var(--ok-fg);     color: #fff; }
.tbl tbody tr td.st-neg { background: var(--aiq-danger); color: #fff; }

/* Resaltado de coincidencias (búsqueda) */
mark.hl {                        /* solo pinta el fondo: color y grosor sin tocar */
    background: #dbe9ff;
    color: inherit;
    font-weight: inherit;
    border-radius: 3px;
    padding: 0 2px;
}

/* ── Badges de stock ────────────────────────────────────────────────────── */
.badge {
    display: inline-block; padding: 3px 9px; border-radius: 999px;
    font-size: .78rem; font-weight: 800; white-space: nowrap;
}
.badge.green, .badge-lg.green { background: var(--ok-bg);   color: var(--ok-fg); }
.badge.amber, .badge-lg.amber { background: var(--warn-bg); color: var(--warn-fg); }
.badge.red,   .badge-lg.red   { background: var(--bad-bg);  color: var(--bad-fg); }

/* ── Ficha de producto ──────────────────────────────────────────────────── */
.back {
    display: inline-flex; align-items: center; gap: 4px;
    background: none; border: none; color: var(--aiq-blue);
    font-weight: 600; font-size: .95rem; padding: 4px 0; margin-bottom: 10px;
}
.pd-photo {
    background: #fff; border: 1px solid var(--aiq-line); border-radius: 16px;
    padding: 12px; margin-bottom: 14px; text-align: center;
}
.pd-photo img { max-width: 100%; max-height: 220px; height: auto; border-radius: 8px; }
.pd-desc { margin: 0; white-space: pre-line; }

/* Cabecera estilo listado original: Id naranja · nombre normal · código rojo */
.pd-head { font-size: 1.02rem; line-height: 1.45; color: var(--aiq-ink); font-weight: 400; }
.pd-id { color: var(--aiq-orange); font-weight: 700; }
.pd-code { color: var(--aiq-danger); font-weight: 600; }

.pd-stats { display: flex; gap: 10px; margin-top: 16px; }
.stat { flex: 1; text-align: center; background: var(--aiq-bg);
    border-radius: 12px; padding: 12px 6px; }
.stat-k { font-size: .72rem; font-weight: 600; color: var(--aiq-muted);
    text-transform: uppercase; letter-spacing: .5px; }
.stat-v { font-size: 1.15rem; font-weight: 600; color: var(--aiq-ink); margin-top: 4px; }
.stat-v.muted { color: var(--aiq-muted); }
.stat-note { font-size: .72rem; color: var(--aiq-muted); margin-top: 2px; }
.badge-lg { display: inline-block; padding: 2px 12px; border-radius: 999px; }

.specs { display: flex; flex-direction: column; gap: 2px; }
.spec { display: flex; align-items: center; gap: 10px; padding: 10px 0;
    border-bottom: 1px solid var(--aiq-line); }
.spec:last-child { border-bottom: none; }
.spec-ic { color: var(--aiq-blue); display: flex; flex-shrink: 0; }
.spec-k { color: var(--aiq-muted); font-size: .88rem; flex-shrink: 0; min-width: 118px; }
.spec-v { color: var(--aiq-ink); font-weight: 500; text-align: right; flex: 1;
    word-break: break-word; }
.spec-link { color: var(--aiq-blue); text-decoration: none; }
/* Variante en bloque: rótulo arriba y el valor debajo, alineado a la izquierda. */
.spec-block { flex-wrap: wrap; }
.spec-block .spec-v { flex-basis: 100%; margin-top: 4px; text-align: left; }

/* Línea secundaria (población · teléfono) en la lista de clientes. */
.cli-sub { color: var(--aiq-muted); font-size: .82rem; margin-top: 2px; }

/* ── Historial: pestañas + filtro + tablas ──────────────────────────────── */
.hist-tabs { display: flex; gap: 6px; margin-bottom: 12px; }
.tab-btn {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
    background: var(--aiq-bg); border: 1px solid var(--aiq-line); border-radius: 10px;
    padding: 8px 2px; font-weight: 600; font-size: .8rem; color: var(--aiq-muted);
}
.tab-btn.active { background: var(--aiq-blue); border-color: var(--aiq-blue); color: #fff; }
.tab-n { font-size: .72rem; font-weight: 700; opacity: .85; }

.hist-search { margin-bottom: 10px; }
.hist-search .search-input { padding: 10px 0; font-size: .92rem; }

.hist-tbl { max-height: 340px; overflow: auto; }   /* scroll vertical Y horizontal */
.hist-tbl .tbl { font-size: .55rem; width: 100%; }
/* Columna de texto estrecha: parte en varias líneas y cede el ancho a los números,
   que se quedan con lo justo (width:1%) y así caben siempre en pantalla. */
.hist-tbl td.hp { white-space: normal; word-break: break-word; }
.hist-tbl td.r, .hist-tbl th.r { width: 1%; }
.hist-tbl thead th { cursor: default; position: sticky; top: 0; font-weight: 600; }
.hist-tbl td, .hist-tbl th { padding: 5px 6px; white-space: nowrap; }
.hp { color: var(--aiq-blue-dark); font-weight: 400; }

/* Listados del historial del cliente (demandas · ofertas · pedidos · facturas):
   todos con la misma letra, algo mayor que el .55rem base de .hist-tbl. */
.lst-tbl .tbl { font-size: .68rem; }

/* Color de fila por estado de la demanda (réplica de AIQResp). */
.hist-tbl .tbl tbody tr.dem-entrega   td { background: rgba(0, 204, 0, .2); }
.hist-tbl .tbl tbody tr.dem-entregado td { background: #cccccc; }
.hist-tbl .tbl tbody tr.dem-pedido    td { background: rgba(255, 128, 255, .2); }
.hist-tbl .tbl tbody tr.dem-enstock   td { background: #afdff5; }

/* ── Login ─────────────────────────────────────────────────────────────── */
.login {
    min-height: 100dvh;
    display: flex; flex-direction: column; align-items: center;
    justify-content: center;
    padding: 24px calc(24px + env(safe-area-inset-left)) 24px;
    background: linear-gradient(160deg, var(--aiq-blue-top), var(--aiq-blue-dark));
    color: #fff;
    text-align: center;
}
.login .logo-img {
    width: 140px; max-width: 46%; height: auto;
    filter: drop-shadow(0 8px 22px rgba(0, 0, 0, .28));
}
.login .logo-sub {
    margin-top: 8px; color: #fff; font-weight: 800;
    letter-spacing: 5px; font-size: .82rem; opacity: .9;
}

.userlist { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin: 18px 0 6px; max-width: 340px; }
.userlist button {
    background: rgba(255, 255, 255, .14);
    border: 1.5px solid rgba(255, 255, 255, .28);
    color: #fff; font-weight: 800;
    padding: 12px 16px; border-radius: 14px; min-width: 92px;
    font-size: .95rem;
}
.userlist button.sel { background: #fff; color: var(--aiq-blue-dark); border-color: #fff; }

.pinbox { margin-top: 12px; }
.pin-dots { display: flex; gap: 14px; justify-content: center; margin: 8px 0 14px; height: 18px; }
.pin-dots .dot { width: 15px; height: 15px; border-radius: 50%; border: 2px solid rgba(255,255,255,.7); }
.pin-dots .dot.on { background: #fff; }

.keypad { display: grid; grid-template-columns: repeat(3, 74px); gap: 12px; justify-content: center; }
.keypad button {
    height: 74px; border-radius: 50%;
    background: rgba(255, 255, 255, .14);
    border: none; color: #fff;
    font-size: 1.6rem; font-weight: 700;
}
.keypad button:active { background: rgba(255, 255, 255, .34); }
.keypad button.ghost { background: none; font-size: 1rem; font-weight: 800; }

.login .msg { min-height: 22px; margin-top: 14px; font-weight: 700; color: #ffd7d2; }
.login .hint { margin-top: 14px; font-size: .85rem; opacity: .8; }

.hidden, [hidden] { display: none !important; }

/* Columnas numéricas de las tablas (clase .r que ya usaban las vistas). */
.tbl .r { text-align: right; }

/* ── Contactos del cliente ─────────────────────────────────────────────── */
.btn-add {
    display: flex; align-items: center; justify-content: center; gap: 6px;
    width: 100%; margin-bottom: 12px;
    background: var(--aiq-bg); border: 1px dashed var(--aiq-blue); border-radius: 12px;
    padding: 11px 10px; font-weight: 700; font-size: .9rem; color: var(--aiq-blue);
}
.btn-add:active { background: #e4eefd; }

.cto-list { display: flex; flex-direction: column; gap: 10px; }
.cto {
    position: relative;
    background: var(--aiq-bg); border: 1px solid var(--aiq-line);
    border-radius: 12px; padding: 12px; padding-right: 44px;
}
.cto-edit {
    position: absolute; top: 8px; right: 8px;
    width: 30px; height: 30px; border-radius: 50%;
    background: #fff; border: 1px solid var(--aiq-line); color: var(--aiq-blue);
    display: flex; align-items: center; justify-content: center;
}
.cto-edit:active { background: #e4eefd; }
.cto-nom { font-weight: 700; color: var(--aiq-ink); }
.cto-cargo {
    display: flex; align-items: center; gap: 6px; margin-top: 2px;
    color: var(--aiq-muted); font-size: .82rem;
}
.cto-l {
    display: flex; align-items: center; gap: 8px; margin-top: 6px;
    font-size: .88rem; color: var(--aiq-blue); text-decoration: none;
    word-break: break-word;
}
.cto-l.muted { color: var(--aiq-muted); }

/* Formulario de alta */
.cto-form { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.f-tit { font-weight: 800; font-size: .95rem; color: var(--aiq-ink); }
.f-in {
    border: 1px solid var(--aiq-line); border-radius: 10px; background: #fff;
    padding: 11px 12px; font-family: inherit; font-size: .95rem; color: var(--aiq-ink);
    outline: none;
}
.f-in:focus { border-color: var(--aiq-blue); }
.f-msg { margin: 0; min-height: 18px; font-size: .82rem; color: var(--aiq-danger); }
.f-btns { display: flex; gap: 8px; }
.btn {
    flex: 1; border-radius: 10px; padding: 11px 10px;
    font-weight: 700; font-size: .92rem; border: 1px solid transparent;
}
.btn-pri { background: var(--aiq-blue); color: #fff; }
.btn-pri:disabled { opacity: .6; }
.btn-sec { background: #fff; border-color: var(--aiq-line); color: var(--aiq-muted); }

/* ── Ventana inferior (ficha de pedido) ────────────────────────────────── */
.modal-bg {
    position: fixed; inset: 0; z-index: 40;
    background: rgba(16, 26, 48, .45);
    display: flex; align-items: flex-end; justify-content: center;
}
.modal {
    background: #fff; width: 100%; max-width: 560px;
    max-height: 88vh;                /* respaldo para iOS sin dvh */
    max-height: 88dvh;
    display: flex; flex-direction: column; overflow: hidden;
    border-radius: 18px 18px 0 0;
    box-shadow: 0 -6px 24px rgba(16, 26, 48, .22);
}
/* Cabecera fija: la ✕ se ve siempre, no se va con el scroll. */
.modal-head {
    flex-shrink: 0; display: flex; justify-content: flex-end;
    padding: 10px 10px 0;
}
.modal-body {
    overflow: auto; -webkit-overflow-scrolling: touch;
    padding: 4px 16px calc(18px + env(safe-area-inset-bottom));
}
.modal-x {
    width: 34px; height: 34px; border-radius: 50%;
    background: var(--aiq-bg); border: none; color: var(--aiq-muted);
    display: flex; align-items: center; justify-content: center;
}

/* Ficha de pedido */
.ped-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.ped-head .pd-id { font-size: 1.1rem; }
.ped-fecha { color: var(--aiq-muted); font-size: .88rem; }
.ped-sub { color: var(--aiq-muted); font-size: .88rem; margin-top: 3px; }
.ped-tbl { margin-top: 12px; max-height: 46dvh; }
.ped-tbl .tbl { font-size: .68rem; }
.ped-tbl td.hp { white-space: normal; min-width: 140px; }

.ped-tot { margin-top: 14px; border-top: 1px solid var(--aiq-line); padding-top: 10px; }
.ped-tot-l {
    display: flex; justify-content: space-between; align-items: baseline;
    padding: 5px 2px; font-size: .9rem; color: var(--aiq-muted);
}
.ped-tot-l b { color: var(--aiq-ink); font-weight: 600; }
.ped-tot-l.total {
    border-top: 1px solid var(--aiq-line); margin-top: 4px; padding-top: 10px;
    font-size: 1rem; color: var(--aiq-ink); font-weight: 700;
}
.ped-tot-l.total b { color: var(--aiq-blue-dark); font-size: 1.12rem; }

/* ── Tirar hacia abajo para recargar ───────────────────────────────────── */
.ptr {
    position: fixed; z-index: 30;
    top: calc(env(safe-area-inset-top) + 8px); left: 50%;
    transform: translateX(-50%);
    width: 36px; height: 36px; border-radius: 50%;
    background: #fff; color: var(--aiq-blue);
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 2px 10px rgba(31, 95, 208, .3);
    opacity: 0; pointer-events: none;
}
.ptr.listo { background: #e4eefd; color: var(--aiq-blue-dark); }
.ptr.girando .icn { animation: girar .8s linear infinite; }

/* ── Nueva demanda ─────────────────────────────────────────────────────── */
.nd-prod { margin-bottom: 10px; }
.f-fila { display: flex; gap: 8px; }
.f-campo { flex: 1; display: flex; flex-direction: column; gap: 3px; }
.f-campo span { font-size: .74rem; font-weight: 600; color: var(--aiq-muted); }
.f-campo .f-in { width: 100%; }
.f-nota { margin: 0; font-size: .76rem; color: var(--aiq-muted); }
textarea.f-in { resize: vertical; }
/* Precio que viene de una venta anterior: amarillo, como .fondoamarillo del ERP. */
.f-in.amarillo { background: #ff0; font-weight: 700; }

/* ── Selector de estado de demanda (mismos colores que las filas) ──────── */
.est-btn {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    width: 100%; margin-bottom: 8px;
    border: 1px solid var(--aiq-line); border-radius: 10px;
    padding: 13px 14px; background: #fff;
    font-weight: 700; font-size: .95rem; color: var(--aiq-ink); text-align: left;
}
.est-btn.dem-entrega   { background: rgba(0, 204, 0, .2); }
.est-btn.dem-entregado { background: #cccccc; }
.est-btn.dem-pedido    { background: rgba(255, 128, 255, .2); }
.est-btn.dem-enstock   { background: #afdff5; }
.est-btn.actual { border-color: var(--aiq-blue); box-shadow: inset 0 0 0 1px var(--aiq-blue); }
.est-btn:disabled { opacity: .6; }

/* ── Facturas: color de la forma de pago (mismo criterio que el ERP) ───── */
.hist-tbl .tbl td.fp { white-space: normal; }
.hist-tbl .tbl tbody td.fp-verde { background: rgba(0, 204, 0, .2); }
.hist-tbl .tbl tbody td.fp-roja {
    background: red; color: #fff; font-weight: 700; opacity: .8;
}
.txt-verde { color: var(--ok-fg); font-weight: 700; }
.txt-roja  { color: var(--aiq-danger); font-weight: 700; }

/* Botón de PDF de la factura (amarillo si el PDF está desactualizado). */
.btn-pdf {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    margin: 12px 0 0; padding: 12px;
    border-radius: 12px; border: 1px solid var(--aiq-blue);
    background: var(--aiq-blue); color: #fff;
    font-weight: 700; font-size: .92rem; text-decoration: none;
}
.btn-pdf.viejo { background: #ffd83d; border-color: #e0b900; color: #4a3b00; }
.btn-pdf:active { opacity: .85; }

/* Cabecera de albarán dentro de las líneas de la factura. */
.hist-tbl .tbl tbody tr.alb-cab td {
    background: var(--aiq-bg); color: var(--aiq-danger);
    font-weight: 400; white-space: normal;
    border-bottom: 1px solid var(--aiq-line);
}
.pdf-no { margin: 12px 0 0; text-align: center; }
/* En las líneas de la factura, el código va en gris y más pequeño que el nombre. */
.fact-tbl .p-code { color: var(--aiq-muted); font-size: .85em; }

/* ── Visor de PDF dentro de la app ─────────────────────────────────────── */
.pdf-tit {
    font-weight: 700; font-size: .95rem; color: var(--aiq-ink);
    margin-bottom: 10px; padding-right: 40px; word-break: break-word;
}
.pdf-vis { display: flex; flex-direction: column; gap: 10px; }
.pdf-pag {
    width: 100%; height: auto; display: block;
    background: #fff; border: 1px solid var(--aiq-line); border-radius: 6px;
}

/* ── Secciones plegables de la ficha de cliente ────────────────────────── */
.sec { padding: 0; overflow: hidden; }
.sec-cab {
    display: flex; align-items: center; gap: 10px;
    width: 100%; padding: 14px 16px;
    background: none; border: none; font-family: inherit;
}
.sec-cab .sec-ic { color: var(--aiq-blue); display: flex; flex-shrink: 0; }
.sec-tit {
    flex: 1; text-align: left; color: var(--aiq-blue-dark);
    font-weight: 800; font-size: .82rem; text-transform: uppercase; letter-spacing: .4px;
}
.sec-fle { color: var(--aiq-muted); display: flex; transition: transform .18s ease; }
.sec.abierta .sec-fle { transform: rotate(180deg); }
.sec-cuerpo { display: none; padding: 0 16px 14px; }
.sec.abierta .sec-cuerpo { display: flex; flex-direction: column; }
.sec-cab:active { background: var(--aiq-bg); }

/* Cabecera de la ficha (Cómo llegar) y rejilla para elegir el bloque. */
.fic-acc { display: grid; margin-top: 12px; }
.fic-sel { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 10px; }
.fic-b {
    min-height: 72px; display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 4px; padding: 8px 4px; font-family: inherit;
    background: var(--aiq-bg); border: 1px solid var(--aiq-line); border-radius: 12px;
    color: var(--aiq-blue-dark); font-weight: 700; font-size: .76rem; line-height: 1.15; text-align: center;
}
.fic-ic { color: var(--aiq-blue); display: flex; }
.fic-n { color: var(--aiq-muted); font-size: .72rem; }
.fic-b.active { background: #fff; border-color: var(--aiq-blue); box-shadow: inset 0 0 0 1px var(--aiq-blue); }
.fic-b:active { opacity: .85; }

.nota-bloque + .nota-bloque { margin-top: 12px; }
.nota-k { color: var(--aiq-muted); font-size: .82rem; margin-bottom: 3px; }

/* ── Edición de la ficha de cliente ────────────────────────────────────── */
.sec-edit {
    display: flex; align-items: center; justify-content: center;
    width: 30px; height: 30px; border-radius: 50%;
    background: var(--aiq-bg); color: var(--aiq-blue); flex-shrink: 0;
}
.sec-cab .sec-edit { visibility: hidden; }
.sec.abierta .sec-cab .sec-edit { visibility: visible; }
.sec.editando .sec-fle { display: none; }

.sec-form { display: flex; flex-direction: column; gap: 10px; width: 100%; }
.f-check { display: flex; align-items: center; gap: 10px; font-size: .92rem; }
.f-check input { width: 20px; height: 20px; }
select.f-in { background: #fff; appearance: none; }

/* Aviso de cliente duplicado */
.aviso-dup {
    background: #fff8e1; border: 1px solid #ffd83d; border-radius: 12px; padding: 12px;
}
.aviso-tit {
    display: flex; align-items: center; gap: 8px;
    color: #7a5b00; font-weight: 700; font-size: .86rem; margin-bottom: 8px;
}
.dup-l {
    display: block; width: 100%; text-align: left;
    background: #fff; border: 1px solid var(--aiq-line); border-radius: 8px;
    padding: 8px 10px; margin-top: 6px; font-size: .86rem; color: var(--aiq-blue-dark);
}

/* ── Estado del pedido: mismos colores que el listado del ERP ──────────── */
.hist-tbl .tbl td.est { white-space: normal; text-align: center; }
.hist-tbl .tbl tbody td.est-azul  { background: #afdff5; }
.hist-tbl .tbl tbody td.est-rosa  { background: rgba(255, 128, 255, .2); }
.hist-tbl .tbl tbody td.est-verde { background: rgba(0, 204, 0, .2); }

/* ── Margen de la oferta: mismos avisos que el ERP ─────────────────────── */
.hist-tbl .tbl tbody td.mg-roja  { background: red; color: #fff; font-weight: 700; opacity: .8; }
.hist-tbl .tbl tbody td.mg-ambar { background: #ffc107; }
b.mg-roja  { color: var(--aiq-danger); }
b.mg-ambar { color: #b9791b; }
/* Con cinco pestañas hay que apretar un poco la letra. */
.hist-tabs .tab-btn { font-size: .74rem; padding: 8px 1px; }

/* ── Oferta en formato documento ───────────────────────────────────────── */
.doc { background: #fff; color: #000; font-size: .62rem; line-height: 1.35; }
.doc-cab {
    display: flex; align-items: flex-start; gap: 8px;
    border-bottom: 2px solid #000; padding-bottom: 8px; margin-bottom: 10px;
}
.doc-logo { width: 74px; height: auto; flex-shrink: 0; }
.doc-emisor { flex: 1; font-weight: 700; }
.doc-contacto { text-align: right; font-weight: 700; white-space: nowrap; }

.doc-ident { display: flex; gap: 10px; margin-bottom: 10px; }
.doc-izq, .doc-der { flex: 1; }
.doc-izq span { color: #444; }
.doc-der { text-align: right; }
.doc-res { background: #edf2fa; padding: 0 4px; display: inline-block; }

.doc-tbl { width: 100%; border-collapse: collapse; }
.doc-tbl th {
    border-bottom: 1px solid #000; padding: 4px 3px;
    font-weight: 700; text-align: center; white-space: nowrap;
}
.doc-tbl td { border-bottom: 1px solid #ddd; padding: 4px 3px; vertical-align: top; }
.doc-tbl td.c { text-align: center; white-space: nowrap; }
.doc-tbl td.d { text-align: right; white-space: nowrap; }
.doc-cod { color: #b00; }
.doc-nota { font-weight: 700; }

.doc-tot { margin-top: 10px; }
.doc-tot > div {
    display: flex; justify-content: flex-end; gap: 14px; padding: 2px 0;
}
.doc-tot span { font-weight: 700; }
.doc-tot b { min-width: 78px; text-align: right; }
.doc-total { border-top: 1px solid #000; padding-top: 4px; font-size: .72rem; }

.doc-notas { margin-top: 12px; border-top: 1px solid #ddd; padding-top: 8px; white-space: pre-line; }
.doc-notas-t { font-weight: 700; margin-bottom: 3px; }

/* Cabecera de la oferta en una línea + botón de documento centrado. */
.of-cab { font-size: .92rem; line-height: 1.45; color: var(--aiq-ink); padding-right: 40px; }
.of-doc { display: flex; justify-content: center; margin: 12px 0 6px; }
.btn-doc {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 8px 16px; border-radius: 999px;
    background: var(--aiq-blue); border: none; color: #fff;
    font-weight: 700; font-size: .85rem;
}
.btn-doc:active { opacity: .85; }
/* En Contactos el botón va al final y las tarjetas ocupan todo el ancho. */
.sec[data-sec="contactos"] .btn-add { margin: 12px 0 0; }
.cto-list { width: 100%; }
.doc-pie {
    margin-top: 16px; padding-top: 8px; border-top: 1px solid #ddd;
    text-align: center; font-size: .55rem; color: #444;
}

/* ── Histórico del cliente ─────────────────────────────────────────────── */
.sub-tabs { display: flex; gap: 6px; margin-bottom: 12px; }
/* Histórico › Productos servidos */
.serv-mas { width: 100%; margin-top: 10px; }
.sub-btn {
    flex: 1; background: var(--aiq-bg); border: 1px solid var(--aiq-line);
    border-radius: 999px; padding: 7px 4px;
    font-weight: 700; font-size: .8rem; color: var(--aiq-muted);
}
.sub-btn.active { background: #fff; border-color: var(--aiq-blue); color: var(--aiq-blue-dark); }

.sem { border-radius: 12px; padding: 12px 14px; margin-bottom: 12px; }
.sem-t { font-weight: 800; font-size: .95rem; }
.sem-s { font-size: .8rem; margin-top: 3px; opacity: .9; }
.sem-ok   { background: var(--ok-bg);   color: var(--ok-fg); }
.sem-ojo  { background: var(--warn-bg); color: var(--warn-fg); }
.sem-mal  { background: var(--bad-bg);  color: var(--bad-fg); }
.sem-nada { background: var(--aiq-bg);  color: var(--aiq-muted); }

.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.kpi { background: var(--aiq-bg); border-radius: 12px; padding: 10px 12px; }
.kpi-k {
    font-size: .68rem; font-weight: 700; color: var(--aiq-muted);
    text-transform: uppercase; letter-spacing: .4px;
}
.kpi-v { font-size: 1.15rem; font-weight: 800; color: var(--aiq-ink); margin-top: 2px; }
.kpi-n { font-size: .72rem; color: var(--aiq-muted); margin-top: 2px; }

.var-sube  { color: var(--ok-fg); font-weight: 700; }
.var-baja  { color: var(--aiq-danger); font-weight: 700; }
.var-igual { color: var(--aiq-muted); font-weight: 700; }
.var-nada  { color: var(--aiq-muted); }

.h-sec2 {
    font-size: .74rem; font-weight: 800; color: var(--aiq-blue-dark);
    text-transform: uppercase; letter-spacing: .4px; margin: 16px 0 8px;
    display: flex; align-items: center; gap: 6px;
}
.grafico {
    width: 100%; height: 120px; display: block;
    background: var(--aiq-bg); border-radius: 10px;
}
.grafico .bar { fill: var(--aiq-blue); }
.grafico .bar-act { fill: var(--aiq-orange); }
.grafico .bar-sep { stroke: #c9d8ef; stroke-width: 1; stroke-dasharray: 2 2; }
.grafico .bar-anio { fill: var(--aiq-muted); font-size: 8px; font-weight: 700; }

.hist-tbl .fila-tot td { background: var(--aiq-bg); border-top: 2px solid var(--aiq-line); }

/* ── Demandas generales: filtros por estado ────────────────────────────── */
.chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 10px; }
.chip {
    display: flex; align-items: center; gap: 5px; white-space: nowrap;
    background: #fff; border: 1px solid var(--aiq-line); border-radius: 999px;
    padding: 6px 12px; font-weight: 700; font-size: .8rem; color: var(--aiq-ink);
}
.chip.sel { border-color: var(--aiq-blue); box-shadow: inset 0 0 0 1px var(--aiq-blue); }
.chip-n { color: var(--aiq-muted); font-size: .74rem; }
.chip.dem-entrega   { background: rgba(0, 204, 0, .2); }
.chip.dem-pedido    { background: rgba(255, 128, 255, .2); }
.chip.dem-enstock   { background: #afdff5; }
.dem-com { font-size: .78rem; margin-top: 2px; }
.dem-cant  { font-weight: 700; white-space: nowrap; }
.dem-stock { color: var(--aiq-muted); white-space: nowrap; }
/* Stock en el buscador de Nueva demanda: verde si hay, rojo si 0 o negativo */
.nd-stock { font-weight: 700; }
.nd-stock.ok  { color: var(--ok-fg); }
.nd-stock.bad { color: var(--bad-fg); }
.stock-big {
    display: inline-block; padding: 4px 12px; border-radius: 8px;
    font-size: 1.15rem; font-weight: 800; white-space: nowrap;
}
.stock-big.ok  { background: var(--ok-bg);  color: var(--ok-fg); }
.stock-big.bad { background: var(--bad-bg); color: var(--bad-fg); }
.nd-stock-line { margin-top: 6px; }
.tbl tbody tr.dem-entrega   td { background: rgba(0, 204, 0, .2); }
.tbl tbody tr.dem-pedido    td { background: rgba(255, 128, 255, .2); }
.tbl tbody tr.dem-enstock   td { background: #afdff5; }
.tbl tbody tr.cli-cab td {
    background: var(--aiq-bg); color: var(--aiq-blue-dark);
    font-weight: 800; font-size: .82rem; text-transform: uppercase; letter-spacing: .3px;
    border-bottom: 1px solid var(--aiq-line);
}
.cli-n {
    background: #fff; border: 1px solid var(--aiq-line); border-radius: 999px;
    padding: 0 8px; margin-left: 6px; font-size: .74rem; color: var(--aiq-muted);
}

/* ── Hoja de acciones de una demanda ───────────────────────────────────── */
.acc-est { margin: 14px 0 6px; }
.acc-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.acc {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    background: var(--aiq-bg); border: 1px solid var(--aiq-line); border-radius: 12px;
    padding: 12px 8px; font-weight: 700; font-size: .88rem; color: var(--aiq-blue-dark);
}
.acc:active { background: #e4eefd; }
.acc-mal { color: var(--aiq-danger); border-color: #f3cfcb; }
.btn-mal { background: var(--aiq-danger); color: #fff; }
.acc-aviso {
    display: flex; align-items: center; gap: 8px; margin: 14px 0;
    background: var(--bad-bg); color: var(--bad-fg);
    border-radius: 12px; padding: 12px; font-weight: 700; font-size: .88rem;
}
.prove-sel {
    background: var(--aiq-bg); border-radius: 10px; padding: 10px 12px;
    display: flex; align-items: center; gap: 8px; color: var(--aiq-ink);
}

/* Proveedor asignado en la lista de compra: amarillo, como .but_amarillo del ERP. */
.prove-tag {
    display: inline-block; margin-top: 3px;
    background: #ff0; color: #000; font-weight: 700; font-size: .74rem;
    border-radius: 4px; padding: 1px 7px;
}
.sel-prove {
    width: 100%; margin-bottom: 10px; font-weight: 700;
    border-radius: 12px; padding: 12px 14px;
}
/* Comentarios de la demanda, con los colores del ERP:
   texto de demanda en rojo (.textodemanda) y texto de cliente en magenta
   (.textolinea), ambos en negrita. */
.com-k {
    display: inline-block; margin-right: 5px; padding: 0 5px;
    background: var(--aiq-line); color: var(--aiq-muted);
    border-radius: 4px; font-size: .66rem; font-weight: 700; text-transform: uppercase;
}
.dem-com { color: #f00; font-weight: 700; }
.dem-cli { color: #f0f; font-weight: 700; }

/* ── Tareas · Mi día ───────────────────────────────────────────────────── */
.hola .btn-add { margin: 12px 0 0; }
.panel-tar { padding: 14px 16px; }
.panel-h { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; font-size: .95rem; }
.panel-ic { color: var(--aiq-blue); display: flex; }
.panel-n {
    margin-left: auto; background: var(--aiq-bg); color: var(--aiq-muted);
    border-radius: 999px; padding: 1px 9px; font-size: .78rem; font-weight: 700;
}
.panel-fle { color: var(--aiq-muted); display: flex; transition: transform .18s ease; }
.panel-h.abierta .panel-fle { transform: rotate(180deg); }
.panel-vacio { margin: 0; font-size: .86rem; }

.tar-list { display: flex; flex-direction: column; gap: 8px; }
.tar {
    display: block; width: 100%; text-align: left;
    background: var(--aiq-bg); border: 1px solid var(--aiq-line); border-radius: 12px;
    padding: 10px 12px; font-family: inherit;
}
.tar:active { background: #e4eefd; }
.tar-t { font-weight: 700; font-size: .92rem; color: var(--aiq-ink); line-height: 1.3; }
.tar-fuego { margin-right: 3px; }
.tar-m { color: var(--aiq-muted); font-size: .76rem; margin-top: 3px; }
.tar-tipo { display: inline-flex; align-items: center; gap: 3px; }
.tar-p { display: flex; align-items: center; gap: 8px; margin-top: 7px; }
.tar-est {
    color: #fff; border-radius: 999px; padding: 1px 9px;
    font-size: .7rem; font-weight: 700;
}
.tar-venc { font-size: .74rem; color: var(--aiq-muted); }
.venc-mal { color: var(--aiq-danger); font-weight: 700; }
.venc-hoy { color: var(--warn-fg); font-weight: 700; }
.venc-ojo { color: var(--warn-fg); }

.tar-estados { display: flex; flex-direction: column; gap: 6px; }
.est-btn.tar-e { border-width: 2px; }

.hist-tar { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.hist-l {
    background: var(--aiq-bg); border-radius: 8px; padding: 7px 10px;
    font-size: .82rem; color: var(--aiq-ink);
}
.hist-f { color: var(--aiq-muted); font-size: .74rem; margin-left: 6px; }

.tipo-pick { display: flex; gap: 6px; }
.tipo-op { flex: 1; }
.tipo-op input { position: absolute; opacity: 0; pointer-events: none; }
.tipo-op span {
    display: flex; align-items: center; justify-content: center; gap: 5px;
    background: var(--aiq-bg); border: 1px solid var(--aiq-line); border-radius: 10px;
    padding: 9px 4px; font-weight: 700; font-size: .82rem; color: var(--aiq-muted);
}
.tipo-op input:checked + span {
    background: #fff; border-color: var(--aiq-blue); color: var(--aiq-blue-dark);
}
.dest-lista {
    display: flex; flex-wrap: wrap; gap: 6px;
    max-height: 168px; overflow-y: auto; padding: 2px;
}
.dest input { position: absolute; opacity: 0; pointer-events: none; }
.dest span {
    display: inline-block; background: #fff; border: 1px solid var(--aiq-line);
    border-radius: 999px; padding: 6px 12px; font-size: .82rem; color: var(--aiq-ink);
}
.dest input:checked + span { background: var(--aiq-blue); border-color: var(--aiq-blue); color: #fff; }
.dest-dep span { border-style: dashed; }

/* ── Tarjetas de SAT y garantías en Mi día ─────────────────────────────── */
.sat-list { display: flex; flex-direction: column; }
.sat-f { padding: 8px 0; border-bottom: 1px solid var(--aiq-line); }
.sat-f:last-child { border-bottom: none; }
.sat-est { font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .3px; }
.sat-maq { font-size: .88rem; color: var(--aiq-ink); margin-top: 2px; line-height: 1.3; }
.sat-sn { color: var(--aiq-muted); font-size: .76rem; font-weight: 400; }
.sat-cli { font-size: .78rem; color: var(--aiq-muted); margin-top: 1px; }
.sat-sub {
    margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--aiq-line);
    font-size: .72rem; font-weight: 800; color: var(--aiq-muted);
    text-transform: uppercase; letter-spacing: .3px;
}
.sat-viejas { opacity: .72; }
.gar-ic { color: var(--warn-fg); }

/* ── Estadísticas de producto ──────────────────────────────────────────── */
.verdict {
    border-radius: 12px; padding: 10px 12px; margin-bottom: 8px;
    font-size: .86rem; font-weight: 600; line-height: 1.35;
}
.v-ok  { background: var(--ok-bg);   color: var(--ok-fg); }
.v-ojo { background: var(--warn-bg); color: var(--warn-fg); }
.v-mal { background: var(--bad-bg);  color: var(--bad-fg); }

.kpi-u { font-size: .72rem; font-weight: 600; color: var(--aiq-muted); }
.precios { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.precio {
    background: var(--aiq-bg); border-radius: 10px; padding: 9px 11px;
    display: flex; flex-direction: column; gap: 2px;
}
.precio span { font-size: .72rem; color: var(--aiq-muted); font-weight: 600; text-transform: uppercase; }
.precio b { font-size: .98rem; color: var(--aiq-ink); }

.grafico .bar-com { fill: var(--aiq-orange); }
.ley { display: inline-block; width: 10px; height: 10px; border-radius: 2px; vertical-align: -1px; }
.ley-v { background: var(--aiq-blue); }
.ley-c { background: var(--aiq-orange); }

/* ── Oferta → demandas: líneas marcables ───────────────────────────── */
/* Toda la fila es zona de toque; el cuadrito va grande para el dedo. */
.tbl td.lin-c, .tbl th.lin-c { width: 1%; text-align: center; padding-right: 0; }
.lin-chk, #ofAll { width: 18px; height: 18px; accent-color: var(--aiq-blue); }
.tbl tbody tr.lin-sel td { background: #dbe9ff; }
.of-acc { display: flex; justify-content: flex-end; margin-top: 10px; }
.of-acc .btn:disabled { opacity: .45; }

/* ── Pizarra de botellas de gas ─────────────────────────────────────────── */
/* Lista compartida del equipo dentro de "Mi día". Tachar = albarán metido en
   la web de LINDE; lo tachado baja al final y se borra solo a los 3 días. */
.bot-ic { color: var(--aiq-orange); }
.bot-btns { display: flex; gap: 8px; }
.bot-btns .btn-add { margin-bottom: 10px; }
.bot-mic { border-color: var(--aiq-orange); color: var(--aiq-orange); }
.bot-mic:active { background: #fdf1dc; }
.bot-mic.grabando {
    background: var(--bad-bg); border-style: solid; border-color: var(--aiq-danger);
    color: var(--aiq-danger); animation: bot-late 1.1s ease-in-out infinite;
}
@keyframes bot-late { 50% { opacity: .55; } }

.bot-list { display: flex; flex-direction: column; gap: 8px; }
.bot-f {
    display: flex; align-items: flex-start; gap: 10px;
    background: var(--aiq-bg); border: 1px solid var(--aiq-line);
    border-radius: 12px; padding: 10px 10px 10px 12px;
}
.bot-check {
    flex: none; width: 24px; height: 24px; margin-top: 1px;
    border: 2px solid var(--aiq-blue); border-radius: 7px; background: #fff;
    color: #fff; display: flex; align-items: center; justify-content: center;
    padding: 0;
}
.bot-check:active { background: #e4eefd; }
.bot-txt { flex: 1; min-width: 0; }
.bot-t { font-weight: 700; font-size: .92rem; line-height: 1.3; overflow-wrap: anywhere; }
.bot-c { color: #c0c; font-weight: 600; font-size: .84rem; margin-top: 2px; overflow-wrap: anywhere; white-space: pre-line; }
.bot-m {
    display: flex; align-items: center; gap: 4px;
    color: var(--aiq-muted); font-size: .76rem; margin-top: 3px;
}
.bot-e, .bot-x {
    flex: none; width: 28px; height: 28px; border-radius: 8px;
    background: transparent; border: 0; color: var(--aiq-muted);
    display: flex; align-items: center; justify-content: center; padding: 0;
}
.bot-e:active { color: var(--aiq-blue); }
.bot-x:active { color: var(--aiq-danger); }
textarea.f-in.bot-fcom { color: #c0c; font-weight: 600; min-height: 2.6rem; }

/* Tachadas: se quedan al final, apagadas y con el texto rayado. */
.bot-f.bot-hecha { background: #fff; border-style: dashed; opacity: .62; }
.bot-hecha .bot-t { text-decoration: line-through; font-weight: 600; }
.bot-hecha .bot-check { background: var(--ok-fg); border-color: var(--ok-fg); }

.bot-esperando { opacity: .45; }
.bot-dictado {
    display: flex; align-items: center; gap: 5px;
    margin: 0; color: var(--aiq-muted); font-size: .8rem; font-style: italic;
}

/* ── Jornada laboral ────────────────────────────────────────────────────── */
.jor-tabs .sub-btn { padding: 7px 2px; font-size: .76rem; }
.jor-sel { width: 100%; margin-bottom: 10px; font-weight: 700; }
.jor-card { text-align: center; }
.jor-fecha { color: var(--aiq-muted); font-weight: 700; text-transform: capitalize; }
.jor-reloj { font-size: 2.4rem; font-weight: 800; letter-spacing: 1px; margin: 2px 0 14px; font-variant-numeric: tabular-nums; }
.jor-centro { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.jor-nota { margin: 0; font-size: .9rem; }
.jor-btns { display: flex; gap: 10px; }
.jor-btn {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px;
    border: 0; border-radius: 16px; padding: 18px 8px; color: #fff; font-family: inherit;
    box-shadow: 0 4px 12px rgba(0,0,0,.12);
}
.jor-btn span { font-size: 1.05rem; font-weight: 800; letter-spacing: .5px; }
.jor-btn small { font-size: .74rem; opacity: .9; }
.jor-btn.ent { background: var(--ok-fg); }
.jor-btn.sal { background: var(--aiq-danger); }
.jor-btn:active { transform: scale(.98); }
.jor-hs { display: flex; justify-content: center; gap: 24px; margin-bottom: 6px; }
.jor-hs small { display: block; font-size: .72rem; color: var(--aiq-muted); }
.jor-hs b { font-size: 1.5rem; font-weight: 800; }
.jor-hora { width: 100%; text-align: center; font-size: 2rem; font-weight: 800; margin: 6px 0 10px; }
.btn-ok { background: var(--ok-fg); color: #fff; }

/* Tabla de la semana: compacta, seis columnas */
.jor-tbl { font-size: .8rem; }
.jor-tbl tbody td { padding: 8px 5px; white-space: nowrap; }
.jor-tbl thead th { padding: 8px 5px; cursor: default; }
.tbl tbody tr.jr-falta td { background: var(--bad-bg); }
.tbl tbody tr.jr-hoy td   { background: #dbe9ff; }
.tbl tbody tr.jr-esp td   { background: #f7f9fc; color: var(--aiq-muted); }
.tbl tbody tr.jr-libre td { color: var(--aiq-muted); }
.tbl tbody tr.jr-corto td { background: var(--warn-bg); }

/* Navegación mes / año */
.jor-nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.jor-nav b { flex: 1; text-align: center; display: inline-flex; align-items: center; justify-content: center; gap: 6px; font-size: 1rem; }
.jor-nav-b {
    background: var(--aiq-bg); border: 1px solid var(--aiq-line); border-radius: 10px;
    color: var(--aiq-blue-dark); font-weight: 700; font-size: .8rem; padding: 6px 10px;
    display: flex; align-items: center;
}
.kpis-3 { grid-template-columns: 1fr 1fr 1fr; }
.jor-mes-cab { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.jor-mes-cab .h-sec2 { margin: 0; }
.jor-add { width: auto; margin: 0; padding: 6px 12px; font-size: .8rem; }

/* Lista de días (mes, vacaciones, equipo, calendario) */
.jor-dias { display: flex; flex-direction: column; }
.jor-dia {
    display: flex; align-items: center; gap: 10px; padding: 9px 4px;
    border-bottom: 1px solid var(--aiq-line); font-size: .86rem;
}
.jor-dia:last-child { border-bottom: 0; }
.jor-dia:active { background: var(--aiq-bg); }
.jor-dia-f { flex: none; width: 40px; text-align: center; line-height: 1.1; }
.jor-dia-f b { display: block; font-size: .7rem; color: var(--aiq-muted); text-transform: uppercase; }
.jor-dia-f span { font-size: 1.1rem; font-weight: 800; }
.jor-dia-c { flex: 1; min-width: 0; }
.jor-dia-obs { font-size: .74rem; color: var(--aiq-muted); margin-top: 2px; overflow-wrap: anywhere; }
.jor-dia-r { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.jor-dia-r b { font-size: .84rem; }
.jor-mark { font-size: .68rem; background: var(--aiq-bg); border-radius: 6px; padding: 1px 5px; color: var(--aiq-muted); }
.jor-dia.jr-falta { background: var(--bad-bg); border-radius: 8px; }
.jor-dia.jr-hoy   { background: #dbe9ff; border-radius: 8px; }
.jor-dia.jr-corto { background: var(--warn-bg); border-radius: 8px; }
.jor-dia.jr-esp, .jor-dia.jr-finde, .jor-dia.jr-past { opacity: .7; }
.jor-eq .jor-dia-r { flex-direction: row; align-items: center; color: var(--aiq-muted); }
.jor-sep { margin-top: 14px; }
.jor-fest { display: flex; flex-wrap: wrap; gap: 6px; }

/* Barra de vacaciones */
.jor-bar { display: flex; height: 10px; background: var(--aiq-bg); border-radius: 999px; overflow: hidden; margin-top: 12px; }
.jor-bar-d { background: var(--ok-fg); }
.jor-bar-p { background: var(--aiq-blue); }
.jor-bar-ley { display: flex; gap: 12px; font-size: .74rem; color: var(--aiq-muted); margin: 6px 0 4px; }
.jor-bar-ley span:last-child { margin-left: auto; }
.jor-bar-ley i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; vertical-align: -1px; margin-right: 3px; }
.ley-d { background: var(--ok-fg); }
.ley-p { background: var(--aiq-blue); }

.badge.blue { background: #dbe9ff; color: var(--aiq-blue-dark); }
.badge.dark { background: #333d55; color: #fff; }
.txt-ojo  { color: var(--warn-fg); font-weight: 700; }
.txt-azul { color: var(--aiq-blue-dark); font-weight: 700; }

/* ── Frutargas / RETO ─────────────────────────────────────────────────── */
.qa.qa-fruta .qa-ic { color: #2e7d32; }
.fru-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 14px; }
.fru-btn {
    display: flex; flex-direction: column; align-items: center; gap: 2px;
    border-radius: 16px; padding: 18px 10px; color: #fff; text-decoration: none;
    box-shadow: 0 4px 14px rgba(0,0,0,.14);
}
.fru-btn span { font-size: 1.25rem; font-weight: 800; margin-top: 4px; }
.fru-btn small { font-size: .74rem; opacity: .9; }
.fru-ent { background: #2e7d32; }
.fru-sal { background: var(--aiq-blue-dark); }
.fru-btn:active { filter: brightness(.92); }
.fru-kpis .kpi-pend { background: var(--warn-bg); }
.fru-kpis .kpi-pend .kpi-v { color: var(--warn-fg); }

/* Carnet de fitosanitarios: nivel = color (sin estilos inline) */
.carnet {
    display: flex; align-items: center; gap: 10px; border-radius: 14px; padding: 12px 14px;
    color: #fff; margin: 14px 0; box-shadow: 0 3px 10px rgba(0,0,0,.12);
}
.carnet-t { font-weight: 800; }
.carnet-s { font-size: .78rem; opacity: .92; }
.carnet-ok       { background: #2e7d32; }
.carnet-aviso    { background: #ef6c00; }
.carnet-urgente  { background: #d84315; }
.carnet-critico  { background: #c62828; }
.carnet-caducado { background: #7f0000; }
.carnet-na       { background: var(--aiq-muted); }

.fru-list { display: flex; flex-direction: column; }
.fru-row {
    display: grid; grid-template-columns: auto 1fr auto; column-gap: 8px; row-gap: 2px;
    padding: 8px 0; border-bottom: 1px solid var(--aiq-line); font-size: .82rem;
}
.fru-row:last-child { border-bottom: none; }
.fru-tag { font-size: .68rem; font-weight: 700; padding: 2px 7px; border-radius: 999px; color: #fff; align-self: center; }
.fru-tag-ent { background: #2e7d32; }
.fru-tag-sal { background: var(--aiq-blue-dark); }
.fru-icc { font-weight: 600; color: var(--aiq-ink); }
.fru-l { color: var(--aiq-muted); }
.fru-who { grid-column: 2; color: var(--aiq-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fru-f { grid-column: 3; color: var(--aiq-muted); text-align: right; }

/* ── Avisos push de fichaje (js/push.js) ─────────────────────────────── */
.push-card .push-txt { margin-top: 8px; font-size: .9rem; }
.push-btns { display: flex; gap: 10px; margin-top: 12px; }
.push-msg { margin: 10px 0 0; font-size: .82rem; color: var(--aiq-muted); min-height: 0; }
.push-msg:empty { display: none; }
.push-msg.error { color: var(--aiq-danger); }
/* Banner «fichaje pendiente» en Inicio: un .sem que se puede tocar */
.sem-btn { display: block; width: 100%; text-align: left; border: 0; font-family: inherit; cursor: pointer; }
.sem-btn:active { opacity: .85; }

/* ── Módulo comercial: bloque en la ficha del cliente (comercial_ficha.js) ── */
.com-card-m { padding-top: 12px; }
.com-cab-m { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin-bottom: 10px; }
.com-sem { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .78rem; font-weight: 800; }
.com-sem-al_dia { background: var(--ok-bg); color: var(--ok-fg); }
.com-sem-pronto { background: var(--warn-bg); color: var(--warn-fg); }
.com-sem-atrasado { background: var(--bad-bg); color: var(--bad-fg); }
.com-sem-sin_visitar { background: #dbe9ff; color: var(--aiq-blue-dark); }
.com-sem-sin_frecuencia { background: #eef1f6; color: #4b5670; }
.com-sem-no_visitar { background: #6b7793; color: #fff; }
.com-sub-m { color: var(--aiq-muted); font-size: .82rem; }
.com-acc3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.com-acc3.com-acc-1 { grid-template-columns: 1fr; }
.com-acc3.com-acc-2 { grid-template-columns: repeat(2, 1fr); }
.com-acc-b {
    min-height: 48px; display: flex; align-items: center; justify-content: center; gap: 6px;
    border-radius: 12px; border: 1px solid var(--aiq-line); background: var(--aiq-bg);
    color: var(--aiq-blue-dark); font-weight: 700; font-size: .86rem; text-decoration: none;
    font-family: inherit;
}
.com-acc-b.pri { background: var(--aiq-blue); border-color: var(--aiq-blue); color: #fff; }
.com-acc-b.off { opacity: .45; }
.com-acc-b:active { opacity: .85; }
.com-prox { border-radius: 12px; padding: 12px 14px; margin-bottom: 10px; }
.com-prox-rot { font-size: .72rem; font-weight: 800; letter-spacing: .03em; }
.com-prox-txt { font-size: 1rem; font-weight: 800; margin-top: 2px; }
.com-prox-nota { font-size: .84rem; margin-top: 3px; white-space: pre-line; opacity: .9; }
.com-prox-btns { display: flex; gap: 8px; margin-top: 8px; }
.com-mini {
    background: #fff; border: 1px solid currentColor; border-radius: 10px; padding: 6px 12px;
    font-family: inherit; font-weight: 700; font-size: .82rem; color: var(--aiq-ink);
}
.com-nota-m {
    display: flex; gap: 8px; align-items: flex-start; margin-bottom: 10px;
    background: #fff3cd; border: 1px solid #ffecb5; border-radius: 12px; padding: 10px 12px;
    font-size: .88rem; white-space: pre-line; color: #5c4700;
}
.com-frec-m { margin-bottom: 12px; }
.com-hist-m { display: flex; flex-direction: column; gap: 8px; }
.com-hi-m {
    display: block; width: 100%; text-align: left; font-family: inherit; color: inherit;
    background: var(--aiq-bg); border: 0; border-radius: 8px; padding: 9px 11px;
}
.com-hi-m.plan { background: #fffaf0; border: 1px dashed var(--aiq-orange); }
.com-hi-m.canc { opacity: .55; }
.com-hi-m-cab { display: flex; align-items: center; gap: 8px; margin-bottom: 3px; }
.com-hi-m-f { font-size: .76rem; color: var(--aiq-muted); }
.com-hi-m-t { font-size: .88rem; white-space: pre-line; overflow-wrap: anywhere; margin: 0; }
.com-tipo { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: .7rem; font-weight: 800; }
.com-tipo-visita { background: #dbe9ff; color: var(--aiq-blue-dark); }
.com-tipo-llamada, .com-tipo-otro { background: #eef1f6; color: #4b5670; }
.com-tipo-email { background: #ecebff; color: #4f4cb8; }
.com-tipo-oferta { background: var(--warn-bg); color: #8a5a10; }
.com-modal-cli { margin: -4px 0 10px; color: var(--aiq-blue-dark); font-weight: 700; text-transform: uppercase; font-size: .82rem; }
.com-form { display: flex; flex-direction: column; gap: 10px; }
.com-seg { display: flex; gap: 6px; }
.com-seg-b, .com-res-b {
    flex: 1; min-height: 42px; border-radius: 10px; border: 1px solid var(--aiq-line);
    background: var(--aiq-bg); color: var(--aiq-muted); font-family: inherit; font-weight: 700; font-size: .84rem;
}
.com-seg-b.activo { background: var(--aiq-blue); border-color: var(--aiq-blue); color: #fff; }
.com-res { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.com-res-b.activo { background: #fff; border-color: var(--aiq-blue); color: var(--aiq-blue-dark); box-shadow: inset 0 0 0 1px var(--aiq-blue); }
.com-mic-m { margin-bottom: 6px; }
.com-geo {
    display: flex; align-items: center; gap: 6px; margin: 0;
    background: var(--aiq-bg); color: var(--aiq-blue-dark); border-radius: 10px; padding: 8px 10px; font-size: .84rem;
}
.com-prox-f { display: flex; flex-direction: column; gap: 8px; border-top: 1px solid var(--aiq-line); padding-top: 10px; }
.com-prox-f-t { font-weight: 700; font-size: .86rem; }
.com-prox-f-t em { color: var(--aiq-muted); font-weight: 400; }
.com-lista-acc { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.com-toast {
    position: fixed; left: 16px; right: 16px; bottom: calc(var(--tabbar-h) + 14px + env(safe-area-inset-bottom));
    z-index: 60; background: var(--ok-bg); color: #17703c; border: 1px solid #bfe6cc;
    border-radius: 12px; padding: 12px 14px; font-weight: 700; font-size: .88rem; text-align: center;
}

/* ── Módulo comercial: vista «Comercial» (Hoy · Cartera · Agenda) ─────────── */
.com-tabs { margin-bottom: 10px; }
.com-hoy-ban { background: #dbe9ff; color: var(--aiq-blue-dark); border-radius: 12px; padding: 12px 14px; margin-bottom: 12px; }
.com-hoy-t { font-weight: 800; }
.com-hoy-s { font-size: .82rem; margin-top: 2px; }
.com-hoy-lista { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.com-hoy-lista .card + .card { margin-top: 0; }
.com-parada-cab { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 10px; }
.com-num {
    flex: none; width: 30px; height: 30px; border-radius: 50%; background: var(--aiq-orange); color: #fff;
    display: flex; align-items: center; justify-content: center; font-weight: 800;
}
.com-parada.hecha .com-num { background: #17703c; }
.com-parada.hecha { opacity: .8; }
.com-parada-txt { flex: 1; min-width: 0; }
.com-parada-meta { font-size: .78rem; color: var(--aiq-muted); }
.com-parada-nom {
    display: block; padding: 0; border: 0; background: none; font-family: inherit; text-align: left;
    font-weight: 800; color: var(--aiq-blue-dark); font-size: .98rem;
}
.com-parada-nota { font-size: .86rem; margin-top: 2px; white-space: pre-line; }
.com-parada-fija { font-size: .8rem; margin-top: 4px; color: #5c4700; background: #fff3cd; border-radius: 8px; padding: 4px 8px; }
.com-parada-ok { background: var(--ok-bg); color: #17703c; border-radius: 10px; padding: 8px 10px; font-weight: 700; font-size: .84rem; }
.com-parada .com-acc3 { margin-bottom: 0; }
.com-atr-tit { font-weight: 800; font-size: .8rem; color: var(--aiq-blue-dark); letter-spacing: .03em; margin-bottom: 8px; }
.com-atr-n { color: var(--aiq-muted); font-weight: 600; }
.com-lista { display: flex; flex-direction: column; gap: 6px; }
.com-fila {
    display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; font-family: inherit; color: inherit;
    background: var(--aiq-bg); border: 1px solid var(--aiq-line); border-radius: 10px; padding: 9px 10px;
}
.com-fila-txt { flex: 1; min-width: 0; }
.com-fila-nom { font-weight: 700; color: var(--aiq-blue-dark); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.com-fila-sub { font-size: .76rem; color: var(--aiq-muted); }
.com-ver-cartera { margin: 10px 0 0; }
.com-dia-nav { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.com-dia-t {
    flex: 1; border: 1px solid var(--aiq-line); background: #fff; border-radius: 10px; padding: 8px;
    font-family: inherit; font-weight: 800; color: var(--aiq-ink);
}
.com-dia-ayuda { margin-bottom: 8px; }
.com-sinh { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.com-dia { display: flex; background: #fff; border: 1px solid var(--aiq-line); border-radius: 12px; overflow: hidden; }
.com-dia-horas { position: relative; flex: none; width: 46px; border-right: 1px solid var(--aiq-line); }
.com-dia-h { position: absolute; right: 5px; font-size: .68rem; color: var(--aiq-muted); transform: translateY(-2px); }
.com-dia-col {
    position: relative; flex: 1;
    background-image: repeating-linear-gradient(to bottom, #eef1f6 0, #eef1f6 1px, transparent 1px, transparent 40px);
}
.com-ev {
    --com-color: var(--aiq-blue);
    background: var(--com-color); color: #fff; border-radius: 8px; padding: 4px 8px; font-size: .78rem; line-height: 1.25;
    overflow: hidden; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
.com-ev.pos { position: absolute; left: 4px; right: 4px; }
.com-ev.hecha { opacity: .45; }
.com-ev.arrastrando { opacity: .9; box-shadow: 0 6px 16px rgba(16, 26, 48, .35); z-index: 5; touch-action: none; }
.com-ev-t { font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.com-ev-s { font-size: .7rem; opacity: .9; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.com-nolab {
    display: flex; align-items: center; gap: 6px; margin-bottom: 6px;
    background: #eef1f6; color: #4b5670; border-radius: 10px; padding: 7px 10px; font-size: .82rem; font-weight: 700;
}
.com-novis { margin-bottom: 10px; }
.com-navegar { text-decoration: none; margin-bottom: 14px; }
/* Comisiones (móvil) */
.com-co-sel { margin-bottom: 10px; }
.com-co-actual { text-align: center; }
.com-co-grande { font-size: 2rem; font-weight: 800; color: var(--aiq-blue-dark); margin: 4px 0; }
.com-co-tramos-m { display: flex; flex-direction: column; gap: 4px; margin-top: 10px; text-align: left; font-size: .84rem; }
.com-co-tramos-m div { display: flex; justify-content: space-between; border-top: 1px solid var(--aiq-line); padding-top: 4px; }
.com-co-imp { font-weight: 800; white-space: nowrap; }
.com-co-imp.neg { color: var(--bad-fg); }
.com-fila:disabled { opacity: .55; }
.com-nc-lista { max-height: 38vh; overflow-y: auto; }
.com-nc-cli { margin: 0; background: #dbe9ff; color: var(--aiq-blue-dark); border-radius: 10px; padding: 8px 10px; font-weight: 700; font-size: .88rem; }
