:root {
    /* Sidebar Colors - Moodle Dark */
    --sidebar-bg: #111827;
    --sidebar-hover: #1F2937;
    --sidebar-active: #F98012;
    --sidebar-text: #F3F4F6;

    /* Main Content Colors */
    --background: #F3F4F6;
    --surface: #FFFFFF;
    --text-main: #111827;
    --text-secondary: #6B7280;
    --border: #E5E7EB;

    /* Brand Colors - Moodle Orange */
    --primary: #F98012;
    --primary-hover: #E67300;

    --success-bg: #D1FAE5;
    --success-text: #065F46;
    --error-bg: #FEE2E2;
    --error-text: #991B1B;

    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--background);
    color: var(--text-main);
    margin: 0;
    padding: 0;
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* --- SIDEBAR --- */
.sidebar {
    width: 260px;
    background-color: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.sidebar-header {
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.brand {
    font-size: 1.25rem;
    font-weight: 700;
    color: white;
    letter-spacing: 0.5px;
}

.nav-section {
    padding: 1rem 0;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    flex: 1;
}

.nav-label {
    padding: 0 1.5rem;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: rgba(255, 255, 255, 0.4);
    margin-top: 1rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.nav-item:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: white;
}

.nav-item.active {
    background-color: var(--sidebar-active);
    color: white;
    border-left-color: white;
}

.nav-item svg {
    width: 20px;
    height: 20px;
    stroke-width: 2;
}

.sidebar-footer {
    padding: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* --- MAIN CONTENT --- */
.main-content {
    flex: 1;
    overflow-y: auto;
    position: relative;
    background: #F9FAFB;
    /* Slightly lighter background for content area */
}

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

.page-title h1 {
    margin: 0;
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: -0.025em;
}

.page-title p {
    margin: 0.5rem 0 0;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.content-container {
    padding: 2.5rem;
    max-width: 1200px;
    margin: 0 auto;
}

/* --- UI COMPONENTS --- */
.card {
    background: var(--surface);
    border-radius: 1rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    padding: 2rem;
    margin-bottom: 2rem;
}

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

.btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 0.95rem;
    text-decoration: none;
}

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

.btn:active {
    transform: translateY(0);
}

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

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

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    box-sizing: border-box;
    font-family: inherit;
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
    background-color: #FAFAFA;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    background-color: white;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

/* Table Styles from Reference */
table {
    width: 100%;
    border-collapse: separate;
    /* Changed for border-radius */
    border-spacing: 0;
}

th {
    text-align: left;
    padding: 1rem 1.5rem;
    font-size: 0.75rem;
    text-transform: uppercase;
    font-weight: 600;
    color: var(--text-secondary);
    background: #F9FAFB;
    border-bottom: 1px solid var(--border);
}

th:first-child {
    border-top-left-radius: 0.5rem;
}

th:last-child {
    border-top-right-radius: 0.5rem;
}

td {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
    font-size: 0.95rem;
}

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

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.025em;
}

.badge-blue {
    background: #DBEAFE;
    color: #1E40AF;
}

.badge-green {
    background: #D1FAE5;
    color: #065F46;
}

.badge-gray {
    background: #F3F4F6;
    color: #374151;
}

/* 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;
}

/* Alert */
.alert {
    padding: 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 500;
}

.alert.success {
    background: var(--success-bg);
    color: var(--success-text);
    border: 1px solid #A7F3D0;
}

.alert.error {
    background: var(--error-bg);
    color: var(--error-text);
    border: 1px solid #FECACA;
}