:root {
    --green: #198754;
    --green-dark: #11633d;
    --gray-50: #f7f9f8;
    --gray-100: #eef2f0;
    --gray-700: #3d4642;
}

body {
    margin: 0;
    background: var(--gray-50);
    color: #17211c;
    font-family: "Segoe UI", Arial, sans-serif;
}

h1 {
    font-size: 1.75rem;
    margin-bottom: 1rem;
}

h2 {
    font-size: 1.1rem;
    margin-bottom: .8rem;
}

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

.sidebar {
    width: 260px;
    background: #ffffff;
    border-right: 1px solid #dde5e1;
    padding: 1rem;
    position: sticky;
    top: 0;
    height: 100vh;
}

.sidebar .nav {
    min-height: calc(100vh - 120px);
}

.brand {
    color: var(--green-dark);
    font-weight: 700;
    font-size: 1.15rem;
    margin-bottom: 1rem;
}

.brand-logo {
    display: block;
    width: 100%;
    max-height: 72px;
    object-fit: contain;
    object-position: left center;
}

.user-chip {
    background: var(--gray-100);
    border-radius: 8px;
    padding: .75rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.user-chip span {
    display: block;
    font-size: .8rem;
    color: #66746e;
    font-weight: 400;
}

.role-switcher {
    margin: -.35rem 0 1rem;
}

.role-switcher .form-label {
    color: #66746e;
    font-size: .78rem;
    margin-bottom: .25rem;
}

.nav-link {
    color: var(--gray-700);
    border-radius: 6px;
    margin-bottom: .25rem;
}

.nav-link:hover {
    background: #e8f4ee;
    color: var(--green-dark);
}

.nav-group {
    margin: .25rem 0 .5rem;
}

.nav-group-title {
    color: #68776f;
    font-size: .78rem;
    font-weight: 700;
    padding: .35rem .75rem .2rem;
    text-transform: uppercase;
}

.nav-group-toggle {
    width: 100%;
    border: 0;
    background: transparent;
    color: #68776f;
    font-size: .78rem;
    font-weight: 700;
    padding: .35rem .75rem .2rem;
    text-align: left;
    text-transform: uppercase;
}

.nav-group-toggle::after {
    content: "▾";
    float: right;
    font-size: .7rem;
}

.nav-group-toggle[aria-expanded="false"]::after {
    content: "▸";
}

.nav-sublink {
    margin-left: .75rem;
    padding-left: .85rem;
    border-left: 2px solid #dfe8e3;
}

.about-link {
    display: flex;
    align-items: center;
    gap: .4rem;
    width: 100%;
    border: 0;
    background: transparent;
    color: #98a39d;
    font-style: italic;
    margin-top: auto;
    padding: .75rem;
    text-align: left;
}

.about-link:hover {
    color: #6f7c75;
}

.about-link svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.about-copy h3 {
    color: var(--green-dark);
    font-size: 1rem;
    margin-top: 1rem;
}

.about-copy h3:first-child {
    margin-top: 0;
}

.privacy-notice h3 {
    color: var(--green-dark);
    font-size: 1.05rem;
    margin-bottom: 1rem;
}

.privacy-notice li {
    margin-bottom: .7rem;
}

.content {
    flex: 1;
    padding: 1.5rem;
    overflow-x: auto;
}

.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, #eff8f3, #ffffff);
}

.login-card {
    width: min(430px, calc(100vw - 2rem));
    background: white;
    border: 1px solid #dfe8e3;
    border-radius: 8px;
    padding: 2rem;
    box-shadow: 0 16px 40px rgba(24, 65, 45, .08);
}

.login-card h1 {
    color: var(--green-dark);
    font-size: 1.35rem;
}

.login-logo {
    display: block;
    width: 100%;
    max-height: 110px;
    object-fit: contain;
    margin-bottom: 1rem;
}

.panel {
    background: #ffffff;
    border: 1px solid #dfe8e3;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
}

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

.metric {
    background: #ffffff;
    border: 1px solid #dfe8e3;
    border-radius: 8px;
    padding: 1rem;
}

.metric span {
    display: block;
    color: #63736b;
    font-size: .9rem;
}

.metric strong {
    font-size: 2rem;
    color: var(--green-dark);
}

.grid-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: .75rem;
    align-items: end;
}

.stack-form {
    display: grid;
    gap: .75rem;
}

.form-section {
    border: 1px solid #e3ece7;
    border-radius: 8px;
    padding: .85rem;
    background: #fbfdfc;
}

.form-section h3 {
    color: var(--green-dark);
    font-size: .95rem;
    font-weight: 700;
    margin: 0 0 .75rem;
}

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

.toolbar {
    display: flex;
    gap: .5rem;
    max-width: 560px;
    margin-bottom: 1rem;
}

.applicant-toolbar {
    max-width: none;
    justify-content: space-between;
    align-items: start;
}

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

.toolbar-form {
    display: flex;
    gap: .5rem;
    max-width: 560px;
    flex: 1;
}

.table-actions {
    display: flex;
    gap: .4rem;
    align-items: center;
}

.table-actions form {
    margin: 0;
}

.icon-button {
    width: 32px;
    height: 31px;
    display: inline-grid;
    place-items: center;
    padding: 0;
}

.icon-button svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.inline-form {
    display: grid;
    grid-template-columns: 90px minmax(150px, 1fr) auto;
    gap: .4rem;
}

.muted {
    color: #68776f;
}

.exam-timer {
    position: sticky;
    top: 0;
    background: #e8f4ee;
    border: 1px solid #cfe7da;
    border-radius: 8px;
    padding: .75rem 1rem;
    margin-bottom: 1rem;
    z-index: 2;
}

.choice {
    display: block;
    padding: .55rem .7rem;
    border: 1px solid #e1e9e5;
    border-radius: 6px;
    margin-bottom: .45rem;
}

.choice span {
    font-weight: 700;
    color: var(--green-dark);
}

.passage-panel {
    border-left: 4px solid var(--green);
}

.passage-text {
    white-space: pre-wrap;
    line-height: 1.55;
}

.question-image-wrap {
    margin: .75rem 0 1rem;
}

.question-image {
    display: block;
    max-width: 100%;
    max-height: 520px;
    object-fit: contain;
    border: 1px solid #dfe8e3;
    border-radius: 8px;
    background: #ffffff;
}

.question-edit-modal-body {
    max-height: min(70vh, 720px);
    overflow-y: auto;
}

.bei-answer-cell {
    max-width: 420px;
    white-space: pre-wrap;
}

.flash-stack {
    margin-bottom: 1rem;
}

.exam-focus-page {
    background: #f4f7f5;
}

.exam-focus-content {
    width: min(1080px, calc(100vw - 2rem));
    margin: 0 auto;
    padding: 1.25rem 0 2rem;
}

.exam-landing {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: end;
    margin-bottom: 1rem;
}

.instruction-list {
    margin-bottom: 0;
    padding-left: 1.25rem;
}

.instruction-list li {
    margin-bottom: .45rem;
}

.exam-action-bar {
    display: flex;
    justify-content: flex-end;
    gap: .75rem;
    align-items: center;
}

.exam-action-bar form {
    margin: 0;
}

@media (max-width: 800px) {
    .app-shell {
        display: block;
    }

    .sidebar {
        width: 100%;
        height: auto;
        position: static;
    }

    .content {
        padding: 1rem;
    }

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

    .exam-landing,
    .exam-action-bar {
        display: grid;
        grid-template-columns: 1fr;
    }
}
