:root {
    --turquoise: #00B4D8;
    --turquoise-dark: #0077B6;
    --turquoise-light: #90E0EF;
    --white: #FFFFFF;
    --black: #111111;
    --gray-50: #F8FAFC;
    --gray-100: #F1F5F9;
    --gray-200: #E2E8F0;
    --gray-300: #CBD5E1;
    --gray-500: #64748B;
    --gray-700: #334155;
    --gray-900: #0F172A;
    --radius: 0.75rem;
    --radius-xl: 1.25rem;
    --font: 'Inter', sans-serif;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

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

body {
    font-family: var(--font);
    background: var(--gray-50);
    color: var(--black);
}

a { text-decoration: none; color: inherit; }
button { font-family: inherit; cursor: pointer; }

.admin-header {
    background: var(--gray-900);
    color: var(--white);
    padding: 0 2rem;
    height: 4rem;
    display: flex;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.admin-header__container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.admin-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 700;
    font-size: 1.3rem;
}

.badge-admin {
    background: var(--turquoise);
    color: var(--white);
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 700;
}

.admin-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.btn-logout {
    background: rgba(255,255,255,0.1);
    border: none;
    color: white;
    padding: 0.4rem 0.6rem;
    border-radius: 6px;
    font-size: 1rem;
    transition: background 0.2s;
}

.btn-logout:hover {
    background: #EF4444;
}

.admin-layout {
    display: grid;
    grid-template-columns: 240px 1fr;
    min-height: calc(100vh - 4rem);
    align-items: start;
}

.admin-sidebar {
    background: var(--white);
    border-right: 1px solid var(--gray-200);
    padding: 1.5rem 0;
    position: sticky;
    top: 4rem;
    height: calc(100vh - 4rem);
    overflow-y: auto;
    align-self: start;
}

/* Scrollbar styling for sidebar */
.admin-sidebar::-webkit-scrollbar {
    width: 4px;
}
.admin-sidebar::-webkit-scrollbar-track {
    background: transparent;
}
.admin-sidebar::-webkit-scrollbar-thumb {
    background: var(--gray-200);
    border-radius: 4px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.8rem 1.5rem;
    font-weight: 500;
    transition: background 0.2s;
    border-left: 3px solid transparent;
}

.sidebar-link:hover {
    background: var(--gray-50);
}

.sidebar-link.active {
    background: rgba(0,180,216,0.08);
    color: var(--turquoise-dark);
    font-weight: 600;
    border-left-color: var(--turquoise);
}

.admin-main {
    padding: 2rem;
}

.admin-section {
    display: none;
}

.admin-section.active {
    display: block;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.section-header h2 {
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn {
    padding: 0.6rem 1.25rem;
    border-radius: var(--radius);
    font-weight: 600;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    transition: 0.2s;
}

.btn-primary {
    background: var(--turquoise);
    color: white;
}

.btn-primary:hover {
    background: var(--turquoise-dark);
}

.btn-outline {
    border: 2px solid var(--gray-300);
    background: white;
}

.btn-outline:hover {
    background: var(--gray-50);
}

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

.products-table-wrapper {
    background: var(--white);
    border-radius: var(--radius-xl);
    border: 1px solid var(--gray-200);
    overflow-x: auto;
    width: 100%;
    box-shadow: var(--shadow-sm);
    -webkit-overflow-scrolling: touch;
}

/* Scrollbar styling for table */
.products-table-wrapper::-webkit-scrollbar {
    height: 8px;
}
.products-table-wrapper::-webkit-scrollbar-track {
    background: var(--gray-50);
    border-radius: 10px;
}
.products-table-wrapper::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: 10px;
}
.products-table-wrapper::-webkit-scrollbar-thumb:hover {
    background: var(--gray-500);
}

.products-table {
    width: 100%;
    border-collapse: collapse;
}

.products-table th {
    text-align: left;
    padding: 1rem 1rem;
    background: var(--gray-50);
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
}

.products-table td {
    padding: 0.8rem 1rem;
    border-top: 1px solid var(--gray-200);
}

.img-cell img {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 4px;
}

.img-cell i {
    font-size: 1.5rem;
    color: var(--turquoise);
}

.btn-edit {
    color: var(--turquoise-dark);
    background: none;
    border: none;
    font-size: 1rem;
    margin-right: 0.5rem;
}

.btn-delete {
    color: #EF4444;
    background: none;
    border: none;
    font-size: 1rem;
}

.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--gray-500);
}

.product-form {
    background: var(--white);
    padding: 2rem;
    border-radius: var(--radius-xl);
    border: 1px solid var(--gray-200);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.25rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.form-group label {
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--gray-700);
    margin-bottom: 0.2rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 0.7rem;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius);
    font-family: var(--font);
}

.file-upload {
    border: 2px dashed var(--gray-300);
    border-radius: var(--radius);
    padding: 1.5rem;
    text-align: center;
    cursor: pointer;
    position: relative;
    transition: border-color 0.2s, background 0.2s;
}

.file-upload:hover {
    border-color: var(--turquoise);
    background: rgba(0, 180, 216, 0.04);
}

.file-upload.dragover {
    border-color: var(--turquoise);
    background: rgba(0, 180, 216, 0.08);
}

/* Ocultar el input nativo — el JS lo activa programáticamente */
.file-upload input[type="file"] {
    display: none;
}

.file-upload__preview img {
    max-height: 120px;
    margin-bottom: 0.5rem;
}

.file-upload__name {
    font-size: 0.82rem;
    color: var(--turquoise-dark);
    margin-top: 0.4rem;
    font-weight: 600;
    word-break: break-all;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 2rem;
}

.filters-config-box {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-xl);
    padding: 2rem;
    margin-top: 1rem;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0.5rem 0;
}

.text-muted {
    color: var(--gray-500);
    margin-bottom: 1.5rem;
}

.security-hint {
    color: var(--gray-500);
    margin-bottom: 1.5rem;
}

.security-code-box {
    margin-top: 1.5rem;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-xl);
    padding: 1.5rem 2rem 2rem;
}

.security-code-box h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.security-code-box p {
    color: var(--gray-500);
    margin-bottom: 1rem;
}

.security-code-row {
    margin-bottom: 0;
}

.info-box {
    background: #E0F2FE;
    padding: 1rem 1.5rem;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 2rem;
}

@media (max-width: 1024px) {
    .admin-layout {
        grid-template-columns: 1fr;
    }

    .admin-sidebar {
        display: flex;
        overflow-x: auto;
        overflow-y: visible;
        height: auto;
        border-right: none;
        border-bottom: 1px solid var(--gray-200);
        position: sticky;
        top: 4rem;
        z-index: 90;
        padding: 0;
        scroll-behavior: smooth;
        -webkit-overflow-scrolling: touch;
    }
    .admin-sidebar::-webkit-scrollbar {
        height: 3px;
    }
    .admin-sidebar::-webkit-scrollbar-thumb {
        background: var(--turquoise);
        border-radius: 2px;
    }
    .admin-sidebar nav {
        display: flex;
        flex-direction: row;
        align-items: stretch;
        min-width: max-content;
    }
    .admin-sidebar .sidebar-separator {
        width: 1px;
        height: 2rem;
        margin: auto 0.5rem;
        border-top: none;
        border-left: 1px solid var(--gray-200);
    }

    .sidebar-link {
        border-left: none;
        white-space: nowrap;
        border-bottom: 3px solid transparent;
        padding: 0.9rem 1rem;
        font-size: 0.85rem;
    }

    .sidebar-link.active {
        border-bottom-color: var(--turquoise);
        border-left-color: transparent;
    }
}

/* --- RESPONSIVE ORDERS (TABLE TO CARDS) --- */
#section-orders .products-table-wrapper {
    background: transparent;
    border: none;
    box-shadow: none;
    overflow: visible;
}

#section-orders .products-table {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
    gap: 1.5rem;
    background: transparent;
}

#section-orders .products-table thead {
    display: none;
}

#section-orders .products-table tbody {
    display: contents;
}

#section-orders .products-table tr {
    display: flex;
    flex-direction: column;
    background: var(--white);
    border-radius: var(--radius-xl);
    padding: 1.5rem;
    border: 1px solid var(--gray-200);
    box-shadow: var(--shadow-sm);
    position: relative;
}

#section-orders .products-table td {
    border: none;
    padding: 0.5rem 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-align: right;
}

#section-orders .products-table td::before {
    content: attr(data-label);
    font-weight: 700;
    text-align: left;
    font-size: 0.8rem;
    color: var(--gray-500);
    text-transform: uppercase;
    margin-right: 1rem;
}

#section-orders .products-table td:last-child {
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 1rem;
    border-top: 1px solid var(--gray-100);
    padding-top: 1rem;
}

#section-orders .products-table td:last-child::before {
    display: none;
}

#section-orders .products-table td[data-label="Acción"] {
    background: #f8fafc;
    margin: 0.5rem -1.5rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--gray-100);
    border-bottom: 1px solid var(--gray-100);
}

/* --- ESTADOS DE PEDIDO --- */
.estado {
    padding: 0.35rem 0.75rem;
    border-radius: 99px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    display: inline-block;
}

.estado-pendiente { background: #fee2e2; color: #b91c1c; }
.estado-en-proceso { background: #fef3c7; color: #b45309; }
.estado-enviado { background: #e0f2fe; color: #0369a1; }
.estado-entregado { background: #d1fae5; color: #047857; }
.estado-cancelado { background: #f3f4f6; color: #374151; }

.estado-select {
    padding: 0.4rem;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    font-size: 0.85rem;
    background: white;
    cursor: pointer;
}

.estado-select:disabled {
    opacity: 0.6;
    cursor: wait;
}

.search-box input:focus {
    outline: none;
    border-color: var(--turquoise) !important;
    box-shadow: 0 0 0 3px rgba(0, 180, 216, 0.1);
}
.bulk-actions-toolbar {
    display: none;
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    background: var(--gray-900);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 999px;
    align-items: center;
    gap: 1.5rem;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2), 0 10px 10px -5px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(8px);
}

.bulk-actions-toolbar.active {
    display: flex;
    animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUp {
    from { transform: translate(-50%, 100%); opacity: 0; }
    to { transform: translate(-50%, 0); opacity: 1; }
}

.btn-save-status {
    background: var(--turquoise);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.8rem;
    border: none;
    transition: 0.2s;
    opacity: 0.5;
    pointer-events: none; /* Deshabilitado por defecto hasta que haya cambios */
}

.btn-save-status.has-changes {
    opacity: 1;
    pointer-events: auto;
    box-shadow: 0 4px 10px rgba(0, 180, 216, 0.3);
}

.btn-save-status.has-changes:hover {
    background: var(--turquoise-dark);
    transform: translateY(-1px);
}

.observacion-input {
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    padding: 8px;
    font-size: 0.85rem;
    transition: border-color 0.2s;
}

.observacion-input:focus {
    border-color: var(--turquoise);
    outline: none;
}

/* --- PRICING & SHIPPING STYLES --- */
.pricing-grid {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 2rem;
    margin-top: 1rem;
}

@media (max-width: 1200px) {
    .pricing-grid {
        grid-template-columns: 1fr;
    }
}

.admin-card {
    background: var(--white);
    border-radius: var(--radius-xl);
    border: 1px solid var(--gray-200);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s, box-shadow 0.2s;
}

.admin-card:hover {
    box-shadow: var(--shadow-md);
}

.admin-card__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--gray-100);
}

.admin-card__header h3 {
    margin: 0;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--gray-900);
}

.pricing-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-box {
    background: linear-gradient(135deg, var(--turquoise), var(--turquoise-dark));
    color: white;
    padding: 1.5rem;
    border-radius: var(--radius-xl);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    position: relative;
    overflow: hidden;
}

.stat-box::after {
    content: '';
    position: absolute;
    top: -20%;
    right: -10%;
    width: 100px;
    height: 100px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
}

.stat-box__label {
    font-size: 0.85rem;
    font-weight: 500;
    opacity: 0.9;
}

.stat-box__value {
    font-size: 1.8rem;
    font-weight: 800;
}

.stat-box__icon {
    position: absolute;
    bottom: 1rem;
    right: 1rem;
    font-size: 2rem;
    opacity: 0.2;
}

.rate-badge {
    background: var(--gray-100);
    color: var(--gray-700);
    padding: 0.25rem 0.75rem;
    border-radius: 99px;
    font-size: 0.75rem;
    font-weight: 600;
}

.cost-highlight {
    color: var(--turquoise-dark);
    font-weight: 700;
}

.actions {
    display: flex;
    gap: 0.5rem;
}

.actions button {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    border: 1px solid var(--gray-200);
    background: white;
    color: var(--gray-500);
    transition: 0.2s;
}

.actions .btn-edit-shipping:hover, .actions .btn-edit-fee:hover {
    background: var(--gray-50);
    color: var(--turquoise);
    border-color: var(--turquoise-light);
}

.actions .btn-delete-shipping:hover, .actions .btn-delete-fee:hover {
    background: #FEF2F2;
    color: #EF4444;
    border-color: #FEE2E2;
}

.pricing-info-card {
    background: #f0f9ff;
    border-left: 4px solid #0ea5e9;
    padding: 1rem;
    border-radius: 0 var(--radius) var(--radius) 0;
    margin-bottom: 1.5rem;
    font-size: 0.85rem;
}

/* --- PRODUCTS SECTION IMPROVEMENTS --- */
.products-filter-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
    background: var(--white);
    padding: 1.25rem;
    border-radius: var(--radius-xl);
    border: 1px solid var(--gray-200);
    box-shadow: var(--shadow-sm);
}

@media (max-width: 900px) {
    .products-filter-bar {
        flex-direction: column;
        align-items: stretch;
    }
}

.search-input-wrapper {
    position: relative;
    flex-grow: 1;
}

.search-input-wrapper i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-500);
    pointer-events: none;
}

.search-input-wrapper input {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 2.75rem;
    border: 2px solid var(--gray-100);
    border-radius: var(--radius);
    background: var(--gray-50);
    font-size: 0.95rem;
    transition: all 0.2s;
}

.search-input-wrapper input:focus {
    outline: none;
    border-color: var(--turquoise);
    background: var(--white);
    box-shadow: 0 0 0 4px rgba(0, 180, 216, 0.1);
}

.filter-controls {
    display: flex;
    gap: 1rem;
}

.filter-controls select {
    padding: 0.75rem 1rem;
    border: 2px solid var(--gray-100);
    border-radius: var(--radius);
    background: var(--gray-50);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.filter-controls select:focus {
    outline: none;
    border-color: var(--turquoise);
}

.pagination-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 2rem;
    padding: 1.25rem;
    background: var(--white);
    border-radius: var(--radius-xl);
    border: 1px solid var(--gray-200);
}

.pagination-info {
    font-size: 0.9rem;
    color: var(--gray-500);
    font-weight: 500;
}

.pagination-buttons {
    display: flex;
    gap: 0.5rem;
}

.pagination-btn {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    border: 1px solid var(--gray-200);
    background: var(--white);
    font-weight: 600;
    color: var(--gray-700);
    transition: 0.2s;
}

.pagination-btn:hover:not(:disabled) {
    border-color: var(--turquoise);
    color: var(--turquoise);
    background: var(--gray-50);
}

.pagination-btn.active {
    background: var(--turquoise);
    color: var(--white);
    border-color: var(--turquoise);
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Stock Indicators */
.stock-badge {
    padding: 0.25rem 0.6rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
}

.stock-ok { background: #DCFCE7; color: #166534; }
.stock-low { background: #FEF3C7; color: #92400E; }
.stock-out { background: #FEE2E2; color: #991B1B; }

.price-tag {
    font-weight: 700;
    color: var(--gray-900);
}

.discount-badge {
    background: #FFEDD5;
    color: #9A3412;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 800;
    margin-left: 0.5rem;
}

/* --- ADD PRODUCT NEW LAYOUT --- */
.product-form-new .admin-card {
    padding: 1.75rem;
    height: 100%;
}

.product-form-new .form-group input:focus,
.product-form-new .form-group select:focus,
.product-form-new .form-group textarea:focus {
    border-color: var(--turquoise);
    outline: none;
    box-shadow: 0 0 0 4px rgba(0, 180, 216, 0.1);
}

.form-sticky-actions {
    box-shadow: 0 -10px 15px -3px rgba(0,0,0,0.05);
    z-index: 50;
}

@media (max-width: 1200px) {
    .admin-grid-layout {
        grid-template-columns: 1fr !important;
    }
}

.variant-row input, .qty-discount-row input {
    border-width: 1px !important;
    font-size: 0.9rem !important;
}

.admin-card__header h3 i {
    color: var(--turquoise);
}

/* Animación suave para la entrada de secciones */
.admin-section.active {
    animation: fadeIn 0.4s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
/* POS Quick Access & Suggestions */
.pos-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: 0 0 var(--radius) var(--radius);
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    max-height: 300px;
    overflow-y: auto;
    display: none;
}

.pos-suggestion-item {
    padding: 0.75rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    border-bottom: 1px solid var(--gray-100);
}

.pos-suggestion-item:hover {
    background: var(--gray-50);
}

.pos-suggestion-info {
    display: flex;
    flex-direction: column;
}

.pos-suggestion-name {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--gray-900);
}

.pos-suggestion-code {
    font-size: 0.75rem;
    color: var(--gray-500);
}

.pos-suggestion-price {
    font-weight: 800;
    color: var(--turquoise-dark);
    font-size: 1rem;
}

.pos-category-tab {
    padding: 0.6rem 1.25rem;
    border-radius: 99px;
    background: var(--white);
    border: 1px solid var(--gray-200);
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
    color: var(--gray-700);
}

.pos-category-tab:hover {
    background: var(--gray-50);
    border-color: var(--gray-300);
}

.pos-category-tab.active {
    background: var(--turquoise);
    color: white;
    border-color: var(--turquoise);
    box-shadow: 0 4px 10px rgba(0, 180, 216, 0.2);
}

.pos-item-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.25rem 0.75rem;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    gap: 0.75rem;
    box-shadow: var(--shadow-sm);
}

.pos-item-btn:hover {
    border-color: var(--turquoise);
    background: #f0f9ff;
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.pos-item-btn i {
    font-size: 1.75rem;
    color: var(--turquoise-dark);
}

.pos-item-btn span {
    font-size: 0.8rem;
    font-weight: 600;
    line-height: 1.3;
    height: 2.6rem;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    color: var(--gray-900);
}

.pos-item-btn b {
    font-size: 0.9rem;
    color: var(--turquoise-dark);
    font-weight: 800;
}

.pos-items-grid::-webkit-scrollbar {
    width: 6px;
}
.pos-items-grid::-webkit-scrollbar-track {
    background: var(--gray-50);
}
.pos-items-grid::-webkit-scrollbar-thumb {
    background: var(--gray-200);
    border-radius: 10px;
}
/* --- POS SPECIFIC IMPROVEMENTS --- */
.pos-layout {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 1.5rem;
    align-items: start;
    /* Sin altura fija — fluye con el contenido */
}

.pos-main {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.pos-main::-webkit-scrollbar {
    width: 6px;
}
.pos-main::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: 10px;
}

.pos-sidebar {
    position: sticky;
    top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    /* max-height limita el sidebar sin afectar al layout general */
    max-height: calc(100vh - 6rem);
    overflow-y: auto;
}

.pos-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: 0 0 var(--radius) var(--radius);
    z-index: 1000;
    box-shadow: var(--shadow-lg);
    max-height: 300px;
    overflow-y: auto;
}

.pos-suggestion-item {
    padding: 0.75rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    border-bottom: 1px solid var(--gray-50);
}

.pos-suggestion-item:hover {
    background: var(--gray-50);
}

.pos-quick-item-card {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 0.75rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    justify-content: center;
    min-height: 100px;
}

.pos-quick-item-card:hover {
    border-color: var(--turquoise);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.pos-quick-item-card h4 {
    font-size: 0.85rem;
    font-weight: 600;
    line-height: 1.2;
    color: var(--gray-900);
}

.pos-quick-item-card span {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--turquoise-dark);
}

.pos-category-tab {
    padding: 0.5rem 1rem;
    background: var(--gray-100);
    border-radius: 99px;
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    border: 2px solid transparent;
    transition: 0.2s;
}

.pos-category-tab.active {
    background: var(--turquoise);
    color: white;
    border-color: var(--turquoise-dark);
}

/* Compact POS table */
.pos-cart-table th {
    font-size: 0.75rem;
    padding: 0.75rem 0.5rem;
}

.pos-cart-table td {
    padding: 0.6rem 0.5rem;
    font-size: 0.9rem;
}

.btn-qty {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gray-100);
    border: 1px solid var(--gray-200);
    border-radius: 4px;
    font-weight: 700;
}

.btn-qty:hover {
    background: var(--gray-200);
}

/* ── POS Responsive ─────────────────────────────────────────── */

/* Tablet ancha: sidebar más compacta pero sigue en columna */
@media (max-width: 1200px) and (min-width: 961px) {
    .pos-layout {
        grid-template-columns: 1fr 320px;
        height: auto;
        min-height: 0;
    }
    .pos-sidebar {
        position: sticky;
        top: 1rem;
        max-height: calc(100vh - 6rem);
        overflow-y: auto;
    }
    #pos-grand-total { font-size: 2.8rem !important; }
}

/* Tablet pequeña / pantalla < 960px: sidebar sube al top */
@media (max-width: 960px) {
    .pos-layout {
        grid-template-columns: 1fr;
        height: auto;
        gap: 1rem;
    }
    .pos-sidebar {
        position: static;
        order: -1;             /* Panel de cobro arriba del buscador */
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 1rem;
        align-items: start;
    }
    .pos-sidebar > .admin-card:last-child {
        grid-column: 1 / -1;  /* Formulario ocupa todo el ancho */
    }
    .pos-main { padding-right: 0; }
    #pos-grand-total { font-size: 2.4rem !important; }
    .pos-items-grid { max-height: 220px !important; }
}

/* Móvil: diseño en tarjetas, sidebar apilada */
@media (max-width: 640px) {
    .pos-layout { gap: 0.75rem; }

    .pos-sidebar {
        display: flex;
        flex-direction: column;
        gap: 0.75rem;
    }

    /* Total más compacto */
    .pos-sidebar > .admin-card:first-child {
        padding: 1rem !important;
    }
    #pos-grand-total { font-size: 2.2rem !important; }
    #pos-items-count { font-size: 0.78rem !important; }

    /* Botón finalizar más alto y legible */
    #btn-pos-complete {
        height: 60px !important;
        font-size: 1.15rem !important;
    }

    /* Quick access items más pequeños */
    .pos-quick-item-card {
        padding: 0.5rem !important;
        min-height: 75px !important;
        gap: 0.25rem !important;
    }
    .pos-quick-item-card h4 { font-size: 0.75rem !important; }
    .pos-quick-item-card span { font-size: 0.8rem !important; }
    .pos-items-grid {
        grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)) !important;
        max-height: 200px !important;
        gap: 0.5rem !important;
    }

    /* Búsqueda compacta */
    #pos-search-code {
        font-size: 1rem !important;
        height: 44px !important;
    }
    #btn-pos-browse-products,
    #btn-pos-add-manual {
        height: 44px !important;
        width: 44px !important;
    }

    /* ── Tabla carrito → tarjetas ─────────────────────────────── */
    .pos-cart-table,
    .pos-cart-table tbody,
    .pos-cart-table tr { display: block; }

    .pos-cart-table thead { display: none; }

    .pos-cart-table tbody tr {
        display: grid;
        grid-template-columns: 1fr auto auto;
        grid-template-rows: auto auto;
        gap: 4px 8px;
        background: #fff;
        border: 1px solid var(--gray-100);
        border-radius: 12px;
        padding: 10px 12px;
        margin-bottom: 8px;
        align-items: center;
    }

    /* Col 1: código → oculta */
    .pos-cart-table tbody tr td:nth-child(1) { display: none; }

    /* Col 2: nombre → fila 1, span completo */
    .pos-cart-table tbody tr td:nth-child(2) {
        grid-column: 1 / -1;
        font-weight: 700;
        font-size: 0.9rem;
        color: var(--gray-900);
    }

    /* Col 3: precio unitario */
    .pos-cart-table tbody tr td:nth-child(3) {
        font-size: 0.8rem;
        color: var(--gray-500);
    }
    .pos-cart-table tbody tr td:nth-child(3)::before {
        content: 'P.U: ';
        font-weight: 600;
        color: var(--gray-400);
    }

    /* Col 4: controles de cantidad */
    .pos-cart-table tbody tr td:nth-child(4) {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* Col 5: total → negrita turquesa */
    .pos-cart-table tbody tr td:nth-child(5) {
        font-weight: 800;
        font-size: 0.95rem;
        color: var(--turquoise-dark);
        text-align: right;
    }

    /* Col 6: botón eliminar */
    .pos-cart-table tbody tr td:nth-child(6) {
        display: flex;
        align-items: center;
        justify-content: flex-end;
    }

    /* Efectivo recibido más compacto */
    #pos-cash-received { font-size: 1.2rem !important; }
    #pos-cash-change   { font-size: 1.5rem !important; }

    /* Método de pago */
    #pos-payment-method { font-size: 0.9rem !important; height: 44px !important; }

    /* Historial ventas en móvil */
    #section-pos .products-table thead { display: none; }
    #section-pos .products-table tbody tr {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 2px 8px;
        padding: 10px;
        border: 1px solid var(--gray-100);
        border-radius: 10px;
        margin-bottom: 6px;
    }
    #section-pos .products-table tbody tr td { font-size: 0.82rem; }
    #section-pos .products-table tbody tr td:last-child {
        grid-column: 1 / -1;
    }
}

/* Extra pequeño */
@media (max-width: 400px) {
    #pos-grand-total { font-size: 1.9rem !important; }
    .pos-items-grid {
        grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)) !important;
    }
    #btn-pos-complete { font-size: 1rem !important; height: 54px !important; }
}

/* Ocultar flechas en inputs numéricos */
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
input[type=number] {
    -moz-appearance: textfield;
}
