:root {
    --bg: #f4f6f8;
    --card: #ffffff;
    --text: #1f2937;
    --muted: #6b7280;
    --border: #d7dde4;
    --primary: #1d4ed8;
    --danger: #b91c1c;
    --warning: #ca8a04;
    --success: #15803d;
}

* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
}
.container {
    width: min(1100px, calc(100% - 2rem));
    margin: 0 auto;
}
.topbar {
    background: #111827;
    color: #fff;
    margin-bottom: 2rem;
}
.topbar-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
}
.brand, .nav a {
    color: #fff;
    text-decoration: none;
}
.nav { display: flex; gap: 1rem; }
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.25rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.grid {
    display: grid;
    gap: 1rem;
}
.two-cols {
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}
.card-span-2 {
    grid-column: 1 / -1;
}
.stack {
    display: grid;
    gap: 0.85rem;
}
label {
    display: grid;
    gap: 0.4rem;
    font-weight: 600;
}
input, select, textarea, button {
    font: inherit;
}
input, select, textarea {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.7rem 0.8rem;
    background: #fff;
}
button {
    border: 0;
    border-radius: 8px;
    background: var(--primary);
    color: #fff;
    padding: 0.75rem 1rem;
    cursor: pointer;
    font-weight: 700;
}
button:hover { opacity: 0.92; }
.button-secondary {
    background: #e5e7eb;
    color: #111827;
}
.button-danger {
    background: var(--danger);
}
.button-small {
    padding: 0.55rem 0.8rem;
}
.button-row {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
}
.button-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    background: #e5e7eb;
    color: #111827;
    text-decoration: none;
    font-weight: 700;
}
.button-link-muted {
    padding: 0.55rem 0.8rem;
}
.auth-wrap {
    min-height: calc(100vh - 120px);
    display: grid;
    place-items: center;
}
.auth-card {
    width: min(460px, 100%);
}
.alert {
    margin-bottom: 1rem;
    border-radius: 10px;
    padding: 0.85rem 1rem;
}
.alert-success { background: #dcfce7; color: #166534; }
.alert-error { background: #fee2e2; color: #991b1b; }
.table-wrap { overflow-x: auto; }
table {
    width: 100%;
    border-collapse: collapse;
}
th, td {
    text-align: left;
    padding: 0.75rem;
    border-bottom: 1px solid var(--border);
}
.badge {
    display: inline-block;
    min-width: 34px;
    text-align: center;
    padding: 0.25rem 0.55rem;
    border-radius: 999px;
    font-weight: 700;
}
.badge-red { background: #fee2e2; color: var(--danger); }
.badge-yellow { background: #fef3c7; color: var(--warning); }
.badge-green { background: #dcfce7; color: var(--success); }
.status-dot {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    vertical-align: middle;
}
.status-red { background: var(--danger); }
.status-yellow { background: var(--warning); }
.status-green { background: var(--success); }
.simple-list {
    margin: 0;
    padding-left: 1.2rem;
}
.muted { color: var(--muted); }
.inline-form {
    display: flex;
    gap: 1rem;
    align-items: end;
}
.admin-class-picker {
    justify-content: flex-start;
}
.checkbox-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}
.student-checkbox-list {
    display: grid;
    gap: 0.6rem;
    max-height: 460px;
    overflow-y: auto;
    padding: 0.35rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #f8fafc;
}
.checkbox-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 0.9rem;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    background: #fff;
    font-weight: 600;
}
.checkbox-row input {
    width: 18px;
    height: 18px;
    margin: 0;
}
.entity-list {
    display: grid;
    gap: 0.75rem;
}
.entity-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 0.85rem 0;
    border-bottom: 1px solid var(--border);
}
.entity-row:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}
.inline-actions {
    display: flex;
    gap: 0.6rem;
    align-items: center;
    flex-wrap: wrap;
}
.inline-actions form {
    margin: 0;
}
.mb-lg { margin-bottom: 1.5rem; }
.mt-lg { margin-top: 1.5rem; }
@media (max-width: 700px) {
    .topbar-inner, .inline-form, .entity-row {
        flex-direction: column;
        align-items: stretch;
    }

    .checkbox-actions,
    .button-row,
    .inline-actions {
        flex-direction: column;
        align-items: stretch;
    }
}
