/* ==========================================================================
   FRUITORDER - Estilos Core Premium (Glassmorphism & Organic Theme)
   FRUITORDER · Demo independiente
   ========================================================================== */

:root {
    /* Paleta de Colores Exclusiva */
    --bg-base: #060b0b;
    --bg-sidebar: rgba(10, 20, 20, 0.75);
    --bg-surface: rgba(16, 28, 28, 0.55);
    --bg-surface-hover: rgba(22, 38, 38, 0.75);
    --border-glass: rgba(16, 185, 129, 0.12);
    --border-glass-strong: rgba(16, 185, 129, 0.25);
    
    --primary: #10b981;          /* Esmeralda Orgánico - Ventas */
    --primary-glow: rgba(16, 185, 129, 0.25);
    --primary-hover: #059669;
    
    --secondary: #f97316;        /* Mandarina Dulce - Compras */
    --secondary-glow: rgba(249, 115, 22, 0.2);
    --secondary-hover: #ea580c;
    
    --accent: #6366f1;           /* Indigo Vibrante - Acciones generales */
    --accent-glow: rgba(99, 102, 241, 0.2);
    
    --success: #34d399;
    --warning: #fbbf24;
    --danger: #ef4444;
    --danger-glow: rgba(239, 68, 68, 0.2);
    
    --text-main: #f3f4f6;
    --text-muted: #9ca3af;
    --text-dark: #1f2937;
    
    --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --sidebar-width: 260px;
}

/* Reset y Estilos Generales */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Plus Jakarta Sans', 'Outfit', sans-serif;
    background-color: var(--bg-base);
    background-image: 
        radial-gradient(circle at 5% 10%, rgba(16, 185, 129, 0.06) 0%, transparent 40%),
        radial-gradient(circle at 95% 85%, rgba(249, 115, 22, 0.04) 0%, transparent 40%),
        radial-gradient(circle at 50% 50%, rgba(99, 102, 241, 0.02) 0%, transparent 50%);
    background-attachment: fixed;
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    overflow-x: hidden;
}

/* Scrollbar Personalizada */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: rgba(10, 15, 15, 0.5);
}
::-webkit-scrollbar-thumb {
    background: rgba(16, 185, 129, 0.2);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(16, 185, 129, 0.4);
}

/* ==========================================================================
   Estructura SPA (Sidebar y Main Content)
   ========================================================================== */

/* Barra de Navegación Lateral (Sidebar) */
aside.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    background: var(--bg-sidebar);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-right: 1px solid var(--border-glass);
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    z-index: 100;
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.5);
    transition: var(--transition-normal);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    margin-bottom: 30px;
    text-decoration: none;
}

.logo-circle {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.3rem;
    box-shadow: 0 0 15px var(--primary-glow);
    animation: gentle-spin 8s infinite linear;
}

.logo-text {
    font-family: 'Outfit', sans-serif;
    font-size: 1.4rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    background: linear-gradient(to right, #ffffff, #a7f3d0);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.sidebar-menu {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.menu-item a {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 600;
    border-radius: 12px;
    transition: all 0.3s ease;
    border: 1px solid transparent;
}

.menu-item a:hover {
    color: white;
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.05);
    transform: translateX(4px);
}

.menu-item.active a {
    color: white;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.15), rgba(16, 185, 129, 0.03));
    border-color: rgba(16, 185, 129, 0.25);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    position: relative;
}

.menu-item.active a::after {
    content: '';
    position: absolute;
    left: 0;
    top: 25%;
    height: 50%;
    width: 4px;
    background: var(--primary);
    border-radius: 0 4px 4px 0;
    box-shadow: 0 0 10px var(--primary);
}

.sidebar-footer {
    margin-top: auto;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding-top: 20px;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px;
    margin-bottom: 12px;
}

.user-avatar {
    width: 36px;
    height: 36px;
    background: rgba(255,255,255,0.06);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.user-info {
    font-size: 0.85rem;
}

.user-name {
    font-weight: 700;
    color: white;
}

.user-role {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.btn-logout {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 12px;
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.15);
    border-radius: 12px;
    color: #fca5a5;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 700;
    transition: all 0.3s;
}

.btn-logout:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.4);
    color: white;
    transform: translateY(-1px);
}

/* Área de Contenido Principal */
main.main-content {
    margin-left: var(--sidebar-width);
    flex-grow: 1;
    min-height: 100vh;
    padding: 40px;
    transition: var(--transition-normal);
}

/* Cabecera de Página */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 35px;
    animation: slideDown 0.5s ease-out;
}

.page-title-group h1 {
    font-family: 'Outfit', sans-serif;
    font-size: 2.2rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: white;
}

.page-title-group p {
    font-size: 0.95rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Contenedores de Secciones (SPA Router) */
.app-section {
    display: none;
    animation: fadeIn 0.5s ease-out;
}

.app-section.active {
    display: block;
}

/* ==========================================================================
   Elementos UI Premium (Tarjetas y Botones)
   ========================================================================== */

/* Tarjetas (Cards) */
.glass-card {
    background: var(--bg-surface);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-glass);
    border-radius: 20px;
    padding: 24px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3), inset 0 0 1px rgba(255, 255, 255, 0.05);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.glass-card:hover {
    border-color: var(--border-glass-strong);
    background: var(--bg-surface-hover);
    transform: translateY(-2px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.4);
}

.glass-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 20px;
    background: linear-gradient(135deg, rgba(255,255,255,0.03), transparent 50%);
    pointer-events: none;
}

/* Botones Premium */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 12px;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid transparent;
    text-decoration: none;
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    color: white;
    box-shadow: 0 4px 15px var(--primary-glow);
}
.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 22px rgba(16, 185, 129, 0.45);
    background: linear-gradient(135deg, #12d393, var(--primary-hover));
}

.btn-secondary {
    background: linear-gradient(135deg, var(--secondary), var(--secondary-hover));
    color: white;
    box-shadow: 0 4px 15px var(--secondary-glow);
}
.btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 22px rgba(249, 115, 22, 0.4);
    background: linear-gradient(135deg, #fa8a3c, var(--secondary-hover));
}

.btn-accent {
    background: linear-gradient(135deg, var(--accent), #4f46e5);
    color: white;
    box-shadow: 0 4px 15px var(--accent-glow);
}
.btn-accent:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 22px rgba(99, 102, 241, 0.4);
    background: linear-gradient(135deg, #7c3aed, #4f46e5);
}

.btn-outline {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-main);
}
.btn-outline:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
    color: white;
}

.btn-danger {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: #fca5a5;
}
.btn-danger:hover {
    background: var(--danger);
    color: white;
    box-shadow: 0 4px 15px var(--danger-glow);
    transform: translateY(-1px);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
    border-radius: 8px;
}

.btn-icon-only {
    padding: 10px;
    border-radius: 12px;
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ==========================================================================
   Vistas Específicas
   ========================================================================== */

/* 1. Dashboard */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 24px;
    margin-bottom: 35px;
}

.metric-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.metric-content h3 {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.metric-value {
    font-family: 'Outfit', sans-serif;
    font-size: 2.2rem;
    font-weight: 800;
    color: white;
    margin-top: 6px;
    line-height: 1.1;
}

.metric-unit {
    font-size: 1rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-left: 4px;
}

.metric-icon {
    width: 52px;
    height: 52px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.metric-icon.sales {
    background: rgba(16, 185, 129, 0.1);
    color: var(--primary);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.metric-icon.purchases {
    background: rgba(249, 115, 22, 0.1);
    color: var(--secondary);
    border: 1px solid rgba(249, 115, 22, 0.2);
}

.metric-icon.clients {
    background: rgba(99, 102, 241, 0.1);
    color: var(--accent);
    border: 1px solid rgba(99, 102, 241, 0.2);
}

/* Paneles de actividad y layout */
.dashboard-layout {
    display: grid;
    grid-template-columns: 1.6fr 1fr;
    gap: 24px;
}

.alert-panel-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.alert-panel-title i {
    color: var(--warning);
    animation: flash 1.5s infinite alternate;
}

.alert-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 380px;
    overflow-y: auto;
    padding-right: 4px;
}

.stock-alert-item {
    background: rgba(239, 68, 68, 0.05);
    border: 1px solid rgba(239, 68, 68, 0.15);
    border-radius: 14px;
    padding: 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s;
}

.stock-alert-item:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
}

.alert-prod-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.alert-emoji {
    font-size: 1.5rem;
}

.alert-name {
    font-weight: 700;
    font-size: 0.95rem;
}

.alert-stock-status {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.alert-danger-text {
    color: #fca5a5;
    font-weight: 700;
}

/* 2. Formularios e Inputs */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-field label {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-muted);
}

.form-select, .form-input-text {
    width: 100%;
    background: rgba(10, 15, 15, 0.7);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 10px;
    padding: 10px 14px;
    color: white;
    font-family: inherit;
    font-size: 0.9rem;
    transition: all 0.3s;
}

.form-select:focus, .form-input-text:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
    background: rgba(10, 15, 15, 0.9);
}

/* 3. Tablas Dinámicas */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.custom-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.9rem;
}

.custom-table th {
    background: rgba(16, 28, 28, 0.9);
    padding: 14px 18px;
    font-weight: 700;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.custom-table td {
    padding: 14px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    color: var(--text-main);
    vertical-align: middle;
}

.custom-table tbody tr {
    transition: all 0.2s;
}

.custom-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

.custom-table tbody tr:last-child td {
    border-bottom: none;
}

/* Emojis en Tablas */
.table-emoji {
    font-size: 1.3rem;
    margin-right: 8px;
    vertical-align: middle;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
}

.badge-client {
    background: rgba(16, 185, 129, 0.15);
    color: var(--primary);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.badge-provider {
    background: rgba(249, 115, 22, 0.15);
    color: var(--secondary);
    border: 1px solid rgba(249, 115, 22, 0.2);
}

.badge-units {
    background: rgba(99, 102, 241, 0.15);
    color: var(--accent);
    border: 1px solid rgba(99, 102, 241, 0.2);
}

.badge-kilos {
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.2);
}

.badge-cajas {
    background: rgba(249, 115, 22, 0.15);
    color: #fb923c;
    border: 1px solid rgba(249, 115, 22, 0.22);
}

.badge-manojos {
    background: rgba(16, 185, 129, 0.15);
    color: var(--primary);
    border: 1px solid rgba(16, 185, 129, 0.22);
}

.badge-bandejas {
    background: rgba(14, 165, 233, 0.15);
    color: #38bdf8;
    border: 1px solid rgba(14, 165, 233, 0.22);
}

.badge-bolsas {
    background: rgba(236, 72, 153, 0.15);
    color: #f472b6;
    border: 1px solid rgba(236, 72, 153, 0.22);
}

.badge-box {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.22);
}

.badge-new-product {
    display: inline-flex;
    align-items: center;
    margin-left: 8px;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(14, 165, 233, 0.16);
    border: 1px solid rgba(14, 165, 233, 0.28);
    color: #38bdf8;
    font-size: 0.68rem;
    font-weight: 800;
    line-height: 1.2;
    text-transform: uppercase;
    vertical-align: middle;
}

/* ==========================================================================
   Listas de Ordenación Personalizada & Drag & Drop
   ========================================================================== */

.list-manager-container {
    display: grid;
    grid-template-columns: 1fr 1.8fr;
    gap: 24px;
}

.entity-selector-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 520px;
    overflow-y: auto;
}

.entity-select-btn {
    width: 100%;
    padding: 14px 18px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 14px;
    color: var(--text-muted);
    text-align: left;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.entity-select-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: white;
    transform: translateX(3px);
}

.entity-select-btn.active {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), rgba(16, 185, 129, 0.02));
    border-color: rgba(16, 185, 129, 0.3);
    color: white;
    font-weight: 700;
}

/* Lista de Arrastre */
.sortable-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 15px;
    max-height: 480px;
    overflow-y: auto;
    padding-right: 4px;
}

.sortable-item {
    background: rgba(10, 15, 15, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: grab;
    transition: background 0.2s, border-color 0.2s;
    user-select: none;
}

.sortable-item:active {
    cursor: grabbing;
}

.sortable-item.ghost-class {
    opacity: 0.3;
    background: var(--primary-glow);
    border: 1px dashed var(--primary);
}

.sortable-item:hover {
    background: rgba(16, 28, 28, 0.8);
    border-color: rgba(16, 185, 129, 0.2);
}

.sort-item-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.drag-handle {
    color: var(--text-muted);
    cursor: grab;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
}

.sort-item-check {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary);
}

.sort-item-details {
    display: flex;
    flex-direction: column;
}

.sort-item-name {
    font-weight: 700;
    font-size: 0.95rem;
}

.sort-item-code {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ==========================================================================
   Toma de Pedidos (Formulario Logístico)
   ========================================================================== */

/* Floating Header Widgets */
#active-provider-badge {
    position: fixed;
    top: 20px;
    right: 100px;
    z-index: 999;
    background: var(--bg-surface);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-glass-strong);
    padding: 8px 16px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 700;
    color: white;
    display: none;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    transition: all 0.3s ease;
}

#active-provider-badge i {
    color: var(--secondary);
    transition: all 0.3s;
}

.active-dot {
    width: 8px;
    height: 8px;
    background: #10b981;
    border-radius: 50%;
    display: inline-block;
    box-shadow: 0 0 8px #10b981;
}

#theme-toggle-btn {
    position: fixed;
    top: 20px;
    right: 40px;
    z-index: 999;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    background: var(--bg-surface);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-color: var(--border-glass-strong);
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    transition: all 0.3s ease;
}

#theme-toggle-btn i.fa-moon {
    color: var(--primary);
}

@media (max-width: 768px) {
    #active-provider-badge {
        position: static;
        margin-bottom: 15px;
        width: 100%;
        justify-content: center;
        box-shadow: none;
    }
    #theme-toggle-btn {
        position: absolute;
        top: 15px;
        right: 15px;
    }
}

/* Toma de Pedido - Contenedor Unificado de Columna Única */
.order-taking-container {
    max-width: 1000px;
    margin: 0;
    width: 100%;
    padding: 30px;
}

.order-selector-header {
    display: flex;
    gap: 20px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.order-selector-header .form-field {
    flex: 1 1 300px;
}

.op-toggle-buttons {
    display: flex;
    gap: 10px;
    margin-top: 4px;
}

.op-toggle-buttons button {
    flex: 1;
}

.order-info-tip {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.4;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 16px;
    margin-bottom: 20px;
}

.order-search-panel {
    margin-bottom: 14px;
}

.order-search-input-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(10, 15, 15, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 14px;
    padding: 10px 12px;
}

.order-search-input-wrap > i {
    color: var(--primary);
    flex-shrink: 0;
}

.order-search-input-wrap .form-input-text {
    border: none;
    background: transparent;
    padding: 8px 4px;
    min-width: 0;
}

.order-search-input-wrap .form-input-text:focus {
    box-shadow: none;
}

.empty-search-state {
    border: 1px dashed rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 120px;
    text-align: center;
}

.order-action-panel {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    background: rgba(10, 15, 15, 0.45);
    border: 1px solid rgba(16, 185, 129, 0.12);
    border-radius: 14px;
    margin-bottom: 14px;
    padding: 14px;
}

.order-action-status {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    min-width: 0;
}

.recipient-control {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    flex-wrap: wrap;
}

.recipient-enabled-check {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text-main);
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
}

.recipient-enabled-check input {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
    cursor: pointer;
}

.recipient-name-input {
    width: 120px;
    max-width: 100%;
    border: 1px solid rgba(16, 185, 129, 0.28);
    border-radius: 9px;
    background: rgba(0, 0, 0, 0.18);
    color: var(--text-main);
    font: inherit;
    font-size: 0.9rem;
    font-weight: 800;
    line-height: 1.2;
    padding: 7px 9px;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.recipient-name-input:focus {
    border-color: var(--primary);
    background: rgba(16, 185, 129, 0.08);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.12);
}

.recipient-entity-suffix {
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 700;
    white-space: nowrap;
}

.order-line-counter {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 1px solid rgba(16, 185, 129, 0.28);
    border-radius: 10px;
    background: rgba(16, 185, 129, 0.12);
    color: var(--text-main);
    font-size: 0.9rem;
    font-weight: 800;
    padding: 8px 11px;
    white-space: nowrap;
}

.order-line-counter i {
    color: var(--primary);
}

.order-action-buttons {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.order-action-buttons .btn {
    min-height: 46px;
    white-space: nowrap;
}

.order-action-buttons #btn-save-order {
    padding-inline: 22px;
}

.order-items-scroll {
    max-height: 480px;
    overflow-y: auto;
    padding-right: 4px;
}

.order-item-row {
    background: rgba(10, 15, 15, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 14px;
    padding: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
    transition: all 0.2s;
    gap: 16px;
}

.order-item-row:hover {
    background: rgba(16, 28, 28, 0.8);
    border-color: rgba(16, 185, 129, 0.15);
}

.order-product-name-line {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.order-product-name {
    font-weight: 700;
}

.order-product-name-editor {
    display: grid;
    grid-template-columns: minmax(190px, 320px) 34px 34px;
    align-items: center;
    gap: 6px;
    max-width: min(430px, 58vw);
}

.order-product-name-input {
    min-height: 34px;
    padding: 7px 10px;
    font-size: 0.9rem;
    font-weight: 700;
}

.product-name-edit-btn,
.product-name-save-btn,
.product-name-cancel-btn {
    width: 30px;
    height: 30px;
    padding: 6px;
    border-radius: 9px;
}

.qty-control {
    display: flex;
    align-items: center;
    gap: 6px;
}

.format-quick-picker {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-right: 8px;
}

.format-icon-btn {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.025);
    color: var(--text-muted);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.78rem;
    transition: all 0.2s ease;
}

.format-icon-btn:hover {
    color: white;
    border-color: rgba(16, 185, 129, 0.35);
    background: rgba(16, 185, 129, 0.1);
}

.format-icon-btn.active {
    color: var(--primary);
    border-color: rgba(16, 185, 129, 0.45);
    background: rgba(16, 185, 129, 0.16);
    box-shadow: 0 0 0 1px rgba(16, 185, 129, 0.12);
}

.format-icon-btn:disabled {
    cursor: not-allowed;
    opacity: 0.35;
}

.qty-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255,255,255,0.03);
    color: white;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.qty-btn:hover {
    background: var(--primary);
    border-color: var(--primary);
    transform: scale(1.05);
}

.qty-btn:active {
    transform: scale(0.95);
}

.qty-input {
    width: 70px;
    text-align: center;
    background: rgba(10, 15, 15, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 6px;
    color: white;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 700;
}

.qty-input:focus {
    outline: none;
    border-color: var(--primary);
}

/* Quitar flechitas estándar */
.qty-input::-webkit-outer-spin-button,
.qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.qty-unit-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 600;
    min-width: 70px;
    text-transform: uppercase;
}

/* ==========================================================================
   Modales Premium (Facturas y Visualización)
   ========================================================================== */

.modal-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s;
}

.modal-backdrop.active {
    display: flex;
    opacity: 1;
}

.modal-content {
    background: #0f1717;
    border: 1px solid var(--border-glass-strong);
    border-radius: 24px;
    padding: 30px;
    width: 100%;
    max-width: 600px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.6);
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-backdrop.active .modal-content {
    transform: scale(1);
}

.invoice-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.invoice-email-recipient {
    width: 100%;
    color: var(--text-muted);
    font-size: 0.8rem;
    text-align: right;
}

.invoice-email-recipient i {
    margin-right: 6px;
    color: var(--secondary);
}

.invoice-action-buttons {
    display: flex;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 12px;
    width: 100%;
}

.invoice-action-buttons .btn:disabled,
.invoice-action-buttons .btn.is-busy {
    cursor: wait;
    opacity: 0.65;
}

#btn-share-order i {
    color: #25d366;
}

@media (max-width: 680px) {
    .invoice-action-buttons {
        display: grid;
        grid-template-columns: 1fr;
    }

    .invoice-action-buttons .btn {
        width: 100%;
        justify-content: center;
    }

    .invoice-email-recipient {
        text-align: left;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 16px;
    margin-bottom: 20px;
}

.modal-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.4rem;
    font-weight: 800;
    color: white;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.3rem;
    cursor: pointer;
    transition: color 0.2s;
}

.modal-close:hover {
    color: white;
}

.icon-picker-trigger {
    width: 100%;
    min-height: 42px;
    padding: 8px 12px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.025);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-family: inherit;
    font-size: 1.25rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.icon-picker-trigger:hover,
.icon-picker-trigger.active {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.icon-picker-trigger i {
    color: var(--text-muted);
    font-size: 0.8rem;
}

.icon-picker-grid {
    display: none;
    grid-template-columns: repeat(8, minmax(0, 1fr));
    gap: 6px;
    margin-top: 8px;
    padding: 8px;
    max-height: 190px;
    overflow-y: auto;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(6, 10, 10, 0.92);
}

.icon-picker-grid.active {
    display: grid;
}

.icon-picker-option {
    height: 34px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(255, 255, 255, 0.03);
    cursor: pointer;
    font-size: 1.15rem;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.icon-picker-option:hover,
.icon-picker-option.active {
    border-color: rgba(16, 185, 129, 0.45);
    background: rgba(16, 185, 129, 0.16);
}

/* Albarán / Factura en Modal */
.invoice-box {
    background: #090e0e;
    border: 1px solid rgba(255,255,255,0.03);
    border-radius: 16px;
    padding: 24px;
    font-size: 0.85rem;
    color: #e5e7eb;
}

.invoice-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
    border-bottom: 1px dashed rgba(255,255,255,0.1);
    padding-bottom: 14px;
}

.invoice-company-details h4 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.1rem;
    color: var(--primary);
    margin-bottom: 4px;
}

.invoice-meta {
    text-align: right;
}

.invoice-meta h4 {
    font-family: 'Outfit', sans-serif;
    font-size: 1rem;
    margin-bottom: 4px;
}

.invoice-parties {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 20px;
}

.invoice-party-col h5 {
    color: var(--text-muted);
    font-weight: 700;
    margin-bottom: 4px;
    text-transform: uppercase;
}

.invoice-party-col p {
    line-height: 1.3;
}

.invoice-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
}

.invoice-table tr,
.invoice-table th,
.invoice-table td {
    break-inside: avoid;
    page-break-inside: avoid;
    -webkit-column-break-inside: avoid;
}

.invoice-table th {
    text-align: left;
    padding: 8px 12px;
    background: rgba(255,255,255,0.02);
    border-bottom: 1px solid rgba(255,255,255,0.1);
    color: var(--text-muted);
}

.invoice-table td {
    padding: 10px 12px;
    border-bottom: 1px solid rgba(255,255,255,0.03);
}

.invoice-total-row {
    display: flex;
    justify-content: flex-end;
    font-size: 1.1rem;
    font-weight: 800;
    border-top: 1px dashed rgba(255,255,255,0.1);
    padding-top: 12px;
}

.invoice-lines-row {
    align-items: center;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.22);
    border-radius: 10px;
    color: var(--text-main);
    font-size: 1.2rem;
    margin-bottom: 8px;
    padding: 12px 14px;
}

.invoice-lines-row strong {
    color: var(--primary);
    font-size: 1.35rem;
}

.invoice-format-summary {
    display: flex;
    justify-content: flex-end;
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 700;
}

/* ==========================================================================
   Animaciones & Feedback
   ========================================================================== */

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-15px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes gentle-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes flash {
    0% { opacity: 0.3; }
    100% { opacity: 1; text-shadow: 0 0 10px var(--warning); }
}

/* Notificación Flotante */
.toast-container {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 1100;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: rgba(16, 28, 28, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-glass-strong);
    border-radius: 14px;
    padding: 16px 20px;
    color: white;
    font-size: 0.9rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    min-width: 250px;
    transform: translateX(120%);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.toast.show {
    transform: translateX(0);
}

.toast.success i { color: var(--success); }
.toast.error i { color: var(--danger); }
.toast.info i { color: var(--accent); }

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 992px) {
    aside.sidebar {
        width: 80px;
        padding: 24px 8px;
    }
    .logo-text, .user-info, .btn-logout span {
        display: none;
    }
    .sidebar-logo {
        justify-content: center;
        padding: 0;
        margin-bottom: 20px;
    }
    .menu-item a {
        justify-content: center;
        padding: 14px;
    }
    .menu-item a span {
        display: none;
    }
    main.main-content {
        margin-left: 80px;
        padding: 20px;
    }
    .list-manager-container, .order-taking-grid, .dashboard-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    body {
        display: block;
        padding-bottom: 86px;
    }

    aside.sidebar {
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        height: 76px;
        padding: 8px 10px;
        border-right: none;
        border-top: 1px solid var(--border-glass);
        box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.35);
        z-index: 950;
    }

    .sidebar-logo,
    .sidebar-footer {
        display: none;
    }

    .sidebar-menu {
        display: grid;
        grid-template-columns: repeat(7, minmax(0, 1fr));
        gap: 4px;
        width: 100%;
        height: 100%;
        align-items: stretch;
    }

    .menu-item a {
        height: 100%;
        flex-direction: column;
        justify-content: center;
        gap: 4px;
        padding: 6px 4px;
        border-radius: 10px;
        font-size: 0.64rem;
        line-height: 1.1;
        text-align: center;
    }

    .menu-item a span {
        display: block;
        max-width: 100%;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .menu-item a i {
        font-size: 1rem;
    }

    .menu-item.active a::after {
        left: 18%;
        right: 18%;
        top: auto;
        bottom: 0;
        width: auto;
        height: 3px;
        border-radius: 3px 3px 0 0;
    }

    main.main-content {
        margin-left: 0;
        padding: 74px 14px 18px;
    }

    #active-provider-badge {
        position: fixed;
        top: 14px;
        left: 14px;
        right: 72px;
        width: auto;
        margin: 0;
        justify-content: center;
        z-index: 900;
    }

    #theme-toggle-btn {
        position: fixed;
        top: 12px;
        right: 14px;
    }

    .order-taking-container {
        padding: 18px;
    }

    .order-action-panel {
        align-items: stretch;
        flex-direction: column;
        gap: 12px;
        padding: 12px;
    }

    .order-action-status,
    .order-line-counter {
        width: 100%;
    }

    .recipient-control {
        width: 100%;
    }

    .recipient-name-input {
        flex: 1;
        min-width: 100px;
    }

    .order-line-counter {
        justify-content: center;
    }

    .order-action-buttons {
        width: 100%;
    }

    .order-action-buttons .btn {
        flex: 1;
        padding-inline: 12px;
    }

    .order-item-row {
        align-items: flex-start;
        flex-direction: column;
    }

    .qty-control {
        width: 100%;
        justify-content: flex-end;
        flex-wrap: wrap;
    }

    .format-quick-picker {
        order: 2;
        width: 100%;
        justify-content: flex-end;
        margin-right: 0;
    }

    .order-product-name-editor {
        grid-template-columns: minmax(0, 1fr) 34px 34px;
        max-width: 100%;
        width: 100%;
    }

    .qty-input {
        width: min(110px, 45vw);
    }

}

@media (max-width: 576px) {
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }
    .metrics-grid {
        grid-template-columns: 1fr;
    }

    .sidebar-menu {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        overflow-x: auto;
        scrollbar-width: none;
    }

    .sidebar-menu::-webkit-scrollbar {
        display: none;
    }

    .menu-item a {
        min-width: 72px;
    }

    .order-search-input-wrap {
        gap: 6px;
        padding: 8px;
    }

    .order-action-buttons {
        flex-direction: column;
    }
}

/* ==========================================================================
   Modo Claro (Light Theme)
   ========================================================================== */

body.light-theme {
    --bg-base: #f1f5f5;
    --bg-sidebar: rgba(240, 246, 246, 0.9);
    --bg-surface: rgba(255, 255, 255, 0.7);
    --bg-surface-hover: rgba(255, 255, 255, 0.95);
    --border-glass: rgba(16, 185, 129, 0.16);
    --border-glass-strong: rgba(16, 185, 129, 0.35);
    --text-main: #1e293b;
    --text-muted: #64748b;
    
    background-image: 
        radial-gradient(circle at 5% 10%, rgba(16, 185, 129, 0.08) 0%, transparent 40%),
        radial-gradient(circle at 95% 85%, rgba(249, 115, 22, 0.06) 0%, transparent 40%);
}

body.light-theme .page-title-group h1,
body.light-theme .user-name,
body.light-theme .custom-table td,
body.light-theme .invoice-meta p strong,
body.light-theme .modal-title,
body.light-theme .metric-value,
body.light-theme .alert-name,
body.light-theme .sort-item-name,
body.light-theme .alert-panel-title span,
body.light-theme h3,
body.light-theme h2,
body.light-theme label {
    color: #0f172a !important;
}

body.light-theme .logo-text {
    background: linear-gradient(to right, #0f172a, #059669) !important;
    -webkit-background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
    -webkit-text-stroke: 0.3px rgba(15, 23, 42, 0.15) !important;
}

body.light-theme aside.sidebar {
    box-shadow: 5px 0 25px rgba(0, 0, 0, 0.05);
}

body.light-theme .menu-item.active a {
    color: #047857;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.12), rgba(16, 185, 129, 0.03));
    border-color: rgba(16, 185, 129, 0.35);
}

body.light-theme .menu-item a {
    color: #475569;
}
body.light-theme .menu-item a:hover {
    color: #0f172a;
    background: rgba(0,0,0,0.02);
}

body.light-theme .form-select,
body.light-theme .form-input-text,
body.light-theme .qty-input,
body.light-theme .form-input {
    background: rgba(255, 255, 255, 0.95) !important;
    color: #0f172a !important;
    border-color: rgba(16, 185, 129, 0.25) !important;
}

body.light-theme .format-icon-btn {
    background: rgba(255, 255, 255, 0.85);
    border-color: rgba(15, 23, 42, 0.1);
    color: #64748b;
}

body.light-theme .format-icon-btn:hover,
body.light-theme .format-icon-btn.active {
    color: #047857;
    border-color: rgba(16, 185, 129, 0.35);
    background: rgba(16, 185, 129, 0.12);
}

body.light-theme .qty-input:focus {
    border-color: var(--primary) !important;
}

body.light-theme .invoice-box {
    background: #ffffff !important;
    border-color: rgba(0,0,0,0.08) !important;
    color: #1e293b !important;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}

body.light-theme .invoice-box * {
    color: #1e293b !important;
}

body.light-theme .sortable-item,
body.light-theme .order-item-row,
body.light-theme .order-search-input-wrap,
body.light-theme .order-action-panel {
    background: rgba(255, 255, 255, 0.7);
    border-color: rgba(16, 185, 129, 0.15);
    box-shadow: 0 2px 8px rgba(0,0,0,0.02);
}

body.light-theme .order-line-counter,
body.light-theme .invoice-lines-row {
    background: rgba(16, 185, 129, 0.1);
    border-color: rgba(16, 185, 129, 0.25);
    color: #0f172a;
}

body.light-theme .recipient-name-input {
    background: rgba(255, 255, 255, 0.86);
    border-color: rgba(5, 150, 105, 0.28);
    color: #0f172a;
}

body.light-theme .sortable-item:hover,
body.light-theme .order-item-row:hover {
    background: rgba(255, 255, 255, 0.95);
    border-color: rgba(16, 185, 129, 0.3);
}

body.light-theme .custom-table th {
    background: rgba(230, 240, 240, 0.9);
    border-bottom-color: rgba(0, 0, 0, 0.05);
}

body.light-theme .table-responsive {
    border-color: rgba(0, 0, 0, 0.06);
}

body.light-theme .modal-content {
    background: #ffffff;
    box-shadow: 0 25px 50px rgba(0,0,0,0.15);
}

body.light-theme .modal-close {
    color: #64748b;
}
body.light-theme .modal-close:hover {
    color: #0f172a;
}

/* Light Theme Contrast Enhancements - Resolving Text Readability */
body.light-theme .entity-select-btn {
    color: #475569 !important;
    background: rgba(0, 0, 0, 0.02) !important;
    border-color: rgba(0, 0, 0, 0.08) !important;
}

body.light-theme .entity-select-btn:hover {
    color: #0f172a !important;
    background: rgba(16, 185, 129, 0.12) !important;
    border-color: rgba(16, 185, 129, 0.25) !important;
}

body.light-theme .entity-select-btn.active {
    color: #047857 !important;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.15), rgba(16, 185, 129, 0.04)) !important;
    border-color: rgba(16, 185, 129, 0.35) !important;
}

body.light-theme .btn-outline {
    background: rgba(0, 0, 0, 0.03) !important;
    border-color: rgba(0, 0, 0, 0.12) !important;
    color: #334155 !important;
}

body.light-theme .btn-outline:hover {
    background: rgba(0, 0, 0, 0.06) !important;
    border-color: rgba(0, 0, 0, 0.2) !important;
    color: #0f172a !important;
}

body.light-theme .btn-danger {
    background: rgba(239, 68, 68, 0.08) !important;
    border-color: rgba(239, 68, 68, 0.25) !important;
    color: #b91c1c !important;
}

body.light-theme .btn-danger:hover {
    background: #dc2626 !important;
    color: white !important;
}

body.light-theme #active-provider-badge {
    background: rgba(255, 255, 255, 0.85) !important;
    border-color: rgba(16, 185, 129, 0.3) !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08) !important;
}

body.light-theme #active-provider-badge span {
    color: #1e293b !important;
}

body.light-theme #active-provider-badge span #active-provider-name {
    font-weight: 800;
}

/* Disponibilidad y Estados de Stock Simplificados */
.badge-available {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    background: rgba(16, 185, 129, 0.15) !important;
    color: var(--primary) !important;
    border: 1px solid rgba(16, 185, 129, 0.25) !important;
}

body.light-theme .badge-available {
    color: #047857 !important;
}

.badge-out-of-stock {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    background: rgba(239, 68, 68, 0.12) !important;
    color: var(--danger) !important;
    border: 1px solid rgba(239, 68, 68, 0.25) !important;
}

body.light-theme .badge-out-of-stock {
    color: #b91c1c !important;
}

/* Fila de Toma de Pedido - Sin Existencias */
.order-item-row.out-of-stock {
    opacity: 0.65;
    background: rgba(239, 68, 68, 0.02) !important;
    border-color: rgba(239, 68, 68, 0.12) !important;
}

.order-item-row.out-of-stock:hover {
    background: rgba(239, 68, 68, 0.04) !important;
}

.order-item-row.out-of-stock .qty-input {
    background: rgba(0, 0, 0, 0.2) !important;
    border-color: rgba(255, 255, 255, 0.05) !important;
    color: var(--text-muted) !important;
    cursor: not-allowed;
}

body.light-theme .order-item-row.out-of-stock .qty-input {
    background: rgba(0, 0, 0, 0.05) !important;
    color: #94a3b8 !important;
}

/* Botón de Habilitación en Caliente */
.btn-enable-hot {
    background: rgba(16, 185, 129, 0.12) !important;
    border: 1px solid rgba(16, 185, 129, 0.3) !important;
    color: var(--primary) !important;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-family: inherit;
}

.btn-enable-hot:hover {
    background: var(--primary) !important;
    color: white !important;
    box-shadow: 0 0 10px var(--primary-glow) !important;
    transform: translateY(-1px);
}

body.light-theme .btn-enable-hot {
    color: #047857 !important;
}
body.light-theme .btn-enable-hot:hover {
    color: white !important;
}

/* ==========================================================================
   Overlay de Carga Premium (Blocking Spinner)
   ========================================================================== */
.loading-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(4, 10, 10, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.loading-overlay.active {
    display: flex;
    opacity: 1;
}

.loading-spinner-box {
    text-align: center;
    background: rgba(16, 28, 28, 0.7);
    border: 1px solid rgba(16, 185, 129, 0.25);
    border-radius: 28px;
    padding: 40px;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.7), 0 0 40px rgba(16, 185, 129, 0.1);
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.loading-overlay.active .loading-spinner-box {
    transform: scale(1);
}

/* Spinner animado Premium (Órbita de Fruta Orgánica) */
.spinner-orbit {
    position: relative;
    width: 80px;
    height: 80px;
    margin: 0 auto 24px auto;
    border: 3px solid rgba(16, 185, 129, 0.1);
    border-radius: 50%;
    animation: gentle-spin 2s linear infinite;
}

.spinner-planet {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 14px;
    height: 14px;
    background: linear-gradient(135deg, var(--primary), #34d399);
    border-radius: 50%;
    box-shadow: 0 0 15px var(--primary-glow);
}

.spinner-orbit::before {
    content: '';
    position: absolute;
    top: 6px;
    left: 6px;
    right: 6px;
    bottom: 6px;
    border: 3px solid transparent;
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: gentle-spin 1s linear infinite reverse;
}

.loading-text {
    font-family: 'Outfit', sans-serif;
    font-size: 1.2rem;
    font-weight: 700;
    color: white;
    margin-bottom: 8px;
    letter-spacing: -0.2px;
}

.loading-subtext {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
    display: block;
}

/* Adaptación para Modo Claro (Light Theme) */
body.light-theme .loading-overlay {
    background: rgba(240, 246, 246, 0.85);
}

body.light-theme .loading-spinner-box {
    background: rgba(255, 255, 255, 0.95);
    border-color: rgba(16, 185, 129, 0.3);
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.08), 0 0 40px rgba(16, 185, 129, 0.05);
}

body.light-theme .loading-text {
    color: #0f172a;
}
