:root {
    --pantone-485: #DA291C;
    --pantone-485-hover: #b82216;
    --cool-gray-8: #888B8D;
    --cool-gray-light: #F8F9FA;
    --cool-gray-border: #E2E8F0;
    --cool-gray-dark: #1E293B;
    --white: #FFFFFF;
    --success: #10B981;
    --warning: #F59E0B;
    --danger: #EF4444;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.05), 0 1px 2px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.1);
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body {
    background-color: var(--white);
    color: var(--cool-gray-dark);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 0;
}

#app {
    width: 100%;
    height: 100vh;
    max-width: 100%;
    max-height: 100vh;
    background-color: var(--white);
    box-shadow: none;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    border-radius: 0;
    border: none;
}

.hidden { display: none !important; }
.screen { flex: 1; display: flex; flex-direction: column; overflow: hidden; position: relative; background: var(--cool-gray-light); }

/* ==========================================
    ALERTAS INLINE DENTRO DE LA PÁGINA
    ========================================== */
.app-alert {
    padding: 10px 14px;
    border-radius: 0px;
    font-size: 12px;
    font-weight: 500;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    animation: fadeIn 0.2s ease-out;
}

.app-alert.success {
    background-color: #D1FAE5;
    color: #065F46;
    border: 1px solid #A3E635;
}

.app-alert.error {
    background-color: #FEE2E2;
    color: #991B1B;
    border: 1px solid #FCA5A5;
}

.app-alert.warning {
    background-color: #FEF3C7;
    color: #92400E;
    border: 1px solid #FCD34D;
}

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

/* ==========================================
    1. LANDING & LOGIN PAGE
    ========================================== */
#login-screen {
    background: linear-gradient(145deg, #1E293B 0%, #0F172A 100%);
    color: var(--white);
    padding: 24px;
    overflow-y: auto;
    justify-content: space-between;
}

.landing-hero {
    text-align: center;
    padding: 20px 0;
}

.brand-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(218, 41, 28, 0.15);
    color: var(--pantone-485);
    border: 1px solid rgba(218, 41, 28, 0.3);
    padding: 6px 14px;
    border-radius: 30px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    margin-bottom: 16px;
}

.landing-hero h1 {
    font-size: 28px;
    font-weight: 800;
    margin-bottom: 10px;
    letter-spacing: -0.5px;
    color: var(--white);
}

.landing-hero h1 span {
    color: var(--pantone-485);
}

.landing-hero p {
    color: #94A3B8;
    font-size: 14px;
    line-height: 1.5;
    max-width: 360px;
    margin: 0 auto 20px;
}

.login-card-box {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 22px;
    border-radius: 16px;
    box-shadow: var(--shadow-md);
    max-width: 440px;
    margin: 0 auto;
    width: 100%;
}

.login-card-box h3 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 15px;
    color: var(--white);
    display: flex;
    align-items: center;
    gap: 8px;
}

.login-card-box h3 svg {
    width: 16px;
    height: 16px;
    fill: var(--pantone-485);
}

.input-group {
    margin-bottom: 12px;
    text-align: left;
}

.input-group label {
    display: block;
    font-size: 11px;
    color: #94A3B8;
    margin-bottom: 4px;
    font-weight: 500;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-wrapper svg {
    position: absolute;
    left: 12px;
    width: 16px;
    height: 16px;
    fill: var(--cool-gray-8);
}

.input-wrapper input {
    width: 100%;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid #334155;
    padding: 10px 12px 10px 38px;
    border-radius: 8px;
    color: var(--white);
    font-size: 13px;
    outline: none;
    transition: var(--transition);
}

.input-wrapper input:focus {
    border-color: var(--pantone-485);
    box-shadow: 0 0 0 2px rgba(218, 41, 28, 0.2);
}

.btn-brand {
    width: 100%;
    background-color: var(--pantone-485);
    color: var(--white);
    border: none;
    padding: 12px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 15px;
}

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

/* ==========================================
    APP SHELL & HEADER COMÚN
    ========================================== */
.app-header {
    background-color: var(--white);
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--cool-gray-border);
    z-index: 10;
}

.header-title-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
}

.app-header h2 {
    font-size: 16px;
    color: var(--cool-gray-dark);
    font-weight: 700;
}

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

.icon-btn {
    background: var(--cool-gray-light);
    border: 1px solid var(--cool-gray-border);
    width: 34px;
    height: 34px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    color: var(--cool-gray-dark);
}

.icon-btn svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

.icon-btn:hover {
    background: #EDF2F7;
    border-color: var(--cool-gray-8);
}

.icon-btn.logout:hover {
    background: #FEE2E2;
    color: var(--pantone-485);
    border-color: rgba(218, 41, 28, 0.3);
}

/* ==========================================
    NAVEGACIÓN INFERIOR
    ========================================== */
.nav-bar {
    background-color: var(--white);
    display: flex;
    justify-content: space-around;
    padding: 8px 0;
    border-top: 1px solid var(--cool-gray-border);
    z-index: 10;
}

.nav-item {
    background: none;
    border: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 10px;
    color: var(--cool-gray-8);
    cursor: pointer;
    transition: var(--transition);
    padding: 4px 12px;
    font-weight: 500;
    position: relative;
}

.nav-item.active {
    color: var(--pantone-485);
    font-weight: 700;
}

.nav-item svg {
    width: 20px;
    height: 20px;
    margin-bottom: 2px;
    fill: currentColor;
}

.nav-badge {
    position: absolute;
    top: 2px;
    right: 14px;
    background: var(--pantone-485);
    color: var(--white);
    font-size: 9px;
    font-weight: 700;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ==========================================
    2. PRODUCTOS / CATÁLOGO
    ========================================== */
.content-body {
    padding: 16px;
    flex: 1;
    overflow-y: auto;
}

.filter-client-box {
    margin-bottom: 10px;
}

.filter-client-box label {
    display: block;
    font-size: 11px;
    color: var(--cool-gray-8);
    font-weight: 600;
    margin-bottom: 4px;
}

.filter-client-box select {
    width: 100%;
    background: var(--white);
    border: 1px solid var(--cool-gray-border);
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 13px;
    color: var(--cool-gray-dark);
    outline: none;
    box-shadow: var(--shadow-sm);
}

.search-filter-box {
    position: relative;
    margin-bottom: 14px;
}

.search-filter-box svg {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    fill: var(--cool-gray-8);
}

.search-filter-box input {
    width: 100%;
    background: var(--white);
    border: 1px solid var(--cool-gray-border);
    padding: 10px 12px 10px 38px;
    border-radius: 8px;
    font-size: 13px;
    outline: none;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.search-filter-box input:focus {
    border-color: var(--pantone-485);
    box-shadow: 0 0 0 2px rgba(218, 41, 28, 0.15);
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

@media (min-width: 768px) {
    .product-grid { grid-template-columns: repeat(3, 1fr); gap: 16px; }
}

@media (min-width: 1024px) {
    .product-grid { grid-template-columns: repeat(4, 1fr); }
}

.product-card {
    background: var(--white);
    border: 1px solid var(--cool-gray-border);
    border-radius: 12px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    cursor: pointer;
}

.product-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: #cbd5e1;
}

.product-top-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.sku-tag {
    font-size: 9px;
    background: #F1F5F9;
    color: var(--cool-gray-8);
    padding: 3px 6px;
    border-radius: 4px;
    font-weight: 600;
}

.stock-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    font-weight: 600;
}

.stock-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.stock-high { color: var(--success); }
.stock-high .stock-dot { background: var(--success); }

.stock-medium { color: var(--warning); }
.stock-medium .stock-dot { background: var(--warning); }

.stock-low { color: var(--danger); }
.stock-low .stock-dot { background: var(--danger); }

.product-img-placeholder {
    background: #F8FAFC;
    border: 1px dashed var(--cool-gray-border);
    height: 85px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--cool-gray-8);
    margin-bottom: 10px;
    overflow: hidden;
}

.product-img-placeholder img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.product-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--cool-gray-dark);
    margin-bottom: 4px;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    height: 32px;
}

.product-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #F1F5F9;
}

.product-price {
    font-size: 14px;
    color: var(--pantone-485);
    font-weight: 750;
}

.btn-add {
    background-color: var(--cool-gray-dark);
    color: var(--white);
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}

.btn-add svg { width: 14px; height: 14px; fill: currentColor; }
.btn-add:hover { background-color: var(--pantone-485); transform: scale(1.05); }

/* ==========================================
    3. CARRITO B2B
    ========================================== */
.cart-wrapper {
    display: flex;
    flex-direction: column;
    height: 100%;
    max-width: 900px;
    margin: 0 auto;
    width: 100%;
}

.cart-items-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.cart-item-card {
    background: var(--white);
    border: 1px solid var(--cool-gray-border);
    padding: 10px 12px;
    border-radius: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-sm);
}

.cart-item-info h4 { font-size: 12px; font-weight: 600; color: var(--cool-gray-dark); margin-bottom: 2px; }
.cart-item-info p { font-size: 11px; color: var(--pantone-485); font-weight: 600; }

.cart-qty-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #F8FAFC;
    border: 1px solid var(--cool-gray-border);
    padding: 2px 6px;
    border-radius: 6px;
}

.qty-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 700;
    color: var(--cool-gray-dark);
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.qty-btn:hover { color: var(--pantone-485); }

.cart-summary-box {
    background: var(--white);
    border-top: 1px solid var(--cool-gray-border);
    padding: 16px;
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -4px 10px rgba(0,0,0,0.02);
}

.summary-row {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: #64748B;
    margin-bottom: 6px;
}

.summary-row.total {
    font-size: 16px;
    font-weight: 800;
    color: var(--cool-gray-dark);
    border-top: 1px solid var(--cool-gray-border);
    padding-top: 8px;
    margin-top: 6px;
}

.summary-row.total span:last-child {
    color: var(--pantone-485);
}

/* ==========================================
    4. HISTORIAL DE PEDIDOS
    ========================================== */
.order-card {
    background: var(--white);
    border: 1px solid var(--cool-gray-border);
    border-left: 4px solid var(--success);
    padding: 14px;
    border-radius: 10px;
    margin-bottom: 10px;
    box-shadow: var(--shadow-sm);
}

.order-card-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.order-id {
    font-size: 12px;
    font-weight: 700;
    color: var(--cool-gray-dark);
    display: flex;
    align-items: center;
    gap: 6px;
}

.order-price {
    font-size: 14px;
    font-weight: 800;
    color: var(--pantone-485);
}

.order-details-meta {
    font-size: 11px;
    color: var(--cool-gray-8);
    display: flex;
    justify-content: space-between;
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--cool-gray-8);
}

.empty-state svg {
    width: 40px;
    height: 40px;
    fill: #CBD5E1;
    margin-bottom: 10px;
}

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

/* ==========================================
    MODALES GENERALES
    ========================================== */
.modal-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    padding: 20px;
}

.modal-card {
    background: var(--white);
    width: 100%;
    max-width: 400px;
    border-radius: 16px;
    padding: 20px;
    box-shadow: var(--shadow-lg);
    animation: modalPop 0.25s ease-out;
}

@keyframes modalPop {
    0% { transform: scale(0.95); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
    border-bottom: 1px solid var(--cool-gray-border);
    padding-bottom: 10px;
}

.modal-header h3 { font-size: 14px; font-weight: 700; color: var(--cool-gray-dark); }

.close-modal {
    background: none; border: none; font-size: 18px; cursor: pointer; color: var(--cool-gray-8);
}

.modal-body-content {
    max-height: 250px;
    overflow-y: auto;
    margin-bottom: 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.modal-item-row {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    padding: 6px 0;
    border-bottom: 1px dashed #F1F5F9;
}

.product-modal-img {
    width: 100%;
    height: 160px;
    background: #F1F5F9;
    border-radius: 8px;
    margin-bottom: 12px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.product-modal-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
