html, body {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    background: #f6f7f9;
    color: #1f2933;
}

a, .btn-link {
    color: #006bb7;
}

.btn-primary {
    color: #fff;
    background-color: #1b6ec2;
    border-color: #1861ac;
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

.content {
    padding-top: 1.1rem;
}

.page-header {
    align-items: center;
    border-bottom: 1px solid #d9dee7;
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
}

.page-header h1 {
    font-size: 2rem;
    margin: 0;
}

.heading-with-help {
    align-items: center;
    display: flex;
    gap: .55rem;
}

.help-tip {
    display: inline-flex;
    position: relative;
    vertical-align: middle;
    z-index: 20;
}

.help-tip__trigger,
.help-tip__example {
    align-items: center;
    background: var(--surface-soft, #eef2f7);
    border: 1px solid var(--line-strong, #c8d0dc);
    border-radius: 50%;
    color: var(--primary, #1b6ec2);
    display: inline-flex;
    font-size: .76rem;
    font-weight: 900;
    height: 1.45rem;
    justify-content: center;
    line-height: 1;
    padding: 0;
    width: 1.45rem;
}

.help-tip__trigger:hover,
.help-tip__trigger:focus {
    background: var(--primary, #1b6ec2);
    color: #fff;
    outline: none;
}

.help-tip__popover {
    background: var(--surface, #fff);
    border: 1px solid var(--line, #dfe4ec);
    border-radius: 9px;
    box-shadow: var(--shadow-lg, 0 16px 38px rgba(17, 24, 39, .2));
    color: var(--text, #1f2933);
    display: none;
    gap: .4rem;
    left: 50%;
    min-width: 260px;
    padding: .85rem;
    position: absolute;
    top: calc(100% + .3rem);
    transform: translateX(-50%);
}

.help-tip__popover::before {
    content: "";
    height: .45rem;
    left: 0;
    position: absolute;
    right: 0;
    top: -.4rem;
}

.help-tip__popover strong,
.help-tip__popover span,
.help-tip__popover a {
    display: block;
}

.help-tip__popover span {
    color: var(--muted, #5f6b7a);
    font-size: .88rem;
    font-weight: 500;
    line-height: 1.45;
}

.help-tip__popover a {
    font-size: .85rem;
    font-weight: 800;
}

.help-tip:hover .help-tip__popover,
.help-tip:focus-within .help-tip__popover {
    display: grid;
}

.help-eyebrow {
    color: var(--primary, #1b6ec2);
    display: block;
    font-size: .72rem;
    font-weight: 850;
    letter-spacing: .09em;
    margin-bottom: .3rem;
    text-transform: uppercase;
}

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

.help-topic-grid a {
    background: var(--surface, #fff);
    border: 1px solid var(--line, #dfe4ec);
    border-radius: 10px;
    box-shadow: var(--shadow-sm);
    display: grid;
    gap: .45rem;
    padding: 1.15rem;
    text-decoration: none;
    transition: border-color .14s ease, transform .14s ease;
}

.help-topic-grid a:hover {
    border-color: var(--primary, #1b6ec2);
    transform: translateY(-2px);
}

.help-topic-grid strong {
    color: var(--text, #1f2933);
    font-size: 1.05rem;
}

.help-topic-grid span {
    color: var(--muted, #5f6b7a);
    line-height: 1.5;
}

.help-article {
    background: var(--surface, #fff);
    border: 1px solid var(--line, #dfe4ec);
    border-radius: 10px;
    box-shadow: var(--shadow-sm);
    margin-top: 1.25rem;
    padding: 1.35rem;
}

.help-article h2 {
    color: var(--text, #1f2933);
    font-size: 1.15rem;
    margin: 1.3rem 0 .4rem;
}

.help-article h2:first-child {
    margin-top: 0;
}

.help-article p {
    color: var(--muted, #5f6b7a);
    line-height: 1.65;
    margin: 0;
}

.help-article ul,
.help-article ol {
    color: var(--muted, #5f6b7a);
    line-height: 1.65;
    margin: .55rem 0 0;
    padding-left: 1.35rem;
}

.help-article li + li {
    margin-top: .35rem;
}

.help-callout {
    background: var(--surface-soft, #eef2f7);
    border-left: 4px solid var(--primary, #1b6ec2);
    border-radius: 7px;
    color: var(--text, #1f2933);
    margin-top: 1rem;
    padding: .9rem 1rem;
}

.help-callout strong {
    display: block;
    margin-bottom: .25rem;
}

.help-steps {
    counter-reset: help-step;
    display: grid;
    gap: .75rem;
    list-style: none;
    padding: 0 !important;
}

.help-steps li {
    background: var(--surface-soft, #eef2f7);
    border-radius: 8px;
    counter-increment: help-step;
    display: grid;
    gap: .2rem;
    grid-template-columns: 2rem 1fr;
    padding: .8rem;
}

.help-steps li::before {
    align-items: center;
    background: var(--primary, #1b6ec2);
    border-radius: 50%;
    color: #fff;
    content: counter(help-step);
    display: flex;
    font-size: .82rem;
    font-weight: 850;
    grid-row: span 2;
    height: 1.7rem;
    justify-content: center;
    width: 1.7rem;
}

.account-detail-grid {
    display: grid;
    gap: .75rem;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    margin-top: .85rem;
}

.user-account-form {
    display: grid;
    gap: .75rem;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: .85rem;
}

.account-verification-row {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: .75rem 1.25rem;
    margin-top: .9rem;
}

.account-verification-row .form-check {
    margin: 0;
}

.account-save-actions {
    border-bottom: 1px solid var(--line, #dfe4ec);
    margin-top: .9rem;
    padding-bottom: 1rem;
}

.account-system-grid {
    display: grid;
    gap: .75rem;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-top: 1rem;
}

.account-detail {
    background: var(--surface-soft, #eef2f7);
    border: 1px solid var(--line, #dfe4ec);
    border-radius: 8px;
    display: grid;
    gap: .3rem;
    min-width: 0;
    padding: .8rem;
}

.account-detail span {
    color: var(--muted, #5f6b7a);
    font-size: .76rem;
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.account-detail strong {
    color: var(--text, #1f2933);
    overflow-wrap: anywhere;
}

.password-reset-grid {
    display: grid;
    gap: .75rem;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    margin: .85rem 0;
}

.password-field-host {
    position: relative;
}

.password-field-input {
    padding-right: 4.75rem !important;
}

.password-reveal-toggle {
    align-items: center;
    background: var(--surface-soft, #f4f7fa);
    border: 0;
    border-left: 1px solid var(--line, #dfe4ec);
    color: var(--primary, #1b6ec2);
    display: flex;
    font-size: .8rem;
    font-weight: 800;
    height: calc(100% - 2px);
    justify-content: center;
    min-width: 4rem;
    padding: 0 .75rem;
    position: absolute;
    right: 1px;
    top: 1px;
    z-index: 6;
}

.password-field-host:not(.form-floating) .password-reveal-toggle {
    border-radius: 0 calc(var(--bs-border-radius, .375rem) - 1px) calc(var(--bs-border-radius, .375rem) - 1px) 0;
}

.password-field-host.form-floating .password-reveal-toggle {
    border-radius: 0 calc(var(--bs-border-radius, .375rem) - 1px) calc(var(--bs-border-radius, .375rem) - 1px) 0;
}

.password-reveal-toggle:hover,
.password-reveal-toggle:focus-visible {
    background: var(--surface, #fff);
    color: var(--text, #1f2933);
    outline: none;
}

.user-management-grid {
    align-items: stretch;
    display: grid;
    gap: 1rem;
    grid-template-columns: minmax(0, 1fr) auto;
}

.user-account-panel {
    min-width: 0;
}

.user-roles-panel {
    align-self: stretch;
    display: flex;
    flex-direction: column;
    min-width: 190px;
}

.role-toggle-row {
    display: grid;
    gap: .75rem;
    margin-top: .75rem;
}

.role-toggle-item {
    align-items: flex-start;
    background: var(--surface-soft, #eef2f7);
    border: 1px solid var(--line, #dfe4ec);
    border-radius: 8px;
    cursor: pointer;
    display: grid;
    gap: .65rem;
    grid-template-columns: auto 1fr;
    padding: .8rem;
}

.role-toggle-item:hover {
    border-color: var(--line-strong, #c3ccd8);
}

.role-toggle-item .form-check-input {
    margin: .15rem 0 0;
}

.role-toggle-item span {
    display: grid;
    gap: .2rem;
}

.role-toggle-item strong {
    color: var(--text, #1f2933);
}

.role-toggle-item small {
    color: var(--muted, #5f6b7a);
    line-height: 1.4;
}

.user-actions-panel {
    grid-column: 1 / -1;
}

.user-action-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: .85rem;
}

.user-action-item {
    align-content: start;
    background: var(--surface-soft, #eef2f7);
    border: 1px solid var(--line, #dfe4ec);
    border-radius: 8px;
    display: grid;
    gap: .75rem;
    padding: 1rem;
}

.user-action-item h3 {
    color: var(--text, #1f2933);
    font-size: 1rem;
    margin: 0 0 .25rem;
}

.user-action-item p {
    margin: 0;
}

.user-action-item .btn {
    justify-self: start;
}

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

    .user-roles-panel,
    .user-actions-panel {
        grid-column: auto;
    }

    .user-action-grid {
        grid-template-columns: 1fr;
    }

    .user-account-form,
    .account-system-grid {
        grid-template-columns: 1fr;
    }
}

.password-reveal-toggle:focus-visible {
    box-shadow: inset 0 0 0 2px var(--primary, #1b6ec2);
}

.form-floating.password-field-host > .password-field-input {
    padding-right: 4.75rem !important;
}

.form-floating.password-field-host > label {
    right: 4rem;
    width: auto;
}

@media (max-width: 640px) {
    .help-tip__popover {
        left: auto;
        min-width: min(280px, calc(100vw - 2rem));
        right: 0;
        transform: none;
    }
}

.page-header p {
    color: #5f6b7a;
    margin: .35rem 0 0;
}

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

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

.chart-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
    display: grid;
    gap: .9rem;
    min-width: 0;
    padding: 1.1rem;
}

.chart-card__header {
    align-items: flex-start;
    display: flex;
    gap: 1rem;
    justify-content: space-between;
}

.chart-card h2 {
    color: var(--text);
    font-size: 1.08rem;
    font-weight: 850;
    margin: 0;
}

.chart-card p {
    color: var(--muted);
    margin: .25rem 0 0;
}

.chart-card__canvas {
    height: 280px;
    min-height: 240px;
    position: relative;
}

.chart-card__canvas canvas {
    display: block;
}

.mode-grid article,
.exam-card,
.stats-grid article,
.settings-panel,
.objective-item {
    background: #fff;
    border: 1px solid #dfe4ec;
    border-radius: 8px;
    padding: 1rem;
}

.mode-grid h2,
.exam-card h2,
.objective-item h2,
.settings-panel h2 {
    font-size: 1.15rem;
    margin: 0 0 .5rem;
}

.exam-card__meta {
    color: #5f6b7a;
    font-size: .85rem;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.exam-card dl,
.settings-panel dl {
    display: grid;
    gap: .5rem;
    grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
    margin: 1rem 0;
}

.exam-card dt,
.settings-panel dt {
    color: #5f6b7a;
    font-size: .8rem;
    margin: 0;
}

.exam-card dd,
.settings-panel dd {
    font-weight: 700;
    margin: 0;
}

.mode-strip {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    margin-bottom: 1rem;
}

.continue-session-card {
    align-items: center;
    background: linear-gradient(135deg, rgba(25, 135, 84, .13), rgba(25, 135, 84, .05));
    border: 1px solid rgba(25, 135, 84, .38);
    border-left: 5px solid #198754;
    border-radius: 10px;
    box-shadow: var(--shadow-sm);
    display: grid;
    gap: 1rem;
    grid-template-columns: auto minmax(0, 1fr) auto;
    margin-bottom: 1.25rem;
    padding: 1.1rem 1.2rem;
}

.continue-session-card__icon {
    align-items: center;
    background: #198754;
    border-radius: 50%;
    color: #fff;
    display: flex;
    font-size: .85rem;
    height: 2.5rem;
    justify-content: center;
    padding-left: .15rem;
    width: 2.5rem;
}

.continue-session-card__content {
    min-width: 0;
}

.continue-session-card__content > span {
    color: #167347;
    display: block;
    font-size: .72rem;
    font-weight: 850;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.continue-session-card h2 {
    color: var(--text);
    font-size: 1.2rem;
    margin: .15rem 0 .2rem;
}

.continue-session-card p {
    color: var(--muted);
    margin: 0;
}

.continue-session-card__meta {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem .9rem;
    margin-top: .55rem;
}

.continue-session-card__meta strong,
.continue-session-card__meta span {
    color: var(--text);
    font-size: .84rem;
}

@media (max-width: 700px) {
    .continue-session-card {
        align-items: start;
        grid-template-columns: auto 1fr;
    }

    .continue-session-card .btn {
        grid-column: 1 / -1;
        width: 100%;
    }
}

.objective-list {
    display: grid;
    gap: .75rem;
}

.objective-item header {
    align-items: center;
    display: flex;
    justify-content: space-between;
    gap: 1rem;
}

.objective-item header span {
    color: #365b9a;
    font-weight: 700;
}

.objective-item ul {
    margin: .75rem 0 0;
}

.stats-grid span {
    color: #5f6b7a;
    display: block;
}

.stats-grid strong {
    display: block;
    font-size: 2rem;
}

.question-panel {
    background: #fff;
    border: 1px solid #dfe4ec;
    border-radius: 8px;
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
    padding: 1.25rem;
}

.question-panel h2 {
    font-size: 1.35rem;
    margin: .75rem 0 1rem;
}

.question-prompt {
    font-size: 1.02rem;
    margin: .75rem 0 1rem;
}

.question-panel__meta {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
}

.question-panel__meta span {
    background: #eef2f7;
    border-radius: 999px;
    color: #334e68;
    font-size: .8rem;
    font-weight: 700;
    padding: .25rem .55rem;
}

.answer-option {
    align-items: flex-start;
    border: 1px solid #d9dee7;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    gap: .75rem;
    margin-bottom: .65rem;
    max-width: 100%;
    min-width: 0;
    padding: .85rem;
    width: 100%;
}

.answer-option input {
    flex: 0 0 auto;
    margin-top: .25rem;
}

.answer-option > .markdown-content {
    flex: 1 1 auto;
    min-width: 0;
}

.answer-option--selected {
    border-color: #1b6ec2;
    background: #eef6ff;
}

.answer-option--correct {
    border-color: #198754;
    background: #edf8f1;
}

.answer-option--wrong {
    border-color: #dc3545;
    background: #fff1f2;
}

.feedback-panel,
.flag-panel {
    border: 1px solid #d9dee7;
    border-radius: 8px;
    margin-top: 1rem;
    padding: 1rem;
}

.feedback-panel h3 {
    font-size: 1.1rem;
    margin: 0 0 .5rem;
}

.feedback-panel--correct {
    background: #edf8f1;
    border-color: #198754;
}

.feedback-panel--wrong {
    background: #fff1f2;
    border-color: #dc3545;
}

.feedback-nav-button {
    align-items: center;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 8px;
    color: rgba(255, 255, 255, .72);
    cursor: pointer;
    display: flex;
    font: inherit;
    font-weight: 700;
    gap: .65rem;
    padding: .68rem .85rem;
    text-align: left;
    text-decoration: none;
    width: 100%;
}

.feedback-nav-button:hover,
.feedback-nav-button:focus-visible {
    background: rgba(255, 255, 255, .08);
    border-color: rgba(255, 255, 255, .08);
    color: #fff;
}

.feedback-nav-button__icon {
    align-items: center;
    border: 1px solid currentColor;
    border-radius: 50%;
    display: inline-flex;
    flex: 0 0 1.1rem;
    font-size: .72rem;
    height: 1.1rem;
    justify-content: center;
    line-height: 1;
}

.site-feedback-dialog {
    color: var(--text);
    width: min(36rem, calc(100dvw - 2rem));
    max-height: calc(100dvh - 2rem);
    margin: auto;
    overflow: hidden;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 1rem;
    background: var(--surface);
    box-shadow: 0 24px 70px rgba(0, 0, 0, .28);
}

.site-feedback-dialog::backdrop {
    background: rgba(7, 15, 28, .72);
}

.site-feedback-dialog__content {
    display: grid;
    gap: 1rem;
    max-height: calc(100dvh - 2rem);
    overflow-y: auto;
    padding: 1.25rem;
}

.site-feedback-dialog__header {
    background: var(--surface);
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: flex-start;
    position: sticky;
    top: -1.25rem;
    z-index: 1;
    padding-top: 1.25rem;
    padding-bottom: .35rem;
}

.site-feedback-dialog__header h2,
.site-feedback-dialog__header p {
    margin: 0;
}

.question-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    margin-top: 1rem;
}

.admin-session-filters {
    display: grid;
    grid-template-columns: minmax(16rem, 1fr) minmax(12rem, 16rem);
    gap: 1rem;
    align-items: end;
}

.deleted-session-row {
    opacity: .7;
}

.session-deleted-banner {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem 1rem;
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
    border: 1px solid var(--danger);
    border-radius: .75rem;
    background: var(--danger-soft);
    color: var(--danger);
}

.admin-session-detail-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(20rem, .7fr);
    gap: 1rem;
}

.session-detail-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .75rem;
    margin: 0;
}

.session-detail-list > div {
    padding: .75rem;
    border: 1px solid var(--border);
    border-radius: .65rem;
    background: var(--surface-soft);
}

.session-detail-list dt {
    color: var(--muted);
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.session-detail-list dd {
    margin: .25rem 0 0;
    font-weight: 700;
}

.admin-attempt-list {
    display: grid;
    gap: .75rem;
}

@media (max-width: 800px) {
    .admin-session-filters,
    .admin-session-detail-grid,
    .session-detail-list {
        grid-template-columns: 1fr;
    }
}

.question-actions--inline {
    margin-top: 0;
}

.flag-panel {
    display: grid;
    gap: .75rem;
}

.study-tools-panel {
    background: #f7f8fa;
    border: 1px solid #d9dee7;
    border-radius: 8px;
    display: grid;
    gap: .75rem;
    margin: 0 0 1rem;
    padding: .85rem;
}

.study-tools-grid {
    align-items: end;
    display: grid;
    gap: .75rem;
    grid-template-columns: minmax(180px, 240px) 1fr;
}

.bookmark-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
}

.result-meta-row {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    margin-bottom: .75rem;
}

.result-meta-row span,
.study-note-result {
    background: #eef2f7;
    border-radius: 6px;
    color: #334e68;
    font-size: .9rem;
    padding: .35rem .55rem;
}

.study-note-result {
    margin: .75rem 0;
}

.study-note-result p {
    margin: .25rem 0 0;
}

.bookmark-list {
    margin-top: 1rem;
}

.bookmark-prompt {
    margin: .85rem 0;
}

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

.inline-pill {
    background: #eef2f7;
    border-radius: 999px;
    color: #334e68;
    display: inline-block;
    font-size: .8rem;
    font-weight: 700;
    margin: 0 .35rem .35rem 0;
    padding: .2rem .5rem;
}

.inline-pill--warning {
    background: #fff4cc;
    color: #6f4e00;
    text-decoration: none;
}

.question-header-badges {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    justify-content: flex-end;
}

.exam-nav-panel {
    margin-bottom: 1rem;
}

.timer-pill {
    background: #eef2f7;
    border: 1px solid #cbd5e1;
    border-radius: 999px;
    color: #17202a;
    font-weight: 700;
    padding: .45rem .7rem;
}

.timer-pill--urgent {
    background: #fff1f2;
    border-color: #dc3545;
    color: #b4232f;
}

.question-number-grid {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem;
}

.question-number {
    background: #fff;
    border: 1px solid #d9dee7;
    border-radius: 6px;
    color: #334e68;
    font-weight: 700;
    min-width: 2.25rem;
    padding: .35rem .55rem;
}

.question-number--current {
    border-color: #1b6ec2;
    color: #1b6ec2;
}

.question-number--answered {
    background: #edf8f1;
    border-color: #198754;
    color: #146c43;
}

.import-textarea {
    font-family: Consolas, 'Courier New', monospace;
    font-size: .9rem;
}

.large-textarea {
    min-height: 560px;
}

.json-import-textarea {
    min-height: 72vh;
}

.export-textarea {
    min-height: 620px;
}

.import-stats {
    margin-top: 1rem;
}

.markdown-content > :first-child {
    margin-top: 0;
}

.markdown-content {
    max-width: 100%;
    min-width: 0;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.markdown-content > * {
    max-width: 100%;
}

.markdown-content > :last-child {
    margin-bottom: 0;
}

.markdown-content p {
    margin-bottom: .75rem;
}

.markdown-content code {
    background: #eef2f7;
    border-radius: 4px;
    color: #17202a;
    font-family: Consolas, 'Courier New', monospace;
    font-size: .92em;
    overflow-wrap: anywhere;
    padding: .12rem .3rem;
    word-break: break-word;
}

.markdown-content pre {
    background: #f7f8fa;
    border: 1px solid #e5e9f0;
    border-radius: 8px;
    box-sizing: border-box;
    display: block;
    margin: .85rem 0;
    max-width: 100%;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    padding: 1rem;
    width: 100%;
    -webkit-overflow-scrolling: touch;
}

.markdown-content pre code {
    background: transparent;
    border-radius: 0;
    color: #0f172a;
    display: block;
    font-size: .9rem;
    line-height: 1.55;
    max-width: none;
    min-width: max-content;
    overflow-wrap: normal;
    padding: 0;
    white-space: pre;
    word-break: normal;
}

.markdown-content img,
.markdown-content svg,
.markdown-content video,
.markdown-content iframe {
    height: auto;
    max-width: 100%;
}

.markdown-content table {
    display: block;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.markdown-content strong {
    font-weight: 700;
}

.markdown-content ul,
.markdown-content ol {
    margin-bottom: .75rem;
}

.markdown-content--compact {
    max-width: 720px;
}

.markdown-content--compact pre {
    max-height: 220px;
}

.answer-explanation {
    border-top: 1px solid rgba(0, 0, 0, .1);
    margin-top: .75rem;
    padding-top: .75rem;
}

.editor-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: minmax(0, 1.15fr) minmax(320px, .85fr);
}

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

.check-row {
    align-items: flex-start;
    display: flex;
    gap: .5rem;
}

.check-row input {
    margin-top: .25rem;
}

.answer-editor {
    border: 1px solid #dfe4ec;
    border-radius: 8px;
    display: grid;
    gap: .65rem;
    margin-bottom: .75rem;
    padding: .75rem;
}

.section-heading-row,
.answer-editor__header {
    align-items: center;
    display: flex;
    gap: .75rem;
    justify-content: space-between;
}

.section-heading-row {
    margin-bottom: .9rem;
}

.section-heading-row > *,
.recommendation-item > *,
.chart-card__header > * {
    min-width: 0;
}

.section-heading-row h2,
.section-heading-row h3 {
    margin-bottom: 0;
}

.section-heading-row > .btn,
.section-heading-row > .question-actions {
    flex: 0 0 auto;
}

.report-summary {
    margin-bottom: 1rem;
}

.report-item header p {
    color: #5f6b7a;
    margin: .15rem 0 0;
}

.report-prompt {
    margin-top: .85rem;
}

.report-details {
    background: #f7f8fa;
    border: 1px solid #e5e9f0;
    border-radius: 8px;
    margin-top: .85rem;
    padding: .75rem;
}

.report-details p {
    margin: .25rem 0 0;
}

.answer-review-list {
    display: grid;
    gap: .5rem;
    margin-top: .85rem;
}

.answer-review-item {
    align-items: flex-start;
    border: 1px solid #d9dee7;
    border-radius: 8px;
    display: flex;
    gap: .75rem;
    justify-content: space-between;
    padding: .75rem;
}

.answer-review-item--correct {
    border-color: #198754;
    background: #edf8f1;
}

.revision-history-panel {
    margin-top: 1rem;
}

.report-meta {
    display: grid;
    gap: .5rem;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    margin: .85rem 0 0;
}

.report-meta dt {
    color: #5f6b7a;
    font-size: .8rem;
}

.report-meta dd {
    font-weight: 700;
    margin: 0;
}

.recent-sessions {
    margin-top: 1rem;
}

.recommendation-panel {
    margin-bottom: 1rem;
}

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

.recommendation-item {
    border: 1px solid #dfe4ec;
    border-radius: 8px;
    display: grid;
    gap: .75rem;
    grid-template-rows: 1fr auto;
    padding: .85rem;
}

.recommendation-item__content {
    min-width: 0;
}

.recommendation-item__action {
    justify-self: stretch;
    width: 100%;
}

.recommendation-item h3 {
    font-size: 1rem;
    margin: .15rem 0 .35rem;
    overflow-wrap: anywhere;
}

.recommendation-item p {
    color: #5f6b7a;
    margin: 0;
}

.coverage-row--empty td {
    background: #fff1f2;
}

.coverage-row--thin td {
    background: #fff8e6;
}

@media (max-width: 1100px) {
    .editor-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 720px) {
    .study-tools-grid {
        grid-template-columns: 1fr;
    }
}

h1:focus {
    outline: none;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid #e50000;
}

.validation-message {
    color: #e50000;
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }

.darker-border-checkbox.form-check-input {
    border-color: #929292;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
    text-align: start;
}

/* Visual polish layer */
:root {
    color-scheme: light;
    --app-bg: #f4f6f8;
    --surface: #ffffff;
    --surface-soft: #f8fafc;
    --line: #d8e0ea;
    --line-strong: #c4cfdd;
    --text: #17202a;
    --muted: #647386;
    --primary: #2563a8;
    --primary-strong: #184d86;
    --primary-soft: #e9f2fb;
    --accent: #21866d;
    --accent-soft: #e8f6f1;
    --warning-soft: #fff6d9;
    --danger: #b4232f;
    --danger-soft: #fff1f2;
    --shadow-sm: 0 1px 2px rgba(17, 24, 39, .05);
    --shadow-md: 0 14px 32px rgba(17, 24, 39, .08);
    --topbar-bg: rgba(255, 255, 255, .88);
    --sidebar-bg: #182330;
    --sidebar-line: rgba(255, 255, 255, .08);
    --field-bg: #ffffff;
    --table-head-bg: #f3f7fb;
    --table-hover-bg: #f8fbfe;
    --code-bg: #eef2f6;
    --code-border: #dce4ee;
    --code-text: #24364a;
    --pre-bg: #101820;
    --pre-text: #edf5ff;
}

:root[data-theme="dark"] {
    color-scheme: dark;
    --app-bg: #101722;
    --surface: #172231;
    --surface-soft: #111b28;
    --line: #2b3b4e;
    --line-strong: #40546b;
    --text: #e7edf5;
    --muted: #9aaabd;
    --primary: #7bb7ff;
    --primary-strong: #a8ceff;
    --primary-soft: #17304b;
    --accent: #5bd3b1;
    --accent-soft: #12372f;
    --warning-soft: #332914;
    --danger: #ff9ba8;
    --danger-soft: #3a1d25;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .32);
    --shadow-md: 0 18px 34px rgba(0, 0, 0, .36);
    --topbar-bg: rgba(18, 27, 39, .88);
    --sidebar-bg: #0d1420;
    --sidebar-line: rgba(255, 255, 255, .08);
    --field-bg: #101a27;
    --table-head-bg: #111d2b;
    --table-hover-bg: #1b2a3d;
    --code-bg: #0d1622;
    --code-border: #30445c;
    --code-text: #d7e7fa;
    --pre-bg: #080e16;
    --pre-text: #e6f0ff;
}

html {
    background: var(--app-bg);
}

html,
body {
    color: var(--text);
    font-family: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 16px;
    line-height: 1.5;
}

body {
    background:
        linear-gradient(180deg, #f8fafc 0, var(--app-bg) 320px);
}

:root[data-theme="dark"] body {
    background:
        linear-gradient(180deg, #121c29 0, var(--app-bg) 340px);
}

a,
.btn-link {
    color: var(--primary);
}

a:hover,
.btn-link:hover {
    color: var(--primary-strong);
}

.content {
    align-content: start;
    display: grid;
    gap: 1.15rem;
    padding-top: 0;
}

.page-header {
    align-items: flex-start;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 0;
    padding: 1.2rem 1.35rem;
}

.page-header h1 {
    color: var(--text);
    font-size: 1.7rem;
    font-weight: 850;
    line-height: 1.15;
}

.page-header p {
    color: var(--muted);
    font-size: .98rem;
}

.btn {
    border-radius: 7px;
    font-weight: 750;
    line-height: 1.2;
    padding: .55rem .82rem;
}

.btn-sm {
    border-radius: 6px;
    padding: .38rem .62rem;
}

.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
    box-shadow: 0 8px 18px rgba(37, 99, 168, .18);
}

.btn-primary:hover,
.btn-primary:focus {
    background: var(--primary-strong);
    border-color: var(--primary-strong);
}

.btn-outline-primary {
    background: var(--surface);
    border-color: #9bb8d9;
    color: var(--primary);
}

.btn-outline-primary:hover,
.btn-outline-primary:focus {
    background: var(--primary-soft);
    border-color: var(--primary);
    color: var(--primary-strong);
}

.btn-outline-secondary {
    background: var(--surface);
    border-color: var(--line-strong);
    color: #425466;
}

.btn-outline-secondary:hover,
.btn-outline-secondary:focus {
    background: #f2f5f8;
    border-color: #9aa9ba;
    color: var(--text);
}

.btn:disabled {
    box-shadow: none;
    cursor: not-allowed;
}

.btn:focus,
.btn:active:focus,
.btn-link.nav-link:focus,
.form-control:focus,
.form-select:focus,
.form-check-input:focus {
    border-color: #6da0d3;
    box-shadow: 0 0 0 .18rem rgba(37, 99, 168, .16);
}

.mode-grid,
.exam-grid,
.stats-grid,
.recommendation-grid {
    gap: 1.15rem;
}

.mode-grid article,
.exam-card,
.stats-grid article,
.settings-panel,
.objective-item,
.question-panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
    padding: 1.1rem;
}

.mode-grid article:hover,
.exam-card:hover,
.objective-item:hover,
.recommendation-item:hover {
    border-color: var(--line-strong);
    box-shadow: var(--shadow-md);
}

.mode-grid h2,
.exam-card h2,
.objective-item h2,
.settings-panel h2 {
    color: var(--text);
    font-size: 1.08rem;
    font-weight: 850;
}

.mode-grid p,
.exam-card p,
.settings-panel p,
.objective-item p {
    color: var(--muted);
}

.exam-card__meta {
    color: var(--accent);
    font-size: .74rem;
    font-weight: 850;
    letter-spacing: .08em;
}

.exam-card dl,
.settings-panel dl {
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: .8rem;
}

.exam-card dt,
.settings-panel dt,
.stats-grid span,
.report-meta dt {
    color: var(--muted);
    font-weight: 700;
}

.exam-card dd,
.settings-panel dd,
.report-meta dd {
    color: var(--text);
}

.stats-grid article {
    overflow: hidden;
    position: relative;
}

.stats-grid article::before {
    background: var(--accent);
    content: "";
    height: 100%;
    left: 0;
    position: absolute;
    top: 0;
    width: 4px;
}

.stats-grid strong {
    color: var(--text);
    font-size: 1.75rem;
    line-height: 1.05;
}

.mode-strip,
.question-actions {
    gap: .6rem;
}

.mode-strip {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 0;
    padding: .75rem;
}

.objective-list {
    gap: 1rem;
}

.objective-item header {
    border-bottom: 1px solid var(--line);
    margin: -.1rem 0 .8rem;
    padding-bottom: .75rem;
}

.objective-item header span,
.inline-pill {
    background: var(--primary-soft);
    border: 1px solid var(--line-strong);
    color: var(--primary-strong);
}

.inline-pill {
    border-radius: 999px;
    font-weight: 800;
}

.inline-pill--warning {
    background: var(--warning-soft);
    border-color: #f2d586;
    color: #735400;
}

.form-control,
.form-select {
    background-color: var(--field-bg);
    border-color: var(--line-strong);
    border-radius: 7px;
    color: var(--text);
    min-height: 2.55rem;
}

textarea.form-control {
    line-height: 1.45;
}

label {
    color: var(--text);
    font-weight: 700;
}

.field-help {
    color: var(--muted);
    display: block;
    font-size: .82rem;
    font-weight: 500;
    line-height: 1.35;
    margin-top: .35rem;
}

.diagnostic-block {
    background: var(--pre-bg);
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--pre-text);
    font-size: .86rem;
    max-height: 360px;
    overflow: auto;
    padding: .85rem;
    white-space: pre-wrap;
}

.form-check,
.check-row {
    color: var(--text);
}

.filter-grid,
.editor-grid,
.checkbox-grid {
    gap: .9rem;
}

.ai-settings-form {
    display: grid;
    gap: 1rem;
}

.ai-settings-grid {
    align-items: start;
    display: grid;
    gap: .95rem;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.ai-settings-grid label {
    align-content: start;
    display: grid;
    gap: .35rem;
}

.ai-settings-grid .field-help {
    margin-top: 0;
}

.ai-settings-grid--single {
    grid-template-columns: minmax(220px, 320px);
}

.management-form-grid {
    display: grid;
    gap: .9rem;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    margin-bottom: 1rem;
}

.management-form-grid label {
    align-content: start;
    display: grid;
    gap: .35rem;
}

.management-form-grid__wide {
    grid-column: 1 / -1;
}

.management-editor {
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: 8px;
    margin-bottom: 1rem;
    padding: 1rem;
}

.management-editor h3 {
    color: var(--text);
    font-size: 1rem;
    font-weight: 850;
    margin: 0 0 .85rem;
}

.bulk-operation-grid {
    border-top: 1px solid var(--line);
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    margin-top: 1rem;
    padding-top: 1rem;
}

.bulk-operation-grid > div {
    align-content: start;
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: 8px;
    display: grid;
    gap: .7rem;
    padding: .85rem;
}

.bulk-danger-zone p {
    color: var(--muted);
    font-size: .86rem;
    margin: 0;
}

.duplicate-list {
    display: grid;
    gap: 1rem;
}

.duplicate-pair {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
    padding: 1rem;
}

.duplicate-pair > header,
.duplicate-question-meta {
    align-items: flex-start;
    display: flex;
    gap: .75rem;
    justify-content: space-between;
}

.duplicate-pair > header {
    border-bottom: 1px solid var(--line);
    margin-bottom: 1rem;
    padding-bottom: .8rem;
}

.duplicate-pair h2 {
    color: var(--text);
    font-size: 1.1rem;
    font-weight: 850;
    margin: .15rem 0 0;
}

.duplicate-compare-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.duplicate-compare-grid > section {
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: 8px;
    min-width: 0;
    padding: .9rem;
}

.duplicate-question-meta {
    color: var(--muted);
    font-size: .82rem;
    margin-bottom: .75rem;
}

.duplicate-question-meta strong {
    color: var(--text);
    font-size: .9rem;
}

.management-subtext {
    color: var(--muted);
    display: block;
    font-size: .82rem;
    margin-top: .15rem;
}

.documentation-list {
    display: grid;
    gap: .65rem;
}

.documentation-list a {
    align-items: center;
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--text);
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    padding: .8rem;
    text-decoration: none;
}

.documentation-list a:hover {
    border-color: var(--primary);
}

.documentation-list span,
.inline-notice {
    color: var(--muted);
}

.inline-notice {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    margin: 0;
    padding: .75rem 1rem;
}

.table-responsive {
    border: 1px solid var(--line);
    border-radius: 8px;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
}

.table {
    margin-bottom: 0;
}

.table thead th {
    background: var(--table-head-bg);
    border-bottom: 1px solid var(--line);
    color: var(--muted);
    font-size: .78rem;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.table tbody td {
    background: var(--surface);
    border-color: var(--line);
    vertical-align: middle;
}

.table tbody tr:hover td {
    background: var(--table-hover-bg);
}

.question-panel {
    box-shadow: 0 18px 42px rgba(17, 24, 39, .08);
    padding: 1.35rem;
}

.question-panel__toolbar {
    align-items: flex-start;
    display: flex;
    gap: .75rem;
    justify-content: space-between;
    margin-bottom: .85rem;
}

.question-panel__meta {
    gap: .45rem;
    margin-bottom: 0;
}

.question-panel__meta span {
    background: #eef7f4;
    border: 1px solid #cfe9df;
    border-radius: 999px;
    color: #0f6a57;
    font-size: .76rem;
    font-weight: 850;
}

.question-prompt {
    border-bottom: 1px solid var(--line);
    color: var(--text);
    font-size: 1.05rem;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
}

.answer-option {
    background: var(--surface);
    border-color: var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
    margin-bottom: .72rem;
    padding: .9rem .95rem;
    transition: background-color .14s ease, border-color .14s ease, box-shadow .14s ease, transform .14s ease;
}

.answer-option:hover {
    border-color: #aac2dc;
    box-shadow: 0 10px 22px rgba(17, 24, 39, .07);
}

.answer-option--selected {
    background: var(--primary-soft);
    border-color: #78a9da;
}

.answer-option--correct {
    background: var(--accent-soft);
    border-color: #65b89f;
}

.answer-option--wrong {
    background: var(--danger-soft);
    border-color: #f0a4ac;
}

.answer-option input {
    accent-color: var(--primary);
}

.feedback-panel,
.flag-panel,
.study-tools-panel {
    border-radius: 8px;
}

.feedback-panel {
    border-color: var(--line);
}

.feedback-panel--correct {
    background: var(--accent-soft);
    border-color: #7ac4ad;
}

.feedback-panel--wrong {
    background: var(--danger-soft);
    border-color: #eba1aa;
}

.study-tools-panel {
    background: var(--surface-soft);
    border-color: var(--line);
}

.study-tools-backdrop {
    align-items: center;
    background: rgba(10, 16, 24, .52);
    display: flex;
    inset: 0;
    justify-content: center;
    padding: 1rem;
    position: fixed;
    z-index: 1100;
}

.study-tools-modal {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 24px 70px rgba(0, 0, 0, .26);
    display: grid;
    gap: 1rem;
    max-height: min(88vh, 680px);
    max-width: 560px;
    overflow: auto;
    padding: 1.1rem;
    width: min(100%, 560px);
}

.study-tools-modal__header {
    align-items: flex-start;
    display: flex;
    gap: .85rem;
    justify-content: space-between;
}

.study-tools-modal__header h2 {
    color: var(--text);
    font-size: 1.15rem;
    font-weight: 850;
    margin: 0;
}

.study-tools-modal__header p {
    color: var(--muted);
    margin: .2rem 0 0;
}

.result-meta-row span,
.study-note-result {
    background: var(--surface-soft);
    border: 1px solid #e4ebf2;
    color: #425466;
}

.timer-pill {
    background: var(--surface);
    border-color: var(--line-strong);
    border-radius: 999px;
    box-shadow: var(--shadow-sm);
}

.timer-pill--urgent {
    background: var(--danger-soft);
    border-color: #e58d98;
    color: var(--danger);
}

.question-number {
    border-color: var(--line);
    border-radius: 7px;
    min-width: 2.35rem;
}

.question-number:hover {
    background: var(--primary-soft);
    border-color: #9bb8d9;
}

.question-number--current {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.question-number--answered {
    background: var(--accent-soft);
    border-color: #7ac4ad;
    color: #0f6a57;
}

.markdown-content {
    color: var(--text);
}

.markdown-content code {
    background: var(--code-bg);
    border: 1px solid var(--code-border);
    color: var(--code-text);
}

.markdown-content pre {
    background: var(--pre-bg);
    border-color: var(--pre-bg);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .05);
}

.markdown-content pre code {
    color: var(--pre-text);
}

.import-textarea {
    background: var(--field-bg);
}

.answer-editor,
.answer-review-item,
.recommendation-item,
.report-details {
    background: var(--surface-soft);
    border-color: var(--line);
    border-radius: 8px;
}

.answer-review-item--correct {
    background: var(--accent-soft);
    border-color: #7ac4ad;
}

.recommendation-item h3 {
    color: var(--text);
    font-weight: 850;
}

.recommendation-item p,
.report-item header p {
    color: var(--muted);
}

.import-stats,
.bookmark-list,
.recent-sessions,
.recommendation-panel,
.revision-history-panel {
    margin-bottom: 0;
    margin-top: 0;
}

.recommendation-panel .section-heading-row {
    align-items: center;
}

.settings-panel,
.question-panel,
.stats-grid,
.exam-grid,
.mode-grid,
.objective-list {
    margin-bottom: 0;
    margin-top: 0;
}

.coverage-row--empty td {
    background: var(--danger-soft);
}

.coverage-row--thin td {
    background: var(--warning-soft);
}

.coverage-objective-link {
    color: var(--text);
    display: inline-flex;
    gap: .25rem;
    text-decoration: none;
}

.coverage-objective-link:hover {
    color: var(--primary-strong);
    text-decoration: underline;
    text-underline-offset: .18rem;
}

.objective-count-hint {
    color: var(--muted);
    display: block;
    font-size: .78rem;
    font-weight: 600;
    margin-top: .1rem;
}

.generation-approval-check {
    margin-top: .85rem;
}

.mistake-reason-editor {
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: 8px;
    display: grid;
    gap: .85rem;
    margin-top: 1rem;
    padding: 1rem;
}

.mistake-reason-editor__heading,
.mistake-reason-editor__form,
.mistake-filter,
.mistake-journal-item header,
.mistake-reason-card {
    align-items: center;
    display: flex;
    gap: .8rem;
    justify-content: space-between;
}

.mistake-reason-editor__heading h3,
.mistake-reason-card h3,
.mistake-journal-item h3 {
    color: var(--text);
    font-size: 1rem;
    font-weight: 850;
    margin: 0;
}

.mistake-reason-editor__heading p,
.mistake-reason-card p,
.mistake-journal-item p,
.mistake-filter p {
    color: var(--muted);
    margin: .15rem 0 0;
}

.mistake-reason-editor__form {
    align-items: end;
}

.mistake-reason-editor__form label {
    min-width: 220px;
}

.mistake-reason-editor__notes {
    flex: 1;
}

.mistake-reason-editor--compact {
    padding: .85rem;
}

.mistake-filter {
    align-items: end;
}

.mistake-filter label {
    min-width: min(100%, 360px);
}

.mistake-filter > div {
    max-width: 620px;
}

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

.mistake-reason-card {
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: .9rem;
}

.mistake-reason-card > div > span {
    color: var(--accent);
    font-size: .76rem;
    font-weight: 850;
    text-transform: uppercase;
}

.mistake-journal-list {
    display: grid;
    gap: .85rem;
}

.mistake-journal-item {
    border-top: 1px solid var(--line);
    padding-top: 1rem;
}

.mistake-journal-item:first-child {
    border-top: 0;
    padding-top: 0;
}

.mistake-journal-item .markdown-content {
    margin-top: .75rem;
}

.empty-state {
    background: var(--surface);
    border: 1px dashed var(--line-strong);
    border-radius: 8px;
    padding: 2rem;
    text-align: center;
}

.empty-state h2 {
    color: var(--text);
    font-size: 1.2rem;
    font-weight: 850;
}

.empty-state p {
    color: var(--muted);
}

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

.text-success {
    color: #14735d !important;
    font-weight: 700;
}

.validation-message {
    background: var(--danger-soft);
    border: 1px solid #eba1aa;
    border-radius: 7px;
    color: var(--danger);
    margin-top: .7rem;
    padding: .65rem .8rem;
}

.password-requirements {
    display: grid;
    gap: .3rem;
    list-style: none;
    margin: -.25rem 0 1rem;
    padding: .8rem 1rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-soft);
}

.password-requirements li {
    color: var(--danger);
    font-size: .88rem;
}

.password-requirements li::before {
    content: "○";
    display: inline-block;
    margin-right: .5rem;
    width: 1rem;
}

.password-requirements .password-rule--met {
    color: var(--accent);
}

.password-requirements .password-rule--met::before {
    content: "✓";
    font-weight: 900;
}

.authenticator-qr {
    display: inline-grid;
    margin: .75rem 0 1rem;
    padding: .75rem;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
}

.authenticator-qr img {
    display: block;
    height: auto;
    max-width: min(16rem, 100%);
    width: 16rem;
}

@media (max-width: 720px) {
    button,
    .btn,
    a.btn,
    input,
    select,
    textarea {
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
    }

    .btn:not(.btn-sm),
    button:not(.btn-sm),
    .form-control,
    .form-select {
        min-height: 2.75rem;
    }

    .btn-sm {
        min-height: 2.5rem;
        padding: .5rem .7rem;
    }

    .page-header {
        display: grid;
        padding: 1rem;
    }

    .page-header h1 {
        font-size: 1.45rem;
    }

    .page-header > .btn,
    .page-header > a.btn,
    .mode-strip .btn,
    .question-actions:not(.question-actions--inline) .btn {
        width: 100%;
    }

    .question-actions,
    .mode-strip {
        display: grid;
        gap: .65rem;
    }

    .section-heading-row,
    .answer-editor__header,
    .chart-card__header {
        align-items: stretch;
        display: grid;
        grid-template-columns: minmax(0, 1fr);
    }

    .section-heading-row > .btn,
    .section-heading-row > a.btn,
    .section-heading-row > .question-actions,
    .question-actions--inline {
        max-width: 100%;
        width: 100%;
    }

    .chart-grid,
    .mode-grid,
    .exam-grid,
    .stats-grid,
    .recommendation-grid,
    .checkbox-grid,
    .filter-grid,
    .management-form-grid,
    .bulk-operation-grid,
    .mistake-reason-grid,
    .ai-settings-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .settings-panel,
    .question-panel,
    .objective-item,
    .chart-card,
    .recommendation-item,
    .table-responsive {
        min-width: 0;
        width: 100%;
    }

    .stats-grid strong {
        font-size: 1.45rem;
    }

    .question-panel {
        max-width: 100%;
        min-width: 0;
        overflow: hidden;
        padding: 1rem;
    }

    .question-panel fieldset,
    .question-prompt,
    .answer-option,
    .feedback-panel,
    .answer-explanation,
    .structured-result,
    .scenario-part {
        max-width: 100%;
        min-width: 0;
    }

    .markdown-content pre {
        font-size: .78rem;
        padding: .75rem;
    }

    .question-panel__toolbar,
    .study-tools-modal__header,
    .mistake-reason-editor__heading,
    .mistake-reason-editor__form,
    .mistake-filter,
    .mistake-journal-item header,
    .mistake-reason-card {
        display: grid;
    }

    .duplicate-compare-grid {
        grid-template-columns: 1fr;
    }

    .duplicate-pair > header,
    .duplicate-question-meta {
        display: grid;
    }

    .mistake-reason-editor__form label,
    .mistake-filter label {
        min-width: 0;
        width: 100%;
    }

    .dashboard-summary-table thead {
        display: none;
    }

    .dashboard-summary-table,
    .dashboard-summary-table tbody,
    .dashboard-summary-table tr,
    .dashboard-summary-table td {
        display: block;
        width: 100%;
    }

    .dashboard-summary-table tr {
        display: grid;
        gap: .55rem;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        padding: .85rem;
    }

    .dashboard-summary-table tr + tr {
        border-top: 1px solid var(--line);
    }

    .dashboard-summary-table td {
        border: 0;
        padding: 0;
    }

    .dashboard-summary-table td:first-child {
        grid-column: 1 / -1;
    }

    .dashboard-summary-table td[data-label]::before {
        color: var(--muted);
        content: attr(data-label);
        display: block;
        font-size: .7rem;
        font-weight: 800;
        letter-spacing: .06em;
        margin-bottom: .15rem;
        text-transform: uppercase;
    }

    .dashboard-summary-table .dashboard-table-action {
        align-self: end;
        grid-column: 1 / -1;
    }

    .dashboard-summary-table .dashboard-table-action .btn {
        width: 100%;
    }
}

:root[data-theme="dark"] .btn-outline-primary {
    border-color: #47739f;
}

:root[data-theme="dark"] .btn-outline-primary:hover,
:root[data-theme="dark"] .btn-outline-primary:focus {
    background: #203b58;
    border-color: #79b4f1;
    color: #d8ebff;
}

:root[data-theme="dark"] .btn-outline-secondary {
    color: #bdc9d8;
}

:root[data-theme="dark"] .btn-outline-secondary:hover,
:root[data-theme="dark"] .btn-outline-secondary:focus {
    background: #1f2f42;
    border-color: #546b84;
    color: var(--text);
}

:root[data-theme="dark"] .form-control,
:root[data-theme="dark"] .form-select,
:root[data-theme="dark"] .form-control:read-only {
    background-color: var(--field-bg);
    color: var(--text);
}

:root[data-theme="dark"] .form-control::placeholder {
    color: #78889b;
}

:root[data-theme="dark"] .table {
    --bs-table-bg: var(--surface);
    --bs-table-color: var(--text);
    --bs-table-border-color: var(--line);
    color: var(--text);
}

:root[data-theme="dark"] .inline-pill--warning {
    border-color: #6c5724;
    color: #f0d485;
}

:root[data-theme="dark"] .question-panel {
    box-shadow: 0 20px 48px rgba(0, 0, 0, .36);
}

:root[data-theme="dark"] .question-panel__meta span {
    background: #12372f;
    border-color: #2f6c5d;
    color: #9de8d3;
}

:root[data-theme="dark"] .answer-option:hover {
    border-color: #5c82aa;
    box-shadow: 0 12px 24px rgba(0, 0, 0, .28);
}

:root[data-theme="dark"] .answer-option--selected {
    background: #17304b;
    border-color: #5d95ce;
}

:root[data-theme="dark"] .answer-option--correct {
    background: #12372f;
    border-color: #43a083;
}

:root[data-theme="dark"] .answer-option--wrong {
    background: #3a1d25;
    border-color: #c76a77;
}

:root[data-theme="dark"] .result-meta-row span,
:root[data-theme="dark"] .study-note-result {
    border-color: var(--line);
    color: var(--muted);
}

:root[data-theme="dark"] .question-number {
    background: var(--surface);
    color: var(--muted);
}

:root[data-theme="dark"] .question-number--current {
    background: #2f75bd;
    border-color: #2f75bd;
    color: #fff;
}

:root[data-theme="dark"] .question-number--answered {
    background: #12372f;
    border-color: #43a083;
    color: #9de8d3;
}

:root[data-theme="dark"] .text-success {
    color: #78ddb8 !important;
}

:root[data-theme="dark"] .text-danger {
    color: #ff9ba8 !important;
}

:root[data-theme="dark"] .alert,
:root[data-theme="dark"] .validation-message {
    color: var(--danger);
}

.structured-preview-note,
.scenario-context {
    display: grid;
    gap: .5rem;
    padding: 1rem 1.15rem;
    margin: 1rem 0;
    border: 1px solid var(--line);
    border-left: .3rem solid var(--accent);
    border-radius: .75rem;
    background: var(--surface-soft);
}

.scenario-context__label {
    color: var(--accent);
    font-size: .78rem;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.scenario-parts,
.admin-attempt-list {
    display: grid;
    gap: 1rem;
}

.scenario-part,
.structured-result-part {
    display: grid;
    gap: .8rem;
    padding: 1rem;
    border: 1px solid var(--line);
    border-radius: .75rem;
    background: var(--surface);
}

.scenario-part > header {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    color: var(--muted);
    font-size: .82rem;
}

.ordering-list,
.matching-grid {
    display: grid;
    gap: .65rem;
}

.ordering-item {
    display: grid;
    grid-template-columns: 2rem minmax(0, 1fr) auto;
    gap: .75rem;
    align-items: center;
    padding: .75rem;
    border: 1px solid var(--line);
    border-radius: .65rem;
    background: var(--surface-soft);
}

.ordering-item__position {
    display: grid;
    width: 1.8rem;
    height: 1.8rem;
    place-items: center;
    border-radius: 50%;
    background: var(--accent);
    color: white;
    font-weight: 800;
}

.ordering-item__actions {
    display: flex;
    gap: .35rem;
}

.matching-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(14rem, 1fr);
    gap: 1rem;
    align-items: center;
    padding: .75rem;
    border: 1px solid var(--line);
    border-radius: .65rem;
}

.fill-in-response {
    display: grid;
    gap: .4rem;
    max-width: 42rem;
    font-weight: 700;
}

.structured-result {
    display: grid;
    gap: .55rem;
    padding: .8rem 0;
}

.matching-result {
    display: grid;
    gap: .45rem;
    margin: 0 0 .75rem;
}

.matching-result > div {
    display: grid;
    grid-template-columns: minmax(8rem, .8fr) minmax(0, 1.2fr);
    gap: .75rem;
    padding: .55rem .7rem;
    border-radius: .5rem;
    background: var(--surface-soft);
}

.matching-result dd {
    margin: 0;
}

@media (max-width: 720px) {
    .matching-row,
    .matching-result > div {
        grid-template-columns: 1fr;
    }

    .ordering-item {
        grid-template-columns: 2rem minmax(0, 1fr);
    }

    .ordering-item__actions {
        grid-column: 2;
    }
}
