:root {
    --bg: #f8f9fa;
    --surface: #ffffff;
    --surface-soft: #f3f4f5;
    --surface-line: #e1e3e4;
    --text: #191c1d;
    --muted: #5f6573;
    --primary: #1a56db;
    --primary-deep: #003fb1;
    --secondary: #712ae2;
    --danger: #ba1a1a;
    --warning: #f59e0b;
    --success: #059669;
    --info: #0ea5e9;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: "Noto Sans Thai", sans-serif;
}

.min-w-0 {
    min-width: 0;
}

.app-shell {
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    background: linear-gradient(180deg, #ffffff 0%, #f3f5f9 100%);
    border-right: 1px solid var(--surface-line);
}

.brand-mark {
    width: 3.25rem;
    height: 3.25rem;
    border-radius: 1rem;
    background: #fff;
    border: 1px solid #d8e2f4;
    box-shadow: 0 8px 24px rgba(18, 40, 76, 0.08);
    overflow: hidden;
}

.brand-logo {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 0.25rem;
}

.nav-link {
    color: var(--muted);
    border-radius: 0.9rem;
    font-weight: 600;
}

.nav-link.active,
.nav-link:hover {
    background: #e9efff;
    color: var(--primary-deep);
}

.feature-disabled {
    opacity: 0.55;
    cursor: not-allowed;
    pointer-events: none;
}

.topbar {
    backdrop-filter: blur(12px);
    background: rgba(248, 249, 250, 0.9);
    border-bottom: 1px solid var(--surface-line);
}

.mobile-topbar {
    backdrop-filter: blur(12px);
    background: rgba(248, 249, 250, 0.96);
    border-bottom: 1px solid var(--surface-line);
}

.mobile-menu-btn {
    width: 2.9rem;
    height: 2.9rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.mobile-brand-mark {
    width: 2.6rem;
    height: 2.6rem;
    border-radius: 0.85rem;
}

.mobile-offcanvas {
    max-width: 320px;
}

.card,
.table-wrap {
    background: var(--surface);
    border: 1px solid var(--surface-line);
    border-radius: 1.1rem;
    box-shadow: 0 10px 30px rgba(18, 40, 76, 0.05);
}

.stat-card {
    min-height: 150px;
}

.stat-icon {
    width: 3rem;
    height: 3rem;
    border-radius: 1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.chart-col {
    min-height: 240px;
}

.chart-bar {
    width: 100%;
    background: linear-gradient(180deg, #3f7cff 0%, var(--primary-deep) 100%);
    border-radius: 0.9rem 0.9rem 0 0;
}

.chart-link {
    color: inherit;
    text-decoration: none;
    cursor: pointer;
}

.chart-link:hover .chart-bar,
.chart-link:focus-visible .chart-bar {
    filter: brightness(1.05);
    transform: translateY(-2px);
}

.chart-link .chart-bar {
    transition: transform 0.18s ease, filter 0.18s ease;
}

.chart-link-active .chart-bar {
    box-shadow: 0 0 0 3px rgba(26, 86, 219, 0.18);
    filter: brightness(1.03);
}

.progress-soft {
    height: 0.55rem;
    background: #e9edf2;
    border-radius: 999px;
}

.pill {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    border-radius: 999px;
    padding: 0.45rem 0.85rem;
    font-size: 0.85rem;
    font-weight: 600;
}

.pill-success { background: #ddf7ec; color: #047857; }
.pill-warning { background: #fef3c7; color: #b45309; }
.pill-danger { background: #fee2e2; color: #b91c1c; }
.pill-info { background: #dbeafe; color: #1d4ed8; }
.pill-secondary { background: #ede9fe; color: #6d28d9; }

.dot {
    width: 0.55rem;
    height: 0.55rem;
    border-radius: 999px;
    display: inline-block;
}

.class-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.class-card:hover {
    transform: translateY(-4px);
}

.class-danger {
    border-left: 4px solid var(--danger);
}

.class-primary {
    border-left: 4px solid var(--primary);
}

.class-secondary {
    border-left: 4px solid var(--secondary);
}

.avatar {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 999px;
    background: linear-gradient(135deg, #dbe8ff 0%, #eff4ff 100%);
    color: var(--primary-deep);
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.student-hero {
    min-height: 220px;
}

.fake-photo {
    width: 120px;
    height: 120px;
    border-radius: 999px;
    background: linear-gradient(135deg, #c7d7ff 0%, #f5f8ff 100%);
    border: 5px solid #e9efff;
    color: var(--primary-deep);
    font-size: 2rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.sticky-actions {
    position: sticky;
    bottom: 1rem;
}

@media (max-width: 1199.98px) {
    .container-fluid[style*="max-width: 1280px;"] {
        max-width: 100% !important;
    }

    .student-hero {
        min-height: auto;
    }
}

@media (max-width: 991.98px) {
    .sidebar {
        width: 100%;
        position: static !important;
        border-right: 0;
        border-bottom: 1px solid var(--surface-line);
    }

    .chart-col {
        min-height: auto;
    }

    .sticky-actions {
        position: static;
    }

    .table-responsive {
        margin-inline: -0.5rem;
        padding-inline: 0.5rem;
    }
}

@media (max-width: 767.98px) {
    .card,
    .table-wrap {
        border-radius: 0.95rem;
    }

    .stat-card {
        min-height: auto;
    }

    .fake-photo {
        width: 88px;
        height: 88px;
        font-size: 1.5rem;
    }

    .student-hero .btn {
        width: 100%;
    }

    .chart-col .col {
        min-width: 72px;
    }

    .topbar + .container-fluid,
    .mobile-topbar + .app-shell .container-fluid {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .table td,
    .table th {
        white-space: nowrap;
    }
}
