/* ============================================================
   TERANET — capa de diseño moderna (carga DESPUÉS de teranet.css)
   Unifica tokens, navegación, formularios, tablas, tarjetas,
   modales y comportamiento responsive de TODAS las pantallas.
   ============================================================ */

/* ---------- 1. Tokens y base ---------- */
:root {
    --brand: #14B8A6;
    --brand-strong: #0D9488;
    --brand-deep: #0F766E;
    --brand-soft: #D5F5F0;
    --sky: #0EA5E9;
    --grad: linear-gradient(135deg, #14B8A6 0%, #0EA5E9 100%);
    --grad-soft: linear-gradient(135deg, #E6FAF7 0%, #E6F4FD 100%);
    --ink: #0B1B2B;
    --ink-2: #51657A;
    --ink-3: #8497AB;
    --line: #E5ECF3;
    --line-2: #D5DFEA;
    --bg: #F3F6FA;
    --surface: #FFFFFF;
    --ok: #0F9D6B;      --ok-bg: #DDF6EB;
    --warn: #B45309;    --warn-bg: #FEF0CC;
    --bad: #C62828;     --bad-bg: #FDE4E4;
    --info: #0369A1;    --info-bg: #E0F2FE;
    --r-sm: 10px; --r-md: 14px; --r-lg: 20px;
    --sh-1: 0 1px 2px rgba(11,27,43,.05), 0 1px 3px rgba(11,27,43,.06);
    --sh-2: 0 4px 10px rgba(11,27,43,.06), 0 12px 28px rgba(11,27,43,.08);
    --sh-3: 0 18px 50px rgba(11,27,43,.22);
    --ring: 0 0 0 3px rgba(20,184,166,.22);
    --sidebar: 84px;
    --safe-b: env(safe-area-inset-bottom, 0px);
    --font: 'Inter', 'Segoe UI Variable', 'Segoe UI', system-ui, -apple-system, sans-serif;
}

html { -webkit-text-size-adjust: 100%; }
html, body {
    font-family: var(--font);
    background: var(--bg); color: var(--ink);
    -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
body { font-size: 14px; line-height: 1.45; }
button, input, select, textarea { font-family: inherit; }
::selection { background: rgba(20,184,166,.25); }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
button:focus:not(:focus-visible) { outline: none; }
b, strong { font-weight: 700; }
.num, .atr .num, .rep-card b, .r-total, [class*="total"] { font-variant-numeric: tabular-nums; }

* { scrollbar-width: thin; scrollbar-color: #C5D2DF transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb { background: #C9D5E1; border-radius: 8px; border: 2px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: #A9BACB; background-clip: content-box; border: 2px solid transparent; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ---------- 2. Shell: sidebar + topbar ---------- */
.app-shell { background: var(--bg); height: 100vh; height: 100dvh; }
.app-main { min-width: 0; }
.app-content { background: var(--bg); }

.side-nav {
    width: var(--sidebar); padding: 14px 8px 12px; gap: 3px;
    background:
        radial-gradient(120% 60% at 0% 0%, rgba(20,184,166,.22), transparent 55%),
        linear-gradient(180deg, #0B1B26 0%, #0A2330 100%);
    border-right: 1px solid rgba(255,255,255,.04);
    scrollbar-color: rgba(255,255,255,.18) transparent;
}
.sn-logo {
    display: flex; align-items: center; gap: 12px; margin: 2px 0 14px;
    text-decoration: none; color: #fff; width: 100%; justify-content: center;
}
.sn-brand { display: none; font-weight: 800; font-size: 17px; letter-spacing: .2px; line-height: 1.1; }
.sn-brand small { display: block; font-size: 10px; font-weight: 600; letter-spacing: 1.6px; text-transform: uppercase; color: #5EEAD4; margin-top: 2px; }
.sn-group { display: none; }
.sn-more-btn { display: none; }

.sn-item {
    position: relative; width: 100%; padding: 9px 4px 8px; border-radius: 14px; gap: 4px;
    color: #8CA3B4; font-size: 10.5px; font-weight: 600; letter-spacing: .1px;
    transition: background .18s, color .18s, transform .12s;
}
.sn-item:hover { background: rgba(255,255,255,.07); color: #fff; }
.sn-item:active { transform: scale(.97); }
.sn-item.active {
    background: linear-gradient(135deg, rgba(20,184,166,.95), rgba(14,165,233,.95));
    color: #fff; box-shadow: 0 6px 18px rgba(14,165,233,.35), inset 0 1px 0 rgba(255,255,255,.25);
}
.sn-ico svg { width: 20px; height: 20px; }
.sn-badge {
    display: inline-block; min-width: 16px; padding: 1px 5px; margin-left: 2px;
    border-radius: 999px; background: #EF4444; color: #fff;
    font-size: 9px; font-weight: 800; line-height: 14px; text-align: center;
}
.sn-logout { color: #FCA5A5; }
.sn-logout:hover { background: rgba(248,113,113,.14); color: #FECACA; }

/* Panel expandido en pantallas anchas */
@media (min-width: 1360px) {
    :root { --sidebar: 240px; }
    .side-nav { align-items: stretch; padding: 18px 14px 14px; gap: 2px; }
    .sn-logo { justify-content: flex-start; padding: 0 6px; margin-bottom: 8px; }
    .sn-brand { display: block; }
    .sn-group {
        display: block; margin: 16px 12px 6px; font-size: 10.5px; font-weight: 700;
        letter-spacing: 1.3px; text-transform: uppercase; color: #5E7A8D;
    }
    .sn-item { flex-direction: row; align-items: center; gap: 12px; padding: 10px 12px; font-size: 14px; font-weight: 600; border-radius: 12px; }
    .sn-lbl { font-size: 14px; }
    .sn-item.active::before {
        content: ""; position: absolute; left: -14px; top: 22%; bottom: 22%; width: 4px;
        border-radius: 0 4px 4px 0; background: #5EEAD4;
    }
}

.app-topbar {
    position: relative; z-index: 5; gap: 16px;
    background: rgba(255,255,255,.86); backdrop-filter: saturate(1.4) blur(12px);
    border-bottom: 1px solid var(--line); padding: 10px 24px; min-height: 64px;
}
.tb-page { display: flex; align-items: center; gap: 12px; min-width: 0; }
.tb-page-ico {
    width: 40px; height: 40px; border-radius: 12px; flex-shrink: 0;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--grad-soft); color: var(--brand-deep);
}
.tb-page-ico svg { width: 21px; height: 21px; }
.tb-page-txt { display: flex; flex-direction: column; min-width: 0; line-height: 1.15; }
.tb-page-txt h1 { margin: 0; font-size: 18px; font-weight: 800; letter-spacing: -.2px; color: var(--ink); }
.app-topbar .tb-tenant {
    font-size: 12px; font-weight: 500; color: var(--ink-3);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 46vw;
}
.tb-right { display: flex; align-items: center; gap: 14px; }
.sn-user {
    display: flex; align-items: center; gap: 10px; padding: 4px 12px 4px 4px;
    border: 1px solid var(--line); border-radius: 999px; background: var(--surface);
}
.avatar { width: 34px; height: 34px; background: var(--grad); color: #fff; font-size: 12.5px; }
.tb-utxt { display: flex; flex-direction: column; line-height: 1.15; }
.tb-uname { font-size: 13px; font-weight: 700; color: var(--ink) !important; }
.tb-urole { font-size: 11px; color: var(--ink-3); font-weight: 500; }
.bell-btn {
    width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line);
    background: var(--surface); color: var(--ink-2); display: inline-flex; align-items: center; justify-content: center;
    transition: .15s;
}
.bell-btn:hover, .bell-btn.on { border-color: var(--brand); color: var(--brand-deep); background: #F2FCFA; }
.bell-btn svg { width: 19px; height: 19px; }
.bell-drop { border-radius: var(--r-md); border: 1px solid var(--line); box-shadow: var(--sh-2); overflow: hidden; }

/* ---------- 3. Contenedores de página ---------- */
.admin-body { padding: 22px 28px 32px; max-width: 1680px; width: 100%; margin: 0 auto; }

/* ---------- 4. Tabs ---------- */
.adm-tabs {
    display: flex; align-items: center; gap: 6px; margin-bottom: 18px; flex-wrap: wrap;
}
.adm-tab {
    background: transparent; border: 1px solid transparent; color: var(--ink-2);
    border-radius: 12px; padding: 9px 16px; font-size: 14px; font-weight: 600;
    transition: background .15s, color .15s, box-shadow .15s; white-space: nowrap; min-height: 40px;
}
.adm-tab:hover { background: rgba(255,255,255,.8); color: var(--ink); }
.adm-tab.sel {
    background: var(--surface); color: var(--brand-deep); border-color: var(--line);
    box-shadow: var(--sh-1), inset 0 -2px 0 var(--brand);
}
.rep-btn.btn-pay { min-height: 40px; }

/* ---------- 5. Botones ---------- */
.btn-new, .btn-pay, .btn-primary, .btn-refresh {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-height: 40px; padding: 0 18px; border: none; border-radius: 12px;
    background: var(--grad); color: #fff !important; font-size: 14px; font-weight: 700; letter-spacing: .1px;
    box-shadow: 0 6px 16px rgba(14,165,233,.25), inset 0 1px 0 rgba(255,255,255,.28);
    transition: transform .12s, box-shadow .18s, filter .18s; white-space: nowrap; cursor: pointer;
}
.btn-new:hover:not(:disabled), .btn-pay:hover:not(:disabled), .btn-primary:hover:not(:disabled), .btn-refresh:hover:not(:disabled) {
    transform: translateY(-1px); box-shadow: 0 10px 24px rgba(14,165,233,.32), inset 0 1px 0 rgba(255,255,255,.28); filter: brightness(1.03);
}
.btn-new:active:not(:disabled), .btn-pay:active:not(:disabled) { transform: translateY(0) scale(.98); }
.btn-new:disabled, .btn-pay:disabled, .btn-primary:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; }
.btn-pay.emit, .btn-pay.big { min-height: 48px; font-size: 15px; }
.btn-primary { margin-top: 20px; min-height: 46px; background-color: transparent; border: none; }

.btn-demo { display: block; width: 100%; margin-top: 10px; padding: 11px 14px;
    border: 1.5px dashed var(--brand, #0d9488); border-radius: 12px;
    background: rgba(13,148,136,.06); color: var(--brand, #0d9488);
    font-weight: 700; font-size: 14px; cursor: pointer; }
.btn-demo:hover:not(:disabled) { background: rgba(13,148,136,.14); }
.btn-demo:disabled { opacity: .5; cursor: not-allowed; }

.btn-print, .dp-btn, .bulk-btn, .btn-back {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-height: 40px; padding: 0 16px; border-radius: 12px; font-size: 13.5px; font-weight: 600;
    background: var(--surface); border: 1.5px solid var(--line-2); color: var(--brand-deep); cursor: pointer;
    transition: .15s; white-space: nowrap;
}
.btn-print:hover:not(:disabled), .dp-btn:hover:not(:disabled), .bulk-btn:hover:not(:disabled) {
    border-color: var(--brand); background: #F0FBF9; color: var(--brand-deep);
}
/* combinación btn-pay + bulk-btn: gana el estilo outline (texto legible) */
.btn-pay.bulk-btn {
    margin: 0; padding: 0 16px; justify-content: center; gap: 8px;
    background: var(--surface); border: 1.5px solid var(--line-2); color: var(--brand-deep) !important;
    font-size: 13.5px; font-weight: 600; letter-spacing: 0; box-shadow: none;
}
.btn-pay.bulk-btn:hover:not(:disabled) {
    transform: translateY(-1px); border-color: var(--brand); background: #F0FBF9; box-shadow: none;
}
.btn-print svg, .btn-new svg, .btn-pay svg { width: 17px; height: 17px; }
.atr-act button, .cat-edit-btn {
    width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--surface);
    color: var(--ink-2); display: inline-flex; align-items: center; justify-content: center; transition: .15s;
}
.atr-act button:hover, .cat-edit-btn:hover { border-color: var(--brand); color: var(--brand-deep); background: #F0FBF9; }
.atr-act button svg, .cat-edit-btn svg { width: 17px; height: 17px; }
.m-x, .dp-close { width: 36px; height: 36px; border-radius: 10px; color: var(--ink-3); font-size: 20px; }
.m-x:hover { background: var(--bg); color: var(--ink); }

/* ---------- 6. Campos de formulario y búsqueda ---------- */
.field, select.field, input.field, textarea.field {
    min-height: 44px; border: 1.5px solid var(--line-2); border-radius: 12px; background: var(--surface);
    padding: 10px 14px; font-size: 14.5px; color: var(--ink); width: 100%;
    transition: border-color .15s, box-shadow .15s, background .15s; box-sizing: border-box;
}
.field::placeholder { color: var(--ink-3); }
.field:hover { border-color: #B9C7D6; }
.field:focus { border-color: var(--brand); box-shadow: var(--ring); outline: none; }
.field:disabled { background: #F1F5F9; color: var(--ink-3); cursor: not-allowed; }
select.field { appearance: none; padding-right: 38px; cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%2351657A' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 12px center; }
.field.big { font-size: 22px; font-weight: 800; text-align: right; min-height: 54px; }
label { color: var(--ink-2); }

.pos-search {
    width: 100%; min-height: 44px; border: 1.5px solid var(--line-2); border-radius: 12px; background-color: var(--surface);
    padding: 10px 14px 10px 42px; font-size: 14.5px; color: var(--ink); box-shadow: none; outline: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' fill='none' stroke='%238497AB' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='8' cy='8' r='6'/%3E%3Cpath d='m17 17-4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: 14px center; transition: .15s;
}
.pos-search:hover { border-color: #B9C7D6; }
.pos-search:focus { border-color: var(--brand); box-shadow: var(--ring); }
.adm-search { width: 300px; max-width: 100%; }
.search-wrap { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; position: relative; }
.search-wrap .search-ico { display: none; }
.search-wrap .pos-search { flex: 1; min-height: 50px; font-size: 15.5px; border-radius: 14px; }
.btn-price {
    width: 50px; height: 50px; border-radius: 14px; background: var(--grad); color: #fff; font-size: 15px; font-weight: 800;
    box-shadow: 0 6px 16px rgba(14,165,233,.25); flex-shrink: 0;
}
.rep-date { width: auto; min-width: 150px; }
input[type="date"].field { padding-right: 10px; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--brand-strong); width: 17px; height: 17px; }

/* ---------- 7. Tablas (.adm-table / .atr) ---------- */
.adm-table {
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
    box-shadow: var(--sh-1); overflow: hidden;
}
.atr { padding: 13px 20px; gap: 14px; font-size: 13.5px; color: #2A3F55; border-bottom: 1px solid #EEF3F8; min-height: 56px; }
.atr:last-child { border-bottom: none; }
.atr-head {
    background: #F7FAFC; color: var(--ink-3); font-size: 11px; font-weight: 700; letter-spacing: .09em;
    min-height: 44px; padding-top: 10px; padding-bottom: 10px; position: sticky; top: 0; z-index: 1;
}
.atr:not(.atr-head):hover { background: #F6FCFB; }
.atr b { color: var(--ink); font-weight: 700; }
.pill-off { background: var(--bad-bg); color: var(--bad); font-weight: 700; padding: 2px 9px; }
.doc-st, .ok-tag, .grp-tag, .pm-tag {
    display: inline-flex; align-items: center; border-radius: 999px; padding: 3px 10px;
    font-size: 11px; font-weight: 700; letter-spacing: .02em;
}

/* ---------- 8. Tarjetas / KPI ---------- */
.rep-cards { gap: 16px; }
.rep-card, .rep-panel, .cfg-card, .cash-card, .lic-plan, .bulk-card {
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
    box-shadow: var(--sh-1);
}
.rep-card { padding: 18px 20px; position: relative; overflow: hidden; transition: box-shadow .2s, transform .2s; }
.rep-card::after {
    content: ""; position: absolute; right: -30px; top: -30px; width: 100px; height: 100px; border-radius: 50%;
    background: radial-gradient(circle, rgba(20,184,166,.12), transparent 70%); pointer-events: none;
}
.rep-card:hover { box-shadow: var(--sh-2); transform: translateY(-1px); }
.rep-card small { color: var(--ink-3); font-weight: 700; letter-spacing: .08em; }
.rep-card b { font-size: 26px; font-weight: 800; letter-spacing: -.5px; color: var(--ink); margin-top: 2px; display: inline-block; }
.rep-card b.neg { color: var(--bad); }
.rep-card b.pos { color: var(--ok); }
.rep-card em { color: var(--ink-3); }

/* --- Kardex / estado de cuenta --- */
.num.pos { color: var(--ok); }
.num.neg { color: var(--bad); }
.rep-filters2 {
    display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
    padding: 14px 18px; margin-bottom: 16px; box-shadow: var(--sh-1);
}
.rep-pick { min-width: 210px; flex: 1; max-width: 340px; }
.rep-pick-lbl { font-size: 12px; font-weight: 700; letter-spacing: .07em; color: var(--ink-3); }
.kdx-chk {
    display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px;
    font-weight: 600; color: var(--ink-2); white-space: nowrap; cursor: pointer;
}
.kdx-chk input { width: 17px; height: 17px; accent-color: var(--brand); }
.atr-kdx { grid-template-columns: 2.2fr .8fr .8fr .8fr .9fr 40px; }
.atr-kmov { grid-template-columns: 105px 130px 1fr .8fr .8fr .9fr; }
.atr-bled { grid-template-columns: 105px 140px 1fr .8fr .8fr .9fr; }
.atr-comm-h { grid-template-columns: 1.6fr .8fr 1fr .85fr .85fr .95fr 40px; }
.atr-comm { grid-template-columns: 100px 1.6fr 1fr .8fr .8fr; }
.comm-sub {
    padding: 10px 14px 4px; font-size: 11px; font-weight: 800;
    letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3);
}
.kdx-movs { border-bottom: 1px solid #EEF3F8; background: #F8FBFC; }
.kdx-movs .atr-head { min-height: 36px; }
.kdx-movs .atr { padding-top: 9px; padding-bottom: 9px; min-height: 44px; font-size: 13px; }
.kdx-chev { text-align: center; color: var(--ink-3); font-size: 11px; font-weight: 700; }
.kdx-chev.off { color: transparent; }
.mv-tag {
    display: inline-flex; align-items: center; border-radius: 999px; padding: 3px 10px;
    font-size: 11px; font-weight: 700; white-space: nowrap;
}
.mv-in { background: var(--ok-bg); color: var(--ok); }
.mv-out { background: var(--bad-bg); color: var(--bad); }
.mv-adj { background: #E8EEF5; color: #47617B; }

/* --- roles personalizados: checkboxes de módulos --- */
.role-mods { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.role-mod {
    display: flex; align-items: center; gap: 10px; padding: 11px 14px;
    border: 1.5px solid var(--line); border-radius: 13px; cursor: pointer;
    font-size: 13px; font-weight: 600; color: var(--ink-2); transition: all .15s;
}
.role-mod:hover { border-color: #B9C7D6; }
.role-mod.sel { border-color: var(--brand); background: #F0FBFD; color: var(--ink); }
.role-mod input { width: 17px; height: 17px; accent-color: var(--brand); }
@media (max-width: 560px) { .role-mods { grid-template-columns: 1fr; } }

/* --- panel fiscal: cola de reintentos + cierres X/Z --- */
.adm-panel {
    background: #fff; border: 1px solid var(--line); border-radius: 16px;
    padding: 16px 18px; margin-bottom: 14px;
}
.adm-ptitle { font-size: 15px; font-weight: 800; color: var(--ink); margin-bottom: 10px;
    display: flex; align-items: center; gap: 10px; }
.adm-psub { font-size: 11.5px; font-weight: 800; letter-spacing: .08em;
    text-transform: uppercase; color: var(--ink-3); margin: 14px 0 6px; }
.adm-panel .adm-table { border: none; }
.adm-panel .empty-grid { padding: 24px 0; }
.kdx-warn {
    background: var(--bad-bg); color: var(--bad); border-radius: 999px;
    padding: 3px 11px; font-size: 11.5px; font-weight: 700;
}
.atr-fq { grid-template-columns: 1.3fr .7fr .7fr 1.8fr .5fr 96px; }
.fq-err {
    color: var(--bad); font-size: 12px; overflow: hidden;
    text-overflow: ellipsis; white-space: nowrap;
}
.fq-recent { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.fq-ok { font-size: 12px; color: var(--ok); font-weight: 600; }
.atr-zh { grid-template-columns: .6fr 1.6fr .8fr .8fr .7fr; }
/* Retenciones / comprobantes */
.atr-ret { grid-template-columns: .7fr .5fr 1.6fr .9fr .9fr 1fr 92px; }
.atr-rl {
    display: grid; gap: 6px; align-items: center; padding: 6px 12px;
    grid-template-columns: .9fr .9fr .9fr .7fr .7fr .7fr .6fr .6fr .7fr .8fr 28px;
}
.atr-rl .field { padding: 5px 8px; font-size: 12.5px; min-width: 0; }
.ret-tot { text-align: right; font-size: 13.5px; color: var(--ink-2);
    margin: 8px 0 4px; }
.ret-tot b { color: var(--ink); }
.f-hint { font-weight: 400; color: var(--ink-3); font-size: 11px; }
.fisc-x { max-width: 520px; }
.fx-row {
    display: flex; justify-content: space-between; gap: 12px;
    padding: 7px 0; font-size: 13.5px; border-bottom: 1px dashed #E9EFF5;
}
.fx-row span { color: var(--ink-3); }
.fx-row b { color: var(--ink); }
.fx-net b { font-size: 16px; color: var(--brand); }
.fx-actions { display: flex; gap: 10px; margin-top: 14px; }
.fis-modal { max-width: 540px; }
.fis-note { font-size: 12.5px; color: var(--ink-3); margin: 0 0 10px; }
.fis-sub { font-size: 12px; font-weight: 700; text-transform: uppercase;
    letter-spacing: .04em; color: var(--ink-3); margin: 16px 0 4px; }
.fis-modal .fisc-x { max-width: none; }
.fis-zcell { display: flex; flex-direction: column; }
.atr-reg { grid-template-columns: 1.1fr 1fr .6fr 44px; }
.reg-key { display: inline-block; margin-top: 6px; padding: 6px 10px;
    background: #0f172a; color: #6ee7b7; border-radius: 8px;
    font-size: 12px; word-break: break-all; user-select: all; }
@media (max-width: 760px) {
    .atr-fq { grid-template-columns: 1.1fr .9fr 2fr 90px; font-size: 12.5px; }
    .atr-fq > span:nth-child(2), .atr-fq > span:nth-child(5) { display: none; }
    .atr-zh { grid-template-columns: .6fr 1.6fr .9fr; }
    .atr-zh > span:nth-child(4), .atr-zh > span:nth-child(5) { display: none; }
}

@media (max-width: 760px) {
    .rep-filters2 { padding: 10px 12px; gap: 8px; }
    .rep-pick { min-width: 100%; }
    .atr-kdx { grid-template-columns: 1.7fr .75fr .75fr .85fr 30px; font-size: 12.5px; }
    .atr-kdx > span:nth-child(3) { display: none; }
    .atr-kmov, .atr-bled { grid-template-columns: 88px 1fr .8fr .9fr; }
    .atr-kmov > span:nth-child(3), .atr-kmov > span:nth-child(5),
    .atr-bled > span:nth-child(3), .atr-bled > span:nth-child(5) { display: none; }
    .atr-comm-h { grid-template-columns: 1.5fr .8fr .85fr .9fr 30px; font-size: 12.5px; }
    .atr-comm-h > span:nth-child(3), .atr-comm-h > span:nth-child(5) { display: none; }
    .atr-comm { grid-template-columns: 80px 1.5fr .8fr .85fr; font-size: 12.5px; }
    .atr-comm > span:nth-child(3) { display: none; }
}
.rep-panel { padding: 20px 22px; }
.dash-head h2 { font-size: 26px; font-weight: 800; letter-spacing: -.5px; color: var(--ink); }
.dash-date { color: var(--ink-3); }
.day-bar-bg { background: #EDF2F7; height: 14px; border-radius: 999px; }
.day-bar { background: var(--grad) !important; border-radius: 999px; }
.dash-row { border-bottom: 1px solid #EEF3F8; }
.dash-empty { color: var(--ink-3); background: #F8FAFC; border-radius: var(--r-md); padding: 18px; text-align: center; }

/* ---------- 9. Modales y hojas ---------- */
.modal-back {
    background: rgba(9,20,31,.5); backdrop-filter: blur(4px); animation: fadeIn .18s ease;
    display: flex; align-items: center; justify-content: center;
}
.modal {
    background: var(--surface); border-radius: 22px; box-shadow: var(--sh-3); border: 1px solid rgba(255,255,255,.6);
    animation: popIn .22s cubic-bezier(.2,.8,.2,1); max-height: 92vh; overflow-y: auto;
}
.m-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.m-head h3 { margin: 0; font-size: 19px; font-weight: 800; letter-spacing: -.3px; }
.m-total {
    background: var(--grad); color: #fff; border-radius: var(--r-md); padding: 16px 18px;
    display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.m-total strong { font-size: 32px; font-weight: 800; letter-spacing: -1px; }
.m-total small, .m-total span { opacity: .9; }
.m-chip, .grp-chip {
    min-height: 38px; padding: 0 14px; border-radius: 999px; border: 1.5px solid var(--line-2);
    background: var(--surface); color: var(--ink-2); font-weight: 600; font-size: 13.5px; transition: .15s;
}
.m-chip:hover, .grp-chip:hover { border-color: var(--brand); color: var(--brand-deep); }
.m-chip.sel, .grp-chip.sel { background: var(--grad); color: #fff; border-color: transparent; box-shadow: 0 4px 12px rgba(14,165,233,.28); }
.m-status { border-radius: 12px; padding: 11px 14px; background: var(--warn-bg); color: var(--warn); font-weight: 600; }
.m-status.ok { background: var(--ok-bg); color: var(--ok); }
.login-error { background: var(--bad-bg); color: var(--bad); border-radius: 12px; font-weight: 500; }
.adm-notice { border-radius: 12px; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn { from { opacity: 0; transform: translateY(10px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes slideUp { from { transform: translateY(100%); } to { transform: none; } }

/* ---------- 10. POS ---------- */
.pos-grid2 { gap: 18px; padding: 18px; grid-template-columns: 1fr minmax(360px, 34vw); }
.doc-panel { border-radius: var(--r-lg); border: 1px solid var(--line); box-shadow: var(--sh-1); }
.dp-head { padding: 14px 18px; }
.product-card {
    border: 1.5px solid var(--line); box-shadow: none; border-radius: 16px; padding: 14px;
    transition: transform .14s, box-shadow .2s, border-color .15s;
}
.product-card:hover { transform: translateY(-3px); border-color: var(--brand); box-shadow: var(--sh-2); }
.pc-icon { background: var(--grad-soft); color: var(--brand-deep); border-radius: 12px; }
.pc-name { color: var(--ink); font-weight: 600; }
.pc-price { color: var(--brand-deep); font-weight: 800; font-variant-numeric: tabular-nums; }
.pc-stock { border-radius: 999px; font-weight: 700; }
.tk-client { border-radius: 12px; border: 1.5px dashed var(--line-2); min-height: 46px; background: #FAFCFE; }
.tk-client:hover { border-color: var(--brand); color: var(--brand-deep); background: #F0FBF9; }
.tk-client.sel { border-style: solid; border-color: var(--brand); background: #F0FBF9; }
.ticket-fab { background: var(--grad); border-radius: 18px; box-shadow: 0 12px 30px rgba(14,165,233,.4); }

/* ---------- 11. Login ---------- */
.login-brand {
    background:
        radial-gradient(60% 50% at 85% 90%, rgba(255,255,255,.22), transparent 60%),
        radial-gradient(50% 40% at 10% 0%, rgba(6,182,212,.35), transparent 60%),
        linear-gradient(140deg, #0A4D4A 0%, #0F9488 52%, #0EA5E9 100%);
}
.login-card { border-radius: 24px; box-shadow: var(--sh-3); border: 1px solid rgba(255,255,255,.7); width: min(400px, 100%); padding: 38px 34px; }
.login-card h2 { font-size: 26px; font-weight: 800; letter-spacing: -.5px; }
.login-card label { color: var(--ink-2); letter-spacing: .8px; }
.company-card { border: 1.5px solid var(--line); border-radius: 16px; background: var(--surface); }
.company-card:hover:not(:disabled) { border-color: var(--brand); background: #F0FBF9; transform: translateY(-1px); box-shadow: var(--sh-1); }
.cc-icon { background: var(--grad); border-radius: 14px; }
.cc-role { background: var(--brand-soft); color: var(--brand-deep); }
.login-panel { background: var(--bg); }

/* ============================================================
   RESPONSIVE
   ============================================================ */

/* Tablet */
@media (max-width: 1100px) {
    .admin-body { padding: 18px 20px 28px; }
    .app-topbar { padding: 8px 18px; }
    .tb-urole { display: none; }
}

/* Móvil + tablet vertical: dock inferior */
@media (max-width: 760px) {
    :root { --sidebar: 0px; }
    body { font-size: 14px; }
    .app-shell { flex-direction: column; }
    .app-main { padding-bottom: calc(68px + var(--safe-b)); }

    .app-topbar { padding: 8px 14px; min-height: 58px; gap: 8px; }
    .tb-page-ico { width: 36px; height: 36px; border-radius: 10px; }
    .tb-page-txt h1 { font-size: 16.5px; }
    .app-topbar .tb-tenant { font-size: 11.5px; max-width: 52vw; }
    .sn-user { padding: 3px; border: none; background: none; }
    .tb-utxt { display: none; }
    .tb-right { gap: 8px; }

    /* Dock */
    .side-nav {
        position: fixed; left: 10px; right: 10px; bottom: calc(10px + var(--safe-b)); top: auto; z-index: 70;
        width: auto; height: 62px; flex-direction: row; align-items: center; justify-content: space-around;
        padding: 6px; gap: 2px; border-radius: 22px; overflow: hidden;
        background: rgba(10,30,42,.94); backdrop-filter: blur(14px) saturate(1.4);
        border: 1px solid rgba(255,255,255,.08); box-shadow: 0 14px 40px rgba(5,15,25,.45);
    }
    .sn-logo, .sn-group, .sn-spacer, .sn-sec, .sn-logout { display: none; }
    .sn-more-btn { display: flex; }
    .sn-item { flex: 1; width: auto; min-width: 0; height: 50px; padding: 5px 2px; border-radius: 16px; justify-content: center; }
    .sn-lbl { display: block; font-size: 10px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .sn-ico svg { width: 21px; height: 21px; }
    .sn-item.active { box-shadow: 0 6px 16px rgba(14,165,233,.4); }

    /* Hoja "Más" */
    .more-back { position: fixed; inset: 0; z-index: 65; background: rgba(8,18,28,.55); backdrop-filter: blur(3px); animation: fadeIn .18s; }
    .side-nav.more-open {
        display: grid; grid-template-columns: repeat(4, 1fr); grid-auto-rows: min-content; align-content: start;
        height: auto; max-height: 78vh; overflow-y: auto; left: 8px; right: 8px; bottom: calc(8px + var(--safe-b));
        padding: 18px 12px 12px; gap: 8px 6px; border-radius: 26px; animation: slideUp .26s cubic-bezier(.2,.8,.2,1);
        background: rgba(9,26,38,.97);
    }
    .side-nav.more-open .sn-group {
        display: block; grid-column: 1 / -1; margin: 6px 6px 0; font-size: 10.5px; font-weight: 700;
        letter-spacing: 1.3px; text-transform: uppercase; color: #5E7A8D;
    }
    .side-nav.more-open .sn-group:first-of-type { margin-top: 0; }
    .side-nav.more-open .sn-item, .side-nav.more-open .sn-sec, .side-nav.more-open .sn-logout { display: flex; flex-direction: column; height: 70px; padding: 8px 2px; background: rgba(255,255,255,.05); }
    .side-nav.more-open .sn-item.active { background: var(--grad); }
    .side-nav.more-open .sn-logout { grid-column: 1 / -1; flex-direction: row; gap: 10px; height: 46px; background: rgba(248,113,113,.12); }
    .side-nav.more-open .sn-more-btn { order: 99; grid-column: 1 / -1; flex-direction: row; gap: 8px; height: 44px; background: rgba(255,255,255,.1); }
    .side-nav.more-open .sn-spacer { display: none; }

    .admin-body { padding: 14px 12px 24px; }

    /* Tabs: carrusel horizontal sin saltos de línea */
    .adm-tabs { flex-wrap: nowrap; overflow-x: auto; margin: 0 -12px 14px; padding: 2px 12px 6px; gap: 6px;
        scrollbar-width: none; -webkit-overflow-scrolling: touch; scroll-snap-type: x proximity; }
    .adm-tabs::-webkit-scrollbar { display: none; }
    .adm-tabs > * { flex-shrink: 0; scroll-snap-align: start; }
    .adm-tabs .adm-spacer { display: none; }
    .adm-tabs .adm-search { width: 220px; order: 0; }
    .adm-tabs .rep-date { min-width: 140px; }
    .adm-tab { padding: 8px 14px; background: rgba(255,255,255,.7); border-color: var(--line); }
    .adm-tab.sel { background: var(--grad); color: #fff; border-color: transparent; box-shadow: 0 4px 12px rgba(14,165,233,.3); }

    .rep-cards { grid-template-columns: 1fr 1fr; gap: 10px; }
    .rep-card { padding: 14px 14px; }
    .rep-card b { font-size: 21px; }
    .rep-panel { padding: 16px; }
    .dash-head { flex-direction: column; align-items: stretch; gap: 12px; }
    .dash-head h2 { font-size: 21px; }
    .dash-actions { grid-template-columns: repeat(3, 1fr); }
    .dash-actions .btn-new { padding: 0 8px; font-size: 12.5px; }

    .adm-table { border-radius: 16px; }
    .atr { padding: 12px 14px; gap: 10px; }

    /* Modales → hoja inferior */
    .modal-back { align-items: flex-end; }
    .modal, .modal.form, .modal.fac-modal, .modal.ret-modal, .lic-modal {
        width: 100% !important; max-width: 100% !important; max-height: 94vh; border-radius: 26px 26px 0 0;
        padding-bottom: calc(18px + var(--safe-b)); animation: slideUp .26s cubic-bezier(.2,.8,.2,1);
    }
    .modal::before { content: ""; display: block; width: 42px; height: 4px; border-radius: 4px; background: var(--line-2); margin: -6px auto 12px; }
    .m-total strong { font-size: 28px; }
    .field, select.field { font-size: 16px; }   /* evita zoom de iOS al enfocar */

    /* Login */
    .login-shell { flex-direction: column; }
    .login-brand { flex: none; padding: 34px 24px 54px; align-items: flex-start; min-height: 150px; }
    .login-panel { margin-top: -32px; padding: 0 16px 28px; justify-content: flex-start; z-index: 1; }
    .login-card { padding: 28px 22px; }

    /* POS */
    .pos-grid2 { padding: 10px; gap: 10px; }
    .search-wrap { margin-bottom: 10px; }
    .search-wrap .pos-search { min-height: 46px; }
    .btn-price { width: 46px; height: 46px; }
    .ticket-fab { left: 12px; right: 12px; bottom: calc(82px + var(--safe-b)); }
}

/* Teléfonos pequeños */
@media (max-width: 380px) {
    .sn-lbl { font-size: 9.5px; }
    .rep-cards { grid-template-columns: 1fr; }
    .dash-actions { grid-template-columns: 1fr; }
}

/* Pantallas bajas (laptops 768px) — compacta el chrome */
@media (min-width: 761px) and (max-height: 800px) {
    .app-topbar { min-height: 56px; padding-top: 6px; padding-bottom: 6px; }
    .sn-item { padding-top: 7px; padding-bottom: 6px; }
}

@media print {
    .side-nav, .app-topbar, .more-back { display: none !important; }
}

/* ---------- Ajustes de pulido (2ª pasada) ---------- */
.btn-new.alt, .btn-refresh.rep-print {
    background: var(--surface); color: var(--brand-deep) !important; border: 1.5px solid var(--line-2);
    box-shadow: none;
}
.btn-new.alt:hover:not(:disabled) { background: #F0FBF9; border-color: var(--brand); box-shadow: none; filter: none; }
.adm-tabs .field, .adm-tabs input.field, input.field.rep-date { width: auto; }
.adm-tabs .tb-rate, .tb-rate {
    display: inline-flex; align-items: center; min-height: 32px; padding: 0 12px; border-radius: 999px;
    background: var(--brand-soft); color: var(--brand-deep); border: none; font-size: 12.5px; font-weight: 700;
}
.adm-filters {
    display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; margin: -4px 0 18px;
    padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--sh-1);
}
.adm-flt { display: flex; flex-direction: column; gap: 4px; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
.adm-flt .field { min-height: 42px; text-transform: none; letter-spacing: 0; font-weight: 500; min-width: 160px; }
.adm-filters .btn-pay, .adm-filters .btn-print { min-height: 42px; }
.rep-cards { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.rep-card em { display: block; margin-top: 2px; }
.dash-date { text-transform: none !important; display: inline-block; }
.dash-date::first-letter { text-transform: uppercase; }
/* POS: footer compacto — resumen a la izquierda, COBRAR a la derecha
   (libera alto para ver más ítems de la venta sin scroll) */
.btn-cobrar, .dp-foot .btn-pay {
    flex: 0 0 190px; width: auto; min-height: 64px;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 1px; font-size: 13px; letter-spacing: .6px; border-radius: 14px; line-height: 1.2;
}
.btn-cobrar .bp-lbl { font-size: 11.5px; font-weight: 800; opacity: .85; }
.btn-cobrar .btn-pay-amt { font-size: 20px; font-weight: 800; letter-spacing: -.3px; }
.btn-cobrar .btn-pay-bs { font-size: 11.5px; font-weight: 600; opacity: .8; }
.tk-row.grand { font-size: 22px; font-weight: 800; letter-spacing: -.3px; }
@media (max-width: 480px) {
    .btn-cobrar, .dp-foot .btn-pay { flex-basis: 140px; }
    .dp-foot { gap: 8px; }
    .tk-summary { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
    .adm-filters { padding: 12px; gap: 8px; }
    .adm-flt { flex: 1 1 130px; }
    .adm-filters .btn-pay, .adm-filters .btn-print { flex: 1 1 45%; }
}

/* ============================================================
   Tablas → tarjetas en móvil (con etiquetas automáticas por JS)
   ============================================================ */
@media (max-width: 760px) {
    .adm-table { overflow: visible; background: transparent; border: none; box-shadow: none; display: flex; flex-direction: column; gap: 10px; }
    .atr-head { display: none !important; }
    .atr:not(.atr-head) {
        display: grid !important; grid-template-columns: 1fr 1fr; gap: 8px 14px; align-items: start;
        padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px;
        box-shadow: var(--sh-1); min-height: 0; font-size: 13.5px;
    }
    .atr:not(.atr-head) > * { display: block !important; min-width: 0; text-align: left !important; overflow-wrap: anywhere; }
    .atr:not(.atr-head) > :empty { display: none !important; }
    .atr:not(.atr-head):not(:has([data-title])) > :first-child,
    .atr:not(.atr-head) > [data-title] { grid-column: 1 / -1; font-size: 15px; font-weight: 700; color: var(--ink); }
    .atr:not(.atr-head) > [data-title] { order: -1; }
    .atr:not(.atr-head) > [data-title]::before { display: none !important; }
    .atr:not(.atr-head) > [data-label]:not([data-title])::before {
        content: attr(data-label); display: block; margin-bottom: 1px; font-size: 10px; font-weight: 700;
        letter-spacing: .09em; text-transform: uppercase; color: var(--ink-3);
    }
    .atr:not(.atr-head) > .atr-act, .atr:not(.atr-head) > :last-child:has(button) {
        grid-column: 1 / -1; display: flex !important; justify-content: flex-end; gap: 8px; padding-top: 6px;
        border-top: 1px dashed var(--line);
    }
    .atr:not(.atr-head) > .atr-act::before, .atr:not(.atr-head) > :last-child:has(button)::before { display: none; }
    .atr:not(.atr-head) > .atr-act button { width: 44px; height: 44px; }
    .atr.off { opacity: .6; }
    .empty-grid { padding: 36px 0; }

    /* Barras con acciones propias (buscar + botones): envolver, no desplazar */
    .adm-tabs:has(.adm-search), .adm-tabs:has(.btn-new) { flex-wrap: wrap; overflow: visible; margin: 0 0 14px; padding: 0; }
    .adm-tabs:has(.btn-new) .adm-tab { flex: 0 0 auto; }
    .adm-tabs:has(.adm-search) .adm-search { flex: 1 1 100%; width: 100%; order: 8; }
    .adm-tabs .btn-new { flex: 1 1 calc(50% - 6px); order: 9; }
    .adm-tabs .btn-new:not(.alt) { flex-basis: 100%; order: 10; }
    .adm-tabs .tb-rate { order: 7; margin-left: auto; }
    .adm-tabs { scroll-padding-left: 12px; }
}

/* ---------- 3ª pasada ---------- */
.btn-cobrar { width: calc(100% - 28px); margin: 4px 14px 16px; }
.dp-head { flex-wrap: wrap; row-gap: 8px; }
.dp-head .dp-title { min-width: 120px; }
.dp-head .dp-btn { min-height: 36px; padding: 0 12px; }
@media (max-width: 1100px) {
    .rep-grid, .rep-grid2 { grid-template-columns: 1fr !important; }
    .rep-panel { width: 100%; }
}

/* ---------- 4ª pasada: contraste de modales, hoja POS, buscador de líneas ---------- */
.m-total, .m-total * { color: #fff !important; }
.m-total small, .m-total span { opacity: .92; font-size: 12.5px; letter-spacing: .08em; text-transform: uppercase; font-weight: 600; }
.m-total strong { text-shadow: 0 2px 10px rgba(0,0,0,.12); }
.btn-add-pay, .m-add { min-height: 44px; border-radius: 12px; background: var(--ink); color: #fff; font-weight: 700; justify-content: center; }
.btn-add-pay:hover, .m-add:hover { background: #16314A; }
.fd-search .pos-search { background-image: none; padding-left: 40px; }
.atr { min-height: 52px; padding-top: 10px; padding-bottom: 10px; }
@media (max-width: 760px) {
    .doc-panel { z-index: 90; padding-bottom: var(--safe-b); }
    .sheet-back { z-index: 85; }
    .modal-back { z-index: 100; }
    .ticket-fab { z-index: 60; }
}

/* ---------- 5ª pasada: Config, login ---------- */
.adm-h2:first-child { display: none; }
.cfg-tabs { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin-bottom: 20px; }
.cfg-tab {
    display: flex; align-items: center; gap: 12px; text-align: left; background: var(--surface);
    border: 1.5px solid var(--line); color: var(--ink); border-radius: var(--r-md); padding: 14px 16px; box-shadow: var(--sh-1);
    transition: .16s; min-height: 68px;
}
.cfg-tab:hover { border-color: var(--brand); transform: translateY(-1px); box-shadow: var(--sh-2); }
.cfg-tab.on { border-color: var(--brand); background: linear-gradient(135deg, #ECFBF8, #E8F5FD); box-shadow: 0 0 0 3px rgba(20,184,166,.15); color: var(--ink); }
.cfg-tab .ct-ico { width: 40px; height: 40px; border-radius: 12px; background: var(--grad-soft); color: var(--brand-deep); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.cfg-tab.on .ct-ico { background: var(--grad); color: #fff; }
.cfg-tab .ct-ico svg { width: 21px; height: 21px; }
.cfg-tab .ct-txt b { display: block; font-size: 15px; color: var(--ink); }
.cfg-tab .ct-txt small { display: block; color: var(--ink-3); font-size: 12px; font-weight: 500; }
.cfg-ico { color: var(--brand-deep); }
.cfg-card { max-width: 760px; }

.login-brand { padding: 56px; }
.lb-title { margin: 34px 0 10px; font-size: clamp(30px, 3.2vw, 46px); font-weight: 800; letter-spacing: -1.2px; line-height: 1.08; color: #fff; }
.lb-title span { color: #7CF3E3; }
.login-brand .brand-tag { max-width: 460px; margin: 0 0 30px; font-size: 16px; line-height: 1.55; opacity: .9; }
.login-brand .brand-points { gap: 12px; font-size: 15px; font-weight: 500; }
.login-brand .brand-points li { display: flex; align-items: center; }
.login-brand .brand-points .dot { width: 10px; height: 10px; background: #7CF3E3; box-shadow: 0 0 0 4px rgba(124,243,227,.2); flex-shrink: 0; }
@media (max-width: 760px) {
    .login-brand { padding: 30px 24px 64px; }
    .lb-title { font-size: 28px; margin: 18px 0 6px; }
    .login-brand .brand-tag, .login-brand .brand-points { display: none; }
}

@media (max-width: 900px) {
    .login-shell { flex-direction: column; min-height: 100dvh; }
    .login-brand { display: flex !important; flex: none; padding: 30px 24px 70px; min-height: 160px; justify-content: flex-start; }
    .login-brand .tg-lg .tg-mark { width: 52px; height: 52px; }
    .login-brand .tg-lg .tg-name { font-size: 26px; }
    .login-brand .tg-lg .tg-sub { font-size: 10px; }
    .lb-title { font-size: 26px; margin: 18px 0 4px; }
    .login-brand .brand-tag, .login-brand .brand-points { display: none; }
    .login-panel { margin-top: -40px; padding: 0 16px 28px; justify-content: flex-start; z-index: 1; }
}
.login-brand h1.lb-title { margin: 34px 0 10px; font-size: clamp(30px, 3.2vw, 46px); font-weight: 800; letter-spacing: -1.2px; }
@media (max-width: 900px) { .login-brand h1.lb-title { margin: 16px 0 4px; font-size: 26px; } }
.adm-filters .btn-print, .adm-filters .btn-pay, .adm-filters .rep-print { flex: 0 0 auto; width: auto; margin: 0; }
@media (min-width: 761px) { .adm-filters .rep-print { margin-left: auto; } }

/* ---------- Robustez de contenido ---------- */
.atr > * { min-width: 0; overflow-wrap: anywhere; }
.atr > span { max-height: 5.6em; overflow: hidden; }
.atr > .atr-act { max-height: none; overflow: visible; }
@media (min-width: 761px) and (max-width: 1100px) {
    .adm-table { overflow-x: auto; }
    .atr { min-width: 760px; }
}
#blazor-error-ui {
    display: none; position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 1000;
    background: #FFF4D6; color: #7A4B00; border: 1px solid #F3D68B; border-radius: 14px;
    padding: 12px 16px; box-shadow: var(--sh-2); font-weight: 600;
}
#blazor-error-ui .reload { color: var(--brand-deep); margin-left: 8px; }
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: 14px; top: 10px; }

@media (max-width: 760px) {
    .rep-cards { grid-template-columns: 1fr 1fr; }
    .dash-actions { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
    .dash-actions .btn-new { padding: 0 6px; font-size: 12px; gap: 5px; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
    .dash-actions .btn-new svg { width: 15px; height: 15px; flex-shrink: 0; }
    .rep-card b { font-size: 19px; overflow-wrap: anywhere; }
    .rep-card small { font-size: 10px; }
    .rep-panel, .day-chart { min-width: 0; max-width: 100%; }
}
@media (max-width: 380px) {
    .rep-cards { grid-template-columns: 1fr 1fr; }
    .dash-actions .btn-new svg { display: none; }
}

/* ============ Selectores con búsqueda (cliente / vendedor / productos) ============ */
.doc-pickers { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 14px 0 12px; }
.doc-add { margin: 0 0 12px; display: flex; gap: 10px; align-items: flex-start; }
.doc-add .picker { flex: 1; }
.doc-add > .btn-refresh { margin-top: 22px; height: 38px; white-space: nowrap; }
.picker { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.picker-lbl { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
.picker-btn {
    display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px; padding: 8px 12px; text-align: left;
    border: 1.5px dashed var(--line-2); border-radius: 14px; background: #FAFCFE; color: var(--ink-2);
    transition: .15s; cursor: pointer;
}
.picker-btn:hover { border-color: var(--brand); background: #F0FBF9; }
.picker-btn.has { border-style: solid; border-color: var(--brand); background: #F0FBF9; color: var(--ink); }
.picker-ico {
    width: 38px; height: 38px; flex-shrink: 0; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center;
    background: var(--grad-soft); color: var(--brand-deep);
}
.picker-btn.has .picker-ico { background: var(--grad); color: #fff; }
.picker-ico svg { width: 19px; height: 19px; }
.picker-main { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.2; }
.picker-main b { font-size: 14.5px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picker-main b.ph { color: var(--ink-2); font-weight: 600; }
.picker-main small { color: var(--ink-3); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picker-chev { color: var(--ink-3); display: inline-flex; }
.picker-chev svg { width: 18px; height: 18px; }
.picker-x { width: 28px; height: 28px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 18px; color: var(--ink-3); }
.picker-x:hover { background: var(--bad-bg); color: var(--bad); }
.picker-add { width: 100%; justify-content: center; min-height: 46px; border-style: dashed; }
.picker-back { z-index: 120; }
.picker-modal { width: min(560px, 100%); display: flex; flex-direction: column; }
.picker-modal .party-list { max-height: min(48vh, 420px); overflow-y: auto; margin: 6px 0 14px; }
.party-row { border-radius: 12px; border: 1.5px solid var(--line); padding: 11px 14px; margin-bottom: 8px; transition: .12s; }
.party-row:hover { border-color: var(--brand); background: #F0FBF9; }
.party-row.sel { border-color: var(--brand); background: #E6FAF7; }
.party-row .pr-name { font-weight: 700; color: var(--ink); }
.party-row .pr-meta { color: var(--ink-3); font-size: 12px; }
.pick-item {
    display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; position: relative;
    padding: 11px 14px; margin-bottom: 8px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--surface); transition: .12s;
}
.pick-item:hover { border-color: var(--brand); background: #F0FBF9; }
.pick-item.added { border-color: var(--brand); background: #E6FAF7; }
.pi-main { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.pi-main b { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pi-main small { color: var(--ink-3); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pi-side { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.25; flex-shrink: 0; }
.pi-side b { font-size: 15px; color: var(--brand-deep); font-variant-numeric: tabular-nums; }
.pi-side small { color: var(--ink-3); font-size: 11.5px; }
.pi-side small.txt-bad { color: var(--bad); font-weight: 700; }
.pi-badge { position: absolute; top: -8px; right: 10px; background: var(--grad); color: #fff; font-size: 11px; font-weight: 800; padding: 2px 9px; border-radius: 999px; box-shadow: 0 4px 10px rgba(14,165,233,.35); }
@media (max-width: 760px) {
    .doc-pickers { grid-template-columns: 1fr; gap: 10px; }
    .picker-modal { width: 100% !important; }
    .picker-modal .party-list { max-height: 52vh; }
}
.fd-lines { max-height: none; overflow: visible; }
.pick-items { padding-top: 12px; }
.modal.fac-modal { max-height: 94vh; overflow-y: auto; }
@media (max-width: 760px) {
    .fd-line { display: grid !important; grid-template-columns: 1fr 1.2fr 1.2fr; gap: 8px; padding: 12px; margin-bottom: 10px;
        border: 1px solid var(--line); border-radius: 14px; background: #FAFCFE; position: relative; }
    .fd-line .fd-desc { grid-column: 1 / -1; padding-right: 44px; }
    .fd-line .fd-num, .fd-line .fd-vat { width: 100%; min-width: 0; }
    .fd-line .fd-total { grid-column: 1 / -1; text-align: right; font-size: 16px; font-weight: 800; }
    .fd-line .m-x { position: absolute; top: 10px; right: 8px; }
}

/* ---------- 13. Gráficos de reportes ---------- */
.colchart { overflow-x: auto; padding: 10px 2px 4px; -webkit-overflow-scrolling: touch; }
.cc-track { display: flex; align-items: flex-end; gap: 5px; width: max-content; min-width: 100%; }
.cc-col { flex: 1 0 34px; display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
    gap: 4px; background: none; border: none; cursor: pointer; padding: 0 2px; }
.cc-val { font-size: 10px; font-weight: 700; color: var(--brand-deep); opacity: 0; transition: opacity .15s; white-space: nowrap; }
.cc-col:hover .cc-val, .cc-col.sel .cc-val { opacity: 1; }
.cc-plot { width: 100%; display: flex; align-items: flex-end; }
.cc-bar { width: 100%; display: flex; flex-direction: column-reverse; border-radius: 7px 7px 2px 2px;
    overflow: hidden; background: var(--grad); box-shadow: inset 0 1px 0 rgba(255,255,255,.3);
    animation: cc-grow .45s ease backwards; transition: filter .15s; }
.cc-bar.stacked { background: transparent; }
.cc-seg { display: block; width: 100%; }
.cc-col:hover .cc-bar { filter: brightness(1.08) saturate(1.1); }
.cc-col.sel .cc-bar { outline: 2px solid var(--brand-deep); outline-offset: 1px; }
.cc-lbl { font-size: 10.5px; color: var(--ink-3); font-weight: 600; white-space: nowrap; }
.cc-col.sel .cc-lbl { color: var(--brand-deep); font-weight: 800; }
@keyframes cc-grow { from { height: 0 !important; } }

.donut-wrap { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; padding: 8px 2px; }
.donut { width: 148px; height: 148px; border-radius: 50%; position: relative; flex: 0 0 auto;
    animation: donut-in .5s cubic-bezier(.2,.9,.3,1.2); }
@keyframes donut-in { from { transform: scale(.55); opacity: 0; } }
.donut-hole { position: absolute; inset: 23%; background: var(--surface, #fff); border-radius: 50%;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    box-shadow: inset 0 0 0 1px var(--line, #e6edf2); text-align: center; }
.donut-hole b { font-size: 15px; font-weight: 800; font-variant-numeric: tabular-nums; }
.donut-hole small { font-size: 10px; color: var(--ink-3); margin-top: 1px; }
.donut-legend { flex: 1; min-width: 170px; display: flex; flex-direction: column; gap: 2px; }
.dl-row { display: flex; align-items: center; gap: 9px; padding: 6px 9px; border-radius: 10px;
    border: none; background: none; cursor: pointer; text-align: left; font-size: 13px; width: 100%; }
.dl-row:hover { background: #F0FBF9; }
.dl-row.sel { background: #E4F6F4; box-shadow: inset 0 0 0 1.5px var(--brand); }
.dl-dot { width: 10px; height: 10px; border-radius: 3px; flex: 0 0 auto; }
.dl-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.dl-val { font-weight: 700; color: var(--ink-2); font-size: 12.5px; font-variant-numeric: tabular-nums; }

@media (max-width: 560px) {
    .donut { width: 120px; height: 120px; margin: 0 auto; }
    .donut-wrap { justify-content: center; }
    .cc-val { display: none; }
    .cc-col.sel .cc-val { display: block; }
}

/* --- error de página recuperable (ErrorBoundary) --- */
.page-error {
    max-width: 460px; margin: 80px auto; padding: 32px; text-align: center;
    background: #fff; border: 1px solid var(--line); border-radius: var(--r-lg);
    display: flex; flex-direction: column; gap: 10px; align-items: center;
}
.page-error b { font-size: 17px; color: var(--ink); }
.page-error span { font-size: 13.5px; color: var(--ink-3); }
.page-error .btn-primary { margin-top: 8px; }

/* --- auditoría --- */
.aud-filters { padding: 4px 0 12px; }
.af-row { display: flex; align-items: end; gap: 10px; flex-wrap: wrap; }
.af-row > label { font-size: 11px; font-weight: 700; color: var(--ink-3); text-transform: uppercase; letter-spacing: .4px; margin-bottom: 4px; }
.af-date { padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--r-md); font-size: 13px; color: var(--ink); background: #fff; }
.af-grow { flex: 1; min-width: 170px; }
.af-q { flex: 0 1 200px; padding: 9px 12px; border: 1px solid var(--line); border-radius: var(--r-md); font-size: 13px; }
.aud-list { display: flex; flex-direction: column; }
.aud-row { display: flex; align-items: center; gap: 12px; padding: 9px 4px; border-top: 1px solid var(--line); }
.aud-row:first-child { border-top: none; }
.aud-when { flex: 0 0 52px; display: flex; flex-direction: column; line-height: 1.15; }
.aud-when b { font-size: 12.5px; color: var(--ink); }
.aud-when em { font-style: normal; font-size: 11px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.aud-act { flex: 0 0 auto; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .3px; padding: 3px 8px; border-radius: 20px; white-space: nowrap; }
.aud-act.a-doc { background: #FEF3C7; color: #92400E; }
.aud-act.a-money { background: #DCFCE7; color: #166534; }
.aud-act.a-stock { background: #DBEAFE; color: #1E40AF; }
.aud-act.a-user { background: #F3E8FF; color: #6B21A8; }
.aud-act.a-bank { background: #CFFAFE; color: #155E75; }
.aud-act.a-config { background: #F1F5F9; color: #475569; }
.aud-act.a-other { background: #F1F5F9; color: #64748B; }
.aud-detail { flex: 1; min-width: 0; font-size: 13px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.aud-ent { font-style: normal; font-size: 10.5px; color: var(--ink-3); margin-left: 6px; }
.aud-who { flex: 0 0 auto; font-size: 12px; font-weight: 600; color: var(--ink); }

@media (max-width: 640px) {
    .aud-row { flex-wrap: wrap; gap: 4px 10px; }
    .aud-detail { flex: 1 1 100%; order: 3; white-space: normal; }
    .af-q { flex: 1 1 100%; }
}

/* --- aviso de stock bajo tras venta --- */
.r-lowstock { display: flex; flex-direction: column; gap: 3px; text-align: left; }
.r-lowstock b { font-size: 12px; }
.r-lowstock span { font-size: 12px; display: block; }

/* --- metas de venta --- */
.goal-cell { display: flex; flex-direction: column; gap: 2px; align-items: flex-end; }
.goal-pct { font-size: 13px; font-weight: 700; color: var(--ink-2); }
.goal-pct.met { color: #15803D; }
.goal-bar { width: 72px; height: 5px; background: var(--line); border-radius: 3px; overflow: hidden; }
.goal-fill { height: 100%; background: var(--brand); border-radius: 3px; transition: width .4s; }
.goal-fill.met { background: #22C55E; }
.goal-num { font-size: 10.5px; color: var(--ink-3); }
.goal-grid { display: flex; flex-direction: column; gap: 8px; margin: 12px 0; max-height: 320px; overflow-y: auto; }
.goal-row { display: flex; align-items: center; gap: 10px; }
.goal-row b { flex: 1; font-size: 13.5px; }
.goal-row input { width: 130px; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--r-md); font-size: 13px; text-align: right; }
.goal-month { display: flex; gap: 10px; align-items: center; margin-top: 6px; }
.goal-month input { padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--r-md); font-size: 13px; }

/* --- selector de canal de envío --- */
.btn-back.sel-ch { border-color: var(--brand); color: var(--brand-deep); background: var(--brand-soft, #EEF2FF); font-weight: 700; }

/* --- conteo físico --- */
.atr-cnt { grid-template-columns: 150px 1.2fr .5fr 100px; }
.atr-cntl { grid-template-columns: 110px 1.6fr .5fr .6fr .5fr; }
.atr-cntl.cnt-diff { background: #FFFBEB; }
.cnt-in { width: 90px; padding: 6px 8px; border: 1px solid var(--line); border-radius: var(--r-md); font-size: 13px; text-align: right; font-variant-numeric: tabular-nums; }
.cnt-in:focus { border-color: var(--brand); outline: none; }
@media (max-width: 640px) {
    .atr-cntl { grid-template-columns: 80px 1.3fr .45fr .6fr .45fr; font-size: 12.5px; }
    .cnt-in { width: 64px; }
}

/* ---------- Documento en media carta (detalle + impresión) ---------- */
.doc-modal { max-width: 880px; width: 94vw; }
.hl-sheet { background:#fff; border:1px solid var(--line-2); border-radius:8px; padding:16px 18px;
    font-size:12.5px; color:#111; display:flex; flex-direction:column; gap:12px; }
.hl-top { display:flex; justify-content:space-between; gap:16px; align-items:flex-start;
    border-bottom:2px solid var(--inv-accent, #111); padding-bottom:8px; }
.hl-biz b { font-size:16px; display:block; }
.hl-biz span, .hl-num span { display:block; color:#444; }
.hl-num { text-align:right; }
.hl-num b { font-size:15px; display:block; color:var(--inv-accent, #111); }
.hl-cust { display:grid; grid-template-columns:1.5fr 1fr 1fr; gap:6px 14px; }
.hl-cust small { display:block; color:#666; font-size:10px; text-transform:uppercase; letter-spacing:.05em; }
.hl-cust b { font-weight:600; }
.hl-cust .hl-wide { grid-column:1 / -1; }
.hl-cust > div:last-child { grid-column: span 2; }
.hl-tbl { width:100%; border-collapse:collapse; }
.hl-tbl th { text-align:left; font-size:10.5px; text-transform:uppercase; letter-spacing:.04em;
    color:var(--inv-accent, #444); border-bottom:1.5px solid var(--inv-accent, #111); padding:4px 6px; }
.hl-tbl td { padding:4px 6px; border-bottom:1px solid #e3e8ee; vertical-align:top; }
.hl-tbl thead { display:table-header-group; }
.hl-tbl tr { break-inside:avoid; }
.hl-tbl .num { text-align:right; white-space:nowrap; }
.hl-bottom { display:flex; gap:20px; align-items:flex-start; break-inside:avoid; }
.hl-notes { flex:1; color:#333; }
.hl-notes small { display:block; color:#666; font-size:10px; text-transform:uppercase; letter-spacing:.05em; margin-top:4px; }
.hl-notes p { margin:1px 0; }
.hl-tot { width:260px; }
.hl-tot > div { display:flex; justify-content:space-between; padding:2px 0; }
.hl-tot .hl-grand { border-top:1.5px solid var(--inv-accent, #111); margin-top:3px; padding-top:4px;
    font-size:15px; font-weight:800; color:var(--inv-accent, #111); }
#print-root { display: none; }
@media print {
    #print-root { display: block !important; }
    /* teranet.css oculta body * en impresión — reexponer el clon */
    #print-root, #print-root * { visibility: visible !important; }
    /* El documento se clona a #print-root y todo lo demás desaparece
       con display:none → sin espacio fantasma ni fragmentación rara */
    body.print-hl > *:not(#print-root) { display: none !important; }
    #print-root .hl-sheet { border:none; border-radius:0; padding:0;
        font-size:10.5px; line-height:1.35; display:block !important; gap:0 !important;
        max-height:none !important; overflow:visible !important; }
    #print-root .hl-sheet > * { margin-bottom:7px; }
    #print-root .hl-top { display:flex !important; gap:12px; padding-bottom:5px;
        break-inside:avoid; }
    #print-root .hl-biz b { font-size:13px; }
    #print-root .hl-num b { font-size:12.5px; }
    #print-root .hl-cust { gap:3px 12px; break-inside:avoid; }
    #print-root .hl-tbl { page-break-inside:auto !important; }
    #print-root .hl-tbl tr { break-inside:avoid; }
    #print-root .hl-tbl td, #print-root .hl-tbl th { padding:2px 6px; }
    #print-root .hl-bottom { display:flex !important; gap:14px; break-inside:avoid; }
    #print-root .hl-tot { width:230px; }
    /* Vouchers (.rcpt) y hojas (.psheet) clonados por teranetPrint():
       fuera del modal no llevan posición fija ni scroll de pantalla */
    #print-root .rcpt {
        position: static !important; left: auto !important; top: auto !important;
        max-height: none !important; overflow: visible !important;
        border: none !important; border-radius: 0 !important; margin: 0 !important;
        width: 100% !important; display: block !important;
    }
    #print-root .psheet {
        position: static !important; left: auto !important; top: auto !important;
        max-height: none !important; overflow: visible !important;
        width: 100% !important; display: block !important;
    }
}


.grp-pick { display:flex; gap:8px; align-items:center; min-width:0; }
.grp-pick .picker { flex:1; min-width:0; }
.grp-pick .picker-btn { min-width:0; }
.grp-pick .picker-main { min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.grp-new { flex:0 0 auto; white-space:nowrap; padding:8px 10px; font-size:12px; }
.f-grid .grp-row { grid-column: 2 / span 3; }

/* ---------- Panel de plataforma: actividad de clientes ---------- */
.atr-actv { grid-template-columns: 1.5fr .8fr 1.1fr .9fr 2.5fr 1fr .8fr 24px; align-items: center; gap: 10px; }
.atr-actv > span { min-width: 0; }
.atr-actv small, .atr-actv .lic-sub { display: block; }
.act-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 4px; background: #c4cdd5; }
.act-dot.hot { background: #16a34a; box-shadow: 0 0 0 3px rgba(22,163,74,.18); }
.act-dot.warm { background: #f59e0b; }
.act-dot.cold { background: #ef4444; }
.act-dot.none { background: #c4cdd5; }
.act-warn { color: #d97706 !important; font-weight: 700; }
.act-chips, .act-feats { display: flex; flex-wrap: wrap; gap: 5px; }
.act-chip { display: inline-flex; align-items: center; gap: 5px; font-style: normal; font-size: 11.5px;
    padding: 2px 8px; border-radius: 999px; background: var(--brand-soft, #e6faf6); color: var(--brand-deep, #0b7a6b); }
.act-chip b { font-weight: 800; }
.act-quota { height: 4px; border-radius: 3px; background: #e8eef3; margin-top: 3px; overflow: hidden; }
.act-quota i { display: block; height: 100%; background: var(--brand, #14b8a6); }
.act-quota i.hot { background: #ef4444; }
.act-detail { padding: 12px 16px 16px; background: #f7fafc; border-bottom: 1px solid var(--line, #e3e8ee); }
.act-mods { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin-bottom: 10px; }
.act-mod { background: #fff; border: 1px solid var(--line, #e3e8ee); border-radius: 10px; padding: 8px 10px; }
.act-mod.off { opacity: .5; }
.act-mod small { display: block; color: var(--ink-3, #6b7c88); font-size: 11px; }
.act-mod b { font-size: 18px; }
.act-mod em { display: block; font-style: normal; font-size: 11.5px; color: var(--ink-3, #6b7c88); }
.act-facts { display: flex; flex-wrap: wrap; gap: 4px 18px; font-size: 12.5px; color: var(--ink-3, #6b7c88); margin-bottom: 8px; }
.act-facts b { color: var(--ink, #12212b); }
.act-trend { display: flex; align-items: flex-end; gap: 6px; height: 92px; padding: 22px 10px 18px; margin: 0 0 14px;
    background: #fff; border: 1px solid var(--line, #e3e8ee); border-radius: 12px; position: relative; }
.act-bar { flex: 1; height: 100%; position: relative; display: flex; align-items: flex-end; }
.act-bar i { display: block; width: 100%; background: var(--brand, #14b8a6); border-radius: 3px 3px 0 0; min-height: 2px; }
.act-bar small { position: absolute; bottom: -15px; left: 0; right: 0; text-align: center; font-size: 9.5px; color: #8aa2ae; }
.act-trend-lbl { position: absolute; top: 4px; left: 12px; font-size: 10.5px; color: #8aa2ae; }
.act-soon { color: #d97706; font-size: 10px; margin-left: 4px; text-transform: uppercase; letter-spacing: .04em; }
.lic-fgroup { grid-column: 1 / -1; font-size: 11px; font-weight: 800; text-transform: uppercase;
    letter-spacing: .06em; color: var(--ink-3, #6b7c88); margin: 10px 0 2px; }
.plan-modal { max-width: 640px; }
@media (max-width: 900px) {
    .atr-actv { grid-template-columns: 1.4fr .8fr 1fr 24px; }
    .atr-actv > span:nth-child(4), .atr-actv > span:nth-child(5),
    .atr-actv > span:nth-child(6), .atr-actv > span:nth-child(7) { display: none; }
}
.lic-grid .lic-feats { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 6px 14px; }
.lic-grid .lic-sect { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; }
.lic-grid .lic-row3 { grid-column: 1 / -1; }

.np-form { display:grid; grid-template-columns:1fr 1fr; gap:10px 12px; margin:6px 0 12px; }
.np-form label { display:flex; flex-direction:column; gap:4px; font-size:12px; font-weight:600; color:#5a6b78; text-align:left; }
.np-form label small { font-weight:400; color:#8aa2ae; }
.np-form .np-wide { grid-column:1 / -1; }
.np-form .field { width:100%; }

/* ---- Botones de acción con texto (Estatus, Reintentar, Ver, Email, Anular…) ---- */
.atr-act .atr-btn, .adm-ptitle .atr-btn, .fq-ok .atr-btn {
    width: auto; min-width: 34px; height: 34px; padding: 0 12px; white-space: nowrap;
    font-size: 12.5px; font-weight: 600; line-height: 1; flex: none;
    border: 1px solid var(--line-2); border-radius: 10px; background: var(--surface); color: var(--brand-deep);
    display: inline-flex; align-items: center; justify-content: center; cursor: pointer; transition: .15s;
}
.atr-act .atr-btn:hover:not(:disabled), .adm-ptitle .atr-btn:hover:not(:disabled), .fq-ok .atr-btn:hover:not(:disabled) {
    border-color: var(--brand); background: #F0FBF9;
}
.atr-act .atr-btn:disabled, .adm-ptitle .atr-btn:disabled, .fq-ok .atr-btn:disabled { opacity: .5; cursor: default; }
.atr-act { flex-wrap: wrap; }
.fq-ok { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.adm-ptitle { flex-wrap: wrap; }
.atr-fq { grid-template-columns: minmax(105px,1.2fr) minmax(70px,.6fr) minmax(60px,.6fr) minmax(110px,1.6fr) 78px 180px; }
.atr-ret { grid-template-columns: 132px 44px minmax(90px,1.2fr) minmax(82px,.8fr) 100px 86px 178px; gap: 10px; }
.atr-ret > span:nth-child(1) small { display: block; }
.atr-ret > span:nth-child(5) { white-space: nowrap; }
.atr-ret .atr-btn { height: 30px; padding: 0 9px; }
.atr-act { gap: 5px; }
.cart-actions { flex-wrap: wrap; max-width: 100%; }
.cart-actions .field { flex: 1 1 200px; min-width: 0; max-width: 240px; }
@media (max-width: 760px) {
    .atr-fq { grid-template-columns: 1.1fr .9fr 2fr 90px; }
    .atr:not(.atr-head) > .atr-act .atr-btn { width: auto; min-width: 44px; height: 40px; }
}

/* ---- Encabezado de Facturación en dos filas: pestañas + tasa / buscador + acciones ---- */
.adm-tabs + .adm-actionbar { margin-top: -4px; gap: 10px; flex-wrap: wrap; }
.adm-actionbar .adm-search { flex: 1 1 260px; width: auto; max-width: 420px; min-width: 200px; }
.adm-actionbar .adm-spacer { flex: 1 1 0; }
.adm-actionbar .btn-new { flex: none; white-space: nowrap; }
@media (max-width: 760px) {
    .adm-tabs + .adm-actionbar { margin-top: 0; }
    .adm-actionbar .adm-search { max-width: none; }
    .adm-actionbar .adm-spacer { display: none; }
}
@media (max-width: 760px) {
    .adm-actionbar .btn-new { flex: 1 1 calc(33% - 8px); min-width: 0; padding: 0 8px; justify-content: center; }
    .adm-actionbar .btn-new svg { display: none; }
    .adm-actionbar .btn-new:not(.alt) { flex-basis: 100%; }
}

/* ---- Ventanas de cobro/pago: compactas + resumen por forma de pago ---- */
.pay-modal { gap: 10px; padding-top: 20px; }
.pay-modal .m-head { margin-bottom: 0; }
.pay-modal .m-total { padding: 10px 14px; }
.pay-modal .m-total strong { font-size: 24px; }
.pay-modal .m-methods.pay-compact { display: flex; flex-wrap: wrap; gap: 6px; }
.pay-modal .m-methods.pay-compact .m-chip { min-height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: 8px; flex: 0 0 auto; }
.pay-modal .m-doctype { margin-bottom: 0; }
.pay-modal .m-doctype .m-chip { min-height: 32px; font-size: 12.5px; }
.pay-modal .m-amount { gap: 4px; }
.pay-modal .field.big { min-height: 40px; font-size: 18px; padding: 6px 12px; }
.pay-modal .btn-add-pay, .pay-modal .m-add { min-height: 38px; margin: 0; padding: 8px 12px; }
.pay-modal .m-pays { max-height: 96px; }
.pay-modal .pay-row { padding: 5px 10px; font-size: 12.5px; }
.pay-modal .ret-lines { max-height: 110px; margin-bottom: 4px; }
.pay-modal .ret-line { padding: 5px 8px; }
.pay-modal .ret-info { margin-bottom: 0; }
.pay-modal .m-status { padding: 8px 12px; }
.pay-sum { position: sticky; top: -1px; z-index: 2; background: var(--surface); border: 1.5px solid var(--line-2);
  border-radius: 12px; padding: 8px 12px; display: flex; flex-direction: column; gap: 6px; }
.pay-sum.ok { border-color: var(--ok); background: var(--ok-bg); }
.pay-sum .ps-head { display: flex; justify-content: space-between; gap: 8px; font-size: 12.5px; color: var(--ink-2); flex-wrap: wrap; }
.pay-sum .ps-head b { color: var(--ink); font-size: 14px; }
.pay-sum .ps-rest { font-weight: 700; color: var(--warn); }
.pay-sum.ok .ps-rest { color: var(--ok); }
.pay-sum .ps-bar { height: 5px; border-radius: 4px; background: var(--line-2); overflow: hidden; }
.pay-sum .ps-bar i { display: block; height: 100%; background: var(--grad); transition: width .2s; }
.pay-sum.ok .ps-bar i { background: var(--ok); }
.pay-sum .ps-empty { font-size: 12px; color: var(--txt-dim, #94A3B8); }
.pay-sum .ps-list { display: flex; flex-wrap: wrap; gap: 5px; }
.pay-sum .ps-chip { display: inline-flex; align-items: baseline; gap: 5px; background: var(--brand-soft, #e0f2fe);
  color: var(--brand-deep); border-radius: 999px; padding: 3px 10px; font-size: 12px; font-weight: 600; }
.pay-sum .ps-chip b { font-weight: 800; }
.pay-sum .ps-chip small { opacity: .75; font-size: 11px; font-weight: 500; }
.pay-modal > * { flex-shrink: 0; }
.pay-sum .ps-head > span { display: inline; }
.pay-sum .ps-head b { display: inline; }
.pay-sum .ps-head { align-items: baseline; }
.pay-sum .ps-list { max-height: 92px; overflow-y: auto; }
.pay-sum .ps-x { color: var(--bad, #dc2626); font-size: 15px; line-height: 1; padding: 0 2px; background: none; border: 0; cursor: pointer; }

/* Ventanas apiladas: cada paso queda por encima del detalle del documento */
.modal-back.z-edit { z-index: 110; }
.modal-back.z-conv { z-index: 120; }
.modal-back.z-pay  { z-index: 130; }
.btn-pay.emit.alt { background: var(--ink); margin-top: -4px; }
.btn-pay.emit.alt:hover:not(:disabled) { background: #16314A; }

/* ---- Compra (Inventario): encabezado compacto + líneas visibles ---- */
.pur-compact { gap: 10px; }
.pur-compact > * { flex-shrink: 0; }
.pur-head { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: flex-end; }
.pur-head .pf { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.pur-head .pf > label { font-size: 11.5px; font-weight: 700; color: #5a6b78; text-align: left; text-transform: uppercase; letter-spacing: .3px; }
.pur-head .pf-sup { flex: 1 1 240px; }
.pur-head .pf-sm { flex: 0 0 150px; }
.pur-head .pf-xs { flex: 0 0 100px; }
.pur-head .pf .field { padding: 7px 10px; font-size: 13.5px; min-height: 36px; width: 100%; box-sizing: border-box; }
.pur-head .pur-chips { display: flex; gap: 6px; }
.pur-head .pur-chips .m-chip { min-height: 34px; padding: 0 12px; font-size: 12.5px; }
.pur-head .pf-chk { flex-direction: row; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--ink-2);
  text-transform: none; letter-spacing: 0; padding-bottom: 8px; white-space: nowrap; }
.pur-head .pf-chk small { color: var(--txt-dim, #94a3b8); font-weight: 500; }
.pur-lines { border: 1px solid var(--line); border-radius: 12px; overflow-y: auto; max-height: 260px; min-height: 60px; }
.pur-lines .pl-row { display: grid; grid-template-columns: 1fr 78px 96px 92px 28px; gap: 8px; align-items: center; padding: 6px 10px;
  border-bottom: 1px solid var(--line); }
.pur-lines .pl-row:last-child { border-bottom: 0; }
.pur-lines .pl-hd { position: sticky; top: 0; background: var(--surface); font-size: 11px; font-weight: 700; color: #5a6b78;
  text-transform: uppercase; letter-spacing: .3px; z-index: 1; padding-top: 8px; padding-bottom: 8px; }
.pur-lines .pl-name { font-size: 13px; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pur-lines .pl-name small { display: block; color: var(--txt-dim, #94a3b8); font-weight: 500; font-size: 11px; }
.pur-lines .pur-in { width: 100%; margin: 0; padding: 5px 8px; min-height: 32px; box-sizing: border-box; }
.pur-lines .pl-sub { text-align: right; font-size: 13px; }
.pur-lines .m-x { font-size: 18px; line-height: 1; }
@media (max-width: 560px) { .pur-lines .pl-row { grid-template-columns: 1fr 60px 76px 24px; } .pur-lines .pl-row > :nth-child(4) { display: none; } }

/* ---- Lotes y vencimientos ---- */
.pur-lines .pl-row.pl-lots { grid-template-columns: 1fr 64px 88px 96px 116px 84px 26px; }
.exp-cards { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.exp-card { flex: 1; min-width: 120px; background: #fff; border: 1px solid #e2e8f0;
    border-radius: 12px; padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; }
.exp-card b { font-size: 26px; font-weight: 800; color: #0f172a; }
.exp-card span { font-size: 12px; color: #64748b; }
.exp-card.exp-red b { color: #dc2626; }
.exp-card.exp-amber b { color: #d97706; }
.exp-card.exp-yellow b { color: #ca8a04; }
.exp-card.exp-green b { color: #16a34a; }
tr.exp-x td { background: #fef2f2; }
tr.exp-30 td { background: #fffbeb; }
tr.exp-60 td { background: #fefce8; }
.tbl-empty { text-align: center; color: #94a3b8; padding: 26px !important; }

/* ---- Fidelidad ---- */
.btn-pts { width: 100%; margin: 8px 0 2px; padding: 10px 14px; border: 1.5px dashed #8b5cf6;
    background: #f5f3ff; color: #6d28d9; border-radius: 10px; font-weight: 700;
    font-size: 14px; cursor: pointer; }
.btn-pts:hover:not(:disabled) { background: #ede9fe; }
.btn-pts:disabled { opacity: .5; cursor: default; }
.f-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ---- Variantes y combos ---- */
.var-box { border: 1px dashed #cbd5e1; border-radius: 10px; padding: 10px;
    margin-top: 8px; display: flex; flex-direction: column; gap: 8px; }
.var-hd { display: flex; justify-content: space-between; align-items: center; }
.var-hd b { font-size: 13px; }
.var-row { display: grid; grid-template-columns: 1.4fr 1fr 1.2fr .7fr .6fr 26px;
    gap: 6px; align-items: center; }
.var-row.comp { grid-template-columns: 1fr 90px 26px; }
/* Fila de opción de modificador: el nombre manda, el precio va angosto */
.var-row.mo { grid-template-columns: 1fr 110px 30px; }
.var-row.mo .field { font-size: 14.5px; min-height: 42px; padding: 9px 12px; }
.var-row .field { padding: 5px 8px; min-height: 30px; font-size: 13px; }
.cmp-name { font-size: 13px; font-weight: 600; }
.cmp-name small { color: #64748b; font-weight: 400; margin-left: 4px; }
.var-box small { color: #94a3b8; font-size: 11px; }
.btn-new.sm { padding: 3px 10px; font-size: 13px; }
.pur-var { margin-top: 4px; width: 150px; padding: 3px 6px; font-size: 12px;
    display: block; }

/* picker de variantes en el POS */
.var-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px; padding: 6px 0; }
.var-chip { display: flex; flex-direction: column; gap: 2px; padding: 12px;
    border: 1.5px solid #e2e8f0; border-radius: 12px; background: #fff;
    cursor: pointer; text-align: center; }
.var-chip:hover { border-color: #14b8a6; background: #f0fdfa; }
.var-chip b { font-size: 15px; }
.var-chip small { color: #64748b; }
.var-chip em { font-style: normal; font-size: 11px; color: #16a34a; }
.var-chip em.out { color: #dc2626; }
.var-chip.sel { border-color:#14b8a6; background:#f0fdfa;
    box-shadow:0 0 0 1px #14b8a6 inset; }
.mod-grp { margin-bottom:14px }
.mod-grp-hd { display:flex; align-items:center; gap:8px; margin-bottom:6px }
.mod-grp-hd b { font-size:14px }
.dtr-mods { display:block; font-size:11px; color:#0d9488; font-style:italic }

/* órdenes de compra */
.po-row { display:flex; align-items:center; justify-content:space-between;
    padding:10px 4px; border-bottom:1px solid var(--bd,#e5e7eb); gap:10px }
.po-row:last-child { border-bottom:none }
.po-info { display:flex; flex-direction:column; gap:2px; min-width:0 }
.po-info small { color:var(--mut,#64748b) }
.po-recv { color:var(--pri,#0d9488) }
.po-act { display:flex; align-items:center; gap:8px; flex-shrink:0 }

/* formato de factura */
.paper-sel { padding:7px 10px; border:1px solid var(--bd,#e5e7eb); border-radius:8px;
    background:#fff; font-size:12.5px; color:var(--ink,#0f172a) }
.m-actions .paper-sel { align-self:center }
.print-letter .hl-sheet { font-size:14px }
.print-letter .hl-sheet .hl-tbl th { font-size:11.5px }

/* marca en factura */
.hl-logo { max-height:46px; max-width:140px; object-fit:contain; }
.hl-biz { display:flex; align-items:center; gap:10px; }
.hl-biz > div, .hl-biz > span { display:block; }
.brand-color { width:44px; height:30px; padding:2px; border:1px solid var(--bd,#e5e7eb);
    border-radius:6px; background:#fff; cursor:pointer }
.brand-prev { max-height:40px; max-width:120px; object-fit:contain;
    border:1px solid var(--bd,#e5e7eb); border-radius:6px; padding:3px; background:#fff }
.brand-demo { border:1px solid var(--bd,#e5e7eb); border-radius:8px; padding:12px 14px;
    background:#fff; font-size:12px; display:flex; flex-direction:column; gap:8px }
.brand-demo .bd-top { display:flex; justify-content:space-between; align-items:flex-start;
    border-bottom:2px solid var(--inv-accent); padding-bottom:6px }
.brand-demo .bd-biz { display:flex; align-items:center; gap:8px; font-weight:600 }
.brand-demo .bd-biz img { max-height:26px; max-width:70px; object-fit:contain }
.brand-demo .bd-doc { font-weight:800; color:var(--inv-accent); font-size:13px }
.brand-demo .bd-ln { display:flex; justify-content:space-between;
    border-bottom:1px solid #eee; padding-bottom:5px }
.brand-demo .bd-tot { display:flex; justify-content:space-between; font-weight:800;
    color:var(--inv-accent) }

/* multi-almacén */
.wh-tbl .atr { display:grid; grid-template-columns:1.6fr repeat(auto-fit, 90px);
    gap:8px; align-items:center; padding:7px 4px; border-bottom:1px solid var(--bd,#e5e7eb) }
.wh-tbl .atr-head { font-size:11px; text-transform:uppercase; color:var(--mut,#64748b) }
.wh-tbl .num { text-align:right }
.st-low { color:#dc2626 }

/* ---- Alertas de anomalías ---- */
.atr-alert {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 14px; border-bottom: 1px solid var(--line, #E6ECF2);
}
.atr-alert.read { opacity: .55; }
.atr-alert.sev-critical { border-left: 3px solid #EF4444; }
.atr-alert.sev-warn { border-left: 3px solid #F59E0B; }
.atr-alert.sev-info { border-left: 3px solid #38BDF8; }
.alt-sev { font-size: 15px; flex-shrink: 0; }
.alt-main { flex: 1; min-width: 0; }
.alt-main small { display: block; color: var(--ink-3, #7C8B99); margin-top: 2px; }
.btn-mini {
    padding: 4px 10px; border-radius: 8px; border: 1px solid var(--line, #D7E0E8);
    background: #fff; color: var(--ink-2, #405263); font-size: 12px; font-weight: 600;
    cursor: pointer; flex-shrink: 0;
}
.btn-mini:hover { background: #F4F8FB; }

/* ============ PLANES PUBLICOS ============ */
.plans-body { max-width: 1200px; }
.plans-head h2 { margin: 0 0 6px; font-size: 24px; }
.plans-sub { color: var(--ink-3); margin: 0 0 18px; max-width: 720px; }
.plans-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 18px; align-items: start; }
.plan-card { padding: 20px 22px; position: relative; }
.plan-card.current { border-color: var(--acc, #14b8a6); border-width: 2px; }
.plan-badge { position: absolute; top: 14px; right: 14px; background: var(--acc, #14b8a6); color: #fff;
    font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 999px; z-index: 1; }
.plan-name { margin: 4px 0 2px; font-size: 19px; }
.plan-desc { color: var(--ink-3); font-size: 13px; margin-bottom: 8px; }
.plan-price b { font-size: 30px; font-weight: 800; }
.plan-price span { color: var(--ink-3); font-size: 14px; }
.plan-setup { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.plan-quotas { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 12px 0 6px; font-size: 12.5px; color: var(--ink-2); }
.plan-fgroup { font-size: 11px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase;
    color: var(--ink-3); margin: 12px 0 4px; border-top: 1px solid var(--line); padding-top: 10px; }
.plan-feat { font-size: 13px; padding: 2.5px 0; display: flex; align-items: baseline; gap: 7px; }
.plan-feat.dim { color: var(--ink-3); }
.plan-check { color: var(--acc, #14b8a6); font-weight: 800; }
.plans-extra { margin-top: 20px; padding: 18px 22px; }
.plans-extra h4 { margin: 0 0 4px; }
.plan-feats-inline { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.plan-chip { background: rgba(20,184,166,.1); border: 1px solid rgba(20,184,166,.35);
    padding: 4px 12px; border-radius: 999px; font-size: 12.5px; }

/* complementos por industria */
.plans-addons { margin-top: 26px; }
.plans-addons h3 { margin: 0 0 4px; }
.addons-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; margin-top: 12px; }
.addon-card { padding: 14px 18px; }
.addon-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.addon-price { color: var(--acc, #14b8a6); font-weight: 800; font-size: 14px; white-space: nowrap; }

/* lookup de usuarios (licencias) */
.ulk-user { border-top: 1px solid var(--line); padding: 10px 0 6px; }
.ulk-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ulk-head b { font-size: 14.5px; }
.atr-ulk { display: grid; grid-template-columns: 2fr 1fr .6fr 1fr; gap: 8px; align-items: center;
    padding: 5px 0; border-top: 1px dashed var(--line); font-size: 13px; }

/* feature destacado en tarjetas de planes */
.plan-feat.hl { font-weight: 600; color: #b45309; }
.plan-feat.hl .plan-check { color: #d97706; }
