/* ============================================
   TallerPro - Modern Production Management System
   Refined & Professional Design System
   ============================================ */

/* CSS Custom Properties */
:root {
    /* Color Palette - Professional Light Theme */
    --color-primary: #2563EB;
    --color-primary-dark: #1E40AF;
    --color-primary-light: #3B82F6;
    --color-secondary: #7C3AED;
    --color-success: #059669;
    --color-warning: #D97706;
    --color-danger: #DC2626;
    --color-info: #0284C7;
    
    /* Neutral Colors - Light Theme */
    --color-bg: #F8FAFC;
    --color-surface: #FFFFFF;
    --color-surface-elevated: #F1F5F9;
    --color-border: #E2E8F0;
    --color-border-light: #CBD5E1;
    
    /* Text Colors - Light Theme */
    --color-text-primary: #0F172A;
    --color-text-secondary: #334155;
    --color-text-muted: #64748B;
    --color-text-disabled: #94A3B8;
    
    /* Shadows - Softer for light theme */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.15);
    --shadow-glow: 0 0 20px rgba(37, 99, 235, 0.15);
    
    /* Spacing System */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;
    
    /* Border Radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-full: 9999px;
    
    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 300ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 500ms cubic-bezier(0.4, 0, 0.2, 1);
    
    /* Typography */
    --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'Space Mono', 'Courier New', monospace;
    
    /* Z-Index Scale */
    --z-base: 1;
    --z-dropdown: 1000;
    --z-sticky: 1020;
    --z-fixed: 1030;
    --z-modal-backdrop: 1040;
    --z-modal: 1050;
    --z-popover: 1060;
    --z-tooltip: 1070;
}

/* ============================================
   Reset & Base Styles
   ============================================ */

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

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

body {
    font-family: var(--font-sans);
    background-color: var(--color-bg);
    color: var(--color-text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
}

/* Selection */
::selection {
    background-color: var(--color-primary);
    color: white;
}

/* Scrollbar Styling - Light Theme */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--color-surface-elevated);
}

::-webkit-scrollbar-thumb {
    background: var(--color-border-light);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--color-text-muted);
}

/* Focus Styles */
:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

/* ============================================
   Sidebar Navigation
   ============================================ */

.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 260px;
    height: 100vh;
    background: var(--color-surface);
    border-right: 1px solid var(--color-border);
    padding: var(--space-xl) 0;
    z-index: var(--z-fixed);
    transition: transform var(--transition-base);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-md);
}

.logo {
    padding: 0 var(--space-xl) var(--space-xl);
    display: flex;
    align-items: center;
    gap: var(--space-md);
    border-bottom: 1px solid var(--color-border);
    margin-bottom: var(--space-lg);
}

.logo-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    font-size: 20px;
    font-family: var(--font-mono);
    letter-spacing: -1px;
    box-shadow: var(--shadow-md);
    color: white;
}

.logo-text {
    font-size: 22px;
    font-weight: 800;
    background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.5px;
}

.nav-menu {
    padding: 0 var(--space-md);
    flex: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md) var(--space-lg);
    margin-bottom: var(--space-xs);
    border-radius: var(--radius-md);
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
    user-select: none;
    min-height: 48px;
    font-weight: 500;
    position: relative;
}

.nav-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 0;
    background: var(--color-primary);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    transition: height var(--transition-fast);
}

.nav-item:hover {
    background: var(--color-surface-elevated);
    color: var(--color-text-primary);
}

.nav-item.active {
    background: linear-gradient(90deg, rgba(37, 99, 235, 0.1), transparent);
    color: var(--color-primary);
    font-weight: 600;
}

.nav-item.active::before {
    height: 24px;
}

.nav-icon {
    font-size: 20px;
    width: 24px;
    text-align: center;
    flex-shrink: 0;
}

.sidebar-footer {
    padding: var(--space-lg) var(--space-xl);
    border-top: 1px solid var(--color-border);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: white;
    box-shadow: var(--shadow-sm);
}

.user-info {
    flex: 1;
}

.user-name {
    font-weight: 600;
    font-size: 14px;
    color: var(--color-text-primary);
}

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

/* ============================================
   Mobile Menu
   ============================================ */

.mobile-menu-toggle {
    display: none;
    position: fixed;
    top: var(--space-lg);
    left: var(--space-lg);
    z-index: calc(var(--z-fixed) + 1);
    background: var(--color-surface-elevated);
    border: 1px solid var(--color-border);
    color: var(--color-text-primary);
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    font-size: 24px;
    cursor: pointer;
    transition: all var(--transition-fast);
    box-shadow: var(--shadow-lg);
}

.mobile-menu-toggle:hover {
    background: var(--color-primary);
    border-color: var(--color-primary);
    transform: scale(1.05);
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: calc(var(--z-fixed) - 1);
    opacity: 0;
    transition: opacity var(--transition-base);
    backdrop-filter: blur(4px);
}

.sidebar-overlay.active {
    opacity: 1;
}

@media (max-width: 768px) {
    .mobile-menu-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .sidebar-overlay {
        display: block;
        pointer-events: none;
    }
    
    .sidebar-overlay.active {
        pointer-events: auto;
    }
}

/* ============================================
   Main Content Area
   ============================================ */

.main-content {
    margin-left: 260px;
    padding: var(--space-2xl);
    min-height: 100vh;
    transition: margin var(--transition-base);
}

@media (max-width: 768px) {
    .main-content {
        margin-left: 0;
        padding: var(--space-xl) var(--space-lg);
        padding-top: 80px;
    }
}

.content-section {
    display: none;
    animation: fadeIn var(--transition-base);
}

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

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

/* ============================================
   Header
   ============================================ */

.header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--space-2xl);
    gap: var(--space-lg);
    flex-wrap: wrap;
}

.header-left h1 {
    font-size: 36px;
    font-weight: 800;
    letter-spacing: -1px;
    margin-bottom: var(--space-xs);
    background: linear-gradient(135deg, var(--color-text-primary), var(--color-text-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-subtitle {
    color: var(--color-text-muted);
    font-size: 14px;
}

.header-actions {
    display: flex;
    gap: var(--space-md);
    flex-wrap: wrap;
}

/* ============================================
   Buttons
   ============================================ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-xl);
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    font-weight: 600;
    font-size: 14px;
    font-family: var(--font-sans);
    cursor: pointer;
    transition: all var(--transition-fast);
    user-select: none;
    white-space: nowrap;
    min-height: 44px;
}

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

.btn-primary {
    background: var(--color-primary);
    color: white;
    box-shadow: var(--shadow-md);
}

.btn-primary:hover:not(:disabled) {
    background: var(--color-primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-primary:active:not(:disabled) {
    transform: translateY(0);
}

.btn-secondary {
    background: var(--color-surface-elevated);
    color: var(--color-text-primary);
    border-color: var(--color-border);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--color-surface);
    border-color: var(--color-border-light);
    box-shadow: var(--shadow-sm);
}

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

.btn-success:hover:not(:disabled) {
    background: #059669;
    transform: translateY(-2px);
}

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

.btn-danger:hover:not(:disabled) {
    background: #DC2626;
    transform: translateY(-2px);
}

.btn-sm {
    padding: var(--space-sm) var(--space-md);
    font-size: 12px;
    min-height: 36px;
}

/* ============================================
   Cards
   ============================================ */

.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-fast);
}

.card:hover {
    border-color: var(--color-border-light);
    box-shadow: var(--shadow-md);
}

.card-header {
    padding: var(--space-lg) var(--space-xl);
    border-bottom: 1px solid var(--color-border);
    background: var(--color-surface-elevated);
}

.card-header h2 {
    font-size: 18px;
    font-weight: 700;
    color: var(--color-text-primary);
}

.card-body {
    padding: var(--space-xl);
}

/* ============================================
   Stats Grid
   ============================================ */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: var(--space-lg);
    margin-bottom: var(--space-2xl);
}

.stat-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    transition: all var(--transition-fast);
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--color-primary), var(--color-secondary));
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.stat-card:hover {
    border-color: var(--color-primary);
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.stat-card:hover::before {
    opacity: 1;
}

.stat-header {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
}

.stat-icon {
    font-size: 28px;
    opacity: 0.9;
}

.stat-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 32px;
    font-weight: 800;
    color: var(--color-text-primary);
    font-family: var(--font-mono);
    margin-bottom: var(--space-sm);
    letter-spacing: -1px;
}

.stat-value.warning {
    color: var(--color-warning);
}

.stat-trend {
    font-size: 13px;
    color: var(--color-text-muted);
    display: flex;
    align-items: center;
    gap: var(--space-xs);
}

.stat-trend.positive {
    color: var(--color-success);
}

.stat-trend.negative {
    color: var(--color-danger);
}

/* ============================================
   Dashboard Grid
   ============================================ */

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: var(--space-lg);
}

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

/* ============================================
   Search & Filters
   ============================================ */

.search-filter-bar {
    display: flex;
    gap: var(--space-md);
    margin-bottom: var(--space-xl);
    flex-wrap: wrap;
}

.search-box {
    flex: 1;
    min-width: 280px;
    position: relative;
}

.search-icon {
    position: absolute;
    left: var(--space-lg);
    top: 50%;
    transform: translateY(-50%);
    font-size: 18px;
    pointer-events: none;
    opacity: 0.5;
}

.search-box input {
    width: 100%;
    padding: var(--space-md) var(--space-lg) var(--space-md) 48px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    color: var(--color-text-primary);
    font-size: 14px;
    font-family: var(--font-sans);
    transition: all var(--transition-fast);
    box-shadow: var(--shadow-sm);
}

.search-box input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

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

.filter-group {
    display: flex;
    gap: var(--space-md);
    flex-wrap: wrap;
}

.filter-group select {
    padding: var(--space-md) var(--space-lg);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    color: var(--color-text-primary);
    font-size: 14px;
    font-family: var(--font-sans);
    cursor: pointer;
    transition: all var(--transition-fast);
    min-width: 160px;
    box-shadow: var(--shadow-sm);
}

.filter-group select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.filter-group select option {
    background: var(--color-surface);
    color: var(--color-text-primary);
}

/* ============================================
   Tables
   ============================================ */

.table-container {
    overflow-x: auto;
}

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

.data-table thead tr {
    background: var(--color-surface-elevated);
}

.data-table th {
    padding: var(--space-lg) var(--space-lg);
    text-align: left;
    font-weight: 600;
    font-size: 12px;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--color-border);
    white-space: nowrap;
}

.data-table td {
    padding: var(--space-lg) var(--space-lg);
    border-bottom: 1px solid var(--color-border);
    font-size: 14px;
    color: var(--color-text-secondary);
}

.data-table tbody tr {
    transition: background var(--transition-fast);
}

.data-table tbody tr:hover {
    background: var(--color-surface-elevated);
}

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

/* Table States */
.empty-state,
.loading-state {
    text-align: center;
    padding: var(--space-2xl) var(--space-lg);
    color: var(--color-text-muted);
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: var(--space-md);
    opacity: 0.5;
}

.empty-state-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--color-text-secondary);
}

/* ============================================
   Status Badges
   ============================================ */

.status-badge {
    display: inline-flex;
    align-items: center;
    padding: var(--space-xs) var(--space-md);
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.status-pendiente {
    background: #FEF3C7;
    color: #92400E;
    border: 1px solid #FDE68A;
}

.status-enproduccion {
    background: #DBEAFE;
    color: #1E40AF;
    border: 1px solid #BFDBFE;
}

.status-completado {
    background: #D1FAE5;
    color: #065F46;
    border: 1px solid #A7F3D0;
}

.status-cancelado {
    background: #FEE2E2;
    color: #991B1B;
    border: 1px solid #FECACA;
}

/* Priority Badges */
.priority-alta {
    color: var(--color-danger);
    font-weight: 700;
}

.priority-media {
    color: var(--color-warning);
    font-weight: 600;
}

.priority-baja {
    color: var(--color-text-muted);
    font-weight: 500;
}

/* ============================================
   Notifications & Activity
   ============================================ */

.notifications-list,
.activity-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    max-height: 400px;
    overflow-y: auto;
}

.notification-item,
.activity-item {
    padding: var(--space-lg);
    background: var(--color-surface-elevated);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.notification-item:hover,
.activity-item:hover {
    border-color: var(--color-border-light);
    transform: translateX(4px);
}

.notification-item.unread {
    border-left: 3px solid var(--color-primary);
}

.notification-header,
.activity-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-sm);
}

.notification-title,
.activity-title {
    font-weight: 600;
    font-size: 14px;
    color: var(--color-text-primary);
}

.notification-time,
.activity-time {
    font-size: 12px;
    color: var(--color-text-muted);
}

.notification-message,
.activity-message {
    font-size: 13px;
    color: var(--color-text-secondary);
    line-height: 1.5;
}

/* ============================================
   Toast Notifications
   ============================================ */

.toast-container {
    position: fixed;
    top: var(--space-xl);
    right: var(--space-xl);
    z-index: var(--z-tooltip);
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    max-width: 400px;
}

.toast {
    background: var(--color-surface-elevated);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--space-lg);
    box-shadow: var(--shadow-xl);
    animation: slideInRight var(--transition-base);
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

@keyframes slideInRight {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: var(--space-xs);
}

.toast-message {
    font-size: 13px;
    color: var(--color-text-secondary);
}

.toast.success {
    border-left: 3px solid var(--color-success);
}

.toast.error {
    border-left: 3px solid var(--color-danger);
}

.toast.warning {
    border-left: 3px solid var(--color-warning);
}

.toast.info {
    border-left: 3px solid var(--color-info);
}

/* ============================================
   Loading States
   ============================================ */

.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(248, 250, 252, 0.95);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: var(--space-lg);
    z-index: var(--z-modal);
}

.loading-overlay.active {
    display: flex;
}

.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--color-border);
    border-top-color: var(--color-primary);
    border-radius: var(--radius-full);
    animation: spin 0.8s linear infinite;
}

.spinner-large {
    width: 48px;
    height: 48px;
    border: 4px solid var(--color-border);
    border-top-color: var(--color-primary);
    border-radius: var(--radius-full);
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ============================================
   Report Lists
   ============================================ */

.report-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.report-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-md) 0;
    border-bottom: 1px solid var(--color-border);
}

.report-item:last-child {
    border-bottom: none;
}

.report-item-label {
    font-weight: 500;
    color: var(--color-text-secondary);
}

.report-item-value {
    font-weight: 700;
    font-family: var(--font-mono);
    color: var(--color-text-primary);
}

/* ============================================
   Responsive Design
   ============================================ */

@media (max-width: 1200px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    :root {
        font-size: 14px;
    }
    
    .header-left h1 {
        font-size: 28px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .search-filter-bar {
        flex-direction: column;
    }
    
    .search-box {
        min-width: 100%;
    }
    
    .filter-group {
        width: 100%;
    }
    
    .filter-group select {
        flex: 1;
        min-width: 0;
    }
    
    .toast-container {
        left: var(--space-md);
        right: var(--space-md);
        max-width: none;
    }
}

/* ============================================
   Utility Classes
   ============================================ */

.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.font-bold {
    font-weight: 700;
}

.font-mono {
    font-family: var(--font-mono);
}

.text-warning {
    color: var(--color-warning) !important;
}

.hidden {
    display: none !important;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* ============================================
   Modals
   ============================================ */

.modal {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: var(--z-modal);
    padding: var(--space-lg);
    animation: fadeIn var(--transition-base);
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
    animation: slideUp var(--transition-base);
}

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

.modal-header {
    padding: var(--space-xl);
    border-bottom: 1px solid var(--color-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--color-surface-elevated);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}

.modal-header h2 {
    font-size: 20px;
    font-weight: 700;
    color: var(--color-text-primary);
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    color: var(--color-text-muted);
    font-size: 32px;
    cursor: pointer;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    line-height: 1;
    padding: 0;
}

.modal-close:hover {
    background: var(--color-surface);
    color: var(--color-text-primary);
}

.modal-body {
    padding: var(--space-xl);
}

.modal-footer {
    padding: var(--space-xl);
    border-top: 1px solid var(--color-border);
    display: flex;
    justify-content: flex-end;
    gap: var(--space-md);
    background: var(--color-surface-elevated);
    border-radius: 0 0 var(--radius-xl) var(--radius-xl);
}

/* ============================================
   Forms
   ============================================ */

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-lg);
    margin-bottom: var(--space-lg);
}

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

.form-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.form-group.full-width {
    grid-column: 1 / -1;
}

.form-group label {
    font-weight: 600;
    font-size: 14px;
    color: var(--color-text-secondary);
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: var(--space-md);
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    color: var(--color-text-primary);
    font-size: 14px;
    font-family: var(--font-sans);
    transition: all var(--transition-fast);
    box-shadow: var(--shadow-sm);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
    background: var(--color-surface);
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.form-group small {
    font-size: 12px;
    color: var(--color-text-muted);
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-md);
    margin-top: var(--space-xl);
    padding-top: var(--space-lg);
    border-top: 1px solid var(--color-border);
}

/* ============================================
   Totales y Cálculos
   ============================================ */

.totales-pedido {
    background: var(--color-surface-elevated);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--space-lg);
    margin: var(--space-lg) 0;
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.total-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
}

.total-item:last-child {
    padding-top: var(--space-md);
    border-top: 1px solid var(--color-border);
    font-size: 16px;
}

.total-item span {
    color: var(--color-text-secondary);
}

.total-item strong {
    color: var(--color-text-primary);
    font-family: var(--font-mono);
    font-size: 18px;
}

/* ============================================
   Cliente Stats
   ============================================ */

.cliente-stats {
    background: var(--color-surface-elevated);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--space-lg);
    margin: var(--space-lg) 0;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-lg);
}

.stat-mini {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.stat-mini span {
    font-size: 12px;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-mini strong {
    font-size: 20px;
    font-family: var(--font-mono);
    color: var(--color-primary);
}

/* ============================================
   Factura Styles
   ============================================ */

.factura-container {
    display: flex;
    flex-direction: column;
    gap: var(--space-xl);
}

.factura-header {
    text-align: center;
    padding-bottom: var(--space-lg);
    border-bottom: 2px solid var(--color-border);
}

.factura-header h3 {
    font-size: 24px;
    font-weight: 800;
    margin-bottom: var(--space-sm);
}

.factura-fecha {
    color: var(--color-text-muted);
    font-size: 14px;
}

.factura-info {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-lg);
}

.info-section h4 {
    font-size: 12px;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: var(--space-sm);
}

.info-section p {
    font-size: 14px;
    color: var(--color-text-primary);
}

.factura-table {
    width: 100%;
    border-collapse: collapse;
    margin: var(--space-lg) 0;
}

.factura-table th,
.factura-table td {
    padding: var(--space-md);
    text-align: left;
    border-bottom: 1px solid var(--color-border);
}

.factura-table th {
    background: var(--color-surface-elevated);
    font-weight: 600;
    font-size: 12px;
    color: var(--color-text-muted);
    text-transform: uppercase;
}

.factura-table td {
    font-size: 14px;
    color: var(--color-text-secondary);
}

.factura-table td:last-child,
.factura-table th:last-child {
    text-align: right;
}

.factura-totales {
    background: var(--color-surface-elevated);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--space-lg);
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.factura-totales .total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
}

.factura-totales .total-row.saldo {
    padding-top: var(--space-md);
    border-top: 2px solid var(--color-border);
    font-size: 16px;
}

.factura-totales .total-row span {
    color: var(--color-text-secondary);
}

.factura-totales .total-row strong {
    color: var(--color-text-primary);
    font-family: var(--font-mono);
    font-size: 18px;
}

.factura-metodo {
    background: var(--color-surface-elevated);
    padding: var(--space-lg);
    border-radius: var(--radius-md);
    border-left: 3px solid var(--color-primary);
}

/* ============================================
   Abono & Envío Info
   ============================================ */

.abono-info,
.envio-info {
    background: var(--color-surface-elevated);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--space-lg);
    margin-bottom: var(--space-xl);
}

.abono-info .info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-sm) 0;
    font-size: 14px;
}

.abono-info .info-row:not(:last-child) {
    border-bottom: 1px solid var(--color-border);
}

.abono-info .info-row span {
    color: var(--color-text-secondary);
}

.abono-info .info-row strong {
    font-family: var(--font-mono);
    color: var(--color-text-primary);
}

.envio-info p {
    margin: var(--space-sm) 0;
    font-size: 14px;
    color: var(--color-text-secondary);
}

.envio-info strong {
    color: var(--color-text-primary);
    font-weight: 600;
}

/* ============================================
   Responsive Modal Adjustments
   ============================================ */

@media (max-width: 768px) {
    .modal {
        padding: 0;
    }
    
    .modal-content {
        max-width: 100%;
        max-height: 100vh;
        border-radius: 0;
    }
    
    .modal-header {
        border-radius: 0;
    }
    
    .modal-footer {
        border-radius: 0;
    }
    
    .factura-info {
        grid-template-columns: 1fr;
    }
    
    .cliente-stats {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   Kanban Board Styles
   ============================================ */

.kanban-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-lg);
    margin-bottom: var(--space-2xl);
}

.kanban-stat {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-sm);
    box-shadow: var(--shadow-sm);
}

.kanban-stat-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.kanban-stat-value {
    font-size: 32px;
    font-weight: 800;
    font-family: var(--font-mono);
    color: var(--color-primary);
}

.kanban-board {
    display: flex;
    gap: var(--space-lg);
    overflow-x: auto;
    padding-bottom: var(--space-lg);
    min-height: 70vh;
}

.kanban-column {
    flex: 0 0 280px;
    background: var(--color-surface-elevated);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 300px);
}

.kanban-column-success {
    background: linear-gradient(180deg, #D1FAE5 0%, var(--color-surface-elevated) 100%);
}

.kanban-column-aprobacion {
    background: linear-gradient(180deg, #FFF7ED 0%, var(--color-surface-elevated) 100%);
    border-color: #FED7AA;
}

.kanban-column-header {
    padding: var(--space-lg);
    border-bottom: 2px solid var(--color-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    background: inherit;
    z-index: 1;
}

.kanban-column-header h3 {
    font-size: 14px;
    font-weight: 700;
    color: var(--color-text-primary);
    margin: 0;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.kanban-count {
    background: var(--color-primary);
    color: white;
    font-size: 12px;
    font-weight: 700;
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-full);
    min-width: 24px;
    text-align: center;
}

.kanban-cards {
    padding: var(--space-md);
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    min-height: 200px;
}

.kanban-cards.drag-over {
    background: rgba(37, 99, 235, 0.05);
    border: 2px dashed var(--color-primary);
    border-radius: var(--radius-md);
}

.kanban-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    cursor: grab;
    transition: all var(--transition-fast);
    box-shadow: var(--shadow-sm);
}

.kanban-card:active {
    cursor: grabbing;
}

.kanban-card.dragging {
    opacity: 0.5;
    transform: rotate(2deg);
}

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

.kanban-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--space-sm);
}

.kanban-card-id {
    font-size: 11px;
    font-weight: 700;
    color: var(--color-primary);
    font-family: var(--font-mono);
}

.kanban-card-priority {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    text-transform: uppercase;
}

.kanban-card-priority.alta {
    background: #FEE2E2;
    color: #991B1B;
}

.kanban-card-priority.media {
    background: #FEF3C7;
    color: #92400E;
}

.kanban-card-priority.baja {
    background: #E0E7FF;
    color: #3730A3;
}

.kanban-card-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text-primary);
    margin-bottom: var(--space-xs);
    line-height: 1.4;
}

.kanban-card-cliente {
    font-size: 12px;
    color: var(--color-text-secondary);
    margin-bottom: var(--space-md);
    display: flex;
    align-items: center;
    gap: var(--space-xs);
}

.kanban-card-meta {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
    padding-top: var(--space-sm);
    border-top: 1px solid var(--color-border);
    font-size: 11px;
    color: var(--color-text-muted);
}

.kanban-card-empleado {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-xs) var(--space-sm);
    background: var(--color-surface-elevated);
    border-radius: var(--radius-sm);
}

.kanban-card-empleado-avatar {
    width: 20px;
    height: 20px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
}

.kanban-card-fecha {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
}

.kanban-card-fecha.urgente {
    color: var(--color-danger);
    font-weight: 600;
}

.kanban-card-actions {
    display: flex;
    gap: var(--space-xs);
    margin-top: var(--space-sm);
}

.kanban-card-btn {
    flex: 1;
    padding: var(--space-xs) var(--space-sm);
    font-size: 11px;
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    color: var(--color-text-secondary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-weight: 500;
}

.kanban-card-btn:hover {
    background: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
}

.kanban-empty {
    text-align: center;
    padding: var(--space-2xl) var(--space-lg);
    color: var(--color-text-muted);
    font-size: 13px;
}

/* Kanban Responsive */
@media (max-width: 1200px) {
    .kanban-board {
        overflow-x: scroll;
    }
    
    .kanban-column {
        flex: 0 0 260px;
    }
}

@media (max-width: 768px) {
    .kanban-stats {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .kanban-board {
        flex-direction: column;
        overflow-x: visible;
    }
    
    .kanban-column {
        flex: 1 1 auto;
        max-height: none;
    }
}

/* ============================================
   Production Table Enhancements
   ============================================ */

.vista-produccion {
    display: none;
}

.vista-produccion.active {
    display: block;
}

.production-table {
    font-size: 13px;
}

.production-table thead th {
    background: var(--color-surface-elevated);
    position: sticky;
    top: 0;
    z-index: 10;
}

.production-table tbody tr:hover {
    background: var(--color-surface-elevated);
}

.etapa-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-xs) var(--space-md);
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    white-space: nowrap;
}

.etapa-nuevo {
    background: #F3F4F6;
    color: #374151;
    border: 1px solid #D1D5DB;
}

.etapa-aprobacion {
    background: #FFF7ED;
    color: #9A3412;
    border: 1px solid #FED7AA;
}

.etapa-diseno {
    background: #FEF3C7;
    color: #92400E;
    border: 1px solid #FDE68A;
}

.etapa-sublimacion {
    background: #DDD6FE;
    color: #5B21B6;
    border: 1px solid #C4B5FD;
}

.etapa-pedreria {
    background: #FCE7F3;
    color: #9F1239;
    border: 1px solid #FBCFE8;
}

.etapa-laser {
    background: #FED7AA;
    color: #9A3412;
    border: 1px solid #FDBA74;
}

.etapa-impresion {
    background: #DBEAFE;
    color: #1E40AF;
    border: 1px solid #BFDBFE;
}

.etapa-completado {
    background: #D1FAE5;
    color: #065F46;
    border: 1px solid #A7F3D0;
}

.empleado-cell {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.empleado-avatar-small {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    flex-shrink: 0;
}

.empleado-name {
    font-size: 12px;
    color: var(--color-text-secondary);
    font-weight: 500;
}

.sin-asignar {
    color: var(--color-text-muted);
    font-style: italic;
    font-size: 12px;
}

.progress-bar-container {
    width: 100%;
    height: 8px;
    background: var(--color-surface-elevated);
    border-radius: var(--radius-full);
    overflow: hidden;
    border: 1px solid var(--color-border);
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--color-primary), var(--color-secondary));
    border-radius: var(--radius-full);
    transition: width var(--transition-base);
}

.progress-text {
    font-size: 11px;
    color: var(--color-text-muted);
    margin-top: var(--space-xs);
    text-align: center;
}

.action-buttons {
    display: flex;
    gap: var(--space-xs);
    flex-wrap: nowrap;
}

.btn-icon {
    padding: var(--space-xs) var(--space-sm);
    min-width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: 14px;
}

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

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

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

.fecha-cell {
    font-size: 12px;
    color: var(--color-text-secondary);
}

.fecha-urgente {
    color: var(--color-danger);
    font-weight: 600;
}

.fecha-proximo {
    color: var(--color-warning);
    font-weight: 500;
}

/* Toggle button active state */
#btnToggleVista {
    position: relative;
}

#btnToggleVista.active-kanban {
    background: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
}

/* Quick stage selector */
.quick-stage-selector {
    padding: var(--space-md) 0;
}

.stage-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-md);
}

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

.stage-option-btn {
    padding: var(--space-lg);
    background: var(--color-surface-elevated);
    border: 2px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    color: var(--color-text-primary);
    font-family: var(--font-sans);
}

.stage-option-btn:hover {
    background: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stage-option-btn.active {
    background: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
    box-shadow: var(--shadow-md);
}

.kanban-stat-value.warning {
    color: var(--color-warning);
}

/* ============================================
   Detalle Kanban & Asignación Styles
   ============================================ */

.detalle-kanban {
    display: flex;
    flex-direction: column;
    gap: var(--space-xl);
}

.detalle-header {
    padding-bottom: var(--space-lg);
    border-bottom: 1px solid var(--color-border);
}

.detalle-badge {
    display: flex;
    gap: var(--space-md);
    flex-wrap: wrap;
}

.detalle-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-lg);
}

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

.detalle-section {
    background: var(--color-surface-elevated);
    padding: var(--space-lg);
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
}

.detalle-section h4 {
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: var(--space-sm);
}

.detalle-section p {
    font-size: 14px;
    color: var(--color-text-secondary);
    margin: var(--space-xs) 0;
}

.detalle-section strong {
    color: var(--color-text-primary);
    font-weight: 600;
}

.detalle-financiero {
    background: var(--color-surface-elevated);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--space-lg);
}

.fin-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-sm) 0;
    font-size: 14px;
}

.fin-row:not(:last-child) {
    border-bottom: 1px solid var(--color-border);
}

.fin-row span {
    color: var(--color-text-secondary);
}

.fin-row strong {
    font-family: var(--font-mono);
    color: var(--color-text-primary);
    font-size: 16px;
}

.asignacion-info {
    background: var(--color-surface-elevated);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--space-lg);
    margin-bottom: var(--space-xl);
}

.asignacion-info p {
    margin: var(--space-sm) 0;
    font-size: 14px;
    color: var(--color-text-secondary);
}

.asignacion-info strong {
    color: var(--color-text-primary);
    font-weight: 600;
}

/* ============================================
   Kanban Board Styles
   ============================================ */

.kanban-board {
    display: flex;
    gap: var(--space-lg);
    overflow-x: auto;
    padding-bottom: var(--space-lg);
    min-height: 70vh;
}

.kanban-column {
    flex: 0 0 280px;
    background: var(--color-surface-elevated);
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 250px);
}

.kanban-column-header {
    padding: var(--space-lg);
    border-bottom: 2px solid var(--color-border);
    background: var(--color-surface);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 10;
}

.column-title {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-weight: 700;
    font-size: 14px;
    color: var(--color-text-primary);
}

.column-icon {
    font-size: 20px;
}

.column-count {
    background: var(--color-primary);
    color: white;
    border-radius: var(--radius-full);
    padding: var(--space-xs) var(--space-sm);
    font-size: 12px;
    font-weight: 700;
    font-family: var(--font-mono);
    min-width: 24px;
    text-align: center;
}

.kanban-cards {
    padding: var(--space-md);
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    min-height: 200px;
}

.kanban-cards.drag-over {
    background: rgba(37, 99, 235, 0.05);
    border: 2px dashed var(--color-primary);
    border-radius: var(--radius-md);
}

.kanban-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    cursor: grab;
    transition: all var(--transition-fast);
    box-shadow: var(--shadow-sm);
}

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

.kanban-card.dragging {
    opacity: 0.5;
    cursor: grabbing;
    transform: rotate(2deg);
}

.kanban-card-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: var(--space-sm);
}

.kanban-card-id {
    font-size: 11px;
    font-weight: 700;
    color: var(--color-primary);
    font-family: var(--font-mono);
    background: rgba(37, 99, 235, 0.1);
    padding: 2px 8px;
    border-radius: var(--radius-sm);
}

.kanban-card-priority {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
}

.kanban-card-priority.alta {
    background: #FEE2E2;
    color: #991B1B;
}

.kanban-card-priority.media {
    background: #FEF3C7;
    color: #92400E;
}

.kanban-card-priority.baja {
    background: #E0E7FF;
    color: #3730A3;
}

.kanban-card-title {
    font-weight: 700;
    font-size: 14px;
    color: var(--color-text-primary);
    margin-bottom: var(--space-xs);
    line-height: 1.4;
}

.kanban-card-cliente {
    font-size: 13px;
    color: var(--color-text-secondary);
    margin-bottom: var(--space-md);
    display: flex;
    align-items: center;
    gap: var(--space-xs);
}

.kanban-card-info {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
    margin-bottom: var(--space-md);
    padding-top: var(--space-sm);
    border-top: 1px solid var(--color-border);
}

.kanban-info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
}

.kanban-info-label {
    color: var(--color-text-muted);
}

.kanban-info-value {
    font-weight: 600;
    color: var(--color-text-primary);
    font-family: var(--font-mono);
}

.kanban-card-employee {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm);
    background: var(--color-surface-elevated);
    border-radius: var(--radius-sm);
    margin-bottom: var(--space-sm);
    font-size: 12px;
}

.employee-avatar {
    width: 24px;
    height: 24px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 10px;
}

.employee-name {
    font-weight: 600;
    color: var(--color-text-secondary);
    flex: 1;
}

.kanban-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: var(--space-sm);
    border-top: 1px solid var(--color-border);
}

.kanban-card-date {
    font-size: 11px;
    color: var(--color-text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
}

.kanban-card-actions {
    display: flex;
    gap: var(--space-xs);
}

.kanban-card-btn {
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
    font-size: 16px;
    opacity: 0.6;
    transition: all var(--transition-fast);
    border-radius: var(--radius-sm);
}

.kanban-card-btn:hover {
    opacity: 1;
    background: var(--color-surface-elevated);
}

.kanban-empty-state {
    padding: var(--space-xl);
    text-align: center;
    color: var(--color-text-muted);
    font-size: 13px;
}

/* Responsive Kanban */
@media (max-width: 1200px) {
    .kanban-board {
        gap: var(--space-md);
    }
    
    .kanban-column {
        flex: 0 0 240px;
    }
}

@media (max-width: 768px) {
    .kanban-board {
        flex-direction: column;
    }
    
    .kanban-column {
        flex: 1 1 auto;
        max-height: none;
    }
    
    .kanban-cards {
        max-height: 400px;
    }
}

/* ============================================
   Card Detail Modal Styles
   ============================================ */

.card-detail-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-lg);
    margin-bottom: var(--space-lg);
}

.detail-section {
    background: var(--color-surface-elevated);
    padding: var(--space-lg);
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
}

.detail-section h3 {
    font-size: 14px;
    font-weight: 700;
    color: var(--color-text-primary);
    margin-bottom: var(--space-md);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.detail-row {
    display: flex;
    justify-content: space-between;
    padding: var(--space-sm) 0;
    border-bottom: 1px solid var(--color-border);
}

.detail-row:last-child {
    border-bottom: none;
}

.detail-label {
    color: var(--color-text-muted);
    font-size: 13px;
}

.detail-value {
    font-weight: 600;
    color: var(--color-text-primary);
    font-size: 13px;
}

.stage-selector {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-sm);
    margin-top: var(--space-md);
}

.stage-option {
    padding: var(--space-md);
    border: 2px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface);
    cursor: pointer;
    transition: all var(--transition-fast);
    text-align: center;
    font-size: 13px;
    font-weight: 600;
}

.stage-option:hover {
    border-color: var(--color-primary);
    background: rgba(37, 99, 235, 0.05);
}

.stage-option.active {
    background: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
}

.employee-selector {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.employee-option {
    padding: var(--space-md);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface);
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.employee-option:hover {
    border-color: var(--color-primary);
    background: rgba(37, 99, 235, 0.05);
}

.employee-option.selected {
    background: rgba(37, 99, 235, 0.1);
    border-color: var(--color-primary);
}

.employee-option-avatar {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 12px;
}

.employee-option-info {
    flex: 1;
}

.employee-option-name {
    font-weight: 600;
    font-size: 14px;
    color: var(--color-text-primary);
}

.employee-option-role {
    font-size: 12px;
    color: var(--color-text-muted);
}

@media (max-width: 768px) {
    .card-detail-grid {
        grid-template-columns: 1fr;
    }
    
    .stage-selector {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   Configuración
   ============================================ */

.config-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-xl);
}

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

.config-card .card-header {
    padding: var(--space-xl);
    border-bottom: 1px solid var(--color-border);
    background: var(--color-surface-elevated);
}

.config-card .card-header h2 {
    font-size: 16px;
    margin-bottom: var(--space-xs);
    color: var(--color-text-primary);
}

.card-subtitle {
    font-size: 13px;
    color: var(--color-text-muted);
    margin: 0;
}

.config-card .card-body {
    padding: var(--space-xl);
}

.config-options {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    margin-bottom: var(--space-xl);
}

.config-option {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-lg);
    background: var(--color-surface-elevated);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    gap: var(--space-lg);
}

.config-option.danger-zone {
    border-color: #FECACA;
    background: #FFF5F5;
}

.config-option-info {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.config-option-info strong {
    font-size: 14px;
    color: var(--color-text-primary);
}

.config-option-info span {
    font-size: 12px;
    color: var(--color-text-muted);
}

.btn-danger {
    background: var(--color-danger);
    color: white;
    border-color: var(--color-danger);
}

.btn-danger:hover {
    background: #B91C1C;
    border-color: #B91C1C;
}

.system-info {
    background: var(--color-surface-elevated);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--space-lg);
}

.sys-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-sm) 0;
    font-size: 13px;
    border-bottom: 1px solid var(--color-border);
}

.sys-row:last-child { border-bottom: none; }
.sys-row span { color: var(--color-text-muted); }
.sys-row strong { color: var(--color-text-primary); font-family: var(--font-mono); }

/* Factura Preview */
.factura-preview {
    background: white;
    border: 2px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--space-xl);
    display: flex;
    align-items: flex-start;
    gap: var(--space-xl);
    box-shadow: var(--shadow-sm);
}

.fp-logo {
    font-size: 48px;
    flex-shrink: 0;
}

.fp-datos { flex: 1; }

.fp-datos h2 {
    font-size: 20px;
    font-weight: 800;
    color: var(--color-primary);
    margin-bottom: var(--space-xs);
}

.fp-slogan {
    font-size: 13px;
    color: var(--color-text-muted);
    margin-bottom: var(--space-md);
    font-style: italic;
}

.fp-contacto {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-md);
    font-size: 12px;
    color: var(--color-text-secondary);
    margin-bottom: var(--space-sm);
}

.fp-rnc {
    font-size: 12px;
    color: var(--color-text-muted);
    font-family: var(--font-mono);
}

/* ============================================
   Formulario Nuevo Pedido — Mejoras
   ============================================ */

/* Separadores de sección dentro del formulario */
.form-section-title {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--color-primary);
    padding: var(--space-md) 0 var(--space-xs);
    border-bottom: 2px solid var(--color-primary);
    margin: var(--space-lg) 0 var(--space-md);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.form-section-title:first-child {
    margin-top: 0;
}

/* Input con botón al lado */
.input-with-btn {
    display: flex;
    gap: var(--space-sm);
    align-items: stretch;
}

.input-with-btn input {
    flex: 1;
    min-width: 0;
}

.btn-sm-icon {
    padding: 0 var(--space-md) !important;
    white-space: nowrap;
    flex-shrink: 0;
    font-size: 13px;
}

/* Hint debajo del campo cliente */
.field-hint {
    display: block;
    margin-top: var(--space-xs);
    font-size: 12px;
    min-height: 16px;
    color: var(--color-success);
    transition: color var(--transition-fast);
}

/* Textarea de notas — más espacio */
#pedidoNotas {
    font-family: var(--font-sans);
    line-height: 1.6;
    resize: vertical;
    min-height: 100px;
}

/* ── Zona de archivos adjuntos ── */
.archivos-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-lg);
    margin-bottom: var(--space-lg);
}

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

.archivo-zone {
    border: 2px dashed var(--color-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: border-color var(--transition-fast), background var(--transition-fast);
    background: var(--color-surface-elevated);
}

.archivo-zone:hover {
    border-color: var(--color-primary);
    background: rgba(37, 99, 235, 0.03);
}

.archivo-zone.has-files {
    border-color: var(--color-success);
    border-style: solid;
    background: rgba(5, 150, 105, 0.03);
}

.archivo-zone-inner {
    padding: var(--space-xl) var(--space-lg);
    text-align: center;
    cursor: pointer;
    user-select: none;
}

.archivo-zone-inner:hover .archivo-icon {
    transform: scale(1.15);
}

.archivo-icon {
    font-size: 36px;
    display: block;
    margin-bottom: var(--space-sm);
    transition: transform var(--transition-fast);
}

.archivo-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text-primary);
    margin: 0 0 var(--space-xs);
}

.archivo-hint {
    font-size: 11px;
    color: var(--color-text-muted);
    margin: 0;
}

/* Grid de previsualizaciones de imágenes */
.archivo-preview-grid {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
    padding: 0 var(--space-md) var(--space-md);
}

.archivo-thumb {
    position: relative;
    width: 72px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.archivo-thumb img {
    width: 72px;
    height: 72px;
    object-fit: cover;
    border-radius: var(--radius-md);
    border: 2px solid var(--color-border);
    cursor: zoom-in;
    transition: transform var(--transition-fast), border-color var(--transition-fast);
}

.archivo-thumb img:hover {
    transform: scale(1.06);
    border-color: var(--color-primary);
}

.archivo-thumb-pdf {
    width: 72px;
    height: 72px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-surface-elevated);
    border: 2px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: 28px;
}

.archivo-thumb span {
    font-size: 10px;
    color: var(--color-text-muted);
    text-align: center;
    max-width: 72px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.archivo-thumb button {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--color-danger);
    color: white;
    border: none;
    cursor: pointer;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    padding: 0;
    transition: background var(--transition-fast);
}

.archivo-thumb button:hover {
    background: #991B1B;
}

/* ── Totales mejorados ── */
.totales-pedido {
    background: linear-gradient(135deg, var(--color-surface-elevated), #F0F4FF);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    margin: var(--space-lg) 0;
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.total-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
}

.total-item span {
    color: var(--color-text-secondary);
}

.total-item strong {
    font-family: var(--font-mono);
    font-size: 15px;
}

/* ============================================
   Factura Mejorada
   ============================================ */

.factura-empresa-header {
    display: flex;
    align-items: flex-start;
    gap: var(--space-xl);
    padding-bottom: var(--space-xl);
    border-bottom: 2px solid var(--color-primary);
    margin-bottom: var(--space-xl);
}

.feh-logo { font-size: 48px; flex-shrink: 0; }

.feh-info { flex: 1; }
.feh-info h2 { font-size: 20px; font-weight: 800; color: var(--color-primary); margin-bottom: 4px; }

.feh-slogan { font-size: 12px; color: var(--color-text-muted); font-style: italic; margin: 0 0 8px; }

.feh-contacto {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-md);
    font-size: 12px;
    color: var(--color-text-secondary);
    margin-bottom: 4px;
}

.feh-rnc { font-size: 11px; color: var(--color-text-muted); font-family: var(--font-mono); margin: 0; }

.feh-numero {
    text-align: right;
    flex-shrink: 0;
}

.feh-badge {
    background: var(--color-primary);
    color: white;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: var(--radius-sm);
    letter-spacing: 1px;
    display: inline-block;
    margin-bottom: 6px;
}

.feh-id {
    font-size: 22px;
    font-weight: 800;
    font-family: var(--font-mono);
    color: var(--color-primary);
    line-height: 1.2;
}

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

.factura-datos-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
}

@media (max-width: 600px) {
    .factura-datos-grid { grid-template-columns: 1fr; }
    .factura-empresa-header { flex-direction: column; }
    .feh-numero { text-align: left; }
}

.factura-section {
    background: var(--color-surface-elevated);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--space-md) var(--space-lg);
}

.factura-section h4 {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--color-text-muted);
    margin-bottom: var(--space-xs);
}

.factura-section p { margin: 0; font-size: 14px; color: var(--color-text-primary); }
.factura-section .text-muted { color: var(--color-text-muted); }

.factura-notas {
    grid-column: 1 / -1;
    margin-bottom: var(--space-lg);
}

.notas-box {
    background: #FFFBEB;
    border: 1px solid #FDE68A;
    border-radius: var(--radius-md);
    padding: var(--space-md) var(--space-lg);
    font-size: 13px;
    line-height: 1.7;
    color: var(--color-text-secondary);
    white-space: pre-wrap;
}

.factura-table {
    width: 100%;
    border-collapse: collapse;
    margin: var(--space-lg) 0;
    font-size: 14px;
}

.factura-table thead th {
    background: var(--color-surface-elevated);
    padding: var(--space-sm) var(--space-md);
    border: 1px solid var(--color-border);
    font-size: 12px;
    font-weight: 700;
    color: var(--color-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.factura-table tbody td {
    padding: var(--space-md);
    border: 1px solid var(--color-border);
    color: var(--color-text-primary);
}

.factura-totales {
    max-width: 340px;
    margin-left: auto;
    background: var(--color-surface-elevated);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-bottom: var(--space-lg);
}

.total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-sm) var(--space-lg);
    font-size: 14px;
    border-bottom: 1px solid var(--color-border);
}

.total-row:last-child { border-bottom: none; }
.total-row span { color: var(--color-text-secondary); font-size: 13px; }

.total-row.total-grande {
    background: var(--color-primary);
    color: white;
}
.total-row.total-grande span,
.total-row.total-grande strong { color: white; font-size: 16px; }

.total-row.pago-row small {
    display: block;
    font-size: 11px;
    color: var(--color-text-muted);
    font-weight: 400;
}

.total-row.saldo-pagado { background: #D1FAE5; }
.total-row.saldo-pagado span,
.total-row.saldo-pagado strong { color: #065F46; }

.total-row.saldo-pendiente { background: #FEF3C7; }
.total-row.saldo-pendiente span,
.total-row.saldo-pendiente strong { color: #92400E; }

.factura-fotos {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
    margin-top: var(--space-sm);
}

.factura-foto-thumb {
    width: 90px;
    height: 90px;
    object-fit: cover;
    border-radius: var(--radius-md);
    border: 2px solid var(--color-border);
    cursor: zoom-in;
    transition: transform var(--transition-fast), border-color var(--transition-fast);
}

.factura-foto-thumb:hover {
    transform: scale(1.05);
    border-color: var(--color-primary);
}

.factura-foto-pdf {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: var(--space-md);
    background: var(--color-surface-elevated);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: 28px;
}

.factura-foto-pdf span {
    font-size: 10px;
    color: var(--color-text-muted);
    max-width: 80px;
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
}

.factura-pie {
    border-top: 1px dashed var(--color-border);
    margin-top: var(--space-xl);
    padding-top: var(--space-md);
    font-size: 12px;
    color: var(--color-text-muted);
    text-align: center;
    font-style: italic;
}

@media print {
    .no-print { display: none !important; }
    .modal-content { box-shadow: none; border: none; }
    body { background: white; }
}

/* ============================================
   Compras Inteligentes
   ============================================ */

.compras-filtros {
    background: var(--color-surface-elevated);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    margin-bottom: var(--space-xl);
}

.compras-filtros .filter-group {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    flex-wrap: wrap;
}

.compras-filtros label {
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text-secondary);
}

.compras-filtros input[type="date"] {
    padding: var(--space-sm) var(--space-md);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: 13px;
}

.compras-resumen {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-lg);
    margin-bottom: var(--space-xl);
}

.compra-stat-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    display: flex;
    align-items: center;
    gap: var(--space-md);
    box-shadow: var(--shadow-sm);
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.compra-stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.compra-stat-card.urgente {
    border-color: var(--color-danger);
    background: #FFF5F5;
}

.stat-icon {
    font-size: 32px;
    flex-shrink: 0;
}

.stat-info {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.stat-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--color-text-muted);
}

.stat-value {
    font-size: 28px;
    font-weight: 800;
    font-family: var(--font-mono);
    color: var(--color-primary);
}

.compra-stat-card.urgente .stat-value {
    color: var(--color-danger);
}

.compras-table .row-urgente {
    background: #FFF5F5;
}

.compras-table .row-urgente:hover {
    background: #FEE2E2;
}

.urgencia-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 700;
    font-family: var(--font-mono);
}

.badge-urgente {
    background: #FEE2E2;
    color: #991B1B;
    border: 1px solid #FECACA;
}

.badge-proximo {
    background: #FEF3C7;
    color: #92400E;
    border: 1px solid #FDE68A;
}

.badge-normal {
    background: #E0E7FF;
    color: #3730A3;
    border: 1px solid #C7D2FE;
}

@media (max-width: 768px) {
    .compras-filtros .filter-group {
        flex-direction: column;
        align-items: stretch;
    }
    .compras-resumen {
        grid-template-columns: 1fr;
    }
}

/* Full width sections in detail modal */
.detalle-section.full-width {
    grid-column: 1 / -1;
}

/* ============================================
   Formulario Nuevo Pedido - Múltiples Productos
   ============================================ */

.cliente-info-box {
    background: var(--color-surface-elevated);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    margin-top: var(--space-sm);
    font-size: 13px;
    line-height: 1.6;
}

.cliente-info-box div {
    margin: 2px 0;
}

.producto-add-section {
    background: var(--color-surface-elevated);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    margin-bottom: var(--space-lg);
}

.productos-lista-pedido {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.producto-item-pedido {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.producto-item-pedido:hover {
    background: var(--color-surface-elevated);
    box-shadow: var(--shadow-sm);
}

.pip-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.pip-info strong {
    font-size: 14px;
    color: var(--color-text-primary);
}

.pip-info span {
    font-size: 13px;
    color: var(--color-text-secondary);
    font-family: var(--font-mono);
}

.pip-info small {
    font-size: 11px;
}

.btn-danger-icon {
    background: #FEE2E2;
    border-color: #FECACA;
    color: #991B1B;
}

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

@media (max-width: 768px) {
    .producto-add-section .form-grid {
        grid-template-columns: 1fr !important;
    }
}

/* Kanban - Lista mini de productos */
.kanban-card-productos-mini {
    font-size: 10px;
    color: var(--color-text-muted);
    margin-top: 4px;
    padding: 4px 8px;
    background: var(--color-surface-elevated);
    border-radius: var(--radius-sm);
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}


/* ============================================
   DARK MODE
   ============================================ */

body.dark-mode {
    --color-bg: #0F172A;
    --color-surface: #1E293B;
    --color-surface-elevated: #293548;
    --color-border: #334155;
    --color-border-light: #475569;
    --color-text-primary: #F1F5F9;
    --color-text-secondary: #CBD5E1;
    --color-text-muted: #94A3B8;
    --color-text-disabled: #64748B;
    --shadow-sm: 0 1px 2px rgba(0,0,0,.3);
    --shadow-md: 0 4px 6px rgba(0,0,0,.4);
    --shadow-lg: 0 10px 15px rgba(0,0,0,.5);
    --shadow-xl: 0 20px 25px rgba(0,0,0,.6);
}

body.dark-mode .sidebar {
    background: #1E293B;
    border-color: #334155;
}

body.dark-mode .stat-card,
body.dark-mode .card {
    background: #1E293B;
    border-color: #334155;
}

body.dark-mode .modal-content {
    background: #1E293B;
    border-color: #334155;
}

body.dark-mode .modal-header {
    background: #293548;
    border-color: #334155;
}

body.dark-mode input,
body.dark-mode select,
body.dark-mode textarea {
    background: #0F172A;
    border-color: #475569;
    color: #F1F5F9;
}

body.dark-mode input:focus,
body.dark-mode select:focus,
body.dark-mode textarea:focus {
    border-color: var(--color-primary-light);
    background: #0F172A;
}

body.dark-mode table thead tr {
    background: #293548;
}

body.dark-mode tbody tr:hover {
    background: #293548;
}

body.dark-mode .nav-item:hover {
    background: rgba(255,255,255,.05);
}

body.dark-mode .nav-item.active {
    background: rgba(37,99,235,.25);
}

body.dark-mode .header {
    background: #1E293B;
    border-color: #334155;
}

body.dark-mode .toast {
    background: #1E293B;
    border-color: #334155;
    color: #F1F5F9;
}

/* Dark mode toggle button */
.dark-mode-btn {
    display: block;
    width: 100%;
    padding: 0.5rem;
    margin-bottom: 0.75rem;
    background: transparent;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 18px;
    transition: background var(--transition-fast);
    color: var(--color-text-secondary);
}

.dark-mode-btn:hover {
    background: var(--color-surface-elevated);
}

/* ============================================
   CONFIRM DIALOG
   ============================================ */

.confirm-dialog-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 1rem 0 1.5rem;
    gap: 1rem;
}

.confirm-icon {
    font-size: 3rem;
    line-height: 1;
}

.confirm-message {
    font-size: 1rem;
    color: var(--color-text-secondary);
    max-width: 340px;
    line-height: 1.6;
}


/* ============================================
   AUTH — HIDE APP UNTIL LOGGED IN
   ============================================ */

body.auth-pending .sidebar,
body.auth-pending .main-content,
body.auth-pending #mobileMenuToggle {
    display: none !important;
}

/* ============================================
   AUTH — LOGIN SCREEN
   ============================================ */

.login-screen {
    position: fixed;
    inset: 0;
    background: linear-gradient(135deg, #0F172A 0%, #1E1B4B 50%, #0F172A 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    padding: 1rem;
    overflow-y: auto;
}

.login-screen::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
        radial-gradient(ellipse 80% 50% at 20% 40%, rgba(37,99,235,0.15) 0%, transparent 60%),
        radial-gradient(ellipse 60% 40% at 80% 70%, rgba(124,58,237,0.12) 0%, transparent 60%);
    pointer-events: none;
}

.login-card {
    background: rgba(30, 41, 59, 0.95);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 20px;
    padding: 2.5rem 2rem;
    width: 100%;
    max-width: 420px;
    backdrop-filter: blur(20px);
    box-shadow:
        0 0 0 1px rgba(255,255,255,0.05),
        0 25px 50px rgba(0,0,0,0.5),
        0 0 80px rgba(37,99,235,0.1);
    position: relative;
    z-index: 1;
    animation: loginSlideUp 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes loginSlideUp {
    from { opacity: 0; transform: translateY(30px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.login-shake {
    animation: loginShake 0.4s cubic-bezier(.36,.07,.19,.97);
}
@keyframes loginShake {
    10%, 90%  { transform: translateX(-3px); }
    20%, 80%  { transform: translateX(5px); }
    30%, 50%, 70% { transform: translateX(-5px); }
    40%, 60%  { transform: translateX(5px); }
}

.login-logo {
    text-align: center;
    margin-bottom: 2rem;
}

.login-logo-icon {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, #2563EB, #7C3AED);
    border-radius: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    font-weight: 900;
    color: white;
    font-family: 'Courier New', monospace;
    letter-spacing: -2px;
    margin-bottom: 1rem;
    box-shadow: 0 8px 20px rgba(37,99,235,0.4);
}

.login-title {
    font-size: 1.75rem;
    font-weight: 800;
    background: linear-gradient(135deg, #60A5FA, #A78BFA);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 0 0 0.25rem;
}

.login-subtitle {
    font-size: 0.875rem;
    color: #94A3B8;
    margin: 0;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.login-field label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #CBD5E1;
    margin-bottom: 0.5rem;
    letter-spacing: 0.025em;
}

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

.login-input-icon {
    position: absolute;
    left: 0.875rem;
    font-size: 16px;
    pointer-events: none;
    z-index: 1;
}

.login-input-wrap input {
    width: 100%;
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 10px;
    padding: 0.75rem 2.75rem 0.75rem 2.75rem;
    font-size: 0.9375rem;
    color: #F1F5F9;
    transition: border-color 0.2s, box-shadow 0.2s;
    font-family: inherit;
    -webkit-text-fill-color: #F1F5F9;
}

.login-input-wrap input::placeholder { color: #475569; }

.login-input-wrap input:focus {
    outline: none;
    border-color: #3B82F6;
    box-shadow: 0 0 0 3px rgba(59,130,246,0.2);
    background: rgba(15, 23, 42, 1);
}

.login-toggle-pw {
    position: absolute;
    right: 0.75rem;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    padding: 0.25rem;
    opacity: 0.6;
    transition: opacity 0.2s;
}
.login-toggle-pw:hover { opacity: 1; }

.login-error {
    background: rgba(239,68,68,0.12);
    border: 1px solid rgba(239,68,68,0.3);
    border-radius: 8px;
    padding: 0.625rem 0.875rem;
    font-size: 0.8125rem;
    color: #FCA5A5;
    text-align: center;
    animation: fadeIn 0.2s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.login-btn {
    width: 100%;
    padding: 0.875rem;
    font-size: 0.9375rem;
    font-weight: 700;
    letter-spacing: 0.025em;
    border-radius: 10px;
    background: linear-gradient(135deg, #2563EB, #7C3AED);
    border: none;
    color: white;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.15s, box-shadow 0.2s;
    box-shadow: 0 4px 15px rgba(37,99,235,0.4);
    margin-top: 0.25rem;
}
.login-btn:hover:not(:disabled) {
    opacity: 0.95;
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(37,99,235,0.5);
}
.login-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.login-hint {
    text-align: center;
    font-size: 0.75rem;
    color: #475569;
    margin: 1.25rem 0 0;
    padding-top: 1.25rem;
    border-top: 1px solid rgba(255,255,255,0.06);
}
.login-hint strong { color: #94A3B8; }

/* ============================================
   AUTH — SIDEBAR FOOTER ACTIONS
   ============================================ */

.sidebar-footer-actions {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--color-border);
}

.footer-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.5rem 0.75rem;
    background: transparent;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 0.8125rem;
    color: var(--color-text-secondary);
    transition: background 0.15s, color 0.15s;
    text-align: left;
    font-family: inherit;
}
.footer-btn:hover {
    background: var(--color-surface-elevated);
    color: var(--color-text-primary);
}
.footer-btn-logout {
    color: #EF4444;
}
.footer-btn-logout:hover {
    background: rgba(239,68,68,0.1);
    color: #EF4444;
}

/* ============================================
   AUTH — USER MANAGEMENT
   ============================================ */

.user-avatar-badge {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.role-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.roles-legend {
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--color-border);
}
.roles-legend h4 {
    font-size: 0.875rem;
    margin-bottom: 0.875rem;
    color: var(--color-text-secondary);
}

.roles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 0.75rem;
}

.role-card {
    background: var(--color-surface-elevated);
    border-radius: var(--radius-md);
    padding: 0.75rem;
}
.role-card-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}
.role-card-sections {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}
.section-tag {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 1px 6px;
    font-size: 0.6875rem;
    color: var(--color-text-muted);
}

/* ============================================
   DARK MODE — AUTH ADDITIONS
   ============================================ */
body.dark-mode .login-input-wrap input {
    background: rgba(0,0,0,0.4);
    border-color: rgba(255,255,255,0.08);
}
body.dark-mode .role-card {
    background: #293548;
}


/* ============================================
   REPORTES — ENHANCED STYLES
   ============================================ */

.report-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 0;
    border-bottom: 1px solid var(--color-border-light);
}
.report-item:last-child { border-bottom: none; }

.report-item-rank {
    width: 24px;
    height: 24px;
    background: var(--color-primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    flex-shrink: 0;
}

.report-item-info {
    flex: 1;
    min-width: 0;
}

.report-item-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 4px;
}

.report-bar-wrap {
    height: 5px;
    background: var(--color-border-light);
    border-radius: 3px;
    overflow: hidden;
}

.report-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--color-primary), var(--color-secondary));
    border-radius: 3px;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.report-bar-clients {
    background: linear-gradient(90deg, #059669, #10b981);
}

.report-item-value {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--color-primary);
    flex-shrink: 0;
    min-width: 80px;
    text-align: right;
}

/* Dark mode overrides */
body.dark-mode .report-bar-wrap {
    background: rgba(255,255,255,0.1);
}

/* ============================================
   PEDIDO FORM — CLIENTE SEARCH + PRODUCT LIST
   ============================================ */

/* Cliente search bar */
.cliente-search-wrap {
    flex: 1;
}
.cliente-search-wrap input {
    width: 100%;
}

/* Multi-row select for clients */
.cliente-select-list {
    width: 100%;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface);
    color: var(--color-text-primary);
    font-size: 0.875rem;
    padding: 0;
    min-height: 100px;
    max-height: 140px;
    overflow-y: auto;
}
.cliente-select-list option {
    padding: 6px 10px;
    cursor: pointer;
    border-bottom: 1px solid var(--color-border-light);
}
.cliente-select-list option:checked {
    background: var(--color-primary);
    color: white;
}

/* Product add grid */
.prod-add-grid {
    grid-template-columns: 2fr 1fr 1fr !important;
}

/* Product item in order list */
.pip-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--color-border);
}

.productos-lista-pedido {
    display: flex;
    flex-direction: column;
    gap: 0;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.producto-item-pedido {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border-light);
    transition: background 0.15s;
}
.producto-item-pedido:last-child { border-bottom: none; }
.producto-item-pedido:hover { background: var(--color-surface-elevated); }

.pip-num {
    width: 24px;
    height: 24px;
    background: var(--color-primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    flex-shrink: 0;
}

.pip-info {
    flex: 1;
    min-width: 0;
}

.pip-nombre {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--color-text-primary);
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 2px;
}

.pip-tag-manual {
    font-size: 10px;
    font-weight: 500;
    background: rgba(124,58,237,0.12);
    color: #7C3AED;
    border-radius: 20px;
    padding: 1px 7px;
}

/* Tag de variante — mismo producto, precio/especificación diferente */
.pip-tag-variante {
    font-size: 10px;
    font-weight: 600;
    background: rgba(249,115,22,0.12);
    color: #C2410C;
    border: 1px solid rgba(249,115,22,0.25);
    border-radius: 20px;
    padding: 1px 8px;
    white-space: nowrap;
}

.pip-calc {
    font-size: 0.8rem;
    color: var(--color-text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.pip-stock {
    font-size: 10px;
    background: rgba(245,158,11,0.12);
    color: #D97706;
    border-radius: 4px;
    padding: 1px 5px;
}
.pip-stock-empty {
    background: rgba(239,68,68,0.12);
    color: #EF4444;
}

.pip-notas {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    margin-top: 3px;
    font-style: italic;
}

.pip-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.pip-qty-btn {
    width: 26px;
    height: 26px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
    background: var(--color-surface-elevated);
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-primary);
    transition: background 0.15s;
    line-height: 1;
    padding: 0;
}
.pip-qty-btn:hover {
    background: var(--color-border);
}

.pip-qty-val {
    min-width: 24px;
    text-align: center;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--color-text-primary);
}

/* Dark mode */
body.dark-mode .cliente-select-list {
    background: #1E293B;
    border-color: rgba(255,255,255,0.1);
    color: #F1F5F9;
}
body.dark-mode .cliente-select-list option:checked {
    background: #2563EB;
}
body.dark-mode .producto-item-pedido {
    background: #1E293B;
}
body.dark-mode .producto-item-pedido:hover {
    background: #293548;
}
body.dark-mode .pip-qty-btn {
    background: #293548;
    border-color: rgba(255,255,255,0.1);
    color: #F1F5F9;
}

/* ============================================
   DESCUENTO ROW
   ============================================ */

.descuento-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    background: rgba(5, 150, 105, 0.06);
    border: 1px solid rgba(5, 150, 105, 0.2);
    border-radius: var(--radius-md);
    margin-bottom: 0.75rem;
}

.descuento-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--color-text-primary);
    white-space: nowrap;
    min-width: 90px;
}

.descuento-inputs {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.descuento-pct-wrap {
    position: relative;
    width: 80px;
}

.descuento-pct-wrap input {
    width: 100%;
    padding-right: 2rem;
    text-align: right;
    font-weight: 700;
    font-size: 1rem;
}

.descuento-pct-sign {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    font-weight: 700;
    color: var(--color-success);
    pointer-events: none;
}

.descuento-sep {
    color: var(--color-text-muted);
    font-size: 1rem;
}

.descuento-monto {
    font-weight: 700;
    color: var(--color-success);
    font-size: 0.9375rem;
    min-width: 80px;
}

.descuento-presets {
    display: flex;
    gap: 0.375rem;
    flex-wrap: wrap;
    margin-left: auto;
}

.descuento-preset {
    padding: 3px 10px;
    border-radius: 20px;
    border: 1px solid var(--color-border);
    background: var(--color-surface-elevated);
    color: var(--color-text-secondary);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    font-family: inherit;
}
.descuento-preset:hover {
    border-color: var(--color-success);
    color: var(--color-success);
    background: rgba(5, 150, 105, 0.08);
}
.descuento-preset-active {
    border-color: var(--color-success) !important;
    background: var(--color-success) !important;
    color: white !important;
}

/* Dark mode */
body.dark-mode .descuento-row {
    background: rgba(5, 150, 105, 0.08);
    border-color: rgba(5, 150, 105, 0.25);
}
body.dark-mode .descuento-preset {
    background: #293548;
    border-color: rgba(255,255,255,0.1);
    color: #94A3B8;
}

/* ============================================
   ENVÍOS — UPDATED STYLES
   ============================================ */

/* Info bar at top of envio modal */
.envio-info {
    display: flex !important;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding: 0.75rem 1rem !important;
    background: var(--color-surface-elevated) !important;
    border-radius: var(--radius-md) !important;
    margin-bottom: 1.25rem !important;
    border: 1px solid var(--color-border) !important;
}

.envio-info-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 120px;
}

.envio-info-item span {
    font-size: 0.7rem;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.envio-info-item strong {
    font-size: 0.875rem;
    color: var(--color-text-primary);
}

/* ============================================
   COMPRAS INTELIGENTES — LAYOUT & COMPONENTS
   ============================================ */

/* 2-column layout */
.compras-layout {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: var(--space-lg);
    align-items: start;
}

@media (max-width: 1100px) {
    .compras-layout { grid-template-columns: 1fr; }
    .compras-sidebar { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-md); }
}

@media (max-width: 640px) {
    .compras-sidebar { grid-template-columns: 1fr; }
}

/* Stats bar (rendered by JS) */
.compras-stats-bar {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
}

.compras-stat {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    background: var(--color-surface-elevated);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-md) var(--space-lg);
    flex: 1;
    min-width: 140px;
}

.urgente-stat {
    border-color: #FECACA;
    background: #FFF5F5;
}

.cs-icon { font-size: 26px; flex-shrink: 0; }
.cs-val  { font-size: 22px; font-weight: 800; font-family: var(--font-mono); color: var(--color-primary); line-height: 1; }
.cs-lbl  { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--color-text-muted); }

/* Alertas */
.compra-alerta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    padding: 10px 14px;
    border-radius: var(--radius-md);
    margin-bottom: 8px;
    font-size: 13px;
}
.alerta-danger  { background: #FEE2E2; border: 1px solid #FECACA; color: #991B1B; }
.alerta-warning { background: #FFEDD5; border: 1px solid #FED7AA; color: #9A3412; }
.alerta-info    { background: #EFF6FF; border: 1px solid #BFDBFE; color: #1E40AF; }
.alerta-tag { background: white; border-radius: 20px; padding: 1px 8px; font-size: 11px; font-weight: 600; border: 1px solid currentColor; }

/* Table cells */
.material-cell { display: flex; flex-direction: column; gap: 2px; }
.material-cell strong { font-size: 13px; }
.material-cell small  { font-size: 11px; color: var(--color-text-muted); }
.notas-mini           { color: var(--color-primary) !important; }

.pedidos-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.pedido-tag   { background: var(--color-primary-light, #EFF6FF); color: var(--color-primary); border: 1px solid var(--color-primary); border-radius: 4px; padding: 2px 6px; font-size: 11px; font-weight: 700; cursor: pointer; white-space: nowrap; }
.pedido-tag:hover { background: var(--color-primary); color: white; }
.pedido-tag-more { font-size: 11px; color: var(--color-text-muted); align-self: center; }

.cant-necesaria { font-size: 15px; font-weight: 800; }
.stock-ok       { color: var(--color-success); font-weight: 700; }
.stock-cero     { color: var(--color-danger); font-weight: 700; }
.cant-comprar   { font-size: 16px; font-weight: 800; color: var(--color-primary); }
.costo-est      { color: var(--color-text-muted); font-size: 11px; }
.ya-suficiente  { color: var(--color-success); font-size: 12px; font-weight: 600; }
.dias-neg       { color: var(--color-danger); font-size: 11px; font-weight: 700; }
.dias-pos       { color: var(--color-text-muted); font-size: 11px; }
.fecha-limite-cell { font-size: 12px; font-weight: 600; }

/* Urgencia badge variants */
.urg-vencido { background: #FEE2E2; color: #991B1B; border: 1px solid #FECACA; }
.urg-hoy     { background: #FEE2E2; color: #991B1B; border: 1px solid #FECACA; }
.urg-critico { background: #FFEDD5; color: #9A3412; border: 1px solid #FED7AA; }
.urg-alto    { background: #FEF3C7; color: #92400E; border: 1px solid #FDE68A; }
.urg-normal  { background: #D1FAE5; color: #065F46; border: 1px solid #A7F3D0; }

/* Estado select */
.estado-select {
    font-size: 12px;
    padding: 3px 6px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    color: var(--color-text-primary);
    cursor: pointer;
    width: 100%;
    max-width: 130px;
}

/* Sidebar cards */
.sidebar-card { overflow: hidden; }

/* Pedidos por día */
.dia-grupo { margin-bottom: 8px; }
.dia-urgente .dia-header { background: #FEE2E2; color: #991B1B; border-radius: var(--radius-sm); }
.dia-header { display: flex; justify-content: space-between; padding: 5px 8px; background: var(--color-surface-elevated); border-radius: var(--radius-sm); margin-bottom: 4px; }
.dia-fecha  { font-size: 12px; font-weight: 700; }
.dia-count  { font-size: 11px; opacity: 0.7; }

.dia-pedido {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 6px 8px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    border-left: 3px solid var(--color-primary);
    margin-bottom: 4px;
    background: var(--color-surface);
    transition: background 0.15s;
}
.dia-pedido:hover { background: var(--color-surface-elevated); }
.dp-id      { font-size: 11px; font-weight: 700; color: var(--color-primary); }
.dp-producto{ font-size: 12px; font-weight: 600; }
.dp-cliente { font-size: 11px; color: var(--color-text-muted); }
.dp-cantidad{ font-size: 11px; color: var(--color-text-muted); }
.dp-etapa   { font-size: 10px; background: var(--color-surface-elevated); border-radius: 10px; padding: 1px 6px; align-self: flex-start; color: var(--color-text-secondary); }

.dp-info { display: flex; flex-direction: column; gap: 1px; }

/* Suplidores */
.suplidor-item { display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: var(--radius-sm); margin-bottom: 4px; }
.suplidor-item:hover { background: var(--color-surface-elevated); }
.sup-avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--color-primary); color: white; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; flex-shrink: 0; }
.sup-info   { flex: 1; min-width: 0; }
.sup-nombre { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sup-contacto { font-size: 11px; color: var(--color-text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.empty-sidebar { font-size: 13px; color: var(--color-text-muted); text-align: center; padding: var(--space-lg); }

/* Dark mode */
body.dark-mode .urgente-stat    { background: rgba(239,68,68,.1); border-color: rgba(239,68,68,.3); }
body.dark-mode .alerta-danger   { background: rgba(239,68,68,.1); border-color: rgba(239,68,68,.3); color: #FCA5A5; }
body.dark-mode .alerta-warning  { background: rgba(234,88,12,.1);  border-color: rgba(234,88,12,.3);  color: #FDBA74; }
body.dark-mode .alerta-info     { background: rgba(37,99,235,.1);  border-color: rgba(37,99,235,.3);  color: #93C5FD; }
body.dark-mode .pedido-tag      { background: rgba(37,99,235,.15); border-color: rgba(37,99,235,.4); }
body.dark-mode .compras-stat    { background: #1E293B; border-color: #334155; }
body.dark-mode .estado-select   { background: #1E293B; border-color: #334155; color: #E2E8F0; }
body.dark-mode .dia-pedido      { background: #1E293B; border-color: #3B82F6; }
body.dark-mode .dia-urgente .dia-header { background: rgba(239,68,68,.15); }
body.dark-mode .suplidor-item:hover { background: #1E293B; }

/* ============================================
   ENVÍO COTIZACIÓN EN NUEVO PEDIDO
   ============================================ */

.envio-cotizacion-wrap {
    background: rgba(37, 99, 235, 0.04);
    border: 1px solid rgba(37, 99, 235, 0.2);
    border-radius: var(--radius-md);
    padding: 1rem;
    margin-bottom: var(--space-md);
}

.envio-toggle-label {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9375rem;
    color: var(--color-text-primary);
    user-select: none;
}

.envio-toggle-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--color-primary);
}

.envio-costo-nota {
    margin-top: 0.75rem;
    padding: 0.625rem 0.875rem;
    background: rgba(37, 99, 235, 0.08);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    color: var(--color-primary);
    border: 1px solid rgba(37, 99, 235, 0.2);
}

/* Detalle envío cotizado en modal */
.detalle-envio-cotizado {
    background: rgba(37, 99, 235, 0.05);
    border: 1px solid rgba(37, 99, 235, 0.18);
    border-radius: var(--radius-md);
    padding: 0.875rem 1rem;
    margin-top: 0.75rem;
}

.dec-title {
    font-size: 0.8125rem;
    font-weight: 700;
    color: var(--color-primary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.625rem;
}

.dec-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.375rem 1rem;
}

.dec-grid > div {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.dec-grid span {
    font-size: 0.6875rem;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.dec-grid strong {
    font-size: 0.875rem;
    color: var(--color-text-primary);
}

/* Dark mode */
body.dark-mode .envio-cotizacion-wrap   { background: rgba(37,99,235,.08); border-color: rgba(37,99,235,.25); }
body.dark-mode .envio-costo-nota        { background: rgba(37,99,235,.12); border-color: rgba(37,99,235,.3); }
body.dark-mode .detalle-envio-cotizado  { background: rgba(37,99,235,.08); border-color: rgba(37,99,235,.25); }

/* ── Manual material badge ── */
.manual-badge {
    display: inline-block;
    background: #F0FDF4;
    color: #166534;
    border: 1px solid #BBF7D0;
    border-radius: 12px;
    padding: 3px 8px;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
}
body.dark-mode .manual-badge {
    background: rgba(22,101,52,.2);
    border-color: rgba(74,222,128,.3);
    color: #86EFAC;
}

/* ── Archivo placeholders (IndexedDB lazy load) ── */
.archivo-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 80px;
    min-height: 80px;
    background: var(--color-bg-secondary, #f8fafc);
    border: 1px dashed var(--color-border, #e2e8f0);
    border-radius: 8px;
    font-size: 11px;
    color: var(--color-text-muted, #64748b);
    text-align: center;
    padding: 6px;
    gap: 4px;
}
.arch-loading {
    font-size: 20px;
    animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
body.dark-mode .archivo-placeholder {
    background: rgba(255,255,255,.05);
    border-color: rgba(255,255,255,.1);
}

/* ============================================
   Cotizaciones Module Styles
   ============================================ */

.cot-estado-pendiente  { background:#FEF3C7; color:#92400E; border:1px solid #FDE68A; }
.cot-estado-aprobada   { background:#D1FAE5; color:#065F46; border:1px solid #A7F3D0; }
.cot-estado-rechazada  { background:#FEE2E2; color:#991B1B; border:1px solid #FECACA; }
.cot-estado-convertida { background:#DBEAFE; color:#1E40AF; border:1px solid #BFDBFE; }
.cot-estado-vencida    { background:#F3F4F6; color:#6B7280; border:1px solid #E5E7EB; }

/* WhatsApp button */
.btn-whatsapp {
    background: #25D366;
    color: white;
    border: none;
    border-radius: var(--radius-md);
    padding: 10px 18px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: background 0.2s;
}
.btn-whatsapp:hover { background: #128C7E; }

/* WhatsApp preview bubble */
.wa-preview {
    background: #ECE5DD;
    border-radius: 12px;
    padding: 16px;
}
.wa-bubble {
    background: white;
    border-radius: 10px;
    padding: 12px 14px;
    box-shadow: 0 1px 3px rgba(0,0,0,.15);
    font-size: 13px;
    line-height: 1.6;
    max-height: 280px;
    overflow-y: auto;
}
.wa-bubble-sender {
    font-size: 11px;
    color: #25D366;
    font-weight: 700;
    margin-bottom: 6px;
}
.wa-bubble-time {
    font-size: 11px;
    color: #999;
    text-align: right;
    margin-top: 6px;
}



/* ============================================
   PEDIDOS — Tabs de vista + Semana Kanban
   ============================================ */

.pedidos-vista-tabs {
    display: flex;
    gap: 4px;
    background: var(--color-surface-elevated);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 3px;
}

.pedidos-tab-btn {
    padding: 6px 16px;
    border: none;
    background: transparent;
    border-radius: calc(var(--radius-md) - 2px);
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text-muted);
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.pedidos-tab-btn:hover   { color: var(--color-text-primary); background: var(--color-surface); }
.pedidos-tab-btn.active  { background: var(--color-surface); color: var(--color-primary); box-shadow: var(--shadow-sm); }

/* Toolbar navegación semana */
.semana-cal-toolbar {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    flex-wrap: wrap;
    margin-bottom: var(--space-lg);
    padding: var(--space-md) var(--space-lg);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.semana-cal-label {
    font-size: 15px;
    font-weight: 700;
    color: var(--color-text-primary);
    min-width: 220px;
    text-align: center;
}

.semana-cal-legend {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-left: auto;
    font-size: 12px;
    color: var(--color-text-muted);
}

.sc-legend-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 3px;
}
.sc-verde    { background: #10B981; }
.sc-amarillo { background: #F59E0B; }
.sc-rojo     { background: #EF4444; }

/* Columna de día en el kanban semanal */
.kanban-col-hoy > .kanban-column-header {
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark)) !important;
    color: white;
}
.kanban-col-hoy > .kanban-column-header h3,
.kanban-col-hoy > .kanban-column-header .kanban-col-fecha {
    color: white !important;
}
.kanban-col-hoy > .kanban-column-header .kanban-count {
    background: rgba(255,255,255,0.25);
    color: white;
}
.kanban-col-hoy {
    border-color: var(--color-primary) !important;
    box-shadow: 0 0 0 2px rgba(37,99,235,0.15), var(--shadow-sm);
}

.kanban-col-pasado { opacity: 0.72; }

.kanban-col-fecha {
    font-size: 10px;
    color: var(--color-text-muted);
    font-weight: 500;
    margin-top: 1px;
}

/* Barra de saturación debajo del header */
.kanban-col-satbar {
    height: 4px;
    flex-shrink: 0;
}

/* Día vacío */
.kanban-col-empty {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-muted);
    font-size: 12px;
    padding: var(--space-xl) var(--space-md);
    text-align: center;
}


/* ============================================
   MÓDULO FINANZAS — Tabs y paneles
   ============================================ */

.fin-tabs-bar {
    display: flex;
    gap: 4px;
    background: var(--color-surface-elevated);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 5px;
    margin-bottom: var(--space-xl);
    flex-wrap: wrap;
    box-shadow: var(--shadow-sm);
}

.fin-tab-btn {
    flex: 1;
    min-width: 120px;
    padding: 8px 14px;
    border: none;
    background: transparent;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text-muted);
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
    text-align: center;
}

.fin-tab-btn:hover {
    color: var(--color-text-primary);
    background: var(--color-surface);
}

.fin-tab-btn.active {
    background: var(--color-primary);
    color: white;
    box-shadow: var(--shadow-sm);
}

.fin-panel {
    animation: fadeIn 0.2s ease;
}

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

/* Dark mode */
body.dark-mode .fin-tabs-bar { background: var(--color-surface); }
body.dark-mode .fin-tab-btn.active { background: var(--color-primary); }

@media (max-width: 900px) {
    .fin-tab-btn { min-width: 90px; font-size: 11px; padding: 7px 8px; }
}
@media (max-width: 600px) {
    .fin-tabs-bar { gap: 3px; }
    .fin-tab-btn { min-width: 70px; font-size: 10px; padding: 6px 4px; }
}

