:root {
    --bg: #f4f5f7;
    --surface: #ffffff;
    --surface-2: #f8fafc;
    --text: #0f172a;
    --muted: #64748b;
    --border: #e2e8f0;
    --primary: #000000;
    --primary-text: #ffffff;
    --accent: #e11d48;
    --ok: #16a34a;
    --ok-bg: #dcfce7;
    --warn: #b45309;
    --warn-bg: #fef3c7;
    --danger: #dc2626;
    --danger-bg: #fee2e2;
    --info-bg: #e0f2fe;
    --info: #0369a1;
    --radius: 10px;
    --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 4px 12px rgba(15, 23, 42, .04);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.45;
}
h1, h2, h3, .brand-logo, .kpi-value { font-family: 'Space Grotesk', sans-serif; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }

/* Layout */
.app { display: flex; min-height: 100vh; }
.sidebar {
    width: 230px; flex-shrink: 0; background: #0b0b0b; color: #e5e7eb;
    display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.brand { padding: 22px 20px 18px; border-bottom: 1px solid #1f2937; }
.brand-logo { display: block; font-size: 22px; font-weight: 800; color: #fff; letter-spacing: -.5px; }
.brand-sub { font-size: 12px; color: #9ca3af; }
.nav { display: flex; flex-direction: column; padding: 12px 10px; gap: 2px; flex: 1; overflow-y: auto; }
.nav a, .nav-group-btn {
    text-decoration: none; padding: 10px 12px; border-radius: 8px; font-weight: 600; color: #d1d5db;
    display: flex; align-items: center; justify-content: space-between; width: 100%; text-align: left;
}
.nav-group-btn { background: transparent; border: 0; cursor: pointer; font-size: 14px; }
.nav a:hover, .nav-group-btn:hover { background: #1f2937; color: #fff; }
.nav a.active { background: #fff; color: #000; }
.nav-group-btn.has-active { color: #fff; }
.caret { font-size: 11px; transition: transform .15s; opacity: .7; }
.nav-group.open .caret { transform: rotate(180deg); }
.nav-sub { display: none; flex-direction: column; gap: 2px; padding: 2px 0 6px 12px; margin-left: 10px; border-left: 1px solid #374151; }
.nav-group.open .nav-sub { display: flex; }
.nav-sub a { font-weight: 500; font-size: 13px; padding: 8px 10px; }
.sidebar-foot { padding: 14px 16px; border-top: 1px solid #1f2937; font-size: 13px; display: flex; flex-direction: column; gap: 10px; }
.sidebar-foot a { color: #9ca3af; text-decoration: none; }
.sidebar-foot a:hover { color: #fff; }
.user-box { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.user-info { display: flex; flex-direction: column; min-width: 0; }
.user-info strong { color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-info span { color: #9ca3af; font-size: 12px; }
.user-box .btn-dark { background: #1f2937; border-color: #374151; color: #fff; }
.user-box .btn-dark:hover { background: #374151; }
.sidebar-backdrop { display: none; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
    display: flex; align-items: center; gap: 12px; padding: 16px 28px;
    background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 5;
}
.topbar h1 { font-size: 22px; flex: 1; }
.menu-btn { display: none; }
.view { padding: 24px 28px 60px; max-width: 1400px; width: 100%; }

/* Components */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    border: 1px solid var(--border); background: var(--surface); padding: 8px 14px; border-radius: 8px;
    font-weight: 700; cursor: pointer; text-decoration: none; white-space: nowrap; font-size: 13px;
}
.btn:hover { background: var(--surface-2); }
.btn-primary { background: var(--primary); color: var(--primary-text); border-color: var(--primary); }
.btn-primary:hover { background: #262626; }
.btn-danger { color: var(--danger); border-color: #fecaca; }
.btn-danger:hover { background: var(--danger-bg); }
.btn-sm { padding: 5px 9px; font-size: 12px; }
.btn-lg { padding: 12px 18px; font-size: 15px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.icon-btn { border: 0; background: transparent; font-size: 22px; cursor: pointer; padding: 4px 8px; line-height: 1; border-radius: 6px; }
.icon-btn:hover { background: var(--surface-2); }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.card + .card { margin-top: 18px; }
.card h3 { font-size: 16px; margin-bottom: 12px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.card-head h3 { margin: 0; }

.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 16px; }
.toolbar .grow { flex: 1; min-width: 200px; }
.toolbar .spacer { flex: 1; }

input[type=text], input[type=number], input[type=date], input[type=email], input[type=tel], input[type=search], select, textarea {
    width: 100%; border: 1px solid var(--border); background: var(--surface); border-radius: 8px; padding: 8px 10px; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: #000; box-shadow: 0 0 0 3px rgba(0, 0, 0, .08); }
textarea { resize: vertical; min-height: 60px; }
label.field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 700; color: var(--muted); }
label.field > span { text-transform: uppercase; letter-spacing: .3px; }
label.check { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; cursor: pointer; }
label.check input { width: 16px; height: 16px; accent-color: #000; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.form-grid .full { grid-column: 1 / -1; }

.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { background: var(--surface-2); font-size: 11px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #fafafa; }
td.num, th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
td.actions { white-space: nowrap; text-align: right; }
td.actions .btn + .btn { margin-left: 4px; }
tfoot td { font-weight: 800; background: var(--surface-2); }
.empty { text-align: center; color: var(--muted); padding: 30px 12px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.strong { font-weight: 800; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 800; white-space: nowrap; }
.badge-ok { background: var(--ok-bg); color: var(--ok); }
.badge-warn { background: var(--warn-bg); color: var(--warn); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-info { background: var(--info-bg); color: var(--info); }
.badge-usd { background: #dcfce7; color: #15803d; }
.badge-muted { background: #f1f5f9; color: var(--muted); }

/* Panel */
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.kpi-label { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .3px; }
.kpi-value { font-size: 26px; font-weight: 800; margin: 4px 0 2px; }
.kpi-sub { font-size: 12px; color: var(--muted); }
.kpi-usd, .kpi-value.small-value { font-size: 15px; font-weight: 800; color: #15803d; margin-bottom: 2px; }
.kpi.alert .kpi-value { color: var(--danger); }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; }
.grid-2 > *, .venta-grid > * { min-width: 0; }
.grid-2 .card + .card { margin-top: 0; }

/* Venta */
.venta-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; }
.venta-grid .card + .card { margin-top: 0; }
.add-row { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; align-items: end; margin-bottom: 8px; }
.add-row > :nth-child(1), .add-row > :nth-child(2), .add-row > :nth-child(3), .add-row > :nth-child(5), .add-row > :nth-child(7) { grid-column: span 2; }
.add-btns .btn { flex: 1; }
.add-btns { display: flex; gap: 6px; }
.resumen { position: sticky; top: 84px; }
.resumen .line { display: flex; justify-content: space-between; padding: 5px 0; }
.resumen .line.total { border-top: 2px solid #000; margin-top: 6px; padding-top: 10px; font-size: 20px; font-weight: 800; font-family: 'Space Grotesk', sans-serif; }
.resumen .stack { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.stock-hint { font-size: 11px; color: var(--muted); }
.qty-input { width: 100px; min-width: 90px; }

/* Modal */
.modal { border: 0; border-radius: 14px; padding: 0; width: min(720px, calc(100vw - 24px)); max-height: calc(100vh - 32px); box-shadow: 0 20px 60px rgba(0, 0, 0, .25); margin: auto; }
.modal.wide { width: min(980px, calc(100vw - 24px)); }
.modal::backdrop { background: rgba(15, 23, 42, .5); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface); z-index: 1; }
.modal-head h2 { font-size: 18px; }
.modal-body { padding: 18px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--border); background: var(--surface-2); position: sticky; bottom: 0; flex-wrap: wrap; }
.modal-foot:empty { display: none; }

/* Toasts */
.toasts { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 1000; }
.toast { background: #111; color: #fff; padding: 10px 16px; border-radius: 8px; font-weight: 600; box-shadow: 0 6px 20px rgba(0, 0, 0, .2); max-width: 360px; animation: toast-in .2s ease-out; }
.toast.error { background: var(--danger); }
.toast.ok { background: var(--ok); }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* Comprobante */
.factura { background: #fff; color: #000; font-size: 12px; max-width: 800px; margin: 0 auto; }
.fa-head { display: grid; grid-template-columns: 1fr 70px 1fr; border: 1px solid #000; }
.fa-head > div { padding: 12px; }
.fa-emp h2 { font-size: 22px; margin-bottom: 4px; }
.fa-letra { border-left: 1px solid #000; border-right: 1px solid #000; text-align: center; display: flex; flex-direction: column; justify-content: flex-start; align-items: center; }
.fa-letra strong { font-size: 38px; line-height: 1; font-family: 'Space Grotesk', sans-serif; border: 2px solid #000; padding: 2px 10px; margin-bottom: 4px; }
.fa-datos h3 { font-size: 16px; margin-bottom: 4px; }
.fa-cliente { border: 1px solid #000; border-top: 0; padding: 10px 12px; display: grid; grid-template-columns: 1fr 1fr; gap: 4px 16px; }
.factura table { margin-top: 10px; border: 1px solid #000; }
.factura th { background: #f1f1f1; color: #000; border-bottom: 1px solid #000; }
.factura td, .factura th { padding: 6px 8px; font-size: 12px; }
.factura tbody tr:hover td { background: transparent; }
.fa-totales { margin-left: auto; width: 300px; margin-top: 10px; }
.fa-totales div { display: flex; justify-content: space-between; padding: 3px 0; }
.fa-totales .total { border-top: 2px solid #000; font-size: 16px; font-weight: 800; padding-top: 6px; margin-top: 4px; }
.fa-pie { margin-top: 16px; border-top: 1px dashed #999; padding-top: 8px; font-size: 11px; color: #444; }
.fa-anulada { text-align: center; color: var(--danger); font-weight: 800; font-size: 18px; border: 2px solid var(--danger); padding: 6px; margin-bottom: 10px; }
#print-area { display: none; }

@media (max-width: 1100px) {
    .venta-grid { grid-template-columns: 1fr; }
    .resumen { position: static; }
    .add-row { grid-template-columns: 1fr 1fr; }
    .add-row > * { grid-column: auto !important; }
    .add-row > :nth-child(1), .add-row > .add-btns { grid-column: 1 / -1 !important; }
    .add-row .add-btns { grid-column: 1 / -1; }
}
@media (max-width: 860px) {
    .sidebar { position: fixed; left: 0; top: 0; z-index: 50; transform: translateX(-100%); transition: transform .2s; }
    .app.nav-open .sidebar { transform: none; }
    .app.nav-open .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .4); z-index: 40; }
    .menu-btn { display: inline-block; }
    .topbar { padding: 12px 16px; }
    .topbar h1 { font-size: 18px; }
    .view { padding: 16px 16px 60px; }
    .grid-2 { grid-template-columns: 1fr; }
    .fa-head { grid-template-columns: 1fr; }
    .fa-letra { border: 0; border-top: 1px solid #000; border-bottom: 1px solid #000; flex-direction: row; gap: 10px; justify-content: center; padding: 8px; }
    .fa-cliente { grid-template-columns: 1fr; }
    .fa-totales { width: 100%; }
}

@media print {
    body { background: #fff; }
    .app, .modal, .toasts { display: none !important; }
    #print-area { display: block; }
    .factura { max-width: none; }
    .fa-head { grid-template-columns: 1fr 70px 1fr !important; }
    .fa-cliente { grid-template-columns: 1fr 1fr !important; }
    .fa-letra { border-top: 0 !important; border-bottom: 0 !important; flex-direction: column !important; }
    .fa-totales { width: 300px !important; }
    @page { margin: 12mm; }
}

/* Utilidades */
.row { display: flex; gap: 8px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.auto { width: auto !important; }
.mt { margin-top: 14px; }
.mt-s { margin-top: 8px; }
.mb { margin-bottom: 12px; }
.full-w { width: 100%; }
.pos { color: var(--ok); font-weight: 700; }
.neg { color: var(--danger); font-weight: 700; }
.qty-input.narrow { width: 70px; }
.toolbar.flush { margin: 0; }
.grid-2.mt { margin-top: 18px; }
.stack-cards { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.stack-cards .card + .card { margin-top: 0; }
tr.clickable { cursor: pointer; }
label.field.inline { flex-direction: row; align-items: center; gap: 8px; }
label.field.inline input { width: auto; }
h4 { font-size: 14px; }

/* Accesos rápidos */
.quick { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin-bottom: 18px; }
.quick-btn {
    display: flex; flex-direction: column; gap: 4px; padding: 16px 18px; border-radius: var(--radius);
    background: var(--surface); border: 1px solid var(--border); text-decoration: none; box-shadow: var(--shadow);
    transition: transform .12s, border-color .12s;
}
.quick-btn strong { font-family: 'Space Grotesk', sans-serif; font-size: 17px; }
.quick-btn span { color: var(--muted); font-size: 13px; }
.quick-btn:hover { border-color: #000; transform: translateY(-1px); }
.quick-accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.quick-accent span { color: rgba(255, 255, 255, .85); }
.quick-accent:hover { border-color: #9f1239; }
.kpi.warn .kpi-value { color: var(--warn); }
.kpi-value.pos, .kpi-value.neg { font-weight: 800; }

/* Avisos y pestañas */
.banner { background: var(--warn-bg); color: #78350f; border: 1px solid #fcd34d; border-radius: var(--radius); padding: 10px 14px; margin-bottom: 16px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.banner.info { background: var(--info-bg); color: #075985; border-color: #7dd3fc; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.tab { border: 1px solid var(--border); background: var(--surface); padding: 7px 14px; border-radius: 999px; font-weight: 700; font-size: 13px; cursor: pointer; }
.tab:hover { border-color: #000; }
.tab.active { background: #000; color: #fff; border-color: #000; }

/* Venta / pedido */
.cliente-info { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; margin-top: 12px; padding: 10px 12px; background: var(--surface-2); border-radius: 8px; font-size: 13px; }
.resumen .field { margin-bottom: 10px; }
.lines { margin-top: 4px; }

/* Estado de cuenta */
.cuenta-head { display: grid; grid-template-columns: 1fr auto; gap: 14px 24px; align-items: center; margin-bottom: 16px; }
.cuenta-head h3 { margin: 0 0 2px; font-size: 20px; }
.cuenta-head .row { grid-column: 1 / -1; }
.cuenta-saldo { text-align: right; display: flex; flex-direction: column; }
.cuenta-saldo strong { font-family: 'Space Grotesk', sans-serif; font-size: 28px; }
.narrow-card { max-width: 440px; }

/* Ingreso */
[hidden] { display: none !important; }
.login { position: fixed; inset: 0; background: #0b0b0b; z-index: 200; display: flex; align-items: center; justify-content: center; padding: 16px; }
.login-card { background: var(--surface); border-radius: 14px; padding: 28px; width: min(380px, 100%); display: flex; flex-direction: column; gap: 14px; box-shadow: 0 20px 60px rgba(0, 0, 0, .4); }
.login-card .brand-logo { font-size: 28px; font-weight: 800; color: var(--text, #111827); }

/* Documentos */
.fa-texto { margin: 12px 0 4px; font-size: 13px; line-height: 1.6; }
.firma { margin: 40px 0 0 auto; width: 240px; border-top: 1px solid #000; text-align: center; padding-top: 4px; font-size: 11px; }

@media (max-width: 860px) {
    .cuenta-head { grid-template-columns: 1fr; }
    .cuenta-saldo { text-align: left; }
}

/* Stock por rollo */
.center { text-align: center; }
.toolbar.center { justify-content: center; }
.btn-excel { background: #6aa84f; border-color: #5b9443; color: #fff; }
.btn-excel:hover { background: #5b9443; }
.stock-totales { display: flex; flex-wrap: wrap; align-items: stretch; gap: 0; border: 1px solid var(--text); border-radius: 8px; overflow: hidden; margin-bottom: 16px; background: var(--surface); }
.stock-totales .st-titulo { display: flex; align-items: center; padding: 8px 14px; font-weight: 800; background: var(--text); color: #fff; font-size: 13px; }
.stock-totales > div { display: flex; align-items: center; gap: 10px; padding: 8px 16px; border-left: 1px solid var(--border); flex: 1; min-width: 150px; }
.stock-totales > div span { font-size: 12px; color: var(--muted); font-weight: 700; text-transform: uppercase; }
.stock-totales > div strong { font-family: 'Space Grotesk', sans-serif; font-size: 22px; font-variant-numeric: tabular-nums; }
.filtros-card { margin-bottom: 16px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.chip { border: 1px solid transparent; border-radius: 8px; padding: 8px 12px; font-weight: 700; cursor: pointer; background: #f1f5f9; color: var(--text); display: inline-flex; gap: 8px; align-items: center; font-size: 13px; }
.chip b { background: #000; color: #fff; border-radius: 999px; padding: 1px 8px; font-size: 12px; }
.chip.active { outline: 3px solid #000; outline-offset: 1px; }
.chip-sm { padding: 2px 8px; font-size: 11px; border-radius: 999px; cursor: default; }
.chip-ok { background: #86efac; }
.chip-np { background: #e9d5ff; }
.chip-warn { background: #fde68a; }
.chip-danger { background: #fca5a5; }
.chip-muted { background: #e2e8f0; color: var(--muted); }
.hist-totales th { text-align: center; }
.hist-totales .h-ing { background: #4b6aa3; color: #fff; }
.hist-totales .h-ven { background: #2c4fae; color: #fff; }
.hist-totales .h-stk { background: #000; color: #fff; }
.hist-totales td { font-size: 16px; font-weight: 700; }
.rollos-lista { max-height: 55vh; overflow-y: auto; }
.rollos-lista thead th { position: sticky; top: 0; }
.fa-rollos { font-size: 10px; color: #555; margin-top: 2px; }
.ingreso-card { max-width: 720px; }
.importar-card { max-width: 820px; }
.importar-card p { margin-top: 10px; line-height: 1.6; }
a.kpi-link { text-decoration: none; }
a.kpi-link:hover { border-color: #000; }
details summary { cursor: pointer; font-weight: 700; }

@media (max-width: 860px) {
    .stock-totales > div { min-width: 45%; padding: 8px 12px; }
    .stock-totales > div strong { font-size: 18px; }
    .stock-totales .st-titulo { width: 100%; }
}
.banner-error { background: var(--danger-bg); color: #7f1d1d; border: 1px solid #fca5a5; border-radius: var(--radius); padding: 10px 14px; }
/* Escaneo de etiquetas */
.scan-field input { font-size: 18px; padding: 12px 14px; border: 2px dashed #000; background: #fffef5; font-variant-numeric: tabular-nums; letter-spacing: .5px; }
.scan-field input:focus { border-style: solid; }
.scan-sep { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; margin: 14px 0 10px; }
.scan-sep::before, .scan-sep::after { content: ''; flex: 1; border-top: 1px solid var(--border); }
/* Selección de cliente en la venta */
.sel-cliente-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.sel-cliente-head h3 { margin: 0 0 4px; font-size: 20px; }
.cliente-elegido { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); color: var(--text); font-size: 15px; }
input.readonly { background: var(--surface-2); color: var(--muted); }
/* Nuevo pedido estilo TexWeb: botones de artículo y color, teclado y barra de totales */
.pos-venta { display: flex; flex-direction: column; gap: 14px; padding-bottom: 12px; }
.pos-top { display: grid; grid-template-columns: minmax(170px, .9fr) minmax(0, 2fr) minmax(0, 1.6fr) minmax(230px, 1fr); gap: 14px; align-items: start; }
.pos-top > * { min-width: 0; }
.pos-lbl { display: block; font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); margin-bottom: 8px; }
.pos-cliente { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; display: flex; flex-direction: column; gap: 6px; }
.pos-cliente strong { font-family: 'Space Grotesk', sans-serif; font-size: 18px; line-height: 1.2; }
.pos-cliente .cliente-info { margin-top: 4px; flex-direction: column; align-items: flex-start; gap: 4px; padding: 8px 10px; }
.pos-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; max-height: 330px; overflow-y: auto; padding: 2px; }
.pos-btn { position: relative; text-align: left; border: 1px solid #c7d2fe; background: #e8ecf8; color: #1e293b; border-radius: 8px; padding: 14px 12px; font-weight: 700; font-size: 13px; cursor: pointer; min-height: 52px; text-transform: uppercase; line-height: 1.25; }
.pos-btn small { position: absolute; top: 4px; right: 6px; font-size: 10px; color: var(--muted); font-weight: 700; }
.pos-btn:hover { background: #dbe2f6; }
.pos-btn.active { background: #1e3a8a; border-color: #1e3a8a; color: #fff; }
.pos-btn.active small { color: #c7d2fe; }
.pos-keypad { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.pos-sel { min-height: 38px; font-size: 13px; color: var(--muted); display: flex; flex-direction: column; }
.pos-sel strong { color: var(--text); }
.kp-display { display: grid; grid-template-columns: auto 1fr auto; gap: 6px; align-items: center; }
.kp-unit { border: 2px solid var(--border); border-radius: 6px; padding: 8px 10px; font-weight: 800; color: #94a3b8; font-size: 13px; }
.kp-unit.on { color: #000; border-color: #000; background: #f1f5f9; }
button.kp-unit { cursor: pointer; font-family: inherit; background: #fff; }
button.kp-unit.on { background: #1e3a8a; border-color: #1e3a8a; color: #fff; }
.kp-ayuda { margin: -2px 0 2px; }
.kp-display input { font-size: 24px; font-weight: 800; text-align: center; padding: 8px; font-family: 'Space Grotesk', sans-serif; }
.kp-keys { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.kp-key { border: 2px solid #111; background: #eef0f3; border-radius: 10px; font-size: 22px; padding: 10px 0; cursor: pointer; font-weight: 600; }
.kp-key:active { background: #d4d8de; }
.kp-key:disabled, .kp-enter:disabled { opacity: .45; cursor: not-allowed; }
.kp-del { background: #6b7280; color: #fff; font-size: 18px; }
.kp-enter { border: 2px solid #111; background: #6ee78a; border-radius: 10px; font-size: 22px; padding: 12px; font-weight: 700; cursor: pointer; }
.pos-tabs { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; border-bottom: 2px solid var(--border); padding-bottom: 8px; }
.pos-modo { font-weight: 800; color: #1e3a8a; margin-right: 6px; letter-spacing: .3px; }
.pos-tab { border: 1px solid var(--border); background: #f1f5f9; padding: 9px 18px; border-radius: 6px; font-weight: 700; text-transform: uppercase; font-size: 13px; cursor: pointer; }
.pos-tab.active { background: #7aa2e3; border-color: #1e3a8a; color: #fff; }
.pos-scan { margin-left: auto; display: flex; align-items: center; gap: 8px; font-weight: 700; }
.pos-moneda { display: inline-flex; border: 1px solid #1e3a8a; border-radius: 6px; overflow: hidden; }
.pos-moneda button { border: 0; background: #f1f5f9; padding: 9px 14px; font-weight: 800; font-size: 13px; cursor: pointer; }
.pos-moneda button + button { border-left: 1px solid #1e3a8a; }
.pos-moneda button.active { background: #15803d; color: #fff; }
.pos-moneda button:disabled { cursor: not-allowed; opacity: .45; }
.pos-scan input { width: 240px; border: 2px solid #1e3a8a; }
tr.fila-nueva td { background: #ecfdf5 !important; }
.pos-bar { position: sticky; bottom: 0; z-index: 4; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 14px; box-shadow: 0 -4px 16px rgba(15, 23, 42, .08); margin-top: 6px; }
.pos-cancel { background: #000; color: #fff; border-color: #000; padding: 12px 18px; font-size: 14px; }
.pos-cancel:hover { background: #262626; }
.pos-tot { display: flex; gap: 18px; flex: 1; flex-wrap: wrap; }
.pos-tot div { display: flex; flex-direction: column; }
.pos-tot span { font-size: 11px; font-weight: 800; color: var(--muted); text-transform: uppercase; }
.pos-tot strong { font-family: 'Space Grotesk', sans-serif; font-size: 22px; font-variant-numeric: tabular-nums; }
.pos-total strong { color: #1e3a8a; }
.pos-acciones { display: flex; gap: 8px; flex-wrap: wrap; }
.pos-valorizar { background: #4a9d3a; border-color: #3f8a31; color: #fff; padding: 12px 18px; font-size: 14px; text-transform: uppercase; }
.pos-pausar { background: #ecd843; border-color: #d6c330; color: #111; padding: 12px 18px; font-size: 14px; text-transform: uppercase; }
.pos-fin { background: #6aa84f; border-color: #5b9443; color: #fff; padding: 12px 22px; font-size: 14px; text-transform: uppercase; }
.pos-valorizar:hover, .pos-fin:hover { filter: brightness(.95); }
.resumen-modal .line { display: flex; justify-content: space-between; padding: 5px 0; }
.resumen-modal .line.total { border-top: 2px solid #000; margin-top: 6px; padding-top: 10px; font-size: 20px; font-weight: 800; font-family: 'Space Grotesk', sans-serif; }
.resumen-modal .stack { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.resumen-modal .field { margin-bottom: 6px; }
.chip-venta { background: #bfdbfe; }
.mb { margin-bottom: 12px; }
@media (max-width: 1250px) {
    .pos-top { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
    .pos-cliente { grid-column: 1 / -1; flex-direction: row; flex-wrap: wrap; align-items: center; }
    .pos-cliente .cliente-info { flex-direction: row; flex-wrap: wrap; }
}
@media (max-width: 760px) {
    .pos-top { grid-template-columns: 1fr; }
    .pos-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); max-height: 240px; }
    .pos-scan { margin-left: 0; width: 100%; }
    .pos-scan input { width: auto; flex: 1; }
    .pos-tot { gap: 12px; }
    .pos-tot strong { font-size: 18px; }
    .pos-bar { padding: 8px 10px; }
    .pos-acciones { width: 100%; }
    .pos-acciones .btn { flex: 1; padding: 12px 6px; }
}
.kp-display { grid-template-columns: auto minmax(0, 1fr) auto; }
.kp-display input, .pos-scan input { min-width: 0; }
.pos-scan { min-width: 0; max-width: 100%; }
/* Consultar pedidos */
.chk-pill { display: inline-flex; align-items: center; gap: 8px; border: 2px solid var(--border); border-radius: 999px; padding: 6px 14px; font-weight: 800; font-size: 12px; cursor: pointer; background: var(--surface); }
.chk-pill input { width: 18px; height: 18px; accent-color: #2563eb; }
.chk-pill:has(input:checked) { border-color: #5eead4; }
.chk-ctacte { color: #6d28d9; }
.pv-mas { display: inline-flex; width: 26px; height: 26px; border-radius: 50%; background: #22a447; color: #fff; align-items: center; justify-content: center; font-weight: 800; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.pv-mas.pausa { background: #eab308; font-size: 11px; }
.pv-tabla thead th { background: #000; color: #fff; }
tr.pv-abierta > td { background: #f8fafc !important; padding: 12px 16px; }
tr.fila-anulada td { color: #94a3b8; text-decoration: line-through; }
tr.fila-anulada td .badge { text-decoration: none; }
/* Devoluciones */
.devol-card { max-width: 760px; margin: 0 auto 18px; }
.devol-card h3 { font-size: 22px; color: #1e3a8a; margin-bottom: 16px; }
hr.sep { border: 0; border-top: 1px solid var(--border); margin: 18px 0; }
.sugeridos { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.devol-resumen .line { display: flex; justify-content: space-between; padding: 4px 0; }
.grow { flex: 1; }
.paginador { display: flex; justify-content: center; align-items: center; gap: 12px; margin-top: 12px; }

/* Estado de cuenta (como TexWeb) */
.cuenta-card { background: #f4f4f4; }
.cuenta-card .btn-dark { background: #5f5f5f; border-color: #5f5f5f; color: #fff; }
.cuenta-titulo { color: #1e4f91; font-size: 22px; margin: 14px 0 12px; }
.cuenta-titulo span { color: var(--text); font-weight: 600; }
.cuenta-generar { align-items: center; gap: 10px; }
.cuenta-filtros { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; margin-top: 18px; }
.moneda-switch { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.moneda-pill { display: inline-flex; border: 2px solid #cbd5e1; background: #eef2f7; border-radius: 999px; padding: 4px; gap: 4px; }
.moneda-pill button { border: 0; background: transparent; border-radius: 999px; padding: 8px 22px; cursor: pointer; display: flex; flex-direction: column; align-items: center; color: #475569; font-family: inherit; }
.moneda-pill button span { font-size: 12px; font-weight: 800; letter-spacing: .02em; }
.moneda-pill button strong { font-size: 16px; }
.moneda-pill button.active { background: #4a8a4f; color: #fff; }
.cuenta-tabla thead th { background: #000; color: #fff; }
.fila-inicial td { background: #f4f4f4; }
.cuenta-saldo-final { text-align: right; font-size: 22px; font-weight: 800; color: #374151; margin-top: 10px; }
.cuenta-saldo-final strong { font-weight: 600; }
@media (max-width: 640px) { .moneda-pill button { padding: 8px 14px; } .cuenta-titulo { font-size: 19px; } }
.btn-azul { background: #1e3a8a; border-color: #1e3a8a; color: #fff; }
.btn-azul:hover { background: #172e6e; }

/* Reporte de Ventas */
.rep-filtros { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.rep-filtros .field { min-width: 160px; flex: 0 1 200px; }
.rep-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin: 16px 0; }
.rep-kpi { background: #f7f7f7; border: 1px solid var(--border); border-radius: 8px; padding: 18px 12px; text-align: center; display: flex; flex-direction: column; gap: 6px; }
.rep-kpi span { color: #4b5563; font-size: 15px; }
.rep-kpi strong { font-size: 26px; font-weight: 800; color: #111827; font-variant-numeric: tabular-nums; }
.rep-h { color: #1e4f91; margin-bottom: 10px; }
.rep-h2 { color: #374151; margin-bottom: 4px; }
.rep-sel { color: #4f46e5; }
.rep-grafico { width: 100%; overflow: hidden; }
.g-grid { stroke: #e5e7eb; stroke-width: 1; }
.g-txt { fill: #6b7280; font-size: 11px; font-family: inherit; }
.g-linea { fill: none; stroke: #3b82d6; stroke-width: 2; stroke-linejoin: round; }
.g-punto { fill: #fff; stroke: #3b82d6; stroke-width: 2; }
.barras { display: flex; flex-direction: column; gap: 6px; }
.barra-fila { display: grid; grid-template-columns: minmax(90px, 38%) 1fr auto; align-items: center; gap: 10px; padding: 3px 4px; border-radius: 6px; }
.barra-fila.clickable:hover { background: #f1f5f9; }
.barra-label { font-size: 13px; text-align: right; color: #374151; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.barra-track { height: 22px; background: transparent; border-left: 1px solid #d1d5db; }
.barra { display: block; height: 100%; background: #cfe3f7; border: 1px solid #3b82d6; border-left: 0; border-radius: 0 4px 4px 0; }
.barra-fila.activa .barra { background: #a5b4fc; border-color: #4f46e5; }
.barra-fila.activa .barra-label { color: #4f46e5; font-weight: 700; }
.barra-valor { font-size: 12px; color: #4b5563; font-variant-numeric: tabular-nums; min-width: 56px; text-align: right; }
tr.fila-sel td { background: #c7d2fe !important; font-weight: 700; }
.chart-tip { position: fixed; z-index: 1000; pointer-events: none; background: #111827; color: #fff; font-size: 12px; padding: 6px 9px; border-radius: 6px; max-width: 280px; box-shadow: 0 4px 12px rgba(0,0,0,.2); }
.chart-tip[hidden] { display: none !important; }
@media (max-width: 640px) { .barra-fila { grid-template-columns: 40% 1fr auto; } .rep-kpi strong { font-size: 22px; } }
th.ordenable { cursor: pointer; user-select: none; white-space: nowrap; }
.orden-ico { opacity: .6; font-size: 11px; }
@media (max-width: 640px) { .col-extra { display: none; } }
.cuenta-saldo-final.saldo-izq { text-align: left; }
.btn-icono { padding: 4px 8px; }
.cuenta-tabla td:first-child { white-space: nowrap; }
.ficha-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px 16px; }
.ficha-grid > div { display: flex; flex-direction: column; gap: 2px; }
.ficha-grid strong { font-weight: 600; font-size: 14px; }
.info-i { display: inline-flex; align-items: center; justify-content: center; width: 17px; height: 17px; border-radius: 50%; background: #a9cde3; color: #fff; font-size: 11px; font-style: italic; font-weight: 700; font-family: Georgia, serif; cursor: help; vertical-align: middle; margin-left: 4px; }
.fav { color: #d97706; }
.pos-btn .fav { color: #f59e0b; }

/* Etiquetas */
.etq-preview { overflow-x: auto; padding: 8px; background: #e5e7eb; border-radius: 8px; display: inline-block; max-width: 100%; }
.etq { box-sizing: border-box; background: #fff; color: #000; padding: 2.5mm 3mm; display: flex; flex-direction: column; justify-content: space-between; overflow: hidden; font-family: Arial, Helvetica, sans-serif; border: 0.2mm solid #d1d5db; }
.etq-emp { font-size: 2.6mm; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.etq-art { font-size: 4.6mm; font-weight: 800; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.etq-art span { font-weight: 600; font-size: 3.4mm; margin-left: 1.5mm; }
.etq-fila { display: flex; justify-content: space-between; align-items: baseline; gap: 2mm; }
.etq-col { font-size: 4mm; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.etq-med { font-size: 5.2mm; font-weight: 800; white-space: nowrap; }
.etq-med small { font-size: 3mm; font-weight: 700; }
.etq-cb { flex: 1; min-height: 8mm; max-height: 16mm; display: flex; }
.etq-cb .cb-svg { width: 100%; height: 100%; }
.etq-num { font-size: 3mm; text-align: center; letter-spacing: .12em; font-family: 'Courier New', monospace; }
@media print { .etq { border: 0; } #print-area .etq-hoja { display: block; } }

/* Panel: accesos directos como TexWeb */
.accesos h3 { font-size: 20px; margin-bottom: 14px; }
.accesos-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.acceso { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 14px 12px; border-radius: 6px; color: #fff; font-weight: 700; font-size: 16px; text-decoration: none; box-shadow: 0 2px 4px rgba(0,0,0,.15); transition: filter .15s, transform .15s; text-align: center; }
.acceso:hover { filter: brightness(1.08); transform: translateY(-1px); }
.acceso span { font-size: 18px; }
.acc-azul { background: #3a78b9; }
.acc-celeste { background: #5bc0de; }
.acc-verde { background: #5cb85c; }
.acc-violeta { background: #7b54b5; }
.acc-info { justify-content: center; gap: 8px; }
.logo-cendatex { text-align: center; font-family: 'Plus Jakarta Sans', Arial, sans-serif; font-weight: 800; font-size: clamp(44px, 9vw, 84px); letter-spacing: -.02em; color: #1f1f1f; margin: 34px 0 30px; }
.logo-cendatex .lx { position: relative; }
.logo-cendatex .bh { position: absolute; left: 0; top: -.2em; display: flex; gap: .05em; transform: translateX(-55%); }
.logo-cendatex .bh i { font-style: normal; font-size: .34em; width: 1.25em; height: 1.25em; border-radius: 50%; background: #e3242b; color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 800; letter-spacing: 0; line-height: 1; }
.brand { display: block; text-decoration: none; } .brand:hover .brand-logo { color: #e5e7eb; }

/* Pedido como TexWeb: encabezado, artículos y colores */
.pos-head { display: grid; grid-template-columns: 1.1fr 1.4fr 1fr auto; gap: 14px; align-items: end; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 14px; margin-bottom: 8px; }
.pos-head > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pos-head strong { font-size: 18px; font-family: 'Space Grotesk', sans-serif; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.moneda-chica { padding: 2px; }
.moneda-chica button { padding: 4px 14px; }
.moneda-chica button span { font-size: 11px; }
.pos-top { grid-template-columns: minmax(0, 1.5fr) minmax(300px, 1fr) !important; }
.pos-arts { grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); max-height: 380px; }
.pos-arts .pos-btn { text-transform: none; font-weight: 600; min-height: 46px; padding: 12px; }
.pos-col-colores { display: flex; flex-direction: column; gap: 10px; }
.pos-swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 6px 4px; max-height: 300px; overflow-y: auto; padding: 4px; }
.swatch { display: flex; flex-direction: column; align-items: center; gap: 2px; background: none; border: 2px solid transparent; border-radius: 10px; padding: 4px 2px; cursor: pointer; font-family: inherit; }
.swatch:hover { background: #f1f5f9; }
.swatch.active { border-color: #1e3a8a; background: #e8ecf8; }
.sw-circ { width: 46px; height: 46px; border-radius: 50%; border: 1px solid rgba(0,0,0,.18); box-shadow: inset 0 -3px 6px rgba(0,0,0,.12); }
.sw-nom { font-size: 11px; font-weight: 700; text-align: center; line-height: 1.15; color: #1f2937; text-transform: uppercase; }
.sw-n { font-size: 13px; font-weight: 700; color: #374151; }
.sw-mini { display: inline-block; width: 14px; height: 14px; border-radius: 50%; border: 1px solid rgba(0,0,0,.2); vertical-align: -2px; }
@media (max-width: 1100px) { .pos-top { grid-template-columns: 1fr !important; } .pos-head { grid-template-columns: 1fr 1fr; } }

/* Listado: acciones como TexWeb */
.pv-acc { display: flex; gap: 4px; justify-content: flex-end; }
.acc-btn { display: inline-flex; flex-direction: column; align-items: center; justify-content: center; min-width: 54px; padding: 5px 6px; border: 0; border-radius: 4px; color: #fff; font-size: 15px; cursor: pointer; line-height: 1.1; font-family: inherit; }
.acc-btn span { font-size: 9px; text-transform: uppercase; font-weight: 700; margin-top: 2px; }
.acc-azul2 { background: #1e4f91; } .acc-rojo { background: #d9282f; } .acc-verde2 { background: #2e9e45; } .acc-cambio { background: #5cbfae; } .acc-gris { background: #c7cdd4; color: #1f2937; }
.fila-borrador td { background: #f8fafc; }

/* Valorizar Pedido */
.val-cliente input[readonly], .val-cliente input:disabled, .val-cliente select:disabled { background: #eef0f3; }
.valorizar-extra [data-action="confirmar-venta"] { display: none; }
.val-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 16px; margin-top: 12px; position: sticky; bottom: 0; }
.btn-verde { background: #1f9d3a; border-color: #1f9d3a; color: #fff; } .btn-verde:hover { background: #188030; }
.btn-gris { background: #6b6b6b; border-color: #6b6b6b; color: #fff; }

/* Ticket (impresora de tickets) */
.ticket { font-family: Arial, Helvetica, sans-serif; font-size: 9pt; color: #000; width: 72mm; padding: 2mm; background: #fff; }
.ticket hr { border: 0; border-top: 1px solid #000; margin: 2mm 0; }
.tk-centro { text-align: center; }
.tk-emp { font-size: 15pt; font-weight: 800; }
.tk-num { font-weight: 800; font-size: 10pt; }
.tk-chico { font-size: 8pt; }
.tk-item { margin-bottom: 2mm; }
.tk-art { font-weight: 800; }
.tk-fila, .tk-tot, .tk-tot2 { display: flex; justify-content: space-between; gap: 2mm; }
.tk-tot { font-size: 11pt; font-weight: 800; }
.tk-qr { display: flex; justify-content: center; padding: 2mm 0; }
.tk-qr svg { width: 34mm; height: 34mm; }
.ficha-importe { display: flex; flex-direction: column; gap: 6px; background: #f4f4f4; border: 1px solid var(--border); border-radius: 6px; padding: 16px 20px; }
.ficha-importe > div:not(.row) { display: grid; grid-template-columns: 90px 1fr; gap: 10px; }
.ficha-importe > div > span { font-weight: 700; color: #374151; }
.ficha-importe strong { font-weight: 500; }
.ficha-importe input[type=number] { width: 140px; font-size: 18px; }
.acc-celeste { background: #5bc0de; } .acc-cobrado { background: #3a8fd6; }
.pv-acc { flex-wrap: wrap; max-width: 260px; margin-left: auto; }

/* ---------- Modo nube ---------- */
.sync-estado { font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px; white-space: nowrap; background: #ecfdf5; color: #047857; }
.sync-estado.sync-guardando { background: #eff6ff; color: #1d4ed8; }
.sync-estado.sync-error { background: #fef2f2; color: #b91c1c; }
.sync-estado.sync-cambios { background: #fefce8; color: #a16207; }
.aviso-abono { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; }
.aviso-abono.info { background: #fefce8; border-color: #fde68a; color: #854d0e; }
.aviso-abono ul { margin: 6px 0 0 18px; padding: 0; }
.logo-empresa { font-family: 'Space Grotesk', sans-serif; text-transform: uppercase; word-break: break-word; }
@media (max-width: 640px) { .sync-estado { display: none; } }
