:root {
    /* Color System - Sky Blue & Green (Richmond Institute) */
    --primary: #0ea5e9;
    /* Sky 500 */
    --primary-hover: #0284c7;
    /* Sky 600 */
    --primary-light: #e0f2fe;
    /* Sky 100 */

    --secondary: #64748b;
    /* Slate 500 */
    --secondary-hover: #475569;
    /* Slate 600 */

    --success: #22c55e;
    /* Green 500 */
    --success-bg: #dcfce7;
    /* Green 100 */

    --danger: #ef4444;
    /* Red 500 */
    --danger-bg: #fee2e2;
    /* Red 100 */

    --warning: #f59e0b;
    /* Amber 500 */
    --warning-bg: #fef3c7;
    /* Amber 100 */

    /* Neutrals */
    --bg-body: #f8fafc;
    /* Slate 50 */
    --surface: #ffffff;
    --border: #e2e8f0;
    /* Slate 200 */

    --text-main: #0f172a;
    /* Slate 900 */
    --text-secondary: #475569;
    /* Slate 600 */
    --text-muted: #94a3b8;
    /* Slate 400 */

    /* Sidebar specific */
    --sidebar-bg: #ffffff;
    /* White */
    --sidebar-text: #475569;
    /* Slate 600 */
    --sidebar-active: #0ea5e9;
    /* Sky 500 */
    --sidebar-hover: #f1f5f9;
    /* Slate 100 */

    /* Effects */
    --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);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --radius: 0.5rem;
    --radius-lg: 0.75rem;

    --header-height: 64px;
}

/* Reset & Base */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    font-size: 0.95rem;
}

a {
    text-decoration: none;
    color: inherit;
    transition: color 0.2s;
}

ul {
    list-style: none;
}

button,
input,
select {
    font-family: inherit;
}

/* Layout Structure */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    transition: transform 0.3s ease;
    z-index: 50;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.05);
    border-right: 1px solid var(--border);
}

.brand {
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    border-bottom: 1px solid var(--border);
}

.brand img {
    height: 40px;
    width: auto;
    object-fit: contain;
}

.nav-menu {
    flex: 1;
    padding: 1.5rem 1rem;
    overflow-y: auto;
}

.nav-header {
    font-size: 0.7rem;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 700;
    margin: 1.5rem 0 0.5rem 0.75rem;
    letter-spacing: 0.05em;
}

.nav-menu ul li {
    margin-bottom: 0.25rem;
}

.nav-menu a {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    color: var(--sidebar-text);
    font-weight: 500;
    transition: all 0.2s;
    font-size: 0.9rem;
}

.nav-menu a:hover {
    background-color: var(--sidebar-hover);
    color: var(--primary);
    transform: translateX(4px);
}

.nav-menu a.active {
    background-color: var(--primary-light);
    color: var(--primary);
    box-shadow: none;
    font-weight: 600;
}

/* Main Content Wrapper */
.main-wrapper {
    flex: 1;
    margin-left: 260px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background: var(--bg-body);
    width: calc(100% - 260px);
}

/* Top Header */
.top-header {
    height: var(--header-height);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    position: sticky;
    top: 0;
    z-index: 40;
}

.header-left {
    display: flex;
    align-items: center;
}

.mobile-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    margin-right: 1rem;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 500;
    color: var(--text-main);
}

.user-avatar {
    width: 36px;
    height: 36px;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
}

.logout-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 500;
    transition: color 0.2s;
    background: none;
    border: none;
    cursor: pointer;
}

.logout-link:hover {
    color: var(--danger);
}

/* Page Content */
.main-content {
    padding: 2rem 2.5rem;
    flex: 1;
}

.main-wrapper.full-width {
    margin-left: 0;
    width: 100%;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f0fdf4 0%, #e0f2fe 100%);
    /* Green to Sky Blue gradient */
}

/* Typography & Utilities */
h1,
h2,
h3,
h4,
h5,
h6 {
    color: var(--text-main);
    line-height: 1.25;
}

.page-title {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: -0.025em;
    margin-bottom: 0.25rem;
}

.text-muted {
    color: var(--text-muted);
}

.action-bar {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
    gap: 1rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.625rem 1.25rem;
    background-color: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.btn:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 6px -1px rgba(14, 165, 233, 0.2);
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
}

.btn-block {
    width: 100%;
}

.btn-secondary {
    background: white;
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--bg-body);
    border-color: var(--text-muted);
}

/* Cards & Containers */
.card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.card-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #ffffff;
}

.card-body {
    padding: 1.5rem;
    flex: 1;
}

.grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

/* Auth Login */
.auth-card {
    background: var(--surface);
    padding: 3rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 420px;
    border: 1px solid var(--border);
    text-align: center;
}

.auth-header {
    margin-bottom: 2rem;
}

.auth-header img {
    height: 60px;
    margin-bottom: 1rem;
}

.auth-header h2 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.form-group {
    margin-bottom: 1.25rem;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.95rem;
    transition: all 0.2s;
    background-color: #f8fafc;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    background-color: white;
    box-shadow: 0 0 0 3px var(--primary-light);
}

/* Tables */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    border-collapse: collapse;
    white-space: nowrap;
}

th {
    background: #f8fafc;
    text-align: left;
    padding: 0.875rem 1.25rem;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border);
}

td {
    padding: 0.875rem 1.25rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
    color: var(--text-main);
}

tr:last-child td {
    border-bottom: none;
}

tr:hover td {
    background-color: #f8fafc;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1;
}

.badge-blue {
    background: var(--primary-light);
    color: var(--primary);
}

.badge-green {
    background: var(--success-bg);
    color: var(--success);
}

.badge-red {
    background: var(--danger-bg);
    color: var(--danger);
}

.badge-gray {
    background: #f1f5f9;
    color: #64748b;
}

/* Alerts */
.alert {
    padding: 1rem 1.5rem;
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.9rem;
}

.alert-success {
    background: var(--success-bg);
    color: #15803d;
    border: 1px solid #bbf7d0;
}

.alert-error {
    background: var(--danger-bg);
    color: #b91c1c;
    border: 1px solid #fecaca;
}

/* Login Page Split Layout */
.login-container {
    display: flex;
    flex: 1;
    width: 100%;
    min-height: 90vh;
}

.login-brand {
    border-radius: 12px;
    flex: 1;
    background: linear-gradient(135deg, var(--primary) 0%, #0c4a6e 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    padding: 2rem;
    text-align: center;
}

.brand-content img {
    height: 130px;
    margin-bottom: 2rem;
    /* filter: brightness(0) invert(1); */
    /* Make logo white if possible, or omit if logo has colors */
}

.brand-content h1 {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 1rem;
    color: white;
}

.brand-content p {
    font-size: 1.1rem;
    color: rgba(255, 255, 255, 0.8);
}

.login-form-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    padding: 2rem;
    border-radius: 12px;

}

.login-form-card {
    width: 100%;
    max-width: 400px;
}

.mobile-brand {
    display: none;
    text-align: center;
    margin-bottom: 2rem;
}

.mobile-brand img {
    height: 50px;
}

.form-header {
    margin-bottom: 2.5rem;
}

.form-header h2 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 0.5rem;
}

.form-header p {
    color: var(--text-secondary);
}

.btn-login {
    margin-top: 1rem;
    padding: 0.875rem;
    font-size: 1rem;
}

/* Responsive Media Queries */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .main-wrapper {
        margin-left: 0;
        width: 100%;
    }

    .top-header {
        padding: 0 1rem;
    }

    .main-content {
        padding: 1.5rem 1rem;
    }

    .mobile-toggle {
        display: block;
    }

    .nav-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 45;
        display: none;
    }

    .nav-overlay.active {
        display: block;
    }

    .grid-container {
        grid-template-columns: 1fr;
    }

    /* Login Page Mobile */
    .login-brand {
        display: none;
    }

    .mobile-brand {
        display: block;
    }

    .login-form-wrapper {
        align-items: flex-start;
        padding-top: 4rem;
    }
}