:root {
    --bg: #f1f5f7;
    --card: #ffffff;
    --primary: #0963a7;
    --primary-dark: #07406d;
    --accent: #c32444;
    --accent-light: #e48ca4;
    --success: #1aa873;
    --danger: #c32444;
    --text: #1e2a36;
    --muted: #667386;
    --border: #d9e2ec;
    --shadow: 0 25px 60px rgba(9, 99, 167, 0.12);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: 'Nunito', 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
}

a {
    text-decoration: none;
    color: inherit;
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.2rem 2rem;
    background: var(--card);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 10;
    border-bottom: 4px solid var(--accent);
}

.brand-mark {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.brand-mark h1 {
    margin: 0;
}

.subtitle {
    margin: 0.2rem 0 0;
    color: var(--muted);
}

.dashboard {
    padding: 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

.card {
    background: var(--card);
    border-radius: 1rem;
    padding: 1.5rem;
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
}

.card.narrow {
    max-width: 480px;
    margin: 2rem auto;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

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

.form-grid {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

label {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text);
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

input,
textarea,
select {
    padding: 0.8rem 1rem;
    border-radius: 0.6rem;
    border: 1px solid var(--border);
    font-size: 1rem;
}

textarea {
    resize: vertical;
}

.btn {
    border: none;
    border-radius: 999px;
    padding: 0.6rem 1.3rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.1s ease, box-shadow 0.2s ease;
}

.btn:active {
    transform: scale(0.98);
}

.btn.primary {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 8px 20px rgba(9, 99, 167, 0.35);
}

.btn.small {
    padding: 0.45rem 1rem;
    font-size: 0.9rem;
}

.btn.ghost.danger {
    color: var(--danger);
}

.btn.outline {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
}

.btn.ghost {
    background: transparent;
    color: var(--primary);
}

.btn.danger {
    background: var(--danger);
    color: #fff;
}

.btn.circle {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    font-size: 1.2rem;
}

.btn.circle.decrease {
    background: rgba(195, 36, 68, 0.12);
    color: var(--danger);
}

.btn.circle.increase {
    background: rgba(9, 99, 167, 0.12);
    color: var(--primary-dark);
}

.alert {
    padding: 1rem 1.2rem;
    border-radius: 0.8rem;
    margin-bottom: 1.5rem;
    font-weight: 600;
}

.alert-success {
    background: rgba(26, 168, 115, 0.12);
    color: var(--success);
}

.alert-error {
    background: rgba(195, 36, 68, 0.15);
    color: var(--danger);
}

.tag {
    background: rgba(195, 36, 68, 0.1);
    color: var(--accent);
    padding: 0.4rem 0.8rem;
    border-radius: 999px;
    font-size: 0.8rem;
}

.list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding-bottom: 0.8rem;
    border-bottom: 1px solid var(--border);
}

.class-list li {
    flex-direction: column;
    align-items: stretch;
}

.class-summary {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
}

.class-summary p {
    margin: 0.35rem 0 0;
    color: var(--muted);
}

.class-manage {
    margin-top: 0.6rem;
}

.class-manage summary {
    cursor: pointer;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 0.4rem;
}

.admin-class-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.class-admin {
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: 0.8rem;
    background: #fff;
    box-shadow: 0 12px 24px rgba(9, 99, 167, 0.08);
}

.class-admin summary {
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    font-weight: 700;
    color: var(--primary);
}

.class-admin summary small {
    font-weight: 500;
    color: var(--muted);
}

.class-admin p {
    margin: 0.8rem 0;
    color: var(--muted);
}

.admin-add-student h3,
.admin-students h3 {
    margin: 0.8rem 0 0.4rem;
    font-size: 1rem;
    color: var(--primary-dark);
}

.student-roster {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.student-roster li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.6rem;
}

.student-roster li:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.form-inline {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 0.8rem;
}

.form-inline textarea {
    min-height: 70px;
}

.inline-danger {
    display: flex;
    justify-content: flex-end;
}

.inline-danger .btn {
    width: fit-content;
}

.student-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
}

.student-card {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: 0.8rem;
    background: #ffffff;
    box-shadow: 0 12px 24px rgba(9, 99, 167, 0.08);
    flex-wrap: wrap;
}

.points {
    font-size: 1.3rem;
    font-weight: 700;
    margin: 0.2rem 0 0;
}

.point-controls {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    align-items: flex-end;
}

.muted {
    color: var(--muted);
}

.points-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding: 0.75rem 1rem;
    background: rgba(9, 99, 167, 0.05);
    border-radius: 0.8rem;
    border: 1px solid var(--border);
}

.points-header label {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    font-weight: 700;
    color: var(--primary-dark);
}

.points-header select {
    min-width: 200px;
    font-weight: 600;
}

.points-limit {
    margin: 0;
    color: var(--muted);
    font-size: 0.95rem;
}

.class-points.hidden {
    display: none !important;
}

.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(195, 36, 68, 0.15), rgba(9, 99, 167, 0.15));
}

.auth-card {
    background: #fff;
    padding: 2.5rem;
    border-radius: 1.5rem;
    width: min(360px, 90%);
    box-shadow: var(--shadow);
    text-align: center;
}

.tagline {
    color: var(--muted);
    margin: 0.75rem 0 1.5rem;
    font-size: 0.95rem;
}

.auth-card h1 {
    margin-top: 0;
}

.logo {
    height: 56px;
    width: auto;
}

.auth-footer small {
    color: var(--muted);
}

.form-stack {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    text-align: left;
}

.btn.full {
    width: 100%;
}

.alert-error,
.alert-success {
    text-align: center;
}

.tab-controls {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.tab-btn {
    padding: 0.6rem 1.2rem;
    border-radius: 999px;
    border: 2px solid transparent;
    background: var(--accent-light);
    color: var(--primary-dark);
    font-weight: 600;
    cursor: pointer;
}

.tab-btn.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
    animation: fadeIn 0.2s ease;
}

.stars {
    display: flex;
    gap: 0.2rem;
    font-size: 1rem;
    color: #cfd8e3;
}

.star.filled {
    color: #f7a400;
}

.star-label {
    color: var(--muted);
    font-size: 0.85rem;
}

.manual-adjust {
    display: flex;
    gap: 0.4rem;
    align-items: center;
    flex-wrap: wrap;
}

.manual-input {
    width: 110px;
    padding: 0.4rem 0.6rem;
    border-radius: 0.5rem;
    border: 1px solid var(--border);
}

.student-info {
    flex: 1;
    min-width: 180px;
}

.quick-adjust {
    display: flex;
    gap: 0.5rem;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 768px) {
    .top-bar {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }

    .dashboard {
        padding: 1rem;
    }

    .student-card {
        flex-direction: column;
    }

    .point-controls {
        width: 100%;
        align-items: stretch;
    }

    .manual-adjust {
        flex-direction: column;
        align-items: stretch;
    }

    .class-summary {
        flex-direction: column;
    }

    .form-inline {
        grid-template-columns: 1fr;
    }

    .points-header {
        flex-direction: column;
        align-items: stretch;
    }

    .points-header select {
        width: 100%;
    }

    .student-roster li {
        flex-direction: column;
        align-items: flex-start;
    }
}
