@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
    --bg-primary: #f4f6f8;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --bg-sidebar: #1c2536;
    --bg-hover: #f1f3f5;
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
    --accent-blue: #4f7cff;
    --accent-green: #22c55e;
    --accent-yellow: #f59e0b;
    --accent-red: #ef4444;
    --accent-cyan: #06b6d4;
    --accent-purple: #8b5cf6;
    --border-color: #e5e7eb;
    
    /* Sidebar specific colors (dark by default even in light theme) */
    --sidebar-text-primary: #ffffff;
    --sidebar-text-secondary: #9ca3af;
    --sidebar-text-muted: #6b7280;
    --sidebar-bg-hover: rgba(255, 255, 255, 0.05);
    --sidebar-border: rgba(255, 255, 255, 0.1);

    --sidebar-width: 260px;
    --sidebar-collapsed-width: 80px;
    --header-height: 64px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --shadow-card: 0 4px 24px rgba(0,0,0,0.04);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
    --bg-primary: #0f1724;
    --bg-secondary: #1a2332;
    --bg-card: #1e2a3a;
    --bg-sidebar: #1a2332;
    --bg-hover: #253345;
    --text-primary: #e4e8ef;
    --text-secondary: #8b95a5;
    --text-muted: #5e6b7d;
    --border-color: #2a3545;
    --shadow-card: 0 4px 24px rgba(0,0,0,0.18);
    
    --sidebar-text-primary: #e4e8ef;
    --sidebar-text-secondary: #8b95a5;
    --sidebar-text-muted: #5e6b7d;
    --sidebar-bg-hover: #253345;
    --sidebar-border: #2a3545;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    text-transform: uppercase; /* Force global uppercase for data display */
}

input, textarea, select {
    text-transform: uppercase;
}

::placeholder {
    text-transform: none; /* Keep placeholders readable */
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--bg-hover); border-radius: 3px; }

/* ===== SIDEBAR ===== */
.sidebar {
    position: fixed; top: 0; left: 0;
    width: var(--sidebar-width); height: 100vh;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--sidebar-border);
    z-index: 1000; display: flex; flex-direction: column;
    transition: var(--transition);
}

.sidebar.collapsed { width: var(--sidebar-collapsed-width); }
.sidebar.collapsed .logo-text,
.sidebar.collapsed .nav-text,
.sidebar.collapsed .nav-badge,
.sidebar.collapsed .chevron { display: none; }
.sidebar.collapsed .sidebar-header { justify-content: center; padding: 20px 0; }
.sidebar.collapsed .nav-item { justify-content: center; padding: 12px 0; margin: 2px 8px; }
.sidebar.collapsed .nav-sub { display: none !important; }
.sidebar.collapsed .nav-section-title { text-align: center; padding: 12px 0; }
.sidebar.collapsed .nav-section-title .nav-text { display: none; }
.sidebar.collapsed .nav-section-title::after { content: '...'; font-size: 14px; }
.sidebar.collapsed .sidebar-toggle { display: none; }

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

.sidebar-logo {
    display: flex; align-items: center; gap: 10px;
    font-size: 20px; font-weight: 700;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    background-clip: text;
}

.sidebar-logo svg { flex-shrink: 0; }

.sidebar-toggle {
    width: 32px; height: 32px; border-radius: 8px;
    background: var(--sidebar-bg-hover); border: none; color: var(--sidebar-text-secondary);
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    transition: var(--transition);
}
.sidebar-toggle:hover { background: var(--accent-blue); color: #fff; }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 16px 0; }

.nav-section-title {
    padding: 8px 24px; font-size: 11px; font-weight: 600;
    text-transform: uppercase; letter-spacing: 1.2px;
    color: var(--sidebar-text-muted);
}

.nav-item {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 24px; margin: 2px 12px;
    border-radius: var(--radius-sm); cursor: pointer;
    color: var(--sidebar-text-secondary); font-size: 14px; font-weight: 500;
    transition: var(--transition); text-decoration: none;
    position: relative;
}
.nav-item:hover { background: var(--sidebar-bg-hover); color: var(--sidebar-text-primary); }
.nav-item.active {
    background: rgba(79, 124, 255, 0.15); color: var(--accent-blue);
}
.nav-item.active::before {
    content: ''; position: absolute; left: 0; top: 50%;
    transform: translateY(-50%); width: 3px; height: 20px;
    background: var(--accent-blue); border-radius: 0 3px 3px 0;
}
.nav-item svg { width: 20px; height: 20px; flex-shrink: 0; }

.nav-badge {
    margin-left: auto; font-size: 10px; font-weight: 700;
    padding: 2px 8px; border-radius: 10px;
    background: var(--accent-red); color: #fff;
}

.nav-sub { padding-left: 56px; }
.nav-sub .nav-item { padding: 8px 16px; margin: 1px 12px; font-size: 13px; }

.nav-item .chevron {
    margin-left: auto; transition: var(--transition);
}
.nav-item.expanded .chevron { transform: rotate(90deg); }

/* ===== HEADER ===== */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh; transition: var(--transition);
}
.sidebar.collapsed ~ .main-content {
    margin-left: var(--sidebar-collapsed-width);
}

.header {
    height: var(--header-height); padding: 0 28px;
    display: flex; align-items: center; justify-content: space-between;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
    position: sticky; top: 0; z-index: 500;
}

.search-box {
    display: flex; align-items: center; gap: 10px;
    background: var(--bg-card); border: 1px solid var(--border-color);
    border-radius: var(--radius-sm); padding: 8px 16px;
    width: 280px; transition: var(--transition);
}
.search-box:focus-within { border-color: var(--accent-blue); }
.search-box input {
    border: none; background: transparent; color: var(--text-primary);
    font-size: 14px; width: 100%; outline: none;
    font-family: 'Inter', sans-serif;
}
.search-box input::placeholder { color: var(--text-muted); }
.search-box svg { color: var(--text-muted); flex-shrink: 0; }

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

.btn-primary {
    padding: 8px 16px; border-radius: var(--radius-sm); border: none;
    background: var(--accent-blue); color: #fff; font-size: 13px;
    font-weight: 600; cursor: pointer; transition: var(--transition);
    font-family: 'Inter', sans-serif; display: flex; align-items: center; gap: 6px;
}
.btn-primary:hover { background: #3d6ae8; }

.btn-secondary {
    padding: 8px 16px; border-radius: var(--radius-sm); 
    border: 1px solid var(--border-color);
    background: var(--bg-card); color: var(--text-primary); font-size: 13px;
    font-weight: 600; cursor: pointer; transition: var(--transition);
    font-family: 'Inter', sans-serif; display: flex; align-items: center; gap: 6px;
}
.btn-secondary:hover { background: var(--bg-hover); }
.header-btn {
    width: 40px; height: 40px; border-radius: var(--radius-sm);
    border: 1px solid var(--border-color); background: var(--bg-primary); color: var(--text-secondary);
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    transition: var(--transition); position: relative;
}
.header-btn:hover { background: var(--bg-hover); color: var(--accent-blue); }

/* Editable fields inside order manager modal */
.manager-client-field {
    position: relative;
}

.manager-value-input {
    width: 100%;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    padding: 6px 8px;
    margin-left: -8px;
    font-family: inherit;
    font-size: 16px;
    line-height: 1.35;
    font-weight: 800;
    outline: none;
    transition: var(--transition);
}

.manager-value-input:hover {
    background: rgba(79, 124, 255, 0.05);
    border-color: var(--border-color);
}

.manager-value-input:focus {
    background: var(--bg-card);
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(79, 124, 255, 0.12);
}

.manager-value-input.manager-reference-input {
    color: var(--accent-blue);
}

.manager-value-input::placeholder {
    color: var(--text-muted);
    font-weight: 700;
}

.manager-autocomplete-results {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    display: none;
    max-height: 220px;
    overflow-y: auto;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: 0 16px 35px rgba(0,0,0,0.16);
    z-index: 3000;
}

.manager-autocomplete-item {
    padding: 10px 12px;
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
}

.manager-autocomplete-item:hover {
    background: var(--bg-hover);
    color: var(--accent-blue);
}

.cash-status-btn {
    height: 40px; padding: 0 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-primary);
    display: flex; align-items: center; gap: 8px;
    text-decoration: none; font-size: 12px; font-weight: 800;
    transition: var(--transition);
    white-space: nowrap;
}
.cash-status-btn:hover { background: var(--bg-hover); border-color: var(--accent-blue); }
.cash-status-dot {
    width: 9px; height: 9px; border-radius: 50%;
    background: #9ca3af;
    box-shadow: inset 0 0 0 1px rgba(17,24,39,0.12);
    flex-shrink: 0;
}
.cash-status-btn.is-open .cash-status-dot {
    background: var(--accent-green);
    box-shadow: 0 0 0 4px rgba(34,197,94,0.12), 0 0 10px rgba(34,197,94,0.45);
}
.cash-status-btn.is-closed { color: var(--text-muted); }
.requires-open-caja { opacity: 0.72; background: var(--text-muted) !important; }
.requires-open-caja:hover { background: var(--text-secondary) !important; }

.header-avatar {
    width: 36px; height: 36px; border-radius: 50%;
    background: var(--accent-blue); color: white;
    display: flex; align-items: center; justify-content: center;
    font-size: 14px; font-weight: 700; cursor: pointer; transition: var(--transition);
}
.header-avatar:hover { transform: scale(1.05); box-shadow: 0 4px 12px rgba(79, 124, 255, 0.3); }

/* User Dropdown */
.user-menu-container { position: relative; }
.user-dropdown {
    position: absolute; top: calc(100% + 12px); right: 0;
    width: 220px; background: var(--bg-card);
    border: 1px solid var(--border-color); border-radius: var(--radius-md);
    box-shadow: 0 10px 40px rgba(0,0,0,0.12);
    padding: 8px; display: none; flex-direction: column;
    animation: slideDown 0.2s ease-out; z-index: 1000;
}
@keyframes slideDown {
    from { transform: translateY(-10px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
.user-dropdown.active { display: flex; }

.dropdown-user-info {
    padding: 12px; border-bottom: 1px solid var(--border-color);
    margin-bottom: 8px;
}
.dropdown-user-name { font-size: 14px; font-weight: 800; color: var(--text-primary); display: block; }
.dropdown-user-role { font-size: 11px; color: var(--text-muted); text-transform: uppercase; }

.dropdown-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px; border-radius: 8px;
    color: var(--text-secondary); text-decoration: none;
    font-size: 13px; font-weight: 600; transition: 0.2s;
    cursor: pointer; border: none; background: none; width: 100%;
}
.dropdown-item:hover { background: var(--bg-primary); color: var(--accent-red); }
.dropdown-item.logout { color: #f43f5e; }
.dropdown-item.logout:hover { background: rgba(244, 63, 94, 0.1); }

/* Notificaciones Dropdown */
.notif-dropdown-container { position: relative; }
.notif-dropdown {
    position: absolute; top: calc(100% + 12px); right: 0;
    width: 320px; background: var(--bg-card);
    border: 1px solid var(--border-color); border-radius: var(--radius-md);
    box-shadow: 0 10px 40px rgba(0,0,0,0.12);
    display: none; flex-direction: column;
    animation: slideDown 0.2s ease-out; z-index: 1000;
}
.notif-dropdown.active { display: flex; }
.notif-header {
    padding: 14px 18px; border-bottom: 1px solid var(--border-color);
    display: flex; justify-content: space-between; align-items: center;
}
.notif-header span:first-child { font-size: 14px; font-weight: 800; color: var(--text-primary); text-transform: uppercase; }
.notif-count { font-size: 10px; color: var(--accent-red); font-weight: 800; text-transform: uppercase; }
.notif-body { max-height: 380px; overflow-y: auto; }
.notif-item {
    display: flex; gap: 14px; padding: 14px 18px;
    border-bottom: 1px solid var(--border-color);
    text-decoration: none; transition: var(--transition);
}
.notif-item:hover { background: var(--bg-hover); }
.notif-icon {
    width: 36px; height: 36px; border-radius: 10px;
    background: rgba(239, 68, 68, 0.1); color: var(--accent-red);
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.notif-content { flex: 1; }
.notif-title { font-size: 13px; font-weight: 700; color: var(--text-primary); margin-bottom: 2px; }
.notif-text { font-size: 12px; color: var(--text-secondary); line-height: 1.4; text-transform: none; }
.notif-text strong { color: var(--accent-red); }
.notif-empty { padding: 40px 20px; text-align: center; color: var(--text-muted); font-size: 13px; }
.notif-footer { padding: 12px; text-align: center; border-top: 1px solid var(--border-color); }
.notif-footer a { font-size: 12px; font-weight: 700; color: var(--accent-blue); text-decoration: none; text-transform: uppercase; }

.notif-badge {
    position: absolute; top: -8px; right: -8px;
    background: var(--accent-red); color: white;
    font-size: 13px; font-weight: 800;
    min-width: 24px; height: 24px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    border: 2px solid var(--bg-secondary);
    padding: 0 4px;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.4);
}

.mobile-menu-btn {
    display: flex; width: 40px; height: 40px;
    border: none; background: transparent; color: var(--text-primary);
    cursor: pointer; align-items: center; justify-content: center;
    border-radius: var(--radius-sm);
}

/* ===== PAGE CONTENT ===== */
.page-content { padding: 24px 28px; }

.page-title-row {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 24px;
}
.page-title { font-size: 22px; font-weight: 700; }
.breadcrumb { display: flex; gap: 8px; font-size: 13px; color: var(--text-muted); }
.breadcrumb span { color: var(--text-primary); }

/* ===== STAT CARDS ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px; margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-card); border-radius: var(--radius-md);
    padding: 22px 24px; border: 1px solid var(--border-color);
    display: flex; align-items: flex-start; justify-content: space-between;
    transition: var(--transition); position: relative; overflow: hidden;
}
.stat-card::before {
    content: ''; position: absolute; top: 0; left: 0; right: 0;
    height: 3px; border-radius: var(--radius-md) var(--radius-md) 0 0;
    opacity: 0; transition: var(--transition);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-card); }
.stat-card:hover::before { opacity: 1; }
.stat-card:nth-child(1)::before { background: var(--accent-blue); }
.stat-card:nth-child(2)::before { background: var(--accent-green); }
.stat-card:nth-child(3)::before { background: var(--accent-red); }
.stat-card:nth-child(4)::before { background: var(--accent-yellow); }

.stat-info h3 {
    font-size: 26px; font-weight: 800; margin-bottom: 4px;
    letter-spacing: -0.5px;
}
.stat-info p { font-size: 13px; color: var(--text-secondary); margin-bottom: 8px; }

.stat-badge {
    font-size: 12px; font-weight: 600; padding: 3px 10px;
    border-radius: 6px; display: inline-flex; align-items: center; gap: 3px;
}
.stat-badge.up { background: rgba(34,197,94,0.12); color: var(--accent-green); }
.stat-badge.down { background: rgba(239,68,68,0.12); color: var(--accent-red); }

.stat-icon {
    width: 52px; height: 52px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.stat-icon.blue { background: rgba(79,124,255,0.15); color: var(--accent-blue); }
.stat-icon.green { background: rgba(34,197,94,0.15); color: var(--accent-green); }
.stat-icon.red { background: rgba(239,68,68,0.15); color: var(--accent-red); }
.stat-icon.yellow { background: rgba(245,158,11,0.15); color: var(--accent-yellow); }

/* Detailed Stat Card (First Card) */
.stat-card-detailed {
    display: flex; flex-direction: column; justify-content: flex-start;
}
.stat-card-detailed::before { display: none; }
.stat-detailed-header {
    display: flex; align-items: center; gap: 8px; margin-bottom: 16px;
}
.stat-detailed-header .title {
    font-size: 15px; font-weight: 500; color: var(--text-secondary);
}
.stat-detailed-header .info-icon {
    color: var(--text-muted); cursor: help;
}
.stat-detailed-main {
    display: flex; align-items: flex-end; gap: 12px; margin-bottom: 24px;
}
.stat-detailed-main .value {
    font-size: 32px; font-weight: 700; color: var(--text-primary);
    line-height: 1; letter-spacing: -0.5px;
}
.stat-detailed-main .trend {
    display: flex; align-items: center; gap: 4px;
    font-size: 14px; font-weight: 600; margin-bottom: 4px;
}
.stat-detailed-main .trend.up { color: #0d9488; }
.stat-detailed-main .trend.down { color: var(--accent-red); }
.stat-detailed-columns {
    display: flex; align-items: center; justify-content: space-between; width: 100%;
}
.stat-detailed-columns .col {
    display: flex; flex-direction: column; gap: 6px;
    padding-left: 12px; position: relative;
}
.stat-detailed-columns .col::before {
    content: ''; position: absolute; left: 0; top: 4px; bottom: 2px;
    width: 2px; background: #0d9488; border-radius: 2px;
}
.stat-detailed-columns .col.line-blue::before {
    background: #3b82f6;
}
.stat-detailed-columns .col-label {
    font-size: 13px; color: var(--text-muted); font-weight: 500;
}
.stat-detailed-columns .col-val {
    font-size: 15px; font-weight: 600; color: var(--text-primary);
}
.text-pink { color: #f43f5e !important; }

/* ===== CHARTS ===== */
.charts-grid {
    display: grid; grid-template-columns: 1fr 1fr;
    gap: 20px; margin-bottom: 24px;
}

.chart-card {
    background: var(--bg-card); border-radius: var(--radius-md);
    padding: 24px; border: 1px solid var(--border-color);
}

.chart-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 20px;
}
.chart-title { font-size: 16px; font-weight: 600; }

.chart-filters { display: flex; gap: 4px; }
.chart-filter-btn {
    padding: 5px 12px; border-radius: 6px; border: none;
    background: transparent; color: var(--text-muted); font-size: 12px;
    font-weight: 600; cursor: pointer; transition: var(--transition);
    font-family: 'Inter', sans-serif;
}
.chart-filter-btn:hover { color: var(--text-primary); }
.chart-filter-btn.active {
    background: var(--accent-blue); color: #fff;
}

.chart-container { position: relative; height: 280px; }

/* ===== TABLE ===== */
.table-card {
    background: var(--bg-card); border-radius: var(--radius-md);
    padding: 24px; border: 1px solid var(--border-color);
    margin-bottom: 24px; overflow: hidden;
}

.table-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 20px;
}
.table-title { font-size: 16px; font-weight: 600; }
.table-action {
    padding: 8px 16px; border-radius: var(--radius-sm); border: none;
    background: var(--accent-blue); color: #fff; font-size: 13px;
    font-weight: 600; cursor: pointer; transition: var(--transition);
    font-family: 'Inter', sans-serif;
}
.table-action:hover { background: #3d6ae8; }

.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
    text-align: left; padding: 12px 16px; font-size: 12px;
    font-weight: 600; color: var(--text-muted); text-transform: uppercase;
    letter-spacing: 0.8px; border-bottom: 1px solid var(--border-color);
}
.data-table td {
    padding: 14px 16px; font-size: 14px; border-bottom: 1px solid var(--border-color);
    color: var(--text-secondary);
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--bg-hover); }

.status-badge {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 12px; border-radius: 20px; font-size: 12px; font-weight: 600;
}
.status-badge::before {
    content: ''; width: 6px; height: 6px; border-radius: 50%;
}
.status-badge.listo { background: rgba(34,197,94,0.12); color: var(--accent-green); }
.status-badge.listo::before { background: var(--accent-green); }
.status-badge.pendiente { background: rgba(245,158,11,0.12); color: var(--accent-yellow); }
.status-badge.pendiente::before { background: var(--accent-yellow); }
.status-badge.cancelado { background: rgba(239,68,68,0.12); color: var(--accent-red); }
.status-badge.cancelado::before { background: var(--accent-red); }

/* Colores genéricos para estados CRM */
.status-badge.red { background: rgba(239, 68, 68, 0.12); color: var(--accent-red); }
.status-badge.red::before { background: var(--accent-red); }
.status-badge.orange { background: rgba(245, 158, 11, 0.12); color: var(--accent-yellow); }
.status-badge.orange::before { background: var(--accent-yellow); }
.status-badge.blue { background: rgba(79, 124, 255, 0.12); color: var(--accent-blue); }
.status-badge.blue::before { background: var(--accent-blue); }
.status-badge.green { background: rgba(34, 197, 94, 0.12); color: var(--accent-green); }
.status-badge.green::before { background: var(--accent-green); }
.status-badge.yellow { background: rgba(245, 158, 11, 0.12); color: var(--accent-yellow); }
.status-badge.yellow::before { background: var(--accent-yellow); }
.status-badge.gray { background: rgba(156, 163, 175, 0.12); color: var(--text-secondary); }
.status-badge.gray::before { background: var(--text-secondary); }

/* ===== MODALS ===== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.68);
    backdrop-filter: blur(5px);
    z-index: 9000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-card {
    width: 100%;
    max-width: 560px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 48px rgba(0,0,0,0.3);
    overflow: hidden;
    animation: modalPop 0.25s ease-out;
}

@keyframes modalPop {
    from { transform: scale(0.96); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

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

.modal-title {
    font-size: 18px;
    font-weight: 800;
    color: var(--text-primary);
}

.modal-body { padding: 24px; }

.modal-footer {
    padding: 18px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* ===== BOTTOM GRID ===== */
.bottom-grid {
    display: grid; 
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 20px; 
    margin-top: 24px;
    margin-bottom: 24px;
}

.form-control {
    width: 100%;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    padding: 12px 14px;
    font-size: 14px;
    font-family: inherit;
    transition: var(--transition);
}

.form-control:focus {
    border-color: var(--accent-blue);
    outline: none;
    box-shadow: 0 0 0 3px rgba(79,124,255,0.1);
}

textarea.form-control {
    resize: vertical;
    min-height: 96px;
}

.top-product-item {
    display: flex; align-items: center; gap: 16px;
    padding: 12px 0; border-bottom: 1px solid var(--border-color);
}
.top-product-item:last-child { border-bottom: none; }
.top-product-rank {
    width: 32px; height: 32px; border-radius: 8px;
    background: var(--bg-hover); display: flex; align-items: center;
    justify-content: center; font-size: 13px; font-weight: 700;
    color: var(--text-muted);
}
.top-product-info { flex: 1; }
.top-product-name { font-size: 14px; font-weight: 600; margin-bottom: 2px; }
.top-product-sales { font-size: 12px; color: var(--text-muted); }
.top-product-bar {
    width: 100px; height: 6px; background: var(--bg-hover);
    border-radius: 3px; overflow: hidden;
}
.top-product-bar-fill {
    height: 100%; border-radius: 3px;
    background: linear-gradient(90deg, var(--accent-blue), var(--accent-purple));
    transition: width 1s ease;
}

.revenue-source-item {
    display: flex; align-items: center; gap: 12px;
    padding: 14px 0; border-bottom: 1px solid var(--border-color);
}
.revenue-source-item:last-child { border-bottom: none; }
.revenue-dot {
    width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0;
}
.revenue-source-name { flex: 1; font-size: 14px; font-weight: 500; }
.revenue-source-pct {
    font-size: 14px; font-weight: 700; color: var(--text-primary);
}

/* ===== SIDEBAR OVERLAY ===== */
.sidebar-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,0.5); z-index: 999;
    backdrop-filter: blur(2px);
}

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

@media (max-width: 992px) {
    .charts-grid, .bottom-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); width: var(--sidebar-width); }
    .sidebar.open { transform: translateX(0); }
    .sidebar.collapsed .logo-text,
    .sidebar.collapsed .nav-text,
    .sidebar.collapsed .nav-badge,
    .sidebar.collapsed .chevron { display: block; }
    .sidebar.collapsed .sidebar-header { justify-content: space-between; padding: 20px 24px; }
    .sidebar.collapsed .nav-item { justify-content: flex-start; padding: 10px 24px; margin: 2px 12px; }
    .sidebar.collapsed .nav-section-title { text-align: left; padding: 8px 24px; }
    .sidebar.collapsed .nav-section-title::after { content: none; }
    .sidebar.collapsed .sidebar-toggle { display: flex; }
    
    .sidebar-overlay.active { display: block; }
    .main-content, .sidebar.collapsed ~ .main-content { margin-left: 0; }
    .mobile-menu-btn { display: flex; }
    .search-box { width: 180px; }
    .stats-grid { grid-template-columns: 1fr; gap: 12px; }
    .page-content { padding: 16px; }
    .page-title-row { flex-direction: column; align-items: flex-start; gap: 8px; }
    .header { padding: 0 16px; }
    .stat-info h3 { font-size: 22px; }
    .chart-container { height: 220px; }
    .data-table { font-size: 12px; }
    .data-table th, .data-table td { padding: 10px 8px; }
    .table-responsive { overflow-x: auto; }
}

@media (max-width: 480px) {
    .search-box { display: none; }
    .header-btn { width: 36px; height: 36px; }
    .stat-card { padding: 16px; }
}

/* ===== ANIMATIONS ===== */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}
.animate-in {
    animation: fadeInUp 0.5s ease forwards;
    opacity: 0;
}
.animate-in:nth-child(1) { animation-delay: 0.05s; }
.animate-in:nth-child(2) { animation-delay: 0.1s; }
.animate-in:nth-child(3) { animation-delay: 0.15s; }
.animate-in:nth-child(4) { animation-delay: 0.2s; }
/* ===== EFEMERIDES BANNER ===== */
.efemerides-banner {
    display: flex;
    align-items: center;
    background: #fff5f7; /* Light pink background */
    border: 1px solid #ffe4e9;
    border-radius: var(--radius-lg);
    padding: 16px 28px; /* Balanced padding */
    gap: 20px;
    width: 100%;
    box-sizing: border-box;
    margin-bottom: 0;
    position: relative;
    transition: var(--transition);
}

.efe-close {
    position: absolute;
    top: 10px;
    right: 10px;
    background: transparent;
    border: none;
    color: #a82424;
    cursor: pointer;
    padding: 6px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    opacity: 0.5;
    z-index: 30;
}

.efe-close:hover {
    background: #ffe4e9;
    opacity: 1;
}

.efe-date-box {
    background: #ffffff;
    border-radius: var(--radius-md);
    padding: 10px 14px;
    min-width: 70px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.efe-day {
    font-size: 22px;
    font-weight: 800;
    color: #a82424;
    line-height: 1;
}

.efe-month {
    font-size: 12px;
    font-weight: 700;
    color: #a82424;
    text-transform: uppercase;
    margin-top: 2px;
}

.efe-actions {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-right: 10px; /* Space to avoid the absolute X button */
}

.efe-content {
    flex: 1;
}

.efe-title {
    font-size: 18px;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0;
    line-height: 1.4;
}

.efe-desc {
    font-size: 14px;
    color: #666;
    margin: 4px 0 0 0;
}

.efe-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.efe-badge {
    background: #fff0f1;
    color: #a82424;
    font-size: 14px;
    font-weight: 700;
    padding: 6px 16px;
    border-radius: 20px;
    border: 1px solid #ffe4e9;
}

.efe-btn {
    background: linear-gradient(135deg, #ff8da1, #ff5e7d);
    color: #ffffff;
    border: none;
    padding: 8px 18px; /* Slightly smaller padding */
    border-radius: 10px;
    font-size: 13px; /* Slightly smaller font */
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(255, 94, 125, 0.3);
}

.efe-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(255, 94, 125, 0.4);
}

/* Dark mode adjustment for banner */
[data-theme="dark"] .efemerides-banner {
    background: #2d1a1e;
    border-color: #4a2a30;
}
[data-theme="dark"] .efe-date-box {
    background: #3d252a;
}
[data-theme="dark"] .efe-title {
    color: #ffdce1;
}
[data-theme="dark"] .efe-desc {
    color: #bfa0a5;
}
[data-theme="dark"] .efe-day, 
[data-theme="dark"] .efe-month,
[data-theme="dark"] .efe-badge {
    color: #ff9fb1;
}

@media (max-width: 768px) {
    .efemerides-banner {
        flex-direction: column;
        align-items: flex-start;
        text-align: left;
        gap: 16px;
    }
    .efe-actions {
        width: 100%;
        justify-content: space-between;
    }
    .efe-date-box {
        align-self: flex-start;
    }
}
/* Status Filter Pills */
.status-filters {
    display: flex;
    gap: 8px;
    margin-left: 10px;
}

.filter-pill {
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
    font-family: 'Inter', sans-serif;
}

.filter-pill span {
    background: rgba(255,255,255,0.1);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    opacity: 0.7;
}

.filter-pill:hover {
    transform: translateY(-2px);
    border-color: var(--accent-blue);
    color: var(--accent-blue);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.filter-pill.active {
    background: var(--accent-blue);
    color: white !important;
    border-color: var(--accent-blue);
}

.filter-pill.active span { 
    background: rgba(255,255,255,0.2); 
    opacity: 1;
}

/* Specific Pill Colors */
.filter-pill.pendiente:hover, .filter-pill.pendiente.active { border-color: var(--accent-yellow); background: var(--accent-yellow); color: white !important; }
.filter-pill.listo:hover, .filter-pill.listo.active { border-color: var(--accent-blue); background: var(--accent-blue); color: white !important; }
.filter-pill.entregado:hover, .filter-pill.entregado.active { border-color: var(--accent-green); background: var(--accent-green); color: white !important; }
.filter-pill.consignado:hover, .filter-pill.consignado.active { border-color: #f43f5e; background: #f43f5e; color: white !important; }
/* Global Search Modal */
.search-shortcut {
    margin-left: auto;
    background: rgba(255,255,255,0.05);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    border: 1px solid var(--border-color);
}

.global-search-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(10, 10, 15, 0.8);
    backdrop-filter: blur(8px);
    z-index: 2000;
    padding-top: 10vh;
    justify-content: center;
}

.global-search-card {
    width: 90%;
    max-width: 650px;
    background: var(--bg-card);
    border-radius: 16px;
    border: 1px solid var(--border-color);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    height: fit-content;
    max-height: 70vh;
    display: flex;
    flex-direction: column;
}

.global-search-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 15px;
}

.global-search-input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 18px;
    outline: none;
    font-family: 'Inter', sans-serif;
}

.global-search-results {
    padding: 10px;
    overflow-y: auto;
}

.search-result-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px 15px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.search-result-item:hover {
    background: rgba(255,255,255,0.05);
    transform: translateX(5px);
}

.result-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(79, 124, 255, 0.1);
    color: var(--accent-blue);
}

.result-info { flex: 1; }
.result-title { font-size: 14px; font-weight: 600; color: var(--text-primary); margin-bottom: 2px; }
.result-meta { font-size: 12px; color: var(--text-muted); }
.result-badge { font-size: 11px; padding: 2px 8px; border-radius: 10px; background: rgba(255,255,255,0.05); color: var(--text-muted); }

/* Status Badges Overrides */
.status-badge.consignado { background: rgba(244, 63, 94, 0.1); color: #f43f5e; border: 1px solid rgba(244, 63, 94, 0.2); }
.status-badge.consignado::before { background: #f43f5e; }

/* ===== GLOBAL SEARCH RESULTS ===== */
.search-box { position: relative; }
.search-results-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    width: 350px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    display: none;
    flex-direction: column;
    z-index: 1100;
    overflow: hidden;
    animation: slideDown 0.2s ease-out;
}
.search-results-dropdown.active { display: flex; }
.search-result-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    text-decoration: none;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition);
}
.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover { background: var(--bg-hover); }
.search-result-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.search-result-icon.cliente { background: rgba(79, 124, 255, 0.1); color: var(--accent-blue); }
.search-result-icon.pedido { background: rgba(34, 197, 94, 0.1); color: var(--accent-green); }
.search-result-content { flex: 1; }
.search-result-title { font-size: 13px; font-weight: 700; display: block; }
.search-result-subtitle { font-size: 11px; color: var(--text-muted); text-transform: uppercase; }
.search-empty { padding: 20px; text-align: center; color: var(--text-muted); font-size: 13px; }
