:root {
    /* Paleta elegante - Tonos Nude/Rosados y Grises */
    --primary: #cda291;         /* Tono principal sofisticado */
    --primary-hover: #b88d7b;
    --sidebar-bg: #ffffff;
    --bg-color: #f5f6f8;        /* Fondo gris súper claro */
    --surface: #ffffff;
    
    --text-main: #2b2b2b;
    --text-muted: #888888;
    --border: #e8e8e8;
    
    /* Colores de estado suaves */
    --success: #4caf50;
    --danger: #f44336;
    --warning: #ff9800;
    
    /* Fondos suaves para iconos */
    --bg-soft-primary: #f8efe8;
    --bg-soft-green: #eaf6ea;
    --bg-soft-red: #fce8e8;
    --bg-soft-purple: #f3eafa;

    --radius-lg: 16px;
    --radius-md: 8px;
    --shadow-sm: 0 2px 10px rgba(0,0,0,0.02);
    --shadow-md: 0 5px 20px rgba(0,0,0,0.05);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
}

/* --- Layout Principal --- */
.app-container {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* --- Barra Lateral (Sidebar) --- */
.sidebar {
    width: 260px;
    background-color: var(--sidebar-bg);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-sm);
    z-index: 10;
}

.brand {
    padding: 30px 20px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.brand-icon {
    font-size: 24px;
    color: var(--primary);
}

.brand h2 {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.sidebar-nav {
    flex: 1;
    padding: 0 15px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nav-item {
    background: transparent;
    border: none;
    width: 100%;
    text-align: left;
    padding: 15px 20px;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 15px;
    font-weight: 500;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 15px;
    transition: all 0.2s ease;
}

.nav-item i {
    font-size: 18px;
    width: 20px;
    text-align: center;
}

.nav-item:hover {
    background-color: #f9f9f9;
    color: var(--text-main);
}

.nav-item.active {
    background-color: var(--bg-soft-primary);
    color: var(--primary);
    font-weight: 600;
}

.sidebar-footer {
    padding: 20px;
    text-align: center;
    color: var(--text-muted);
    font-size: 12px;
    border-top: 1px solid var(--border);
}

/* --- Contenido Principal --- */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: var(--bg-color);
}

.top-header {
    background: var(--surface);
    padding: 20px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
}

.top-header h1 {
    font-size: 22px;
    font-weight: 600;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 20px;
}

.date-display {
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 500;
}

.btn-icon {
    background: var(--bg-color);
    border: 1px solid var(--border);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    color: var(--text-main);
    cursor: pointer;
    transition: 0.2s;
}

.btn-icon:hover {
    background: var(--border);
}

.content-area {
    padding: 40px;
    overflow-y: auto;
    flex: 1;
}

/* --- Vistas --- */
.view {
    display: none;
    animation: fadeIn 0.3s ease;
}

.view.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- Dashboard Stats --- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--surface);
    padding: 25px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: 20px;
}

.stat-icon-wrapper {
    width: 60px;
    height: 60px;
    border-radius: 14px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.stat-icon { font-size: 24px; }
.text-primary { color: var(--primary); }
.text-green { color: var(--success); }
.text-red { color: var(--danger); }
.text-purple { color: #9c27b0; }

.stat-info h3 {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 5px;
}

.stat-info .amount {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-main);
}

/* --- Paneles y Tablas --- */
.panel {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 25px;
    margin-bottom: 25px;
}

.panel-title {
    font-size: 18px;
    margin-bottom: 20px;
    font-weight: 600;
}

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

.data-table th, .data-table td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.data-table th {
    color: var(--text-muted);
    font-weight: 500;
    font-size: 14px;
}

.data-table td {
    font-size: 15px;
}

.data-table tr:last-child td {
    border-bottom: none;
}

/* --- Badges --- */
.badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}
.badge-success { background: var(--bg-soft-green); color: var(--success); }
.badge-danger { background: var(--bg-soft-red); color: var(--danger); }
.badge-warning { background: #fff3e0; color: var(--warning); }

.text-success { color: var(--success); font-weight: 600; }
.text-danger { color: var(--danger); font-weight: 600; }

/* --- Headers de Vista y Controles --- */
.view-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.search-box {
    display: flex;
    align-items: center;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0 15px;
    width: 350px;
    transition: 0.3s;
}

.search-box:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--bg-soft-primary);
}

.search-box i {
    color: var(--text-muted);
}

.search-box input {
    border: none;
    padding: 12px 15px;
    width: 100%;
    outline: none;
    font-size: 14px;
}

.btn-primary {
    background-color: var(--primary);
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.3s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
}

/* --- Empty States --- */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 48px;
    margin-bottom: 20px;
    color: var(--border);
}

.empty-state h3 {
    font-size: 18px;
    color: var(--text-main);
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 14px;
}

/* --- Modales --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(4px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal-overlay.active {
    display: flex;
    opacity: 1;
}

.modal-content {
    background: var(--surface);
    width: 500px;
    border-radius: var(--radius-lg);
    box-shadow: 0 15px 40px rgba(0,0,0,0.1);
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.modal-overlay.active .modal-content {
    transform: translateY(0);
}

.modal-header {
    padding: 20px 25px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-size: 18px;
    font-weight: 600;
}

.btn-close {
    background: none;
    border: none;
    font-size: 20px;
    color: var(--text-muted);
    cursor: pointer;
}

.btn-close:hover {
    color: var(--danger);
}

.modal-body {
    padding: 25px;
}

.modal-footer {
    padding: 20px 25px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.btn-secondary {
    background-color: var(--bg-color);
    color: var(--text-main);
    border: 1px solid var(--border);
    padding: 12px 20px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.3s;
}

.btn-secondary:hover {
    background-color: var(--border);
}

/* --- Formularios --- */
.form-group {
    margin-bottom: 20px;
}

.form-row {
    display: flex;
    gap: 15px;
}

.form-row .form-group {
    flex: 1;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-main);
}

.form-control {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 15px;
    outline: none;
    transition: 0.3s;
    background: var(--bg-color);
}

.form-control:focus {
    border-color: var(--primary);
    background: var(--surface);
    box-shadow: 0 0 0 3px var(--bg-soft-primary);
}

/* --- Apartados (Layaways) --- */
.layaways-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}

.layaway-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 25px;
    box-shadow: var(--shadow-sm);
    border-top: 4px solid var(--warning);
    display: flex;
    flex-direction: column;
}

.layaway-card.completed {
    border-top-color: var(--success);
}

.layaway-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
}

.layaway-client {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-main);
}

.layaway-date {
    font-size: 12px;
    color: var(--text-muted);
}

.layaway-details {
    font-size: 14px;
    margin-bottom: 15px;
    color: var(--text-muted);
    flex: 1;
}

.layaway-financials {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    margin-bottom: 10px;
}

.layaway-financials span {
    color: var(--text-muted);
}

.layaway-financials strong {
    color: var(--text-main);
}

.progress-bg {
    background: var(--border);
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 20px;
}

.progress-fill {
    background: var(--primary);
    height: 100%;
    width: 0%;
    transition: width 0.3s;
}

.layaway-card.completed .progress-fill {
    background: var(--success);
}

.layaway-actions {
    display: flex;
    gap: 10px;
}

.btn-small {
    padding: 8px 12px;
    font-size: 13px;
    flex: 1;
    justify-content: center;
}


/* --- OPTIMIZACIÓN PARA MÓVILES - Estilo App Premium --- */
@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
    }

    /* Barra de navegación inferior estilo glassmorphism */
    .sidebar {
        width: 100%;
        height: auto;
        flex-direction: row;
        position: fixed;
        bottom: 0;
        z-index: 99999 !important; /* MÁXIMA PRIORIDAD */
        border-right: none;
        border-top: 1px solid var(--border);
        background: rgba(255, 255, 255, 0.98) !important;
        backdrop-filter: blur(25px) !important;
        -webkit-backdrop-filter: blur(25px) !important;
        box-shadow: 0 -5px 30px rgba(0,0,0,0.1) !important;
        padding-bottom: env(safe-area-inset-bottom, 30px);
    }

    .brand, .sidebar-footer {
        display: none;
    }

    .sidebar-nav {
        flex-direction: row;
        justify-content: space-around;
        padding: 8px 0 12px 0;
        width: 100%;
        background: transparent;
        gap: 0;
    }

    .nav-item {
        flex-direction: column;
        padding: 10px 4px 6px; /* Más área de clic */
        gap: 4px;
        font-size: 11px;
        font-weight: 600;
        text-align: center;
        width: auto;
        flex: 1;
        border-radius: 0;
        color: #999;
        position: relative;
        user-select: none;
        -webkit-tap-highlight-color: transparent;
    }

    .nav-item i {
        font-size: 22px;
        width: auto;
        transition: transform 0.2s ease, color 0.2s ease;
    }

    .nav-item.active {
        background-color: transparent;
        color: var(--primary);
    }

    .nav-item.active i {
        transform: scale(1.12);
    }

    /* Punto indicador bajo icono activo */
    .nav-item.active::after {
        content: '';
        display: block;
        width: 5px;
        height: 5px;
        background: var(--primary);
        border-radius: 50%;
        margin: 4px auto 0;
    }

    .main-content {
        margin-bottom: 72px;
    }

    .top-header {
        padding: 12px 15px;
        flex-direction: row;
        gap: 10px;
    }

    .top-header h1 {
        font-size: 18px;
    }

    .content-area {
        padding: 15px;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }

    .stat-card {
        padding: 15px;
        gap: 12px;
    }

    .stat-icon-wrapper {
        width: 45px;
        height: 45px;
        min-width: 45px;
    }

    .stat-icon {
        font-size: 18px;
    }

    .stat-info .amount {
        font-size: 18px;
    }

    .view-header {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .search-box {
        width: 100%;
    }

    /* --- REDISEÑO MÓVIL PREMIUM --- */
    .app-container {
        flex-direction: column;
        padding-bottom: 80px;
    }

    .sidebar {
        width: 100%; height: auto;
        flex-direction: row;
        position: fixed; bottom: 0; left: 0;
        z-index: 9999;
        background: rgba(255, 255, 255, 0.98);
        backdrop-filter: blur(20px);
        border-top: 1px solid rgba(0,0,0,0.05);
        box-shadow: 0 -10px 30px rgba(0,0,0,0.08);
        padding-bottom: env(safe-area-inset-bottom, 20px);
    }

    .brand, .sidebar-footer { display: none; }

    .sidebar-nav {
        flex-direction: row;
        justify-content: space-around;
        padding: 10px 5px;
        width: 100%;
        gap: 0;
    }

    .nav-item {
        flex-direction: column;
        flex: 1;
        padding: 8px 0;
        font-size: 10px;
        color: #999;
        gap: 4px;
        border-radius: 12px;
    }

    .nav-item i { font-size: 20px; }
    .nav-item span { font-weight: 600; }
    .nav-item.active { background: transparent; color: var(--primary); }

    .main-content { margin-left: 0; }
    .top-header { padding: 15px; border-bottom: 1px solid var(--border); }
    .top-header h1 { font-size: 20px; }

    .stats-grid { grid-template-columns: 1fr; gap: 15px; }
    .stat-card { padding: 20px; border-radius: 20px; }

    /* Transformación de Tabla a CARDS DE BOUTIQUE */
    .table-responsive { border: none; overflow: visible; }
    .data-table { display: block; }
    .data-table thead { display: none; }
    .data-table tbody { display: block; }
    
    .data-table tr {
        display: grid;
        grid-template-columns: 1fr 1fr;
        background: white;
        border-radius: 24px;
        margin-bottom: 20px;
        padding: 20px;
        box-shadow: 0 8px 25px rgba(0,0,0,0.04);
        border: 1px solid rgba(0,0,0,0.03);
        gap: 15px;
    }

    .data-table td {
        display: flex;
        flex-direction: column;
        padding: 0 !important;
        border: none !important;
        align-items: flex-start;
        text-align: left !important;
    }

    /* Título de la Prenda (Ocupa todo el ancho) */
    .data-table td[data-label="Prenda"] {
        grid-column: span 2;
        font-size: 18px;
        font-weight: 700;
        color: var(--text-main);
        padding-bottom: 10px !important;
        border-bottom: 1px solid var(--border) !important;
        margin-bottom: 5px;
    }

    /* Tarjetas de Inventario (Nativas) */
    .mobile-only-cards { display: block; }
    .desktop-only-table { display: none; }

    .inventory-card-mobile {
        background: white;
        border-radius: 24px;
        padding: 20px;
        margin-bottom: 20px;
        box-shadow: 0 10px 30px rgba(0,0,0,0.06);
        border: 1px solid rgba(0,0,0,0.03);
    }

    .inventory-card-mobile .card-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 15px;
        padding-bottom: 12px;
        border-bottom: 1px solid #f0f0f0;
    }

    .inventory-card-mobile .card-header h3 {
        font-size: 18px;
        font-weight: 700;
        color: var(--text-main);
    }

    .card-body-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 15px;
        margin-bottom: 20px;
    }

    .card-body-grid .item {
        display: flex;
        flex-direction: column;
        gap: 4px;
    }

    .card-body-grid .label {
        font-size: 9px;
        font-weight: 700;
        color: #bbb;
        text-transform: uppercase;
        letter-spacing: 1px;
    }

    .card-body-grid .value {
        font-size: 15px;
        font-weight: 600;
        color: var(--text-main);
    }

    .card-actions-mobile {
        display: flex;
        flex-direction: column;
        gap: 12px;
    }

    .btn-sell-mobile {
        width: 100%;
        height: 50px;
        background: var(--primary);
        color: #4a3434;
        border: none;
        border-radius: 14px;
        font-weight: 700;
        font-size: 15px;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 10px;
    }

    .secondary-actions {
        display: flex;
        justify-content: space-between;
        gap: 10px;
    }

    .btn-mini {
        flex: 1;
        height: 45px;
        background: #f8f9fa;
        border: none;
        border-radius: 12px;
        color: var(--text-main);
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 18px;
    }

    .btn-mini.btn-delete {
        color: var(--danger);
        background: #fff5f5;
    }

    /* Etiquetas Modernas (Fallback) */
    .data-table td:before {
        content: attr(data-label);
        font-size: 10px;
        text-transform: uppercase;
        letter-spacing: 1px;
        color: #bbb;
        margin-bottom: 4px;
        font-weight: 600;
    }

    .data-table td[data-label="Prenda"]:before,
    .data-table td[data-label="Acciones"]:before { display: none; }

    /* Botones de Acción en Fila */
    .data-table td[data-label="Acciones"] {
        grid-column: span 2;
        flex-direction: row;
        justify-content: space-between;
        margin-top: 10px;
        padding-top: 15px !important;
        border-top: 1px dashed var(--border) !important;
    }

    .data-table td[data-label="Acciones"] .actions,
    .data-table td[data-label="Acciones"] div {
        display: flex;
        gap: 10px;
        width: 100%;
        justify-content: space-around;
    }

    /* Modales en Móvil */
    .modal-content {
        width: 95% !important;
        margin: 10px auto;
        border-radius: 30px;
        max-height: 90vh;
    }

    .view-header { flex-direction: column; gap: 15px; }
    .search-box { width: 100%; }

    /* Visibilidad en Móvil */
    .mobile-only-cards { display: block !important; }
    .desktop-only-table { display: none !important; }
}

/* Visibilidad por defecto (Escritorio) */
.mobile-only-cards { display: none; }
.desktop-only-table { display: block; }

/* --- Micro-animaciones Premium --- */
button:active {
    transform: scale(0.96) !important;
    transition: transform 0.1s ease !important;
}
.nav-item:active {
    transform: scale(0.92) !important;
}

.inventory-card-mobile, .layaway-card, .data-table tr {
    animation: slideUpFade 0.4s ease-out backwards;
}

@keyframes slideUpFade {
    0% { opacity: 0; transform: translateY(15px); }
    100% { opacity: 1; transform: translateY(0); }
}

.layaway-card:nth-child(1), .data-table tr:nth-child(1), .inventory-card-mobile:nth-child(1) { animation-delay: 0.05s; }
.layaway-card:nth-child(2), .data-table tr:nth-child(2), .inventory-card-mobile:nth-child(2) { animation-delay: 0.10s; }
.layaway-card:nth-child(3), .data-table tr:nth-child(3), .inventory-card-mobile:nth-child(3) { animation-delay: 0.15s; }
.layaway-card:nth-child(4), .data-table tr:nth-child(4), .inventory-card-mobile:nth-child(4) { animation-delay: 0.20s; }
.layaway-card:nth-child(5), .data-table tr:nth-child(5), .inventory-card-mobile:nth-child(5) { animation-delay: 0.25s; }