:root {
    --bg: #f5f7fb;
    --panel: #ffffff;
    --ink: #152033;
    --muted: #637083;
    --line: #dbe2ec;
    --accent: #0f766e;
    --accent-strong: #115e59;
    --danger: #b42318;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--ink);
    font-family: Inter, Segoe UI, Arial, sans-serif;
}

button,
input,
select {
    font: inherit;
}

button {
    min-height: 40px;
    border: 0;
    border-radius: 8px;
    background: var(--accent);
    color: white;
    padding: 0 16px;
    cursor: pointer;
    font-weight: 700;
}

button:hover {
    background: var(--accent-strong);
}

button.secondary {
    background: #edf2f7;
    color: var(--ink);
}

input,
select {
    width: 100%;
    min-height: 40px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: white;
    color: var(--ink);
    padding: 8px 10px;
}

label {
    display: grid;
    gap: 6px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.shell {
    min-height: 100vh;
}

.hidden {
    display: none !important;
}

.login-panel {
    width: min(960px, calc(100% - 32px));
    min-height: 520px;
    margin: 48px auto;
    display: grid;
    grid-template-columns: 1.15fr 0.85fr;
    gap: 32px;
    align-items: center;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 48px;
    box-shadow: 0 24px 70px rgba(21, 32, 51, 0.08);
}

.login-panel h1,
.toolbar h1 {
    margin: 0;
    font-size: 40px;
    line-height: 1.05;
}

.login-form {
    display: grid;
    gap: 16px;
}

.app {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 300px 1fr;
}

.sidebar {
    background: #182230;
    color: white;
    padding: 24px;
    display: grid;
    align-content: start;
    gap: 24px;
}

.sidebar .eyebrow,
.sidebar .subtle {
    color: #a7b3c4;
}

.sidebar h2,
.sidebar h3 {
    margin: 4px 0 0;
}

.class-list {
    display: grid;
    gap: 8px;
}

.mask-tabs {
    display: grid;
    gap: 10px;
}

.tab-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 6px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.14);
    padding: 6px;
}

.class-item {
    width: 100%;
    text-align: left;
    background: rgba(255, 255, 255, 0.08);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.tab-item {
    width: 100%;
    min-height: 36px;
    text-align: left;
    background: transparent;
    color: #d8dee8;
    border: 1px solid transparent;
    border-radius: 6px;
    padding: 0 12px;
}

.tab-item:hover {
    background: rgba(56, 189, 248, 0.13);
    color: white;
}

.tab-item.active {
    background: #f8fafc;
    color: #123047;
    border-color: rgba(125, 211, 252, 0.65);
    box-shadow: 0 6px 18px rgba(2, 132, 199, 0.18);
}

.class-item.active {
    background: var(--accent);
}

.workspace {
    padding: 24px;
    display: grid;
    gap: 20px;
    align-content: start;
    outline: none;
}

.toolbar,
.panel-head {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 16px;
}

.date-field {
    width: 190px;
}

.mask {
    display: grid;
    gap: 20px;
}

.panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 20px;
}

.panel h2 {
    margin: 0;
}

.eyebrow {
    margin: 0 0 8px;
    color: var(--accent);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
}

.subtle {
    margin: 8px 0 0;
    color: var(--muted);
}

.table-wrap {
    overflow-x: auto;
    margin-top: 16px;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    border-bottom: 1px solid var(--line);
    padding: 12px 10px;
    text-align: left;
    vertical-align: middle;
}

th {
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
}

td input[type="checkbox"] {
    width: 22px;
    height: 22px;
}

.grade-toolbar {
    display: grid;
    grid-template-columns: minmax(160px, 240px) minmax(160px, 220px);
    gap: 16px;
    align-items: end;
    margin-top: 16px;
}

.grade-input,
.modifier-input {
    max-width: 110px;
}

.empty-state {
    margin: 16px 0 0;
    color: var(--muted);
}

.error {
    min-height: 20px;
    color: var(--danger);
    margin: 0;
}

.toast {
    position: fixed;
    right: 24px;
    bottom: 24px;
    margin: 0;
    background: #152033;
    color: white;
    border-radius: 8px;
    padding: 12px 16px;
    box-shadow: 0 16px 40px rgba(21, 32, 51, 0.2);
}

@media (max-width: 900px) {
    .login-panel,
    .app {
        grid-template-columns: 1fr;
    }

    .login-panel {
        padding: 28px;
        margin: 16px auto;
    }

    .sidebar {
        position: static;
    }

    .tab-list {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .tab-item {
        display: flex;
        align-items: center;
        justify-content: center;
        min-width: 0;
        min-height: 44px;
        padding: 4px 6px;
        line-height: 1.15;
        text-align: center;
        white-space: normal;
        overflow-wrap: anywhere;
    }

    .toolbar,
    .panel-head {
        align-items: stretch;
        flex-direction: column;
    }

    .date-field,
    .grade-toolbar {
        width: 100%;
    }

    .grade-toolbar {
        grid-template-columns: 1fr;
    }
}
