/* pulsolite - Futuristic Theme (Dark / Light) */
:root {
    --bg-main: #0b0f19;
    --bg-card: #111827;
    --bg-card-hover: #1f2937;
    --bg-sidebar: #090d16;
    --border-color: #1f2937;
    --text-primary: #f9fafb;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;

    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --primary-light: rgba(99, 102, 241, 0.15);

    --accent: #06b6d4;
    --success: #10b981;
    --warning: #eab308;
    --orange: #f97316;
    --danger: #ef4444;

    --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --sidebar-width: 260px;
    --header-height: 64px;
}

[data-theme="light"] {
    --bg-main: #f3f4f6;
    --bg-card: #ffffff;
    --bg-card-hover: #f9fafb;
    --bg-sidebar: #ffffff;
    --border-color: #e5e7eb;
    --text-primary: #111827;
    --text-secondary: #4b5563;
    --text-muted: #9ca3af;
    --primary-light: rgba(99, 102, 241, 0.08);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: var(--font-sans);
    min-height: 100vh;
    display: flex;
    font-size: 14px;
    line-height: 1.5;
}

/* Layout */
.app-container {
    display: flex;
    width: 100%;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 40;
    transition: transform 0.2s ease;
}

.sidebar-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.logo-text {
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, #6366f1, #06b6d4);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo-badge {
    font-size: 0.7rem;
    background: var(--primary-light);
    color: var(--primary);
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    border: 1px solid rgba(99, 102, 241, 0.3);
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 1.25rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.nav-section-title {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: 0.75rem 0.75rem 0.25rem;
    letter-spacing: 0.5px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0.75rem;
    border-radius: 0.5rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.15s ease;
}

.nav-item:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--primary);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.nav-item svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.topbar {
    height: var(--header-height);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 30;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.content-body {
    padding: 1.5rem;
    flex: 1;
}

/* Cards & Grid */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

.kpi-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    padding: 1.25rem;
    position: relative;
    overflow: hidden;
    transition: transform 0.15s ease, border-color 0.15s ease;
}

.kpi-card:hover {
    transform: translateY(-2px);
    border-color: rgba(99, 102, 241, 0.4);
}

.kpi-card.alert-card {
    border-left: 4px solid var(--danger);
}

.kpi-title {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
}

.kpi-value {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.2;
}

.kpi-sub {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.4rem;
}

.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.card-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.2rem 0.6rem;
    border-radius: 9999px;
    line-height: 1;
}

.badge-success {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-warning {
    background: rgba(234, 179, 8, 0.15);
    color: var(--warning);
    border: 1px solid rgba(234, 179, 8, 0.3);
}

.badge-orange {
    background: rgba(249, 115, 22, 0.15);
    color: var(--orange);
    border: 1px solid rgba(249, 115, 22, 0.3);
}

.badge-danger {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.badge-muted {
    background: rgba(107, 114, 128, 0.15);
    color: var(--text-muted);
    border: 1px solid rgba(107, 114, 128, 0.3);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 0.55rem 1rem;
    border-radius: 0.5rem;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.15s ease;
    text-decoration: none;
    line-height: 1;
}

.btn-primary {
    background: var(--primary);
    color: #ffffff;
}

.btn-primary:hover {
    background: var(--primary-hover);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.btn-secondary {
    background: var(--bg-card-hover);
    color: var(--text-primary);
    border-color: var(--border-color);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.05);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger);
    border-color: rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
    background: var(--danger);
    color: #ffffff;
}

.btn-sm {
    padding: 0.35rem 0.65rem;
    font-size: 0.75rem;
}

/* Tables */
.table-responsive {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

th {
    background: rgba(0, 0, 0, 0.15);
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
}

td {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    font-size: 0.85rem;
}

tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

/* Forms */
.form-group {
    margin-bottom: 1rem;
}

label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.4rem;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="month"],
select,
textarea {
    width: 100%;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 0.6rem 0.85rem;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.85rem;
    outline: none;
    transition: border-color 0.15s ease;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

/* Dropdowns legibles en tema oscuro */
select {
    background: var(--bg-card-hover);
    color: var(--text-primary);
    color-scheme: dark;
    cursor: pointer;
}
[data-theme="light"] select { color-scheme: light; }

select option,
select optgroup {
    background: var(--bg-card);
    color: var(--text-primary);
}

select:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

/* Flashes */
.alert {
    padding: 0.85rem 1.25rem;
    border-radius: 0.5rem;
    margin-bottom: 1.25rem;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.alert-success {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.alert-danger {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.alert-warning {
    background: rgba(234, 179, 8, 0.15);
    color: var(--warning);
    border: 1px solid rgba(234, 179, 8, 0.3);
}

/* Notification Bell Dropdown */
.notif-wrapper {
    position: relative;
}

.notif-bell {
    position: relative;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.4rem;
    display: flex;
    align-items: center;
}

.notif-bell:hover {
    color: var(--text-primary);
}

.notif-badge {
    position: absolute;
    top: 0;
    right: 0;
    background: var(--danger);
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.notif-dropdown {
    position: absolute;
    right: 0;
    top: 100%;
    width: 320px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    display: none;
    z-index: 50;
    margin-top: 0.5rem;
}

.notif-dropdown.show {
    display: block;
}

.notif-header {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
}

.notif-list {
    max-height: 300px;
    overflow-y: auto;
}

.notif-item {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.8rem;
    cursor: pointer;
    transition: background 0.15s ease;
}

.notif-item:hover {
    background: var(--bg-card-hover);
}

/* Toast Container */
#toast-container {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-width: 360px;
}

.toast {
    background: var(--bg-card);
    border-left: 4px solid var(--primary);
    border-top: 1px solid var(--border-color);
    border-right: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    padding: 0.85rem 1rem;
    border-radius: 0.5rem;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.4);
    font-size: 0.85rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    animation: slideIn 0.2s ease forwards;
}

.toast.toast-warning {
    border-left-color: var(--warning);
}

.toast.toast-orange {
    border-left-color: var(--orange);
}

.toast.toast-danger {
    border-left-color: var(--danger);
}

.toast.toast-success {
    border-left-color: var(--success);
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* POS Terminal Layout */
.pos-layout {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 1.5rem;
    height: calc(100vh - var(--header-height) - 3rem);
}

.pos-products {
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    padding: 1rem;
    overflow: hidden;
}

.pos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 0.65rem;
    overflow-y: auto;
    padding: 0.5rem;
    flex: 1;
    align-content: start;
}

.pos-item-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 0.6rem;
    padding: 0.55rem;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    transition: all 0.15s ease;
}

.pos-item-img-container {
    position: relative;
    width: 100%;
    height: 74px;
    background: rgba(0, 0, 0, 0.25);
    border-radius: 0.4rem;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.05);
    flex-shrink: 0;
}

.pos-item-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.2s ease;
}

.pos-item-card:hover .pos-item-img {
    transform: scale(1.05);
}

.pos-item-no-img {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
}

.pos-item-badge {
    position: absolute;
    top: 5px;
    left: 5px;
    font-size: 0.62rem;
    padding: 0.15rem 0.4rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.4);
}

.pos-item-card:hover:not(.out-of-stock) {
    border-color: var(--primary);
    transform: translateY(-2px);
    background: var(--primary-light);
}

.pos-item-card.out-of-stock {
    opacity: 0.45;
    cursor: not-allowed;
    border-color: rgba(239, 68, 68, 0.3);
}

.pos-cart {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.cart-items {
    flex: 1;
    overflow-y: auto;
    margin: 1rem 0;
}

.cart-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.65rem 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.85rem;
}

.cart-totals {
    border-top: 2px solid var(--border-color);
    padding-top: 1rem;
}

/* Printable A4 & PDF Styles */
@media print {
    body {
        background: #ffffff !important;
        color: #000000 !important;
    }

    .sidebar,
    .topbar,
    .no-print,
    .btn,
    .notif-bell,
    #toast-container {
        display: none !important;
    }

    .main-content {
        margin: 0 !important;
        width: 100% !important;
    }

    .content-body {
        padding: 0 !important;
    }

    .card {
        border: none !important;
        box-shadow: none !important;
        padding: 0 !important;
        margin-bottom: 1.5rem !important;
    }

    .narrativa-section {
        page-break-inside: avoid;
        margin-bottom: 1.5rem;
    }

    h1,
    h2,
    h3 {
        color: #111827 !important;
    }
}
/* ===================== RESPONSIVE ===================== */
#menu-toggle { display: none; }

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 35;
}

@media (max-width: 1024px) {
    .pos-layout {
        grid-template-columns: 1fr;
        height: auto;
    }
    .pos-products {
        overflow: visible;
    }
    .pos-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        overflow-y: visible;
        max-height: none;
    }
    .pos-cart {
        position: static;
    }
    .kpi-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 900px) {
    .sidebar {
        transform: translateX(-100%);
        z-index: 60;
        box-shadow: 8px 0 30px rgba(0,0,0,0.5);
    }
    .sidebar.open { transform: translateX(0); }
    .sidebar-overlay.show { display: block; }
    .main-content { margin-left: 0; }
    #menu-toggle { display: inline-flex; align-items: center; justify-content: center; }
    .topbar { padding: 0 0.85rem; }
    .content-body { padding: 1rem; }
    .card { padding: 1rem; }
    .kpi-grid { grid-template-columns: 1fr; gap: 0.75rem; }
    .topbar-right { gap: 0.5rem; }
    .topbar-right .btn { padding: 0.4rem 0.6rem; }
    .report-doc { padding: 1.5rem 1rem; }
    .report-kpis { grid-template-columns: repeat(2, 1fr); }
    .report-header { flex-direction: column; gap: 1rem; }
    .report-title-box { text-align: left; }
}

@media (max-width: 560px) {
    .pos-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 0.5rem; }
    .pos-item-img-container { height: 62px; }
    .card-header { flex-direction: column; align-items: flex-start !important; gap: 0.75rem; }
    .form-group { margin-bottom: 0.85rem; }
    div[style*="grid-template-columns"] { grid-template-columns: 1fr !important; }
    .co-grid { grid-template-columns: 1fr !important; }
    .kl-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
    .kl-hero h1 { font-size: 1.5rem; }
}

/* Ajustes finos móvil */
@media (max-width: 900px) {
    .topbar-title {
        max-width: 38vw;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .topbar-user-info { display: none; }
    .pos-filters { flex-direction: column; align-items: stretch !important; }
    .pos-filters input { max-width: 100% !important; }
    .pos-cat-scroll { padding-bottom: 0.4rem; }
    .pos-cat-scroll .btn { flex-shrink: 0; white-space: nowrap; }
    .pos-products { padding: 0.75rem; }
    .pos-cart { padding: 1rem; }
    #pos-cart-total { font-size: 1.4rem !important; }
}

@media (max-width: 560px) {
    .topbar { height: 56px; }
    .notif-dropdown { position: fixed; left: 0.75rem; right: 0.75rem; top: 60px; width: auto; }
    .card-header .btn-sm, .card .btn-sm { font-size: 0.75rem; }
    .kl-header-inner { padding: 0.8rem 1rem; }
    .kl-brand-name { font-size: 1.15rem; }
    .kl-fab { bottom: 1rem; right: 1rem; padding: 0.8rem 1.2rem; }
    .kl-drawer { width: 100vw; max-width: 100vw; }
    .kl-card .img { height: 150px; }
}

/* Ajustes finos móviles */
@media (max-width: 900px) {
    .topbar-title { font-size: 0.95rem !important; max-width: 40vw; }
    .topbar-user-info { display: none; }
    .topbar-left { gap: 0.5rem; min-width: 0; }
    .pos-filter-bar { flex-direction: column; align-items: stretch !important; gap: 0.5rem !important; }
    .pos-filter-bar #pos-search-input { max-width: 100% !important; }
    .pos-cat-scroll { width: 100%; }
    .pos-cat-scroll .btn { flex-shrink: 0; padding: 0.35rem 0.7rem; font-size: 0.75rem; }
    .notif-dropdown { position: fixed; right: 0.5rem; left: 0.5rem; width: auto; }
}
@media (max-width: 560px) {
    .topbar-title { font-size: 0.85rem !important; max-width: 34vw; }
    .cart-items { max-height: 30vh; }
    .pos-cart { padding: 0.9rem; }
    #pos-cart-total { font-size: 1.35rem !important; }
}

/* Tablas responsivas estilo tarjeta + corrección overflow */
@media (max-width: 900px) {
    html, body, .app-container, .main-content {
        overflow-x: hidden;
        max-width: 100vw;
    }
    .pos-cat-scroll { min-width: 0; max-width: 100%; }

    .table-responsive { overflow-x: visible; }
    .table-responsive table,
    .table-responsive thead,
    .table-responsive tbody,
    .table-responsive tr,
    .table-responsive td,
    .table-responsive th { display: block; }

    .table-responsive thead { display: none; }

    .table-responsive tr {
        border: 1px solid var(--border-color);
        border-radius: 0.6rem;
        margin-bottom: 0.75rem;
        padding: 0.65rem 0.85rem;
        background: rgba(255, 255, 255, 0.02);
    }
    .table-responsive td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 0.75rem;
        padding: 0.3rem 0;
        border: none !important;
        text-align: right;
    }
    .table-responsive td::before {
        content: attr(data-label);
        font-weight: 700;
        color: var(--text-muted);
        font-size: 0.68rem;
        text-transform: uppercase;
        letter-spacing: 0.4px;
        text-align: left;
        flex-shrink: 0;
        margin-right: 0.5rem;
    }
    .table-responsive td[colspan] { display: block; text-align: center; }
    .table-responsive td[colspan]::before { content: none; }
}

/* Buscador de clientes del POS */
#pos-cliente-search {
    padding-left: 2.3rem;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'%3E%3C/circle%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'%3E%3C/line%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: 0.75rem center;
}

#pos-cliente-select {
    border: 1px solid var(--primary) !important;
    border-radius: 0.5rem;
    background: var(--bg-card);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.5);
    padding: 0.3rem;
}

#pos-cliente-select option {
    padding: 0.5rem 0.7rem;
    border-radius: 0.35rem;
    cursor: pointer;
    font-size: 0.82rem;
}

#pos-cliente-select option:hover { background: var(--bg-card-hover); }
#pos-cliente-select option:checked {
    background: linear-gradient(135deg, var(--primary), var(--accent)) !important;
    color: #fff !important;
}

#pos-cliente-elegido {
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.35);
    border-radius: 0.5rem;
    padding: 0.45rem 0.7rem;
}

/* Dropdown elegante de clientes del POS */
.pos-cliente-dd {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 50;
    margin-top: 0.35rem;
    background: var(--bg-card);
    border: 1px solid var(--primary);
    border-radius: 0.65rem;
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.55);
    max-height: 250px;
    overflow-y: auto;
    scrollbar-width: thin;
}

.pcl-item {
    padding: 0.6rem 0.85rem;
    cursor: pointer;
    border-bottom: 1px solid var(--border-color);
    transition: background 0.12s ease;
}
.pcl-item:last-child { border-bottom: none; }
.pcl-item:hover { background: var(--primary-light); }
.pcl-item.sel { background: linear-gradient(135deg, rgba(99,102,241,0.25), rgba(6,182,212,0.18)); }
.pcl-item.sel .pcl-nombre { color: var(--primary); }

.pcl-nombre { font-size: 0.82rem; font-weight: 600; color: var(--text-primary); }
.pcl-doc { font-size: 0.68rem; color: var(--text-muted); margin-top: 1px; font-family: monospace; }

.pcl-vacio {
    padding: 1rem 0.85rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    text-align: center;
}

#pos-cliente-elegido {
    align-items: center;
    gap: 0.5rem;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.35);
    border-radius: 0.55rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.78rem;
    color: var(--success);
}
#pos-cliente-elegido .pcl-quitar {
    margin-left: auto;
    cursor: pointer;
    font-size: 1.1rem;
    line-height: 1;
    color: var(--text-muted);
    padding: 0 0.25rem;
    border-radius: 50%;
}
#pos-cliente-elegido .pcl-quitar:hover { color: var(--danger); }

/* POS móvil — tarjetas legibles en pantallas chicas */
@media (max-width: 560px) {
    .pos-grid { grid-template-columns: repeat(2, 1fr); gap: 0.5rem; padding: 0.35rem; }
    .pos-item-card { padding: 0.45rem; gap: 0.35rem; }
    .pos-item-footer { flex-direction: column; align-items: stretch !important; gap: 0.15rem !important; }
    .pos-item-price { font-size: 0.95rem !important; }
    .pos-item-img-container { height: 58px; }
    .pos-cat-scroll .btn { font-size: 0.7rem; padding: 0.3rem 0.6rem; }
    .pos-products { padding: 0.75rem; }
    #pos-search-input { font-size: 0.85rem; }
}
@media (max-width: 380px) {
    .pos-grid { grid-template-columns: 1fr; }
}

/* POS móvil — tarjetas en fila horizontal compacta */
@media (max-width: 560px) {
    .pos-grid { grid-template-columns: 1fr; gap: 0.45rem; padding: 0.3rem; }
    .pos-item-card {
        flex-direction: row;
        align-items: center;
        padding: 0.5rem;
        gap: 0.7rem;
    }
    .pos-item-img-container {
        width: 48px;
        height: 48px;
        flex-shrink: 0;
        margin-bottom: 0;
        border-radius: 0.45rem;
    }
    .pos-item-no-img svg { width: 18px; height: 18px; }
    .pos-item-badge { font-size: 0.55rem; padding: 1px 5px; top: 3px; left: 3px; }
    .pos-item-info { flex-direction: row !important; align-items: center; }
    .pos-item-head { flex: 1; min-width: 0; }
    .pos-item-head div:first-child { font-size: 0.62rem !important; margin-bottom: 0.1rem !important; }
    .pos-item-head div:last-child {
        font-size: 0.8rem !important;
        margin-bottom: 0 !important;
        -webkit-line-clamp: 1;
    }
    .pos-item-footer {
        border-top: none !important;
        padding-top: 0 !important;
        margin-top: 0 !important;
        flex-direction: column !important;
        align-items: flex-end !important;
        gap: 0.1rem !important;
        flex-shrink: 0;
    }
    .pos-item-footer > div:first-child { font-size: 0.62rem !important; }
    .pos-item-price { font-size: 0.95rem !important; }
}

/* POS — barra de filtros fija en móvil */
@media (max-width: 900px) {
    .pos-filter-bar {
        position: sticky;
        top: var(--header-height);
        z-index: 20;
        background: var(--bg-card);
        margin: -0.5rem -0.5rem 0.75rem !important;
        padding: 0.5rem;
        border-radius: 0.5rem;
        border: 1px solid var(--border-color);
        flex-wrap: nowrap !important;
        gap: 0.5rem !important;
    }
    .pos-filter-bar #pos-search-input { flex: 1; min-width: 0; }
    .pos-filter-bar .pos-cat-scroll { flex: 0 1 auto; min-width: 0; }
}
