:root {
    --primary: #ED70AB; /* New Pink Base */
    --primary-hover: #CF3B89; /* CTA Pink */
    --secondary: #CF3B89; /* CTA Pink */
    --bg-color: #F3F4F6; /* Gray 100 */
    --surface: #FFFFFF;
    --text-main: #111827; /* Gray 900 */
    --text-muted: #6B7280; /* Gray 500 */
    --border: #E5E7EB; /* Gray 200 */
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.5);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --transition: all 0.3s ease;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.5;
    background-image: radial-gradient(circle at 10% 20%, rgba(79, 70, 229, 0.05) 0%, transparent 20%),
                      radial-gradient(circle at 90% 80%, rgba(16, 185, 129, 0.05) 0%, transparent 20%);
    min-height: 100vh;
}

/* Utilities */
.hidden { display: none !important; }
.active { display: block; }
.max-w-md { max-width: 28rem; }
.max-w-lg { max-width: 32rem; }
.mt-4 { margin-top: 1.5rem; }
.mb-4 { margin-bottom: 1.5rem; }
.right { text-align: right; }
.center { text-align: center; }
.loading-spinner { display: flex; align-items: center; gap: 0.5rem; color: var(--text-muted); }
.spin { animation: spin 1s linear infinite; }
@keyframes spin { 100% { transform: rotate(360deg); } }

/* Forms */
.form-group { margin-bottom: 1.25rem; }
label { display: block; margin-bottom: 0.5rem; font-weight: 500; font-size: 0.875rem; }
input, select, textarea {
    width: 100%;
    padding: 0.625rem 0.875rem;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    font-family: 'Inter', sans-serif;
    font-size: 0.875rem;
    transition: var(--transition);
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}
textarea {
    resize: vertical;
    min-height: 80px;
}
.glass-input {
    background: rgba(255, 255, 255, 0.9);
}

/* Hide Spinners/Arrows on Order ID Input ONLY */
#input-pedido-id::-webkit-outer-spin-button,
#input-pedido-id::-webkit-inner-spin-button {
    -webkit-appearance: none;
    appearance: none;
    margin: 0;
}
#input-pedido-id {
    -moz-appearance: textfield;
    appearance: textfield;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    border-radius: 0.5rem;
    font-weight: 500;
    font-size: 0.875rem;
    cursor: pointer;
    border: none;
    transition: var(--transition);
}
.btn-primary { background-color: var(--primary); color: white; }
.btn-primary:hover { background-color: var(--primary-hover); transform: translateY(-1px); }
.btn-block { width: 100%; }
.btn-ghost { background: transparent; color: var(--text-muted); padding: 0.5rem; }
.btn-ghost:hover { background: var(--bg-color); color: var(--text-main); }

/* Login View */
#login-view {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 1rem;
}
.login-glass {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    padding: 2.5rem;
    border-radius: 1rem;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    width: 100%;
    max-width: 400px;
}
.logo-branding { text-align: center; margin-bottom: 1.5rem; }
.login-logo { width: 180px; height: auto; object-fit: contain; }
.login-header { text-align: center; margin-bottom: 2rem; }
.login-header .logo { 
    display: inline-flex; justify-content: center; align-items: center;
    width: 3rem; height: 3rem; border-radius: 0.75rem;
    background: var(--primary); color: white; margin-bottom: 1rem;
}
.login-header h1 { font-size: 1.5rem; font-weight: 700; margin-bottom: 0.25rem;}
.login-header p { color: var(--text-muted); font-size: 0.875rem; }
.input-icon { position: relative; }
.input-icon i { position: absolute; left: 0.875rem; top: 50%; transform: translateY(-50%); color: var(--text-muted); width: 1.25rem; height: 1.25rem;}
.input-icon input { padding-left: 2.75rem; }
.link-text { color: var(--primary); text-decoration: none; font-size: 0.875rem; font-weight: 500;}
.link-text:hover { text-decoration: underline; }

/* Dashboard layout */
#dashboard-view { display: flex; flex-direction: column; min-height: 100vh; }
.sidebar {
    width: 100%;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    border-right: none;
    display: flex;
    flex-direction: column;
}
@media (min-width: 768px) {
    #dashboard-view { flex-direction: row; }
    .sidebar { width: 260px; height: 100vh; position: sticky; top: 0; border-right: 1px solid var(--border); border-bottom: none; }
}

.sidebar-header {
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-bottom: 1px solid var(--border);
}
.sidebar-header img.logo-img { height: 80px; width: auto; max-width: 240px; object-fit: contain; }
.sidebar-header h2 { font-size: 1.25rem; font-weight: 700; display: none; } /* Hide text if logo is present */
.highlight { color: var(--primary); }
.user-profile { padding: 1.5rem; display: flex; align-items: center; gap: 1rem; border-bottom: 1px solid var(--border); }
.avatar { width: 40px; height: 40px; background: var(--primary); color: white; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.user-info { display: flex; flex-direction: column; }
.user-info .name { font-weight: 600; font-size: 0.875rem; }
.user-info .role { font-size: 0.75rem; color: var(--text-muted); }
.sidebar-nav { flex: 1; padding: 1.5rem 0; }
.nav-item {
    display: flex; align-items: center; gap: 0.75rem;
    padding: 0.75rem 1.5rem; color: var(--text-muted); text-decoration: none;
    font-weight: 500; transition: var(--transition); border-left: 3px solid transparent;
}
.nav-item:hover { background: var(--bg-color); color: var(--text-main); }
.nav-item.active { background: rgba(79, 70, 229, 0.05); color: var(--primary); border-left-color: var(--primary); }
.sidebar-footer { padding: 1.5rem; border-top: 1px solid var(--border); }

.content-area { flex: 1; padding: 2.5rem; overflow-y: auto; }
.section-header { margin-bottom: 2rem; }
.section-header h2 { font-size: 1.875rem; font-weight: 700; letter-spacing: -0.025em; }
.section-header p { color: var(--text-muted); }

/* Cards & Grid */
.card { background: var(--surface); border-radius: 1rem; padding: 1.5rem; box-shadow: var(--shadow); border: 1px solid var(--border); overflow: hidden; }
.glass-card { background: var(--glass-bg); backdrop-filter: blur(10px); }
.highlight-card { background: rgba(16, 185, 129, 0.05); border-color: rgba(16, 185, 129, 0.2); }
.highlight-card h3 { color: var(--secondary); display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.5rem; }

.category-section { margin-top: 1.5rem; }
.category-title { display: flex; align-items: center; gap: 0.75rem; font-size: 1.125rem; font-weight: 600; margin-bottom: 1rem; color: var(--text-main); border-bottom: 2px solid var(--border); padding-bottom: 0.5rem; }
.category-icon { width: 32px; height: 32px; object-fit: contain; }

.packs-grid, .equipos-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1rem; }
.pack-item {
    border: 1px solid var(--border); border-radius: 0.75rem; padding: 1rem;
    display: flex; flex-direction: column; justify-content: space-between; background: white;
}
.pack-name { font-weight: 600; margin-bottom: 0.5rem; }
.pack-price { color: var(--primary); font-weight: 700; }
.pack-qty { margin-top: 1rem; display: flex; align-items: center; gap: 0.5rem; }
.pack-qty input { width: 4rem; text-align: center; }

.cajas-list { list-style: none; padding: 0; }
.cajas-list li {
    padding: 0.75rem; background: white; border-radius: 0.5rem; border: 1px solid var(--border);
    margin-bottom: 0.5rem; display: flex; justify-content: space-between; align-items: center;
}
.caja-badge { color: var(--secondary); font-weight: 700; font-size: 0.875rem; }
.qty-highlight { color: var(--secondary); font-weight: 700; padding: 0 0.5rem; }

/* Tables */
.table-container { overflow-x: auto; background: white; border: 1px solid var(--border); border-radius: 0.75rem; }
.bom-table { width: 100%; border-collapse: collapse; text-align: left; }
.bom-table th, .bom-table td { padding: 1rem; border-bottom: 1px solid var(--border); font-size: 0.875rem; }
.bom-table th { background-color: var(--bg-color); font-weight: 600; color: var(--text-muted); text-transform: uppercase; font-size: 0.75rem; }
.bom-table tr:last-child td { border-bottom: none; }
.bom-badge-tipo { display: inline-block; padding: 0.25rem 0.5rem; border-radius: 4px; font-size: 0.75rem; background: var(--bg-color); color: var(--text-main); font-weight: 600; }

/* Toast */
#toast-container { position: fixed; top: 1rem; right: 1rem; z-index: 50; display: flex; flex-direction: column; gap: 0.5rem; }
.toast {
    background: var(--surface); border-left: 4px solid var(--primary);
    padding: 1rem; border-radius: 0.5rem; box-shadow: var(--shadow);
    display: flex; align-items: center; gap: 0.75rem; color: var(--text-main); font-weight: 500; font-size: 0.875rem;
    transform: translateX(120%); transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.toast.show { transform: translateX(0); }
.toast.error { border-left-color: #EF4444; }
.toast.success { border-left-color: var(--secondary); }

/* Modal Confirmación */
.modal {
    position: fixed; inset: 0; background: rgba(0,0,0,0.5); backdrop-filter: blur(4px);
    display: flex; align-items: center; justify-content: center; z-index: 100; padding: 1rem;
    opacity: 0; pointer-events: none; transition: opacity 0.3s ease;
}
.modal.active { opacity: 1; pointer-events: auto; }
.modal-content {
    background: var(--surface); width: 100%; border-radius: 1rem; padding: 1.5rem;
    transform: translateY(-20px); transition: transform 0.3s ease; max-height: 90vh; overflow-y: auto;
}
.modal.active .modal-content { transform: translateY(0); }
.modal-content h3 { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 1rem; }

/* Order List Styles */
.cursor-pointer {
    cursor: pointer;
}

.order-row:hover {
    background: rgba(237, 112, 171, 0.05) !important;
}

@media (max-width: 600px) {
    .responsive-table thead {
        display: none;
    }
    .responsive-table tbody tr {
        display: block;
        margin-bottom: 1rem;
        background: var(--surface);
        border: 1px solid var(--border);
        border-radius: 12px;
        padding: 0.5rem;
        box-shadow: 0 2px 4px rgba(0,0,0,0.02);
    }
    .responsive-table td {
        display: flex;
        justify-content: space-between;
        padding: 0.5rem 0.75rem;
        border: none;
    }
    .responsive-table td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--text-muted);
        font-size: 0.75rem;
        text-transform: uppercase;
    }
}
