:root {
    --accent: #f5265e;
    --green: #20c776;
    --blue: #2f74ff;
    --orange: #ff9f1a;
    --purple: #7161ef;
    --red: #f5265e;
    --bg: #f6f8fc;
    --panel: #ffffff;
    --text: #101827;
    --muted: #65738c;
    --line: #e7ebf2;
    --shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
}

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

.icon-sprite {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

.ui-icon {
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
}

.topbar {
    position: fixed;
    z-index: 30;
    top: 0;
    right: 0;
    left: 0;
    display: flex;
    align-items: center;
    height: 64px;
    padding: 0 26px;
    background: #050b18;
    color: #ffffff;
    box-shadow: 0 8px 24px rgba(8, 10, 15, 0.22);
}

.brand {
    display: flex;
    align-items: center;
    min-width: 0;
    gap: 18px;
}

.brand-name {
    color: var(--accent);
    font-size: 28px;
    font-weight: 800;
}

.brand-title {
    overflow: hidden;
    font-size: 17px;
    font-weight: 700;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.menu-button {
    display: none;
    width: 40px;
    height: 40px;
    padding: 10px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    cursor: pointer;
    gap: 5px;
}

.menu-button span {
    display: block;
    height: 2px;
    border-radius: 2px;
    background: #ffffff;
}

.top-actions {
    display: flex;
    align-items: center;
    margin-left: auto;
    gap: 16px;
}

.icon-button {
    position: relative;
    display: grid;
    width: 36px;
    height: 36px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    background: transparent;
    color: #ffffff;
    cursor: pointer;
    place-items: center;
}

.badge-button span,
.nav-badge {
    display: grid;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 10px;
    background: var(--accent);
    color: #ffffff;
    font-size: 11px;
    font-weight: 700;
    place-items: center;
}

.badge-button span {
    position: absolute;
    top: -5px;
    right: -4px;
}

.profile-button {
    display: flex;
    align-items: center;
    min-width: 140px;
    padding: 0;
    border: 0;
    background: transparent;
    color: #ffffff;
    cursor: pointer;
    gap: 10px;
}

.avatar {
    display: grid;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #e8f3ff;
    color: #1447a0;
    font-weight: 800;
    place-items: center;
}

.profile-text {
    display: grid;
    text-align: left;
    gap: 2px;
}

.profile-text strong { font-size: 13px; }
.profile-text small { color: rgba(255,255,255,0.74); font-size: 12px; }

.sidebar {
    position: fixed;
    z-index: 20;
    top: 64px;
    bottom: 0;
    left: 0;
    width: 220px;
    overflow-y: auto;
    border-right: 1px solid var(--line);
    background: #ffffff;
}

.nav {
    display: grid;
    padding: 24px 12px;
    gap: 8px;
}

.nav-item {
    position: relative;
    display: flex;
    align-items: center;
    min-height: 42px;
    padding: 0 18px;
    border-radius: 7px;
    color: #283751;
    font-weight: 700;
    gap: 12px;
}

.nav-item .ui-icon { color: #304569; }
.nav-item.active { background: #eafaf3; color: var(--green); }
.nav-item.active .ui-icon { color: var(--green); }
.nav-item.active::before {
    position: absolute;
    top: 0;
    bottom: 0;
    left: -12px;
    width: 4px;
    border-radius: 0 4px 4px 0;
    background: var(--green);
    content: "";
}

.nav-badge { margin-left: auto; }
.drawer-mask { display: none; }

.main {
    min-height: 100vh;
    padding: 78px 26px 26px 246px;
}

.role-switch {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 10px;
}

.role-switch button {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #ffffff;
    color: #304569;
    cursor: pointer;
    gap: 8px;
}

.teacher-hero,
.teacher-stats,
.panel {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    box-shadow: var(--shadow);
}

.teacher-hero {
    display: grid;
    grid-template-columns: minmax(360px, 1.7fr) repeat(3, minmax(190px, 0.75fr));
    align-items: center;
    min-height: 138px;
    padding: 18px 28px;
    gap: 18px;
}

.hello-card {
    display: flex;
    align-items: center;
    gap: 24px;
}

.teacher-avatar {
    position: relative;
    display: grid;
    width: 96px;
    height: 96px;
    overflow: hidden;
    border-radius: 50%;
    background: #d9f6ea;
    place-items: center;
}

.teacher-avatar::before {
    width: 54px;
    height: 58px;
    border-radius: 28px;
    background: #ffd5bf;
    box-shadow: 0 34px 0 20px #4b5563;
    content: "";
}

.teacher-avatar::after {
    position: absolute;
    top: 20px;
    width: 58px;
    height: 28px;
    border-radius: 20px 20px 8px 8px;
    background: #172033;
    content: "";
}

.teacher-avatar i {
    position: absolute;
    top: 44px;
    left: 32px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #172033;
    box-shadow: 24px 0 0 #172033, 12px 18px 0 -2px #d86b5e;
}

.hello-card h1 {
    margin: 0 0 14px;
    font-size: 24px;
}

.hello-card p {
    margin: 0;
    color: #52627e;
    font-size: 15px;
}

.hero-stat,
.teacher-stats article {
    display: flex;
    align-items: center;
    min-height: 94px;
    gap: 18px;
}

.hero-stat {
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.stat-icon {
    display: grid;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    color: #ffffff;
    place-items: center;
}

.stat-green { background: var(--green); }
.stat-purple { background: var(--purple); }
.stat-orange { background: var(--orange); }
.stat-blue { background: var(--blue); }

.hero-stat small,
.teacher-stats small {
    color: #52627e;
    font-weight: 700;
}

.hero-stat strong,
.teacher-stats strong {
    display: block;
    margin-top: 6px;
    font-size: 26px;
}

.hero-stat p,
.teacher-stats p {
    margin: 6px 0 0;
    color: #0da873;
    font-size: 13px;
}

.hero-stat a {
    display: block;
    margin-top: 8px;
    color: var(--blue);
    font-size: 13px;
    font-weight: 800;
}

.teacher-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-top: 10px;
    padding: 18px 28px;
}

.teacher-stats article {
    padding: 0 28px;
    border-right: 1px solid var(--line);
}

.teacher-stats article:last-child { border-right: 0; }

.teacher-grid {
    display: grid;
    margin-top: 10px;
    gap: 10px;
}

.teacher-grid.two {
    grid-template-columns: minmax(0, 1fr) minmax(420px, 0.95fr);
}

.teacher-grid.second {
    grid-template-columns: minmax(390px, 0.85fr) minmax(0, 1.15fr);
}

.panel {
    padding: 20px;
}

.panel h2 {
    margin: 0 0 16px;
    font-size: 16px;
}

.class-table,
.recent-table {
    width: 100%;
    border-collapse: collapse;
}

.class-table th,
.class-table td {
    padding: 11px 10px;
    border-bottom: 1px solid var(--line);
    color: #304569;
    font-size: 13px;
    text-align: left;
}

.class-table th {
    background: #f7f9fc;
    color: #52627e;
    font-weight: 800;
}

.class-table a,
.panel-more {
    color: var(--blue);
    font-weight: 800;
}

.panel-more {
    display: block;
    margin-top: 12px;
    text-align: center;
}

.todo-list {
    display: grid;
    gap: 12px;
}

.todo-list a {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr) auto;
    align-items: center;
    min-height: 52px;
    padding: 10px 14px;
    border: 1px solid var(--line);
    border-radius: 7px;
    gap: 12px;
}

.todo-icon {
    display: grid;
    width: 34px;
    height: 34px;
    border-radius: 7px;
    color: #ffffff;
    place-items: center;
}

.todo-icon.orange { background: var(--orange); }
.todo-icon.blue { background: var(--blue); }
.todo-icon.red { background: var(--red); }
.todo-list strong { color: #304569; font-size: 14px; }
.todo-list em { color: #0da873; font-style: normal; font-weight: 800; }

.exam-state-list {
    display: grid;
    gap: 13px;
}

.exam-state-list p {
    display: grid;
    grid-template-columns: 76px minmax(0, 1fr) minmax(110px, 0.7fr) 92px;
    align-items: center;
    margin: 0;
    color: #304569;
    gap: 12px;
}

.state {
    display: inline-grid;
    min-height: 24px;
    border-radius: 4px;
    font-weight: 800;
    place-items: center;
}

.state.done { background: #eaf4ff; color: var(--blue); }
.state.doing { background: #fff2df; color: #e87800; }
.state.todo { background: #ffecef; color: var(--red); }
.exam-state-list em { color: #52627e; font-style: normal; }
.exam-state-list time { color: #52627e; }

.bar-chart {
    display: grid;
    grid-template-columns: repeat(8, minmax(0, 1fr));
    align-items: end;
    height: 150px;
    padding: 12px 10px 0;
    border-bottom: 1px solid var(--line);
    gap: 16px;
}

.bar-chart div {
    display: grid;
    justify-items: center;
    align-items: end;
    height: 130px;
    color: #304569;
    font-size: 12px;
}

.bar-chart b { margin-bottom: 4px; }
.bar-chart span {
    width: 26px;
    height: calc(var(--v) * 1px);
    border-radius: 4px 4px 0 0;
    background: linear-gradient(180deg, #3b82ff, #1f6bff);
}

.bar-chart em {
    margin-top: 8px;
    font-style: normal;
    white-space: nowrap;
}

.ranking-panel {
    margin-top: 10px;
}

.ranking-list {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 32px;
}

.ranking-list article {
    display: grid;
    grid-template-columns: 28px 38px minmax(0, 1fr);
    align-items: center;
    min-height: 78px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 7px;
    gap: 4px 10px;
}

.rank {
    display: grid;
    grid-row: span 3;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: #eef3fb;
    color: #304569;
    font-weight: 800;
    place-items: center;
}

.rank.medal { background: #ffc928; color: #ffffff; }
.rank.blue { background: #3b82ff; color: #ffffff; }
.rank.orange { background: #ff8a4c; color: #ffffff; }
.ranking-list i {
    display: grid;
    grid-row: span 3;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #eaf3ff;
    color: #1447a0;
    font-style: normal;
    font-weight: 800;
    place-items: center;
}

.ranking-list strong { font-size: 14px; }
.ranking-list small { color: #52627e; }
.ranking-list b { font-size: 20px; }

@media (max-width: 1280px) {
    .teacher-hero,
    .teacher-stats,
    .teacher-grid.two,
    .teacher-grid.second,
    .ranking-list {
        grid-template-columns: 1fr 1fr;
    }

    .hello-card {
        grid-column: span 2;
    }
}

@media (max-width: 900px) {
    .topbar {
        height: 58px;
        padding: 0 14px;
    }

    .brand-name { font-size: 22px; }
    .brand-title { max-width: 160px; font-size: 14px; }
    .menu-button { display: grid; order: -1; margin-right: 8px; }
    .profile-text,
    .top-actions .icon-button:nth-child(2) { display: none; }
    .profile-button { min-width: 38px; }

    .sidebar {
        top: 58px;
        width: 268px;
        transform: translateX(-100%);
        transition: transform 0.2s ease;
    }

    .sidebar.open { transform: translateX(0); }
    .drawer-mask.open {
        position: fixed;
        z-index: 15;
        inset: 58px 0 0;
        display: block;
        background: rgba(15, 23, 42, 0.38);
    }

    .main { padding: 78px 14px 24px; }

    .teacher-hero,
    .teacher-stats,
    .teacher-grid.two,
    .teacher-grid.second,
    .ranking-list {
        grid-template-columns: 1fr;
    }

    .hello-card {
        grid-column: auto;
    }

    .teacher-stats article {
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }

    .teacher-stats article:last-child {
        border-bottom: 0;
    }

    .exam-state-list p {
        grid-template-columns: 76px minmax(0, 1fr);
    }

    .bar-chart {
        overflow-x: auto;
        grid-template-columns: repeat(8, 72px);
    }
}

@media (max-width: 520px) {
    .teacher-hero,
    .teacher-stats,
    .panel {
        padding: 16px;
    }

    .hello-card {
        align-items: flex-start;
        flex-direction: column;
    }

    .class-table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
}
