/* MathAI stage 2: sign-in, classes, instructor and admin pages. Builds on app.css tokens. */

.page {
    width: min(1100px, 100%);
    margin: 0 auto;
    padding: clamp(1rem, 3vw, 2rem) clamp(1rem, 3vw, 2rem) 3rem;
    display: grid;
    gap: 1.25rem;
}

.page--narrow {
    width: min(520px, 100%);
}

/* For pages whose main content is a wide table. */
.page--wide {
    width: min(1400px, 100%);
}

.page-title h1 {
    margin: 0 0 0.25rem;
    font-size: clamp(1.4rem, 2.4vw, 1.9rem);
    color: var(--text-strong);
}

.page-title p {
    margin: 0;
    color: var(--text-muted);
}

.card {
    background: var(--surface-card);
    border: 1px solid var(--border-soft);
    border-radius: 16px;
    box-shadow: var(--shadow-card);
    padding: 1.25rem;
}

    .card h2 {
        margin: 0 0 0.75rem;
        font-size: 1.1rem;
        color: var(--text-strong);
    }

    .card h3 {
        margin: 0 0 0.5rem;
        font-size: 1rem;
        color: var(--text-strong);
    }

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

.small {
    font-size: 0.85rem;
}

.form-row {
    display: grid;
    gap: 0.35rem;
    margin-bottom: 0.9rem;
}

    .form-row label {
        font-weight: 650;
        font-size: 0.9rem;
        color: var(--text-strong);
    }

.form-inline {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    align-items: end;
}

    .form-inline .form-row {
        margin-bottom: 0;
        flex: 1 1 200px;
    }

.input,
select.input,
textarea.input {
    width: 100%;
    min-height: 42px;
    padding: 0.55rem 0.75rem;
    border: 1px solid var(--border-medium);
    border-radius: 10px;
    background: white;
    color: var(--text-strong);
}

    .input:focus {
        outline: 3px solid rgba(37, 99, 235, 0.2);
        border-color: var(--brand);
    }

.input--code {
    font-size: 1.5rem;
    letter-spacing: 0.35em;
    text-align: center;
    font-weight: 800;
}

.check {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    font-weight: 500;
}

.btn-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.btn-link {
    border: 0;
    background: none;
    padding: 0;
    color: var(--brand-dark);
    text-decoration: underline;
    cursor: pointer;
    font: inherit;
}

.btn-danger {
    border: 1px solid #fecaca;
    background: #fff5f5;
    color: #b91c1c;
    border-radius: 10px;
    min-height: 36px;
    padding: 0.4rem 0.8rem;
    font-weight: 650;
    cursor: pointer;
}

.notice {
    padding: 0.7rem 0.9rem;
    border-radius: 10px;
    background: var(--brand-soft);
    color: var(--brand-dark);
    font-weight: 550;
}

.notice--error {
    background: #fef2f2;
    color: #b91c1c;
}

.notice--ok {
    background: #ecfdf5;
    color: #047857;
}

.code-chip {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-weight: 800;
    letter-spacing: 0.06em;
    padding: 0.25rem 0.55rem;
    border-radius: 8px;
    background: var(--surface-soft);
    border: 1px solid var(--border-soft);
    color: var(--text-strong);
    user-select: all;
}

.badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    background: var(--surface-soft);
    border: 1px solid var(--border-soft);
    color: var(--text-muted);
}

.badge--brand {
    background: var(--brand-soft);
    color: var(--brand-dark);
    border-color: transparent;
}

.badge--ok {
    background: #ecfdf5;
    color: #047857;
    border-color: transparent;
}

.list-plain {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.5rem;
}

.class-item {
    border: 1px solid var(--border-soft);
    border-radius: 12px;
    padding: 0.9rem 1rem;
    display: grid;
    gap: 0.6rem;
}

.class-item__head {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 0.6rem;
    align-items: center;
}

    .class-item__head strong {
        font-size: 1.02rem;
        color: var(--text-strong);
    }

.class-item--archived {
    opacity: 0.7;
}

.table-wrap {
    overflow-x: auto;
}

/* For short cells that should never be split, such as "16 Oct 19:20". */
.nowrap {
    white-space: nowrap;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

    .table th,
    .table td {
        text-align: left;
        padding: 0.5rem 0.6rem;
        border-bottom: 1px solid var(--border-soft);
        vertical-align: middle;
    }

    .table th {
        color: var(--text-muted);
        font-weight: 700;
        font-size: 0.8rem;
        text-transform: uppercase;
        letter-spacing: 0.04em;
    }

.grid-2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.25rem;
    align-items: start;
}

/* A card inside .grid-2 that needs the whole width rather than one column. */
.grid-2 > .span-all {
    grid-column: 1 / -1;
}

/* Sessions page: a narrow list beside a wide editor.
   Not .grid-2, because equal halves give the list far more room than a short
   title and a badge need, while starving the six-column transcript table next to
   it. The list is capped; the editor takes everything left over. */
.session-layout {
    display: grid;
    grid-template-columns: minmax(240px, 320px) minmax(0, 1fr);
    gap: 1.25rem;
    align-items: start;
}

/* minmax(0, 1fr) above matters: a grid column defaults to min-content, so a wide
   table would push the column wider than the page instead of scrolling inside
   its own .table-wrap. */

@media (max-width: 900px) {
    .session-layout {
        grid-template-columns: 1fr;
    }
}

.tabs {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
}

    .tabs a {
        padding: 0.45rem 0.85rem;
        border-radius: 999px;
        text-decoration: none;
        font-weight: 650;
        color: var(--text-body);
        border: 1px solid var(--border-soft);
        background: white;
    }

        .tabs a.active {
            background: var(--brand);
            color: white;
            border-color: var(--brand);
        }

/* Header account menu */
.account-menu {
    position: relative;
}

    .account-menu > button {
        display: inline-flex;
        align-items: center;
        gap: 0.45rem;
        border: 1px solid var(--border-soft);
        background: white;
        border-radius: 999px;
        padding: 0.3rem 0.75rem 0.3rem 0.35rem;
        cursor: pointer;
        font-weight: 650;
        color: var(--text-strong);
    }

.account-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--brand-soft);
    color: var(--brand-dark);
    font-weight: 800;
    font-size: 0.85rem;
}

.account-menu__panel {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    min-width: 230px;
    background: white;
    border: 1px solid var(--border-soft);
    border-radius: 12px;
    box-shadow: var(--shadow-card);
    padding: 0.4rem;
    display: grid;
    z-index: 40;
}

    .account-menu__panel .who {
        padding: 0.5rem 0.6rem;
        border-bottom: 1px solid var(--border-soft);
        margin-bottom: 0.3rem;
    }

        .account-menu__panel .who strong {
            display: block;
            color: var(--text-strong);
        }

    .account-menu__panel a,
    .account-menu__panel button {
        text-align: left;
        padding: 0.5rem 0.6rem;
        border-radius: 8px;
        border: 0;
        background: none;
        font: inherit;
        color: var(--text-body);
        text-decoration: none;
        cursor: pointer;
    }

        .account-menu__panel a:hover,
        .account-menu__panel button:hover {
            background: var(--surface-soft);
        }

@media (max-width: 640px) {
    .account-menu__name {
        display: none;
    }
}

/* Links styled as buttons (stage 3) */
a.btn-send,
a.btn-secondary-mathai {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    text-decoration: none;
}

a.btn-secondary-mathai {
    color: var(--text-strong);
}

.btn-secondary-mathai--small {
    min-height: 34px;
    padding: 0.35rem 0.7rem;
    font-size: 0.85rem;
}

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

    .eyebrow a:hover {
        text-decoration: underline;
    }

/* Scenario library grouped by institution. Only an administrator sees more than one
   group, so these headings are absent for an ordinary instructor. */
.library-group {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    margin: 1.6rem 0 0.5rem;
    font-size: 0.95rem;
    color: var(--text-strong);
}

    .library-group:first-of-type {
        margin-top: 0.4rem;
    }

    .library-group span {
        font-weight: 400;
    }
