/* ═══════════════════════════════════════════════════════════════
   TI Manager — Design System
   Mobile-First | Light Theme | Farith Tobias
   ═══════════════════════════════════════════════════════════════ */

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

/* ── CSS Variables ──────────────────────────────────────────── */
:root {
    /* Primary Colors */
    --primary: #91c849;
    --primary-hover: var(--primary-hover);
    --primary-light: color-mix(in srgb, var(--primary) 12%, transparent);
    --primary-glow: var(--primary-glow);

    /* Secondary Colors */
    --secondary: #14a7ed;
    --secondary-hover: #1190cc;
    --secondary-light: rgba(20, 167, 237, 0.12);

    /* Backgrounds */
    --bg-body: #f3f4f6;
    --bg-card: #ffffff;
    --bg-card-hover: #f8fafc;
    --bg-input: #f8fafc;
    --bg-hover: #f1f5f9;
    --bg-sidebar: #ffffff;
    --bg-header: rgba(255, 255, 255, 0.88);

    /* Text Colors */
    --text-primary: #111827;
    --text-secondary: #4b5563;
    --text-muted: #9ca3af;
    --text-link: #14a7ed;

    /* Status Colors */
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;

    /* Spacing */
    --space-xs: 6px;
    --space-sm: 10px;
    --space-md: 20px;
    --space-lg: 30px;
    --space-xl: 40px;
    --space-2xl: 60px;

    /* Border Radius */
    --radius-sm: 12px;
    --radius-md: 16px;
    --radius-lg: 20px;
    --radius-xl: 24px;
    --radius-full: 9999px;

    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.03);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.08);
    --shadow-glow-primary: 0 0 16px color-mix(in srgb, var(--primary) 20%, transparent);
    --shadow-glow-secondary: 0 0 16px color-mix(in srgb, var(--secondary) 20%, transparent);

    /* Transitions */
    --transition: all 0.3s ease;
    --transition-fast: all 0.15s ease;

    /* Layout */
    --header-height: 60px;
    --sidebar-width: 260px;
    --bottom-bar-height: 70px;
}

/* ── Reset & Base ──────────────────────────────────────────── */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: 'League Spartan', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background-color: var(--bg-body);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    color: var(--text-link);
    text-decoration: none;
    transition: var(--transition-fast);
}

a:hover {
    color: var(--secondary-hover);
}

img {
    max-width: 100%;
    height: auto;
}

/* ── Scrollbar ─────────────────────────────────────────────── */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-body);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-hover);
    border-radius: 3px;
}

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

/* ── Typography ────────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.3;
    color: var(--text-primary);
}

h1 { font-size: 1.75rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.1rem; }

.text-primary-color { color: var(--primary); }
.text-secondary-color { color: var(--secondary); }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-sm { font-size: 0.85rem; }
.text-xs { font-size: 0.75rem; }
.text-lg { font-size: 1.15rem; }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.font-medium { font-weight: 500; }

/* ── Layout System ─────────────────────────────────────────── */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    width: 100%;
    transition: var(--transition);
}

.page-content {
    flex: 1;
    padding: var(--space-md);
    padding-top: calc(var(--header-height) + var(--space-md));
    padding-bottom: calc(var(--bottom-bar-height) + var(--space-lg));
    margin: 0 auto;
}

/* ── Header ────────────────────────────────────────────────── */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: var(--bg-header);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    display: flex;
    align-items: center;
    padding: 0 var(--space-md);
    z-index: 100;
    gap: var(--space-md);
}

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

.header-center {
    flex: 1;
    display: flex;
    justify-content: center;
}

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

.header-logo {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text-primary);
}

.header-logo .logo-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.75rem;
    color: #fff;
    position: relative;
}

.header-logo .logo-icon span {
    position: absolute;
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 1px;
}

.hamburger-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 1.5rem;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: var(--transition-fast);
}

.hamburger-btn:hover {
    background: var(--bg-hover);
}

/* Header Search */
.header-search {
    display: none;
    position: relative;
    max-width: 400px;
    width: 100%;
}

.header-search input {
    width: 100%;
    padding: 8px 16px 8px 40px;
    background: var(--bg-input);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: var(--radius-xl);
    color: var(--text-primary);
    font-size: 0.9rem;
    outline: none;
    transition: var(--transition);
    font-family: inherit;
}

.header-search input:focus {
    border-color: var(--primary);
    box-shadow: var(--shadow-glow-primary);
}

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

.header-search i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 1rem;
}

/* Notification Bell */
.notification-btn {
    position: relative;
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.3rem;
    cursor: pointer;
    border-radius: var(--radius-full);
    transition: var(--transition-fast);
}

.notification-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.notification-badge {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 16px;
    height: 16px;
    background: var(--danger);
    border-radius: var(--radius-full);
    font-size: 0.65rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    line-height: 1;
    padding-top: 2px; /* Ajuste vertical para la fuente League Spartan */
}

/* User Avatar Dropdown */
.user-menu {
    position: relative;
}

.user-avatar {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    color: #fff;
    cursor: pointer;
    transition: var(--transition);
}

.user-avatar:hover {
    box-shadow: var(--shadow-glow-primary);
}

.user-avatar img {
    width: 100%;
    height: 100%;
    border-radius: var(--radius-full);
    object-fit: cover;
}

/* ── Sidebar ───────────────────────────────────────────────── */
.sidebar {
    position: fixed;
    top: 0;
    left: -280px;
    width: 270px;
    height: 100vh;
    background: var(--bg-sidebar);
    border-right: 1px solid rgba(0, 0, 0, 0.06);
    z-index: 200;
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    transform: translateX(0);
}

.sidebar.open {
    transform: translateX(280px);
}

.sidebar-header {
    padding: var(--space-lg);
    display: flex;
    align-items: center;
    gap: var(--space-md);
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.sidebar-logo {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sidebar-logo span {
    font-size: 0.85rem;
    font-weight: 800;
    color: #fff;
    letter-spacing: 1px;
}

.sidebar-brand {
    display: flex;
    flex-direction: column;
}

.sidebar-brand-name {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.sidebar-brand-sub {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

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

.sidebar-section-title {
    padding: var(--space-sm) var(--space-lg);
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-top: var(--space-sm);
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: 8px var(--space-md);
    margin: 2px var(--space-md);
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 500;
    transition: var(--transition-fast);
    border-radius: var(--radius-sm);
    min-height: 38px;
    text-decoration: none;
    position: relative;
}

.sidebar-link:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.sidebar-link.active {
    background: transparent;
    color: var(--text-primary);
    font-weight: 700;
}

.sidebar-link.active::before {
    content: '';
    position: absolute;
    left: calc(var(--space-md) * -1);
    top: 15%;
    bottom: 15%;
    width: 6px;
    background: var(--primary);
    border-radius: 0 4px 4px 0;
}

.sidebar-link.active i {
    color: var(--primary);
}

.sidebar-link i {
    font-size: 1.25rem;
    width: 24px;
    text-align: center;
}

.sidebar-link .badge-soon {
    margin-left: auto;
    font-size: 0.6rem;
    padding: 2px 6px;
    background: var(--bg-hover);
    color: var(--text-muted);
    border-radius: var(--radius-sm);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sidebar-link .badge-count {
    margin-left: auto;
    font-size: 0.65rem;
    padding: 6px 6px 4px 6px;
    background: var(--primary);
    color: #fff;
    border-radius: 6px;
    font-weight: 600;
    min-width: 24px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.sidebar-link.disabled {
    opacity: 0.4;
    pointer-events: none;
}

.sidebar-footer {
    padding: var(--space-md) var(--space-lg);
    border-top: 1px solid rgba(0, 0, 0, 0.06);
}

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

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

.sidebar-user-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-role {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.sidebar-logout {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    width: 100%;
    padding: 10px var(--space-md);
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: var(--danger);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-fast);
    font-family: inherit;
}

.sidebar-logout:hover {
    background: rgba(239, 68, 68, 0.2);
}

.sidebar-update-card {
    margin: var(--space-md);
    background: linear-gradient(135deg, #111827, #1f2937);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    color: #fff;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.sidebar-update-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 60%);
    pointer-events: none;
}

.sidebar-update-card-title {
    font-size: 0.85rem;
    font-weight: 700;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.sidebar-update-card-desc {
    font-size: 0.75rem;
    color: #9ca3af;
    margin-bottom: 12px;
    line-height: 1.4;
}

.sidebar-update-card-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 8px;
    background: #fff;
    color: #111827;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 600;
    text-decoration: none;
    transition: var(--transition-fast);
}

.sidebar-update-card-btn:hover {
    background: #f3f4f6;
    transform: translateY(-1px);
}

/* ── Overlay ───────────────────────────────────────────────── */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 150;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.overlay.show {
    opacity: 1;
    visibility: visible;
}

/* ── Bottom Bar ────────────────────────────────────────────── */
.bottom-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--bottom-bar-height);
    background: var(--bg-sidebar);
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    display: flex;
    align-items: center;
    justify-content: space-around;
    padding: 0 var(--space-sm);
    z-index: 100;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.bottom-bar-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 6px 12px;
    color: var(--text-muted);
    font-size: 0.65rem;
    font-weight: 500;
    text-decoration: none;
    border-radius: var(--radius-md);
    transition: var(--transition-fast);
    min-width: 56px;
    min-height: 48px;
    position: relative;
}

.bottom-bar-item i {
    font-size: 1.4rem;
}

.bottom-bar-item:hover,
.bottom-bar-item.active {
    color: var(--primary);
}

.bottom-bar-item.active::after {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 24px;
    height: 3px;
    background: var(--primary);
    border-radius: 0 0 3px 3px;
}

.bottom-bar-fab {
    width: 52px;
    height: 52px;
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.5rem;
    margin-top: -20px;
    box-shadow: 0 4px 20px color-mix(in srgb, var(--primary) 35%, transparent);
    transition: var(--transition);
    cursor: pointer;
    border: none;
    text-decoration: none;
}

.bottom-bar-fab:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 28px color-mix(in srgb, var(--primary) 50%, transparent);
    color: #fff;
}

/* ── Cards ─────────────────────────────────────────────────── */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid rgba(0, 0, 0, 0.06);
    padding: var(--space-lg);
    transition: var(--transition);
}

.card:hover {
    border-color: rgba(0, 0, 0, 0.1);
}

.card-glass {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: var(--radius-lg);
    border: 1px solid rgba(0, 0, 0, 0.08);
    padding: var(--space-lg);
    transition: var(--transition);
}

.card-glass:hover {
    border-color: rgba(0, 0, 0, 0.12);
    box-shadow: var(--shadow-md);
}

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

.card-title {
    font-size: 1rem;
    font-weight: 600;
}

/* ── Stat Cards ────────────────────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: var(--space-md);
}

@media (max-width: 767px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-sm);
    }
}

.stat-card {
    flex: 1 1 240px;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid rgba(0, 0, 0, 0.06);
    padding: var(--space-lg);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 80px;
    height: 80px;
    border-radius: 0 0 0 80px;
    opacity: 0.08;
}

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

.stat-card.green { border-left: 3px solid var(--primary); }
.stat-card.green::before { background: var(--primary); }
.stat-card.green .stat-icon { color: var(--primary); background: var(--primary-light); }

.stat-card.blue { border-left: 3px solid var(--secondary); }
.stat-card.blue::before { background: var(--secondary); }
.stat-card.blue .stat-icon { color: var(--secondary); background: var(--secondary-light); }

.stat-card.orange { border-left: 3px solid var(--warning); }
.stat-card.orange::before { background: var(--warning); }
.stat-card.orange .stat-icon { color: var(--warning); background: rgba(245, 158, 11, 0.15); }

.stat-card.red { border-left: 3px solid var(--danger); }
.stat-card.red::before { background: var(--danger); }
.stat-card.red .stat-icon { color: var(--danger); background: rgba(239, 68, 68, 0.15); }

.stat-card.purple { border-left: 3px solid #8b5cf6; }
.stat-card.purple::before { background: #8b5cf6; }
.stat-card.purple .stat-icon { color: #8b5cf6; background: rgba(139, 92, 246, 0.15); }

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

.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1;
    color: var(--text-primary);
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: var(--space-xs);
    font-weight: 500;
}

/* ── Buttons ───────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: 12px 24px;
    font-size: 0.9rem;
    font-weight: 600;
    font-family: inherit;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    min-height: 48px;
    white-space: nowrap;
    line-height: 1;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.8rem;
    min-height: 36px;
    border-radius: var(--radius-sm);
}

.btn-lg {
    padding: 14px 32px;
    font-size: 1rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    color: #fff;
    box-shadow: 0 4px 16px var(--primary-glow);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 24px color-mix(in srgb, var(--primary) 40%, transparent);
    color: #fff;
}

.btn-secondary {
    background: linear-gradient(135deg, var(--secondary), var(--secondary-hover));
    color: #fff;
    box-shadow: 0 4px 16px color-mix(in srgb, var(--secondary) 25%, transparent);
}

.btn-secondary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 24px rgba(20, 167, 237, 0.4);
    color: #fff;
}

.btn-danger {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.25);
    color: var(--danger);
}

.btn-outline {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.btn-outline:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: rgba(0, 0, 0, 0.15);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    padding: 8px;
}

.btn-ghost:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.btn-icon {
    width: 42px;
    height: 42px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    font-size: 1.1rem;
}

.btn-block {
    width: 100%;
}

/* ── Forms ─────────────────────────────────────────────────── */
.form-group {
    margin-bottom: var(--space-lg);
}

.form-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: var(--space-sm);
}

.form-label .required {
    color: var(--danger);
    margin-left: 2px;
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-input);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.9rem;
    font-family: inherit;
    transition: var(--transition);
    min-height: 48px;
    outline: none;
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 15%, transparent);
}

.form-control::placeholder {
    color: var(--text-muted);
}

.form-control.is-invalid {
    border-color: var(--danger);
}

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

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%236b6b80' viewBox='0 0 16 16'%3e%3cpath d='M8 11L3 6h10z'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.form-control-icon {
    position: relative;
}

.form-control-icon .form-control {
    padding-left: 44px;
}

.form-control-icon > i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 1.1rem;
}

.form-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: var(--space-md);
}

.form-error {
    display: block;
    color: var(--danger);
    font-size: 0.78rem;
    margin-top: var(--space-xs);
}

.form-check {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    min-height: 48px;
    cursor: pointer;
}

.form-check input[type="checkbox"] {
    appearance: none;
    width: 20px;
    height: 20px;
    background: var(--bg-input);
    border: 2px solid rgba(0, 0, 0, 0.12);
    border-radius: 4px;
    cursor: pointer;
    transition: var(--transition-fast);
    flex-shrink: 0;
}

.form-check input[type="checkbox"]:checked {
    background: var(--primary);
    border-color: var(--primary);
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' fill='%23000' viewBox='0 0 16 16'%3e%3cpath d='M13.854 3.646a.5.5 0 0 1 0 .708l-7 7a.5.5 0 0 1-.708 0l-3.5-3.5a.5.5 0 1 1 .708-.708L6.5 10.293l6.646-6.647a.5.5 0 0 1 .708 0z'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: center;
}

.form-toggle {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    cursor: pointer;
}

.form-toggle input {
    display: none;
}

.form-toggle .toggle-slider {
    width: 48px;
    height: 26px;
    background: var(--bg-hover);
    border-radius: 13px;
    position: relative;
    transition: var(--transition);
}

.form-toggle .toggle-slider::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    background: var(--text-secondary);
    border-radius: var(--radius-full);
    transition: var(--transition);
}

.form-toggle input:checked + .toggle-slider {
    background: var(--primary);
}

.form-toggle input:checked + .toggle-slider::after {
    transform: translateX(22px);
    background: #fff;
}

/* File Upload */
.file-upload {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-xl);
    background: var(--bg-input);
    border: 2px dashed rgba(0, 0, 0, 0.1);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
}

.file-upload:hover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.file-upload i {
    font-size: 2rem;
    color: var(--text-muted);
}

.file-upload-text {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.file-preview {
    width: 80px;
    height: 80px;
    border-radius: var(--radius-md);
    object-fit: cover;
    border: 2px solid rgba(0, 0, 0, 0.1);
}

/* ── Tables ────────────────────────────────────────────────── */
.table-responsive {
    overflow-x: auto;
    border-radius: var(--radius-lg);
    border: 1px solid rgba(0, 0, 0, 0.06);
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.table th {
    padding: 14px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 0.78rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: var(--bg-card);
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    white-space: nowrap;
}

.table td {
    padding: 14px 16px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
    color: var(--text-secondary);
    vertical-align: middle;
}

.table tr:hover td {
    background: var(--bg-card-hover);
}

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

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

/* ── Badges ────────────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    font-size: 0.72rem;
    font-weight: 600;
    border-radius: var(--radius-xl);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    white-space: nowrap;
}

/* ── SweetAlert Overrides ────────────────────────────── */
div:where(.swal2-icon).swal2-success { border-color: var(--success); color: var(--success); }
div:where(.swal2-icon).swal2-success [class^=swal2-success-line] { background-color: var(--success); }
div:where(.swal2-icon).swal2-success .swal2-success-ring { border-color: color-mix(in srgb, var(--success) 30%, transparent); }
div:where(.swal2-icon).swal2-info { border-color: var(--info); color: var(--info); }
div:where(.swal2-icon).swal2-warning { border-color: var(--warning); color: var(--warning); }
div:where(.swal2-icon).swal2-error { border-color: var(--danger); color: var(--danger); }
div:where(.swal2-icon).swal2-error [class^=swal2-x-mark-line] { background-color: var(--danger); }

.badge-success { background: color-mix(in srgb, var(--success) 15%, transparent); color: var(--success); }
.badge-warning { background: color-mix(in srgb, var(--warning) 15%, transparent); color: var(--warning); }
.badge-danger { background: color-mix(in srgb, var(--danger) 15%, transparent); color: var(--danger); }
.badge-info { background: color-mix(in srgb, var(--info) 15%, transparent); color: var(--info); }
.badge-muted { background: var(--bg-hover); color: var(--text-muted); }
.badge-primary { background: var(--primary-light); color: var(--primary); }

/* ── Alerts / Flash Messages ───────────────────────────────── */
.alert {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: 14px var(--space-lg);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-lg);
    font-size: 0.9rem;
    animation: slideDown 0.3s ease;
    border: 1px solid;
}

.alert-success {
    background: color-mix(in srgb, var(--success) 12%, transparent);
    border-color: color-mix(in srgb, var(--success) 25%, transparent);
    color: var(--success);
}

.alert-danger {
    background: color-mix(in srgb, var(--danger) 12%, transparent);
    border-color: color-mix(in srgb, var(--danger) 25%, transparent);
    color: var(--danger);
}

.alert-warning {
    background: color-mix(in srgb, var(--warning) 12%, transparent);
    border-color: color-mix(in srgb, var(--warning) 25%, transparent);
    color: var(--warning);
}

.alert-info {
    background: color-mix(in srgb, var(--info) 12%, transparent);
    border-color: color-mix(in srgb, var(--info) 25%, transparent);
    color: var(--info);
}

.alert-close {
    margin-left: auto;
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    font-size: 1.2rem;
    opacity: 0.7;
    padding: 4px;
}

.alert-close:hover {
    opacity: 1;
}

/* ── Avatars ───────────────────────────────────────────────── */
.avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    color: #fff;
    flex-shrink: 0;
}

.avatar-sm { width: 32px; height: 32px; font-size: 0.7rem; }
.avatar-lg { width: 56px; height: 56px; font-size: 1.2rem; }

.avatar img {
    width: 100%;
    height: 100%;
    border-radius: var(--radius-full);
    object-fit: cover;
}

/* ── Search Box ────────────────────────────────────────────── */
.search-box {
    display: flex;
    gap: var(--space-sm);
}

.search-box .form-control {
    flex: 1;
}

/* ── Empty State ───────────────────────────────────────────── */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-2xl);
    text-align: center;
}

.empty-state i {
    font-size: 4rem;
    color: var(--text-muted);
    margin-bottom: var(--space-lg);
    opacity: 0.5;
}

.empty-state h3 {
    color: var(--text-secondary);
    margin-bottom: var(--space-sm);
}

.empty-state p {
    color: var(--text-muted);
    margin-bottom: var(--space-lg);
    font-size: 0.9rem;
}

/* ── List Items ────────────────────────────────────────────── */
.list-item {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md);
    background: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid rgba(0, 0, 0, 0.06);
    margin-bottom: var(--space-sm);
    transition: var(--transition-fast);
    min-height: 64px;
}

.list-item:hover {
    background: var(--bg-card-hover);
    border-color: rgba(0, 0, 0, 0.1);
}

.list-item-content {
    flex: 1;
    min-width: 0;
}

.list-item-title {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-primary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    white-space: normal;
    word-break: break-word;
    line-height: 1.3;
}

.list-item-subtitle {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.list-item-actions {
    display: flex;
    gap: var(--space-xs);
    flex-shrink: 0;
}

/* ── Mobile Cards (for lists on mobile) ────────────────────── */
.mobile-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid rgba(0, 0, 0, 0.06);
    padding: var(--space-lg);
    margin-bottom: var(--space-md);
    transition: var(--transition-fast);
}

.mobile-card:hover {
    border-color: rgba(0, 0, 0, 0.1);
}

.mobile-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-md);
}

.mobile-card-header > .d-flex {
    flex: 1;
    min-width: 0;
    margin-right: var(--space-sm);
}

.mobile-card-header > .d-flex > div:not(.avatar):not(.avatar-sm) {
    flex: 1;
    min-width: 0;
}

.mobile-card-body {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.mobile-card-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
}

.mobile-card-label {
    color: var(--text-muted);
}

.mobile-card-value {
    color: var(--text-secondary);
    font-weight: 500;
    text-align: right;
    max-width: 65%;
    word-break: break-word;
}

.mobile-card-actions {
    display: flex;
    gap: var(--space-sm);
    margin-top: var(--space-lg);
    padding-top: var(--space-lg);
    border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.mobile-card-actions .btn {
    flex: 1;
}

/* ── Dropdown ──────────────────────────────────────────────── */
.dropdown {
    position: relative;
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 200px;
    background: var(--bg-card);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 300;
    padding: var(--space-xs);
}

.dropdown-menu.show {
    /* Kept for backwards compatibility if any */
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: 10px 14px;
    color: var(--text-secondary);
    font-size: 0.85rem;
    border-radius: var(--radius-sm);
    transition: var(--transition-fast);
    text-decoration: none;
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    font-family: inherit;
}

.dropdown-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.dropdown-divider {
    height: 1px;
    background: rgba(0, 0, 0, 0.06);
    margin: var(--space-xs) 0;
}

/* ── Modal ─────────────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-md);
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid rgba(0, 0, 0, 0.08);
    max-width: 480px;
    width: 90%;
    margin: 0 auto;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-lg);
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

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

.modal-footer {
    display: flex;
    gap: var(--space-sm);
    justify-content: flex-end;
    padding: var(--space-md) var(--space-lg);
    border-top: 1px solid rgba(0, 0, 0, 0.06);
}

/* ── Pagination ────────────────────────────────────────────── */
.pagination-wrapper {
    display: flex;
    justify-content: center;
    padding: var(--space-lg) 0;
}

.pagination-wrapper nav > div:first-child {
    display: none;
}

.pagination-wrapper svg {
    width: 20px;
    height: 20px;
}

.pagination-wrapper a,
.pagination-wrapper span {
    padding: 8px 14px;
    margin: 0 2px;
    font-size: 0.85rem;
    border-radius: var(--radius-sm);
    transition: var(--transition-fast);
}

.pagination-wrapper a {
    background: var(--bg-card);
    color: var(--text-secondary);
    border: 1px solid rgba(0, 0, 0, 0.06);
}

.pagination-wrapper a:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.pagination-wrapper span[aria-current] {
    background: var(--primary);
    color: #fff;
    font-weight: 600;
}

.pagination-wrapper span:not([aria-current]) {
    color: var(--text-muted);
}

/* ── Page Header ───────────────────────────────────────────── */
.page-header {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
}

.page-header-top {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-md);
}

.page-title {
    font-size: 1.5rem;
    font-weight: 700;
}

.page-title .count {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 400;
    margin-left: var(--space-sm);
}

/* ── Filters ───────────────────────────────────────────────── */
.filter-tabs {
    display: flex;
    gap: var(--space-xs);
    overflow-x: auto;
    padding-bottom: var(--space-xs);
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.filter-tabs::-webkit-scrollbar {
    display: none;
}

.filter-tab {
    padding: 8px 16px;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-muted);
    background: var(--bg-card);
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: var(--radius-xl);
    white-space: nowrap;
    cursor: pointer;
    transition: var(--transition-fast);
    text-decoration: none;
    font-family: inherit;
}

.filter-tab:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.filter-tab.active {
    background: var(--primary-light);
    color: var(--primary);
    border-color: var(--primary);
}

/* ── Info Cards (Show page) ────────────────────────────────── */
.info-group {
    margin-bottom: var(--space-lg);
}

.info-group-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: var(--space-md);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

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

.info-label {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.info-value {
    color: var(--text-primary);
    font-weight: 500;
    font-size: 0.9rem;
    text-align: right;
}

/* ── Greeting Section ──────────────────────────────────────── */
.greeting {
    margin-bottom: var(--space-lg);
}

.greeting h1 {
    font-size: 1.5rem;
    margin-bottom: 2px;
}

.greeting h1 span {
    color: var(--primary);
}

.greeting p {
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* ── Chart Container ───────────────────────────────────────── */
.chart-container {
    position: relative;
    height: 250px;
    width: 100%;
}

/* ── Utility Classes ───────────────────────────────────────── */
.d-flex { display: flex; }
.d-none { display: none; }
.d-block { display: block; }
.flex-wrap { flex-wrap: wrap; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-xs { gap: var(--space-xs); }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.p-md { padding: var(--space-md); }
.p-lg { padding: var(--space-lg); }
.w-full { width: 100%; }
.flex-1 { flex: 1; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── Animations ────────────────────────────────────────────── */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

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

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

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.animate-fadeIn { animation: fadeIn 0.4s ease; }
.animate-slideUp { animation: slideUp 0.4s ease; }

/* ── Desktop Visibility ────────────────────────────────────── */
.desktop-only { display: none; }
.mobile-only { display: block; }
.mobile-only-flex { display: flex; }

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE — Tablet (≥768px)
   ═══════════════════════════════════════════════════════════════ */
@media (min-width: 768px) {
    .stats-grid {
        /* Flexbox handles the layout fluidly */
    }

    .form-row {
        grid-template-columns: repeat(2, 1fr);
    }

    .header-search {
        display: block;
    }

    .page-content {
        padding: calc(var(--header-height) + var(--space-lg)) var(--space-lg) var(--space-lg);
    }
}

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE — Desktop (≥1024px)
   ═══════════════════════════════════════════════════════════════ */
@media (min-width: 1024px) {
    body.desktop-collapsed .sidebar {
        width: 80px !important;
        transform: translateX(0) !important;
    }
    
    body.desktop-collapsed .sidebar .sidebar-header {
        padding: 15px 0 !important;
    }

    body.desktop-collapsed .sidebar .sidebar-header .sidebar-logo-expanded {
        display: none !important;
    }
    
    body.desktop-collapsed .sidebar .sidebar-header .sidebar-logo-collapsed {
        display: block !important;
        margin: 0 auto !important;
    }

    body.desktop-collapsed .sidebar-nav {
        padding: 10px !important;
    }

    body.desktop-collapsed .sidebar-section-title,
    body.desktop-collapsed .sidebar-update-card {
        display: none !important;
    }
    
    body.desktop-collapsed .sidebar-link span:not(.badge-count) {
        display: none !important;
    }
    
    body.desktop-collapsed .sidebar-link {
        justify-content: center !important;
        padding: 12px 0 !important;
        margin: 8px auto !important;
        width: 44px !important;
        min-height: 44px !important;
    }
    
    body.desktop-collapsed .sidebar-link i {
        margin: 0 !important;
        font-size: 1.4rem !important;
    }

    body.desktop-collapsed .sidebar-link .badge-count {
        position: absolute;
        top: 6px;
        right: 6px;
        width: 10px !important;
        min-width: 10px !important;
        height: 10px !important;
        padding: 0 !important;
        border-radius: 50% !important;
        font-size: 0 !important;
        line-height: 0 !important;
        transform: none;
        background: var(--primary);
    }
    
    /* Tooltip */
    body.desktop-collapsed .sidebar-link::after {
        content: attr(data-title);
        position: absolute;
        left: calc(100% + 15px);
        top: 50%;
        transform: translateY(-50%);
        background: var(--text-primary);
        color: white;
        padding: 6px 12px;
        border-radius: var(--radius-sm);
        font-size: 0.8rem;
        font-weight: 500;
        white-space: nowrap;
        opacity: 0;
        visibility: hidden;
        transition: all 0.2s ease;
        z-index: 1000;
        pointer-events: none;
        box-shadow: var(--shadow-sm);
    }
    
    body.desktop-collapsed .sidebar-link:hover::after {
        opacity: 1;
        visibility: visible;
        left: calc(100% + 10px);
    }
    
    body.desktop-collapsed .main-content {
        padding-left: calc(80px + 16px) !important;
        margin-left: 0 !important;
    }
    
    body.desktop-collapsed .header {
        left: calc(80px + 16px) !important;
        width: calc(100% - 80px - 24px) !important;
    }
}
@media (min-width: 1024px) {
    .sidebar {
        left: 8px;
        top: 8px;
        height: calc(100vh - 16px);
        border-radius: var(--radius-lg);
        box-shadow: var(--shadow-sm);
        border: none;
        transform: translateX(0);
        transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1), left 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        padding-left: calc(270px + 8px);
        padding-top: calc(var(--header-height) + 8px);
        margin-left: 0;
        width: 100%;
        transition: padding-left 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .header {
        left: calc(270px + 16px);
        width: calc(100% - (270px + 24px));
        top: 8px;
        border-radius: var(--radius-lg);
        box-shadow: var(--shadow-sm);
        border: none;
        transition: left 0.35s cubic-bezier(0.4, 0, 0.2, 1), width 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .page-content {
        margin: 8px 8px 8px 8px;
        background: var(--bg-card);
        border-radius: var(--radius-lg);
        padding: 16px;
        min-height: calc(100vh - var(--header-height) - 24px);
        box-shadow: var(--shadow-sm);
    }

    .bottom-bar {
        display: none;
    }

    .hamburger-btn {
        display: flex;
    }

    .overlay {
        display: none !important;
    }

    .page-content {
        padding-bottom: var(--space-xl);
    }

    .desktop-only {
        display: block;
    }

    .desktop-only-flex {
        display: flex;
    }

    .mobile-only,
    .mobile-only-flex {
        display: none;
    }

    .form-row-3 {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* ═══════════════════════════════════════════════════════════════
   Login Page Specific
   ═══════════════════════════════════════════════════════════════ */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-lg);
    background: var(--bg-body);
    position: relative;
    overflow: hidden;
}

.login-page::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: 
        radial-gradient(circle at 20% 30%, color-mix(in srgb, var(--primary) 4%, transparent) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, color-mix(in srgb, var(--secondary) 4%, transparent) 0%, transparent 50%);
    animation: pulse 8s ease-in-out infinite;
}

.login-card {
    width: 100%;
    max-width: 420px;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: var(--radius-xl);
    padding: var(--space-2xl) var(--space-xl);
    position: relative;
    z-index: 1;
    animation: slideUp 0.6s ease;
}

.login-logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-md);
    margin-bottom: var(--space-xl);
}

.login-logo-icon {
    width: 72px;
    height: 72px;
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1.4rem;
    color: #fff;
    letter-spacing: 2px;
}

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

.login-logo-text h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.login-logo-text p {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.login-form h2 {
    font-size: 1.15rem;
    margin-bottom: var(--space-lg);
    text-align: center;
    color: var(--text-secondary);
    font-weight: 500;
}

.login-footer {
    text-align: center;
    margin-top: var(--space-lg);
}

.login-footer a {
    color: var(--secondary);
    font-size: 0.85rem;
}

.password-toggle {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.1rem;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.password-toggle:hover {
    color: var(--text-primary);
}

/* ── Alpine.js x-cloak ────────────────────────────────────── */
[x-cloak] {
    display: none !important;
}

/* ── Badge Primary ────────────────────────────────────────── */
.badge-primary {
    background: var(--primary-light);
    color: var(--primary);
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    font-weight: 600;
}

.badge-muted {
    background: var(--bg-hover);
    color: var(--text-muted);
}

/* ── Card Header fixes ────────────────────────────────────── */
.card-header {
    flex-wrap: wrap;
    gap: var(--space-sm);
}

.card-title .count {
    font-size: 0.8rem;
    font-weight: 400;
    color: var(--text-muted);
}

/* ── View Toggle and Responsive Grid Layouts ── */
.view-toggle-group {
    display: inline-flex;
    background: var(--bg-input);
    border-radius: var(--radius-md);
    padding: 3px;
    gap: 2px;
    align-items: center;
}

.view-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: calc(var(--radius-md) - 2px);
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition-fast);
    padding: 0;
}

.view-toggle-btn:hover {
    color: var(--text-primary);
}

.view-toggle-btn.active {
    background: var(--bg-card);
    color: var(--primary);
    box-shadow: var(--shadow-sm);
}

.card-grid-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-md);
    margin-bottom: var(--space-md);
}

.card-grid-container .mobile-card {
    margin-bottom: 0 !important;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.card-grid-container .mobile-card-actions {
    margin-top: auto !important;
}

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

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

/* ── Barcode & QR Scanner UI ───────────────────────────────── */
.scanner-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 15, 26, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-md);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.scanner-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.scanner-modal-content {
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 480px;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    transform: translateY(20px);
    transition: all 0.3s ease;
}

.scanner-modal-overlay.active .scanner-modal-content {
    transform: translateY(0);
}

.scanner-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-lg);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.scanner-modal-header h3 {
    margin: 0;
    font-size: 1.1rem;
    color: var(--text-primary);
}

.scanner-modal-body {
    padding: var(--space-lg);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-md);
}

.scanner-viewfinder-container {
    width: 100%;
    aspect-ratio: 4 / 3;
    position: relative;
    border-radius: var(--radius-md);
    overflow: hidden;
    background: #000;
    border: 2px solid var(--border-color);
}

.scanner-viewfinder-container.scanning {
    border-color: var(--secondary);
}

.scanner-laser {
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, transparent 10%, var(--secondary) 50%, transparent 90%);
    position: absolute;
    left: 0;
    top: 0;
    z-index: 10;
    pointer-events: none;
    box-shadow: 0 0 8px var(--secondary);
    animation: scan-laser 2.5s linear infinite;
    display: none;
}

.scanner-viewfinder-container.scanning .scanner-laser {
    display: block;
}

@keyframes scan-laser {
    0% {
        top: 0%;
    }
    50% {
        top: calc(100% - 4px);
    }
    100% {
        top: 0%;
    }
}

.scanner-modal-footer {
    display: flex;
    gap: var(--space-sm);
    justify-content: center;
    padding: var(--space-md) var(--space-lg);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

#scanner-preview {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover;
}

#scanner-preview video {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
}

/* scan button alignment */
.scan-btn {
    border-radius: var(--radius-md) !important;
    padding: 0 var(--space-md) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    height: 42px !important;
    color: var(--secondary) !important;
    border-color: var(--secondary) !important;
}

.scan-btn:hover {
    background: rgba(20, 167, 237, 0.1) !important;
}

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE — Mobile (max-width: 767px) - 90% Width Content
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 767px) {
    .page-content {
        width: 90%;
        margin-left: auto;
        margin-right: auto;
        padding-left: 0;
        padding-right: 0;
    }
    .login-card {
        width: 90%;
        margin-left: auto;
        margin-right: auto;
    }
}

/* ═══════════════════════════════════════════════════════════════
   DARK THEME OVERRIDES
   ═══════════════════════════════════════════════════════════════ */
body.dark-theme {
    --bg-body: #0f0f1a;
    --bg-card: #1a1a2e;
    --bg-card-hover: #252540;
    --bg-input: #252540;
    --bg-hover: #2a2a45;
    --bg-sidebar: #1a1a2e;
    --bg-header: rgba(26, 26, 46, 0.88);

    --text-primary: #ffffff;
    --text-secondary: #a0a0b8;
    --text-muted: #6b6b80;

    --border-color: rgba(255, 255, 255, 0.08);
}

body.dark-theme .card,
body.dark-theme .stat-card {
    background: var(--bg-card);
    border-color: rgba(255, 255, 255, 0.05);
}

body.dark-theme .card:hover,
body.dark-theme .stat-card:hover {
    border-color: rgba(255, 255, 255, 0.1);
}

body.dark-theme .card-glass {
    background: rgba(26, 26, 46, 0.75) !important;
    border-color: rgba(255, 255, 255, 0.08) !important;
}

body.dark-theme .card-glass:hover {
    border-color: rgba(255, 255, 255, 0.15) !important;
}

body.dark-theme .header {
    border-bottom-color: rgba(255, 255, 255, 0.06);
}

body.dark-theme .sidebar {
    border-right-color: rgba(255, 255, 255, 0.06);
}

body.dark-theme .sidebar-header,
body.dark-theme .sidebar-footer {
    border-color: rgba(255, 255, 255, 0.06);
}

body.dark-theme .sidebar-link:hover {
    background: var(--bg-hover);
}

body.dark-theme .bottom-bar {
    border-top-color: rgba(255, 255, 255, 0.06);
}

body.dark-theme .dropdown-menu {
    background: #1a1a2e !important;
    border-color: rgba(255, 255, 255, 0.08) !important;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5) !important;
}

body.dark-theme .dropdown-item {
    color: #a0a0b8 !important;
}

body.dark-theme .dropdown-item:hover {
    background: var(--bg-hover) !important;
    color: #ffffff !important;
}

body.dark-theme .form-control,
body.dark-theme input,
body.dark-theme select,
body.dark-theme textarea {
    background: var(--bg-input) !important;
    border-color: rgba(255, 255, 255, 0.08) !important;
    color: #ffffff !important;
}

body.dark-theme input::placeholder,
body.dark-theme textarea::placeholder {
    color: #6b6b80 !important;
}

body.dark-theme .table {
    color: #ffffff !important;
}

body.dark-theme .table th {
    background: rgba(255, 255, 255, 0.03) !important;
    border-bottom-color: rgba(255, 255, 255, 0.08) !important;
    color: #a0a0b8 !important;
}

body.dark-theme .table td {
    border-bottom-color: rgba(255, 255, 255, 0.05) !important;
}

body.dark-theme .table tr:hover td {
    background: rgba(255, 255, 255, 0.02) !important;
}

/* Adjust colors for notification bells and icons */
body.dark-theme .notification-btn:hover {
    background: var(--bg-hover);
}

body.dark-theme .hamburger-btn:hover {
    background: var(--bg-hover);
}

body.dark-theme .user-avatar {
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* ── Pagination ────────────────────────────────────────────── */
.pagination {
    display: flex;
    justify-content: center;
    list-style: none;
    padding: 0;
    margin: var(--space-lg) 0;
    gap: 8px;
    align-items: center;
}

.pagination .page-item .page-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--bg-card);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: none;
    transition: var(--transition-fast);
}

.pagination .page-item.active .page-link {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
    box-shadow: 0 4px 12px color-mix(in srgb, var(--primary) 30%, transparent);
}

.pagination .page-item:not(.active):not(.disabled) .page-link:hover {
    background: var(--bg-hover);
    color: var(--primary);
    border-color: var(--primary);
}

/* scan button alignment */
.scan-btn {
    border-radius: var(--radius-md) !important;
    padding: 0 var(--space-md) !important;
display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    height: 42px !important;
    color: var(--secondary) !important;
    border-color: var(--secondary) !important;
}

.scan-btn:hover {
    background: rgba(20, 167, 237, 0.1) !important;
}

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE — Mobile (max-width: 767px) - 90% Width Content
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 767px) {
    .page-content {
        width: 90%;
        margin-left: auto;
        margin-right: auto;
        padding-left: 0;
        padding-right: 0;
    }
    .login-card {
        width: 90%;
        margin-left: auto;
        margin-right: auto;
    }

    /* Force grids to 1 column */
    .form-row, .form-row-3 {
        grid-template-columns: minmax(0, 1fr) !important;
    }

    /* Touch targets */
    .btn {
        min-height: 48px;
    }
    
    .form-control {
        min-height: 48px;
    }

    /* Stack info rows vertically */
    .info-row, .mobile-card-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
    .info-value, .mobile-card-value {
        text-align: left;
    }

    /* Modals */
    .modal-content {
        width: 90%;
        max-width: none;
    }
    .modal-body, .modal-header, .modal-footer {
        padding: 15px;
    }

    /* Kanban adjust */
    .kanban-column {
        flex: 0 0 85vw !important;
        min-width: 0 !important;
    }
}

/* ═══════════════════════════════════════════════════════════════
   DARK THEME OVERRIDES
   ═══════════════════════════════════════════════════════════════ */
body.dark-theme {
    --bg-body: #0f0f1a;
    --bg-card: #1a1a2e;
    --bg-card-hover: #252540;
    --bg-input: #252540;
    --bg-hover: #2a2a45;
    --bg-sidebar: #1a1a2e;
    --bg-header: rgba(26, 26, 46, 0.88);

    --text-primary: #ffffff;
    --text-secondary: #a0a0b8;
    --text-muted: #6b6b80;

    --border-color: rgba(255, 255, 255, 0.08);
}

body.dark-theme .card,
body.dark-theme .stat-card {
    background: var(--bg-card);
    border-color: rgba(255, 255, 255, 0.05);
}

body.dark-theme .card:hover,
body.dark-theme .stat-card:hover {
    border-color: rgba(255, 255, 255, 0.1);
}

body.dark-theme .card-glass {
    background: rgba(26, 26, 46, 0.75) !important;
    border-color: rgba(255, 255, 255, 0.08) !important;
}

body.dark-theme .card-glass:hover {
    border-color: rgba(255, 255, 255, 0.15) !important;
}

body.dark-theme .header {
    border-bottom-color: rgba(255, 255, 255, 0.06);
}

body.dark-theme .sidebar {
    border-right-color: rgba(255, 255, 255, 0.06);
}

body.dark-theme .sidebar-header,
body.dark-theme .sidebar-footer {
    border-color: rgba(255, 255, 255, 0.06);
}

body.dark-theme .sidebar-link:hover {
    background: var(--bg-hover);
}

body.dark-theme .bottom-bar {
    border-top-color: rgba(255, 255, 255, 0.06);
}

body.dark-theme .dropdown-menu {
    background: #1a1a2e !important;
    border-color: rgba(255, 255, 255, 0.08) !important;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5) !important;
}

body.dark-theme .dropdown-item {
    color: #a0a0b8 !important;
}

body.dark-theme .dropdown-item:hover {
    background: var(--bg-hover) !important;
    color: #ffffff !important;
}

body.dark-theme .form-control,
body.dark-theme input,
body.dark-theme select,
body.dark-theme textarea {
    background: var(--bg-input) !important;
    border-color: rgba(255, 255, 255, 0.08) !important;
    color: #ffffff !important;
}

body.dark-theme input::placeholder,
body.dark-theme textarea::placeholder {
    color: #6b6b80 !important;
}

body.dark-theme .table {
    color: #ffffff !important;
}

body.dark-theme .table th {
    background: rgba(255, 255, 255, 0.03) !important;
    border-bottom-color: rgba(255, 255, 255, 0.08) !important;
    color: #a0a0b8 !important;
}

body.dark-theme .table td {
    border-bottom-color: rgba(255, 255, 255, 0.05) !important;
}

body.dark-theme .table tr:hover td {
    background: rgba(255, 255, 255, 0.02) !important;
}

/* Adjust colors for notification bells and icons */
body.dark-theme .notification-btn:hover {
    background: var(--bg-hover);
}

body.dark-theme .hamburger-btn:hover {
    background: var(--bg-hover);
}

body.dark-theme .user-avatar {
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* ── Pagination ────────────────────────────────────────────── */
.pagination {
    display: flex;
    justify-content: center;
    list-style: none;
    padding: 0;
    margin: var(--space-lg) 0;
    gap: 8px;
    align-items: center;
}

.pagination .page-item .page-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--bg-card);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: none;
    transition: var(--transition-fast);
}

.pagination .page-item.active .page-link {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
    box-shadow: 0 4px 12px color-mix(in srgb, var(--primary) 30%, transparent);
}

.pagination .page-item:not(.active):not(.disabled) .page-link:hover {
    background: var(--bg-hover);
    color: var(--primary);
    border-color: var(--primary);
}

.pagination .page-item.disabled .page-link {
    opacity: 0.5;
    cursor: not-allowed;
    background: var(--bg-body);
}

body.dark-theme .pagination .page-item .page-link {
    background: var(--bg-input);
    border-color: rgba(255, 255, 255, 0.08);
}
body.dark-theme .pagination .page-item.active .page-link {
    background: var(--primary);
    border-color: var(--primary);
}

/* Ensure SweetAlert is always on top of custom modals (which use z-index 9999) */
.swal2-container {
    z-index: 10000 !important;
}

/* Card Grid Layout */
.card-grid-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-md);
}

/* Two columns specific modifier for mobile */
@media (max-width: 767px) {
    .card-grid-container.two-columns-mobile {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-sm);
    }
}

@media (min-width: 768px) {
    .card-grid-container {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    }
}
.card-grid-container .mobile-card {
    margin-bottom: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
}
.card-grid-container .mobile-card-body {
    flex: 1;
}
.card-grid-container .mobile-card-actions {
    margin-top: auto;
}



/* Desktop collapsed 85% removed to allow full width */
@media (min-width: 1024px) {
    body.desktop-collapsed .page-content {
        max-width: none !important;
        margin-left: 8px !important;
        margin-right: 8px !important;
    }
}


.swal2-actions { gap: 12px; flex-wrap: wrap; margin-top: 1.5rem !important; }
.swal2-popup .btn { margin: 0; }

.sidebar-update-card {
    margin: var(--space-md);
    background: linear-gradient(135deg, #111827, #1f2937);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    color: #fff;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

.sidebar-update-card::before {
    content: '';
    position: absolute;
    top: -50px;
    right: -50px;
    width: 100px;
    height: 100px;
    background: radial-gradient(circle, rgba(20, 167, 237, 0.4) 0%, transparent 70%);
    border-radius: 50%;
}

.sidebar-update-card h4 {
    color: #fff;
    font-size: 0.95rem;
    margin-bottom: 4px;
    position: relative;
    z-index: 1;
}

.sidebar-update-card p {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.75rem;
    margin-bottom: 12px;
    position: relative;
    z-index: 1;
    line-height: 1.3;
}

.sidebar-update-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    padding: 8px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-fast);
    position: relative;
    z-index: 1;
    text-decoration: none;
}

.sidebar-update-btn:hover {
    background: var(--primary-hover);
    color: #fff;
    box-shadow: var(--shadow-glow-primary);
}