:root {
    /* Modern Palette - Indigo & Slate */
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --primary-light: #eef2ff;

    --bg-body: #f8fafc;
    /* Slate 50 */
    --bg-white: #ffffff;

    --text-main: #0f172a;
    /* Slate 900 */
    --text-muted: #64748b;
    /* Slate 500 */
    --text-light: #94a3b8;
    /* Slate 400 */

    --border-color: #e2e8f0;
    /* Slate 200 */
    --sidebar-width: 260px;
    --radius: 10px;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--bg-body);
    color: var(--text-main);
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
    font-size: 0.925rem;
    line-height: 1.5;
}

/* Global Link Reset */
a {
    text-decoration: none !important;
    color: inherit;
    transition: all 0.2s ease;
}

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

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-white);
    border-right: 1px solid var(--border-color);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
}

.brand {
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-main);
    border-bottom: 1px solid var(--border-color);
}

.nav {
    padding: 1.5rem 1rem;
    flex: 1;
    overflow-y: auto;
}

/* Nav Section Label */
.nav-section {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-light);
    font-weight: 700;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    padding-left: 0.75rem;
}

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

/* Nav Links */
.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0.75rem 1rem;
    color: var(--text-muted);
    font-weight: 500;
    border-radius: var(--radius);
    margin-bottom: 2px;
}

.nav-link i {
    width: 20px;
    text-align: center;
    font-size: 1rem;
    transition: color 0.2s;
}

.nav-link:hover {
    background-color: var(--bg-body);
    color: var(--primary);
}

.nav-link:hover i {
    color: var(--primary);
}

.nav-link.active {
    background-color: var(--primary-light);
    color: var(--primary);
}

.nav-link.logout {
    color: #ef4444;
}

.nav-link.logout:hover {
    background: #fef2f2;
}

/* Dropdown */
.nav-dropdown {
    position: relative;
    margin-bottom: 2px;
}

.nav-dropdown .dropdown-toggle {
    justify-content: space-between;
    cursor: pointer;
    user-select: none;
}

.nav-dropdown .dropdown-arrow {
    font-size: 0.7rem;
    transition: transform 0.2s ease;
}

.nav-dropdown.open .dropdown-arrow {
    transform: rotate(180deg);
}

.nav-dropdown .dropdown-menu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    margin-left: 12px;
    padding-left: 12px;
    border-left: 2px solid var(--border-color);
}

.nav-dropdown.open .dropdown-menu {
    max-height: 500px;
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
}

.sub-nav-link {
    display: flex !important;
    align-items: center;
    gap: 10px;
    padding: 0.6rem 1rem !important;
    font-size: 0.9rem !important;
    font-weight: 500;
    color: var(--text-muted) !important;
    border-radius: var(--radius);
}

.sub-nav-link i {
    font-size: 0.8rem;
    opacity: 0.7;
}

.sub-nav-link:hover {
    color: var(--primary) !important;
    background: var(--bg-body) !important;
    padding-left: 1.2rem !important;
    /* Slight shift effect */
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    /* Prevent flex overflow */
}

.topbar {
    background: var(--bg-white);
    padding: 1rem 2rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 10;
}

.topbar h1 {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0;
}

.content {
    padding: 2rem;
    max-width: 1600px;
    width: 100%;
    margin: 0 auto;
}

@media (max-width: 768px) {
    .content {
        padding: 1rem !important;
    }

    .card {
        padding: 1rem !important;
    }

    .topbar {
        padding: 1rem !important;
    }
}

/* Components */
.card {
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.5rem;
}

.card h3 {
    margin-top: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-main);
}

/* Forms */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-main);
    font-size: 0.9rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.6rem 0.8rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 0.9rem;
    transition: all 0.2s;
    background: var(--bg-body);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
    background: var(--bg-white);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0.6rem 1.2rem;
    border: 1px solid transparent;
    border-radius: var(--radius);
    cursor: pointer;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.2s;
    justify-content: center;
}

.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 6px -1px rgba(79, 70, 229, 0.2);
}

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

.btn-secondary {
    background: white;
    border-color: var(--border-color);
    color: var(--text-main);
}

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

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
}

th {
    text-align: left;
    padding: 0.75rem 1rem;
    border-bottom: 2px solid var(--border-color);
    color: var(--text-muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-main);
}

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

tr:hover td {
    background-color: var(--bg-body);
}

/* Status Badges */
.badge {
    padding: 4px 10px;
    border-radius: 99px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-success {
    background: #dcfce7;
    color: #15803d;
}

.badge-warning {
    background: #fef9c3;
    color: #a16207;
}

.badge-danger {
    background: #fee2e2;
    color: #b91c1c;
}

/* Alerts */
.alert {
    padding: 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.alert.error {
    background: #fee2e2;
    color: #b91c1c;
    border-left: 4px solid #b91c1c;
}

.alert.success {
    background: #dcfce7;
    color: #15803d;
    border-left: 4px solid #15803d;
}

/* Auth Page */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: var(--bg-body);
}

.login-box {
    background: white;
    padding: 2.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    width: 100%;
    max-width: 400px;
}



/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}