/* ==========================================================================
   GestioERP Ventas — hoja de estilo de la app externa.

   Es una app fuera del ERP, con su propio diseño: por eso no carga Bootstrap.
   Los colores salen de las variables del tema (--ge-1/2/3) cuando la
   instalación las define, y si no de los valores por defecto de GestioERP.

   Móvil primero. A partir de 768 px el menú inferior se cambia por el
   superior y el contenido se centra en una columna de 1180 px.
   ========================================================================== */

:root {
    --g: var(--ge-1, #0D9E80);
    --g-d: var(--ge-2, #0B6B58);
    --g-dd: color-mix(in srgb, var(--g-d) 78%, #000);
    --g-l: var(--ge-3, #6FD9BE);
    --wash: color-mix(in srgb, var(--g) 12%, #fff);

    --ink: #0E1A17;
    --ink-2: #3C4F49;
    --mut: #7A8D86;
    --line: #E2EBE7;
    --surf: #fff;
    --canvas: #F4F7F5;

    /* Semánticos: separados de la marca para que el estado se lea de un vistazo. */
    --amber: #C77700;
    --amber-w: #FDF4E4;
    --red: #B3402F;
    --red-w: #FBEDEA;
    --slate: #5A7180;
    --slate-w: #EEF2F4;
    --brass: #8A5E10;
    --brass-w: #FBF1DE;
}

* { box-sizing: border-box; }

body.av {
    margin: 0;
    background: var(--canvas);
    color: var(--ink);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.45;
    -webkit-font-smoothing: antialiased;
    padding-bottom: 86px;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; }
.num, .amt, .money { font-variant-numeric: tabular-nums; }
.mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 12px; letter-spacing: -.02em; }
.ocultar-movil { display: none; }
.solo-movil { display: block; }
.wsalir, .wayuda { display: none; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--g) 45%, transparent); outline-offset: 2px; }

/* ── Logo ─────────────────────────────────────────────────────────────── */
.logo { display: flex; align-items: center; gap: 9px; justify-content: center; }
.logomark {
    width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; flex: none;
    background: linear-gradient(155deg, var(--g), var(--g-d));
}
.logomark.sm { width: 30px; height: 30px; border-radius: 9px; background: rgba(255, 255, 255, .16); }
.logotxt { font-weight: 800; letter-spacing: -.03em; font-size: 20px; line-height: 1; color: #fff; }
.logotxt span {
    display: block; font-size: 10.5px; font-weight: 700; letter-spacing: .16em;
    color: var(--g-l); text-transform: uppercase; margin-top: 3px;
}

/* ── Acceso ───────────────────────────────────────────────────────────── */
.av-login {
    min-height: 100vh; background: linear-gradient(168deg, var(--g-d), var(--g-dd));
    display: flex; align-items: center; justify-content: center; padding: 24px 20px;
}
/* El ancho máximo tiene que contar el padding del contenedor: con grid y
   max-width fijo, en un móvil de 390 px la tarjeta se salía por la derecha. */
.av-login-box { width: 100%; max-width: 360px; margin: 0 auto; }
.av-login-box .logo { margin-bottom: 6px; }
/* Logo oficial de GestioERP: grande y centrado sobre el verde. */
.av-login-logo { display: block; width: 100%; max-width: 264px; height: auto; margin: 0 auto 10px; }
.av-login-sub { text-align: center; color: var(--g-l); font-size: 13px; margin: 8px 0 22px; }
.av-login-pie { text-align: center; color: color-mix(in srgb, var(--g-l) 80%, #fff); font-size: 12px; margin-top: 18px; }
.av-login .card { border: none; border-radius: 20px; }

/* ── Cabecera de sección (verde en móvil, limpia en web) ───────────────── */
.top { background: linear-gradient(168deg, var(--g-d), var(--g-dd)); color: #fff; padding: 14px 16px 16px; }
.top .line1 { display: flex; align-items: center; gap: 12px; min-height: 38px; }
.top h1 { font-size: 20px; font-weight: 700; letter-spacing: -.02em; margin: 0; flex: 1; line-height: 1.2; }
.top .sub { font-size: 12.5px; color: color-mix(in srgb, var(--g-l) 85%, #fff); margin-top: 2px; }
.top .grande { font-size: 30px; font-weight: 800; letter-spacing: -.035em; line-height: 1.1; }
.top .etiqueta { font-size: 11px; letter-spacing: .12em; font-weight: 700; color: var(--g-l); }

.icobtn {
    width: 34px; height: 34px; border-radius: 11px; background: rgba(255, 255, 255, .14);
    display: grid; place-items: center; color: #fff; flex: none; border: none; cursor: pointer;
}
.icobtn.plain { background: none; width: 26px; }
.avat {
    width: 34px; height: 34px; border-radius: 50%; background: var(--g-l); color: var(--g-dd);
    display: grid; place-items: center; font-weight: 700; font-size: 13px; flex: none;
}

.searchbar {
    margin-top: 12px; height: 40px; background: rgba(255, 255, 255, .16); border-radius: 12px;
    display: flex; align-items: center; gap: 9px; padding: 0 12px;
}
.searchbar input {
    flex: 1; background: none; border: none; color: #fff; font-size: 14px; min-width: 0;
}
.searchbar input::placeholder { color: color-mix(in srgb, var(--g-l) 90%, #fff); }
.searchbar svg { color: color-mix(in srgb, var(--g-l) 90%, #fff); flex: none; }

/* ── Contenido ────────────────────────────────────────────────────────── */
.contenido {
    padding: 14px; display: flex; flex-direction: column; gap: 12px;
    max-width: 1180px; margin: 0 auto;
}
.sec-t {
    font-size: 11px; letter-spacing: .13em; text-transform: uppercase; color: var(--mut);
    font-weight: 700; margin: 2px 0 -4px;
}
.av-avisos { max-width: 1180px; margin: 0 auto; padding: 12px 14px 0; }
.aviso { border-radius: 12px; padding: 11px 14px; font-size: 13.5px; font-weight: 600; }
.aviso.bueno { background: var(--wash); color: var(--g-d); }
.aviso.malo { background: var(--red-w); color: var(--red); }

.card { background: var(--surf); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 1px 2px rgba(14, 26, 23, .04); }
/* Sirve suelta y sobre .card: los formularios de dentro de un desplegable la
   llevan sin ser tarjeta, y sin esto salían pegados a los bordes en el móvil. */
.pad { padding: 14px; }
.vacio { padding: 28px 14px; text-align: center; color: var(--mut); font-size: 13.5px; }

/* ── Indicadores ──────────────────────────────────────────────────────── */
.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.kpi { background: var(--surf); border: 1px solid var(--line); border-radius: 16px; padding: 13px 14px; }
.kpi .lab { font-size: 11.5px; color: var(--mut); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.kpi .val { font-size: 22px; font-weight: 750; letter-spacing: -.03em; margin-top: 5px; font-variant-numeric: tabular-nums; }
.kpi .foot { font-size: 11.5px; margin-top: 3px; font-weight: 600; color: var(--mut); }
.kpi.hi { background: linear-gradient(160deg, var(--g), var(--g-d)); border-color: transparent; color: #fff; }
.kpi.hi .lab, .kpi.hi .foot { color: color-mix(in srgb, var(--g-l) 85%, #fff); }
.kpi .val.amber { color: var(--amber); }
.kpi .val.red { color: var(--red); }
.kpi .foot.red { color: var(--red); }

/* ── Filas de lista ───────────────────────────────────────────────────── */
.rows { display: flex; flex-direction: column; }
.row {
    display: flex; align-items: center; gap: 12px; padding: 12px 14px;
    border-bottom: 1px solid var(--line); color: inherit;
}
.row:last-child { border-bottom: none; }
.row:hover { background: color-mix(in srgb, var(--wash) 45%, #fff); }
.row .grow { flex: 1; min-width: 0; overflow: hidden; }
.row .t { display: block; font-weight: 650; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .s { display: block; font-size: 12.5px; color: var(--mut); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .amt { text-align: right; font-weight: 700; letter-spacing: -.02em; flex: none; white-space: nowrap; }
.row .amt .u { font-size: 11.5px; color: var(--mut); font-weight: 600; display: block; margin-top: 2px; }
.row .amt.amber { color: var(--amber); }
.row .amt.red { color: var(--red); }
.chev { color: #B9C7C1; flex: none; }

.sq {
    width: 42px; height: 42px; border-radius: 13px; background: var(--wash); color: var(--g-d);
    display: grid; place-items: center; font-weight: 700; font-size: 13px; flex: none;
}
.sq.doc { background: var(--slate-w); color: var(--slate); }
.sq.amber { background: var(--amber-w); color: var(--amber); }
.sq.red { background: var(--red-w); color: var(--red); }

/* ── Estados ──────────────────────────────────────────────────────────── */
.pill {
    display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 700;
    padding: 3px 9px; border-radius: 999px; white-space: nowrap;
}
.pill.ok { background: var(--wash); color: var(--g-d); }
.pill.warn { background: var(--amber-w); color: var(--amber); }
.pill.bad { background: var(--red-w); color: var(--red); }
.pill.draft { background: var(--slate-w); color: var(--slate); }
.pill.brass { background: var(--brass-w); color: var(--brass); }

/* ── Chips y segmentos ────────────────────────────────────────────────── */
.chiprow { display: flex; gap: 7px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.chiprow::-webkit-scrollbar { display: none; }
.chip {
    border: 1px solid var(--line); background: var(--surf); color: var(--ink-2); border-radius: 999px;
    padding: 7px 13px; font-size: 12.5px; font-weight: 650; white-space: nowrap; cursor: pointer;
}
.chip.on { background: var(--g-d); border-color: var(--g-d); color: #fff; }

.seg { display: flex; background: rgba(255, 255, 255, .16); border-radius: 12px; padding: 3px; gap: 2px; margin-top: 12px; }
.seg a { flex: 1; text-align: center; font-size: 12.5px; font-weight: 650; padding: 7px 4px; border-radius: 9px; color: #fff; }
.seg a.on { background: #fff; color: var(--g-d); }

/* ── Pestañas de la ficha ─────────────────────────────────────────────── */
.tabs {
    display: flex; gap: 18px; overflow-x: auto; border-bottom: 1px solid var(--line);
    padding: 0 14px; background: var(--surf); scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tabs a {
    padding: 11px 0; font-size: 13px; font-weight: 650; color: var(--mut); white-space: nowrap;
    border-bottom: 2.5px solid transparent;
}
.tabs a.on { color: var(--g-d); border-bottom-color: var(--g); }

/* ── Botones ──────────────────────────────────────────────────────────── */
.btn {
    display: flex; align-items: center; justify-content: center; gap: 8px; height: 48px; width: 100%;
    border-radius: 14px; font-weight: 700; font-size: 15px; letter-spacing: -.01em;
    border: none; cursor: pointer; text-align: center;
}
.btn.pri { background: var(--g-d); color: #fff; box-shadow: 0 6px 14px -6px color-mix(in srgb, var(--g-d) 70%, transparent); }
.btn.pri:hover { background: var(--g-dd); }
.btn.sec { background: var(--surf); color: var(--g-d); border: 1.5px solid var(--g); }
.btn.brassy { background: var(--brass-w); color: var(--brass); border: 1.5px solid #E9CE96; }
.btn.peligro { background: var(--red-w); color: var(--red); }
.btn.sm { height: 38px; font-size: 13.5px; border-radius: 11px; padding: 0 14px; width: auto; }
.btn-fila { display: grid; grid-template-columns: 1fr 1.3fr; gap: 9px; }

/* ── Rejilla de acciones ──────────────────────────────────────────────── */
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 9px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; }
.act {
    background: var(--surf); border: 1px solid var(--line); border-radius: 15px; padding: 12px 5px;
    text-align: center; font-size: 11.5px; font-weight: 650; color: var(--ink-2); line-height: 1.25;
    display: block; cursor: pointer;
}
.act .ic {
    width: 36px; height: 36px; border-radius: 12px; background: var(--wash); color: var(--g-d);
    display: grid; place-items: center; margin: 0 auto 7px;
}
.act.on { border-color: var(--g); background: var(--wash); box-shadow: 0 0 0 3px color-mix(in srgb, var(--g) 15%, transparent); }
.act.on .ic { background: var(--g-d); color: #fff; }
.act.on span { color: var(--g-d); font-weight: 750; }
.act.brass .ic { background: var(--brass-w); color: var(--brass); }
.act.red .ic { background: var(--red-w); color: var(--red); }

/* ── Formularios ──────────────────────────────────────────────────────── */
.field { margin-bottom: 11px; }
.field:last-child { margin-bottom: 0; }
.field label { display: block; font-size: 11.5px; font-weight: 700; color: var(--ink-2); margin-bottom: 5px; }
.input {
    width: 100%; height: 46px; border: 1px solid var(--line); background: var(--surf); border-radius: 12px;
    padding: 0 13px; font-size: 14.5px; color: var(--ink); font-family: inherit;
}
.input:focus { border-color: var(--g); box-shadow: 0 0 0 3px color-mix(in srgb, var(--g) 14%, transparent); outline: none; }
textarea.input { height: auto; padding: 12px 13px; line-height: 1.55; resize: vertical; }
select.input { appearance: none; background-image: none; }
/* El desplegable, en el verde de GestioERP: por defecto el navegador pinta la
   opción marcada con su azul de sistema y desentona con toda la app. */
select.input, input.input { accent-color: var(--g); }
select.input option:checked, select.input option:hover {
    background: var(--wash); color: var(--g-d);
}
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tres { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.check { display: flex; align-items: center; gap: 10px; padding: 4px 0; }
.check input { width: 20px; height: 20px; accent-color: var(--g); }
.check label { font-size: 13.5px; font-weight: 600; color: var(--ink-2); }
.ayuda { font-size: 12.5px; color: var(--mut); line-height: 1.5; margin-top: 8px; }

/* ── Totales ──────────────────────────────────────────────────────────── */
.totes {
    background: var(--surf); border-top: 1px solid var(--line); padding: 12px 14px 16px;
    display: flex; flex-direction: column; gap: 8px;
    position: sticky; bottom: 0; z-index: 5;
}
.tline { display: flex; justify-content: space-between; font-size: 13px; color: var(--mut); font-variant-numeric: tabular-nums; }
.tline.big {
    font-size: 19px; color: var(--ink); font-weight: 750; letter-spacing: -.02em;
    padding-top: 8px; border-top: 1px dashed var(--line);
}

/* ── Firma ────────────────────────────────────────────────────────────── */
.signpad {
    background: #fff; border: 1.5px dashed #C4D3CD; border-radius: 16px; height: 240px;
    position: relative; overflow: hidden; touch-action: none;
}
.signpad canvas { width: 100%; height: 100%; display: block; touch-action: none; }
.signhint {
    position: absolute; bottom: 14px; left: 0; right: 0; text-align: center; font-size: 11.5px;
    color: #A9B8B2; font-weight: 600; pointer-events: none;
}
.signpad.firmado .signhint { display: none; }
.nota { border-radius: 15px; padding: 13px 14px; display: flex; gap: 13px; align-items: center; }
.nota.brass { background: #FDF7EA; border: 1px solid #F0DFBC; }
.nota .h { font-weight: 700; font-size: 13.5px; color: #6E4A08; }
.nota .p { font-size: 12.5px; color: #8A6A2C; margin-top: 3px; line-height: 1.45; }
.qrbox { width: 112px; height: 112px; border-radius: 12px; background: #fff; padding: 7px; border: 1px solid var(--line); flex: none; }
.qrbox img { width: 100%; height: 100%; display: block; image-rendering: pixelated; }
.firma-img { max-width: 220px; max-height: 90px; }

/* ── Gráfico de barras (web) ──────────────────────────────────────────── */
.bars { display: flex; align-items: flex-end; gap: 9px; height: 118px; padding: 0 4px; }
.bars div { flex: 1; background: linear-gradient(180deg, var(--g-l), var(--g)); border-radius: 5px 5px 2px 2px; min-height: 3px; }
.bars div.now { background: linear-gradient(180deg, var(--g), var(--g-d)); }
.barlabs { display: flex; gap: 9px; padding: 6px 4px 0; }
.barlabs span { flex: 1; text-align: center; font-size: 10.5px; color: var(--mut); font-weight: 600; }

/* ── Menú inferior (móvil) ────────────────────────────────────────────── */
.nav {
    background: var(--surf); border-top: 1px solid var(--line); display: grid;
    grid-template-columns: repeat(5, 1fr); padding: 7px 0 10px;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
    padding-bottom: calc(10px + env(safe-area-inset-bottom));
}
.nav a { text-align: center; font-size: 10px; font-weight: 650; color: #93A69F; }
.nav a i { display: block; margin: 0 auto 3px; width: 22px; height: 22px; }
.nav a i svg { width: 22px; height: 22px; }
.nav a.on { color: var(--g-d); }
.fabwrap { position: relative; }
.fab {
    position: absolute; top: -24px; left: 50%; transform: translateX(-50%); width: 54px; height: 54px;
    border-radius: 19px; background: linear-gradient(160deg, var(--g), var(--g-d)); color: #fff;
    display: grid; place-items: center; box-shadow: 0 10px 20px -8px color-mix(in srgb, var(--g-d) 85%, transparent);
}

/* ── Menú superior (web) ──────────────────────────────────────────────── */
.wnav { display: none; }

/* ── Diálogo propio ───────────────────────────────────────────────────── */
.av-modal {
    position: fixed; inset: 0; background: rgba(14, 26, 23, .45); display: grid; place-items: center;
    z-index: 60; padding: 20px;
}
.av-modal[hidden] { display: none; }
.av-modal-box { background: #fff; border-radius: 18px; padding: 22px; max-width: 360px; width: 100%; }
.av-modal-box p { margin: 0 0 18px; font-size: 15px; line-height: 1.5; }
.av-modal-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ── Buscador de artículos ────────────────────────────────────────────── */
.sugerencias { border: 1px solid var(--line); border-radius: 12px; background: #fff; overflow: hidden; }
.sugerencias:empty { display: none; }
.sugerencias button {
    display: flex; width: 100%; gap: 10px; align-items: center; padding: 11px 13px; background: none;
    border: none; border-bottom: 1px solid var(--line); text-align: left; cursor: pointer;
}
.sugerencias button:last-child { border-bottom: none; }
.sugerencias button:hover { background: var(--wash); }

/* ==========================================================================
   Web: a partir de 768 px
   ========================================================================== */
@media (min-width: 768px) {
    body.av { padding-bottom: 0; }
    .nav { display: none; }
    .ocultar-movil { display: inline; }

    .wnav {
        display: flex; align-items: center; gap: 14px; padding: 0 22px; height: 58px;
        background: linear-gradient(100deg, var(--g-d), var(--g-dd)); color: #fff;
        position: sticky; top: 0; z-index: 30;
    }
    .wnav .brand { display: flex; align-items: center; gap: 9px; font-weight: 800; letter-spacing: -.02em; font-size: 15px; }
    .wnav .brand small { font-size: 9.5px; letter-spacing: .16em; color: var(--g-l); display: block; font-weight: 700; }
    .wnav .wctx {
        display: flex; align-items: center; gap: 6px; color: #fff; font-weight: 700; font-size: 12.5px;
        padding: 5px 11px; border-radius: 999px; background: rgba(255,255,255,.14); white-space: nowrap;
    }
    .wnav .wctx svg { opacity: .85; flex: none; }
    /* Con ocho apartados el menú no cabe: se deja encoger y desplazar en vez
       de empujar la página y provocar scroll horizontal. */
    .wnav nav { display: flex; gap: 2px; flex: 1 1 auto; min-width: 0; overflow-x: auto; scrollbar-width: none; }
    .wnav nav::-webkit-scrollbar { display: none; }
    .wnav nav a { white-space: nowrap; padding: 19px 10px; }
    .wnav nav a {
        color: color-mix(in srgb, var(--g-l) 85%, #fff); font-size: 13.5px; font-weight: 650;
        padding: 19px 13px; border-bottom: 3px solid transparent;
    }
    .wnav nav a.on { color: #fff; border-bottom-color: #fff; }
    .wnav .wsearch {
        width: 260px; height: 34px; background: rgba(255, 255, 255, .15); border-radius: 10px;
        display: flex; align-items: center; gap: 8px; padding: 0 11px; color: var(--g-l); flex: none;
    }
    .wnav .wsearch input { background: none; border: none; color: #fff; font-size: 13px; width: 100%; }
    .wnav .wsearch input::placeholder { color: color-mix(in srgb, var(--g-l) 90%, #fff); }
    .wnav .who { display: flex; align-items: center; gap: 9px; font-size: 13px; color: var(--g-l); flex: none; }
    .wnav .wsalir, .wnav .wayuda { display: block; flex: none; }
    .wnav .icobtn { font-weight: 800; font-size: 15px; }
    .solo-movil { display: none; }

    /* Por debajo de 1100 px el buscador estorba: la lupa está en Clientes. */
    @media (max-width: 1100px) {
        .wnav .wsearch { display: none; }
    }

    /* La cabecera de sección deja de ser verde: ya lo es el menú superior. */
    .top { background: none; color: var(--ink); padding: 20px 22px 6px; max-width: 1180px; margin: 0 auto; }
    .top h1 { font-size: 25px; }
    .top .sub, .top .etiqueta { color: var(--mut); }
    .top .grande { color: var(--ink); }
    .top .icobtn { background: var(--wash); color: var(--g-d); }
    .top .avat { background: var(--g-d); color: #fff; }
    .searchbar { background: var(--surf); border: 1px solid var(--line); max-width: 420px; }
    .searchbar input { color: var(--ink); }
    .searchbar input::placeholder, .searchbar svg { color: var(--mut); }
    .seg { background: var(--slate-w); max-width: 460px; }
    .seg a { color: var(--ink-2); }
    .seg a.on { box-shadow: 0 1px 3px rgba(14, 26, 23, .12); }

    .contenido { padding: 14px 22px 40px; gap: 16px; }
    .tabs { padding: 0 22px; max-width: 1180px; margin: 0 auto; border-radius: 0; }
    .kpis { grid-template-columns: repeat(4, 1fr); }
    .dos-col { display: grid; grid-template-columns: 1.7fr 1fr; gap: 16px; align-items: start; }
    .dos-col-igual { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
    .totes { border: 1px solid var(--line); border-radius: 16px; position: static; }
    .btn { width: auto; padding: 0 22px; }
    .btn.ancho { width: 100%; }
    .btn-fila { grid-template-columns: max-content max-content; justify-content: end; }
    .av-avisos { padding: 14px 22px 0; }
}

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; animation: none !important; }
}

/* ── Editor de documento: en el ordenador, líneas a la izquierda y pie a la
   derecha, para verlo todo sin bajar. En el móvil sigue en una columna. ── */
.editor { display: flex; flex-direction: column; gap: 12px; }
.editor > div, .editor > aside { display: flex; flex-direction: column; gap: 12px; min-width: 0; }

@media (min-width: 768px) {
    .editor { display: grid; grid-template-columns: minmax(0, 1.7fr) 330px; gap: 16px; align-items: start; }
    .editor > aside { position: sticky; top: 74px; }
    .editor .totes { border: 1px solid var(--line); border-radius: 16px; }
}

/* Miniatura del artículo en el buscador de líneas. */
.sugerencias img { width: 42px; height: 42px; border-radius: 10px; object-fit: cover; background: var(--wash); flex: none; }

/* Buscador con lupa dentro del campo. */
.conlupa { position: relative; display: flex; align-items: center; }
.conlupa .lupabtn { position: absolute; left: 4px; width: 30px; height: 30px; display: flex;
    align-items: center; justify-content: center; border: 0; background: none; color: var(--g-d);
    cursor: pointer; border-radius: 8px; padding: 0; }
.conlupa .lupabtn:hover { background: var(--sup); }
.conlupa .lupabtn:disabled { opacity: .5; }
.conlupa .input { padding-left: 35px; }

/* Alta rapida de articulo, plegada hasta que hace falta. */
.altaart { margin-top: 12px; }
.altaart > summary { display: flex; align-items: center; gap: 12px; padding: 13px 14px;
    cursor: pointer; list-style: none; }
.altaart > summary::-webkit-details-marker { display: none; }
.altaart[open] > summary { border-bottom: 1px solid var(--line); }
.altaart > form { padding: 13px 14px 14px; }

/* Miniatura del articulo en las lineas del documento. */
.minia { width: 42px; height: 42px; border-radius: 10px; overflow: hidden; flex: 0 0 auto;
    background: var(--sup); border: 1px solid var(--line); display: flex; align-items: center;
    justify-content: center; }
.minia img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* Capa de "procesando", para las esperas largas (la IA tarda 8-15 s). */
.procesando { position: fixed; inset: 0; z-index: 90; display: none; align-items: center;
    justify-content: center; padding: 24px; background: rgba(9, 46, 38, .55);
    backdrop-filter: blur(3px); }
.procesando.on { display: flex; }
.procesando .caja { background: #fff; border-radius: 18px; padding: 22px 20px; width: 100%;
    max-width: 330px; text-align: center; box-shadow: 0 18px 44px rgba(0,0,0,.25); }
.procesando .tit { font-weight: 700; font-size: 16px; color: var(--ink); }
.procesando .det { font-size: 13px; color: var(--mut); margin-top: 6px; line-height: 1.45; }
.procesando .seg { font-size: 12.5px; color: var(--g-d); font-weight: 700; margin-top: 10px;
    font-variant-numeric: tabular-nums; }
.procesando .barra { height: 6px; border-radius: 99px; background: var(--sup); overflow: hidden;
    margin-top: 14px; }
.procesando .barra i { display: block; height: 100%; width: 40%; border-radius: 99px;
    background: linear-gradient(90deg, var(--g), var(--g-d));
    animation: avCorre 1.15s ease-in-out infinite; }
@keyframes avCorre {
    0%   { transform: translateX(-105%); }
    100% { transform: translateX(255%); }
}
@media (prefers-reduced-motion: reduce) {
    .procesando .barra i { animation: none; width: 100%; opacity: .6; }
}

/* Boton pequeno, para acciones dentro de una fila. */
.btn.chico { padding: 6px 11px; font-size: 12.5px; border-radius: 10px; width: auto;
    display: inline-flex; gap: 5px; }

/* Referencia del articulo, en su propia linea y sin recortar. */
.ref { display: inline-block; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 11.5px; font-weight: 700; letter-spacing: .3px; color: var(--g-d);
    background: var(--wash); border-radius: 6px; padding: 2px 7px; margin-bottom: 4px; }

/* Avisos de la IA, plegados: se lee el primero y el resto se despliega. */
.aviso.avisos { padding: 0; }
.aviso.avisos > summary { display: flex; align-items: center; gap: 8px; cursor: pointer;
    list-style: none; padding: 11px 13px; }
.aviso.avisos > summary::-webkit-details-marker { display: none; }
.aviso.avisos > summary::after { content: '⌄'; margin-left: auto; font-size: 16px; opacity: .7; }
.aviso.avisos[open] > summary::after { content: '⌃'; }
.aviso.avisos > summary .linea { overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    min-width: 0; }
.aviso.avisos[open] > summary .linea { white-space: normal; }
.aviso.avisos > summary .cuantos { flex: 0 0 auto; font-weight: 700; font-size: 12px;
    border-radius: 99px; padding: 1px 7px; background: rgba(0, 0, 0, .07); }
.aviso.avisos .mas { padding: 0 13px 11px; }
.aviso.avisos .mas + .mas { padding-top: 0; }
