/* CSS Variables & Reset */
:root {
    --bg: #f4f6f9; --fg: #1a1f2e; --muted: #6b7280;
    --accent: #0d9488; --accent-light: #14b8a6;
    --card: #ffffff; --border: #e5e7eb;
    --sidebar: #111827; --sidebar-hover: #1f2937;
    --success: #10b981; --warning: #f59e0b; --error: #ef4444;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Inter', sans-serif; background: var(--bg); color: var(--fg); min-height: 100vh; }
h1, h2, h3, h4, h5, h6 { font-family: 'Space Grotesk', sans-serif; }
.bg-pattern {
    background-color: var(--bg);
    background-image: radial-gradient(at 20% 30%, rgba(13, 148, 136, 0.05) 0px, transparent 50%),
                      radial-gradient(at 80% 70%, rgba(13, 148, 136, 0.03) 0px, transparent 50%);
}

/* Login */
.login-container { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1rem; }
.login-card { background: var(--card); border-radius: 24px; padding: 3rem; width: 100%; max-width: 420px; box-shadow: 0 20px 50px -12px rgba(0, 0, 0, 0.15); animation: slideUp 0.6s ease; }
@keyframes slideUp { from { opacity: 0; transform: translateY(30px); } to { opacity: 1; transform: translateY(0); } }
.login-logo { width: 64px; height: 64px; background: linear-gradient(135deg, var(--accent), var(--accent-light)); border-radius: 16px; display: flex; align-items: center; justify-content: center; margin: 0 auto 1.5rem; box-shadow: 0 8px 24px -4px rgba(13, 148, 136, 0.4); }

/* Forms & Buttons */
.form-group { margin-bottom: 1.25rem; }
.form-label { display: block; font-size: 0.875rem; font-weight: 500; color: var(--fg); margin-bottom: 0.5rem; }
.form-input, .form-select { width: 100%; padding: 0.875rem 1rem; border: 2px solid var(--border); border-radius: 12px; font-size: 1rem; transition: all 0.2s; background: var(--card); }
.form-input:focus, .form-select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px rgba(13, 148, 136, 0.1); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem; padding: 0.875rem 1.5rem; border-radius: 12px; font-size: 0.9375rem; font-weight: 600; cursor: pointer; transition: all 0.2s; border: none; font-family: 'Space Grotesk', sans-serif; }
.btn-primary { background: linear-gradient(135deg, var(--accent), var(--accent-light)); color: white; box-shadow: 0 4px 14px -2px rgba(13, 148, 136, 0.4); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 20px -2px rgba(13, 148, 136, 0.5); }
.success-message { display: none; background: rgba(16, 185, 129, 0.1); border: 1px solid rgba(16, 185, 129, 0.3); border-radius: 12px; padding: 1rem; margin-top: 1rem; color: #047857; font-weight: 500; }
.show { display: flex; align-items: center; gap: 0.75rem; animation: slideIn 0.3s ease; }
.error-msg { background: rgba(239, 68, 68, 0.1); border: 1px solid rgba(239, 68, 68, 0.3); color: #b91c1c; padding: 0.75rem; border-radius: 8px; margin-bottom: 1rem; text-align: center; }

/* Dashboard Layout */
.dashboard-layout { display: flex; min-height: 100vh; }
.sidebar { width: 280px; background: var(--sidebar); min-height: 100vh; position: fixed; left: 0; top: 0; z-index: 40; display: flex; flex-direction: column; transition: transform 0.3s; }
.sidebar-header { padding: 1.5rem; border-bottom: 1px solid rgba(255, 255, 255, 0.1); }
.sidebar-logo { display: flex; align-items: center; gap: 0.75rem; }
.sidebar-logo-icon { width: 44px; height: 44px; background: linear-gradient(135deg, var(--accent), var(--accent-light)); border-radius: 12px; display: flex; align-items: center; justify-content: center; }
.sidebar-logo-text { color: white; font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 1.125rem; }
.sidebar-logo-text span { display: block; font-size: 0.75rem; font-weight: 400; color: var(--muted); }
.sidebar-nav { flex: 1; padding: 1rem 0; }
.nav-section-title { font-size: 0.6875rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: rgba(255, 255, 255, 0.4); padding: 0.5rem 1rem; margin-top: 1rem; }
.nav-item { display: flex; align-items: center; gap: 0.75rem; padding: 0.875rem 1rem; color: rgba(255, 255, 255, 0.7); text-decoration: none; border-radius: 10px; margin: 0.25rem 0.5rem; transition: all 0.2s; cursor: pointer; font-weight: 500; }
.nav-item:hover { background: var(--sidebar-hover); color: white; }
.nav-item.active { background: linear-gradient(135deg, var(--accent), var(--accent-light)); color: white; }
.nav-item.logout { color: rgba(239, 68, 68, 0.8); }
.nav-item.logout:hover { background: rgba(239, 68, 68, 0.1); color: #ef4444; }
.nav-item svg { width: 20px; height: 20px; flex-shrink: 0; }

.main-content { flex: 1; margin-left: 280px; }
.top-navbar { background: var(--card); border-bottom: 1px solid var(--border); padding: 1rem 2rem; position: sticky; top: 0; z-index: 30; display: flex; align-items: center; justify-content: space-between; }
.navbar-title { font-family: 'Space Grotesk', sans-serif; font-size: 1.25rem; font-weight: 700; }
.user-avatar { width: 40px; height: 40px; background: linear-gradient(135deg, var(--accent), var(--accent-light)); border-radius: 12px; display: flex; align-items: center; justify-content: center; color: white; font-weight: 600; }
.page-content { padding: 2rem; }

/* Cards & Stats */
.card { background: var(--card); border-radius: 16px; padding: 1.5rem; box-shadow: 0 1px 3px rgba(0,0,0,0.05); border: 1px solid var(--border); margin-bottom: 1.5rem; }
.card-header { margin-bottom: 1.5rem; border-bottom: 1px solid var(--border); padding-bottom: 1rem; }
.card-title { font-size: 1.25rem; font-weight: 700; color: var(--fg); }
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1.5rem; margin-bottom: 2rem; }
.stat-card { background: var(--card); border-radius: 16px; padding: 1.5rem; border: 1px solid var(--border); position: relative; overflow: hidden; }
.stat-card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 4px; background: linear-gradient(90deg, var(--accent), var(--accent-light)); }
.stat-icon { width: 48px; height: 48px; border-radius: 12px; display: flex; align-items: center; justify-content: center; margin-bottom: 1rem; }
.stat-value { font-family: 'Space Grotesk', sans-serif; font-size: 2rem; font-weight: 700; }
.stat-label { font-size: 0.875rem; color: var(--muted); }

/* Tables */
.table-container { overflow-x: auto; border-radius: 12px; border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 1rem; text-align: left; }
th { background: var(--bg); font-weight: 600; font-size: 0.75rem; text-transform: uppercase; color: var(--muted); border-bottom: 1px solid var(--border); }
td { border-bottom: 1px solid var(--border); font-size: 0.9375rem; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(13, 148, 136, 0.02); }

/* Utilities */
.badge { display: inline-flex; align-items: center; padding: 0.375rem 0.75rem; border-radius: 20px; font-size: 0.75rem; font-weight: 600; }
.badge-a1 { background: rgba(16, 185, 129, 0.1); color: #10b981; }
.badge-a2 { background: rgba(59, 130, 246, 0.1); color: #3b82f6; }
.badge-b1 { background: rgba(245, 158, 11, 0.1); color: #f59e0b; }
.search-wrapper { position: relative; max-width: 320px; }
.search-wrapper svg { position: absolute; left: 1rem; top: 50%; transform: translateY(-50%); color: var(--muted); width: 20px; height: 20px; pointer-events: none; }
.search-input { width: 100%; padding: 0.75rem 1rem 0.75rem 3rem; border: 2px solid var(--border); border-radius: 12px; background: var(--card); }
.mobile-menu-btn { display: none; background: none; border: none; cursor: pointer; color: var(--fg); }
.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 35; }
.grid-layout { display: grid; grid-template-columns: 400px 1fr; gap: 1.5rem; }
.font-medium { font-weight: 500; }

@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); position: fixed; z-index: 50; }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .mobile-menu-btn { display: block; }
    .sidebar-overlay.show { display: block; }
    .navbar-title { font-size: 1rem; }
    .grid-layout { grid-template-columns: 1fr; }
}
/* Text utilities (used in Jinja templates) */
.text-success {
    color: var(--success);
}

.text-warning {
    color: var(--warning);
}

.text-error {
    color: var(--error);
}

.text-muted {
    color: var(--muted);
}

.font-semibold {
    font-weight: 600;
}