:root {
    --brand-purple: #5a1cb2;
    --brand-purple-dark: #3a1a62;
    --brand-purple-soft: #7b3bd6;
    --brand-blue: #3b82f6;
    --brand-blue-dark: #2563eb;
    --primary: var(--brand-purple);
    --card-white: #ffffff;
    --card-border: rgba(90, 28, 178, 0.15);
    --text-main: #1d1633;
    --text-muted: #4b3d63;
    --shadow: 0 16px 40px rgba(58, 26, 98, 0.2);
    --shadow-soft: 0 8px 22px rgba(58, 26, 98, 0.16);
    --font-main: 'Open Sans', sans-serif;
    --font-brand: 'Montserrat', sans-serif;
    --font-decor: 'Pacifico', cursive;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-main);
    background: var(--brand-purple) url("../bg.6182c84c49dd.svg") no-repeat top center;
    background-size: cover;
    color: var(--text-main);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    background: rgba(90, 28, 178, 0.12);
    z-index: 0;
    pointer-events: none;
}

.skip-link {
    position: fixed;
    top: 0.5rem;
    left: 0.5rem;
    z-index: 1000;
    padding: 0.65rem 0.9rem;
    border-radius: 0.5rem;
    background: #ffffff;
    color: var(--brand-purple-dark);
    font-weight: 700;
    transform: translateY(-150%);
}

.skip-link:focus {
    transform: translateY(0);
}

:focus-visible {
    outline: 3px solid var(--brand-blue);
    outline-offset: 3px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2.5rem 1.75rem 4rem;
    position: relative;
    z-index: 2;
}

/* Header */
nav {
    background: #ffffff;
    border-bottom: 1px solid rgba(90, 28, 178, 0.2);
    padding: 0.9rem 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-soft);
}

.logo {
    font-family: var(--font-brand);
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--brand-purple);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    letter-spacing: 0.02em;
}

.logo span {
    display: inline-flex;
    width: 36px;
    height: 36px;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: rgba(90, 28, 178, 0.1);
    box-shadow: inset 0 0 0 1px rgba(90, 28, 178, 0.2);
}

.nav-links {
    display: flex;
    gap: 1.2rem;
    flex-wrap: wrap;
}

.nav-links a {
    text-decoration: none;
    color: var(--brand-purple-dark);
    font-weight: 600;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    transition: background 0.2s, color 0.2s, transform 0.2s;
}

.nav-links a:hover {
    background: rgba(90, 28, 178, 0.1);
    transform: translateY(-1px);
}

.auth-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.logout-form {
    margin: 0;
}

.mobile-menu {
    display: none;
    position: relative;
}

.mobile-menu summary {
    padding: 0.55rem 0.75rem;
    border: 1px solid var(--card-border);
    border-radius: 0.65rem;
    color: var(--brand-purple-dark);
    font-weight: 700;
    cursor: pointer;
    list-style: none;
}

.mobile-menu summary::-webkit-details-marker {
    display: none;
}

.mobile-menu-panel {
    position: absolute;
    top: calc(100% + 0.65rem);
    right: 0;
    display: grid;
    width: min(78vw, 280px);
    padding: 0.55rem;
    border: 1px solid var(--card-border);
    border-radius: 0.8rem;
    background: #ffffff;
    box-shadow: var(--shadow);
}

.mobile-menu-panel a,
.mobile-menu-panel button {
    width: 100%;
    padding: 0.7rem 0.75rem;
    border: 0;
    border-radius: 0.55rem;
    background: transparent;
    color: var(--brand-purple-dark);
    font: inherit;
    font-weight: 700;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
}

.mobile-menu-panel a:hover,
.mobile-menu-panel button:hover {
    background: #f5f3ff;
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.75rem;
    margin-top: 2rem;
}

.card {
    background: var(--card-white);
    border: 1px solid var(--card-border);
    border-radius: 1.5rem;
    padding: 2rem;
    box-shadow: var(--shadow-soft);
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    transition: transform 0.3s, box-shadow 0.3s, border 0.3s;
}

.card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow);
    border-color: rgba(90, 28, 178, 0.4);
}

.card h3 {
    color: var(--brand-purple);
    font-size: 1.25rem;
    font-family: var(--font-brand);
}

.card p {
    color: var(--text-muted);
}

.card .icon {
    font-size: 2.4rem;
    margin-bottom: 0.35rem;
}

/* Hero Section */
.hero {
    text-align: center;
    padding: 3.5rem 2rem;
    background: #ffffff;
    border-radius: 2rem;
    border: 1px solid rgba(90, 28, 178, 0.15);
    margin-bottom: 3rem;
    box-shadow: var(--shadow);
}

.hero h1 {
    font-family: var(--font-decor);
    font-size: 3rem;
    margin-bottom: 1rem;
    color: var(--brand-purple);
    text-shadow: 0 6px 12px rgba(90, 28, 178, 0.2);
}

.hero p {
    font-size: 1.2rem;
    color: var(--text-muted);
    max-width: 640px;
    margin: 0 auto;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.6rem;
    border-radius: 999px;
    font-weight: 700;
    text-decoration: none;
    transition: all 0.2s;
    cursor: pointer;
    border: none;
    font-family: var(--font-brand);
    letter-spacing: 0.02em;
}

.btn-primary {
    background: #3b82f6;
    color: white;
    box-shadow: none;
}

.btn-primary:hover {
    transform: translateY(-1px);
    background: #2563eb;
}

.btn-secondary {
    background: #f3f4f6;
    color: var(--brand-purple-dark);
    border: 1px solid rgba(90, 28, 178, 0.2);
}

.btn-secondary:hover {
    background: #e5e7eb;
}

.flash-container {
    max-width: 1200px;
    margin: 1rem auto 0;
    padding: 0 2rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    position: relative;
    z-index: 5;
}

.flash {
    border-radius: 0.9rem;
    padding: 0.75rem 1rem;
    font-weight: 600;
    backdrop-filter: blur(6px);
}

.flash-success {
    background: #e0f2fe;
    color: #1e3a8a;
}

.flash-error {
    background: #fee2e2;
    color: #991b1b;
}

.flash-info {
    background: #ede9fe;
    color: #4c1d95;
}

/* Stage Menu */
.stage-blocks {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin-top: 2rem;
}

.block-card {
    padding: 1.75rem;
    background: #ffffff;
    border-radius: 1.25rem;
    text-align: center;
    border: 1px solid var(--card-border);
    box-shadow: var(--shadow-soft);
    transition: all 0.2s;
}

.block-card:hover {
    border-color: rgba(90, 28, 178, 0.4);
    transform: translateY(-4px);
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
}

.form-grid label {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    font-weight: 600;
    color: var(--brand-purple-dark);
}

.form-grid input,
.form-grid select,
.form-grid textarea,
.report-form input,
.report-form textarea {
    padding: 0.75rem 1rem;
    border-radius: 0.9rem;
    border: 1px solid rgba(90, 28, 178, 0.25);
    background: #ffffff;
    color: var(--text-main);
    font: inherit;
}

.form-grid textarea,
.report-form textarea {
    min-height: 120px;
    resize: vertical;
}

.form-grid input::placeholder,
.report-form input::placeholder,
.report-form textarea::placeholder {
    color: rgba(75, 61, 99, 0.6);
}

.form-grid option {
    color: #1f2937;
}

.form-errors {
    grid-column: 1 / -1;
    border-radius: 0.9rem;
    padding: 0.85rem 1rem;
    background: #fee2e2;
    color: #991b1b;
}

.form-errors ul {
    margin-left: 1.2rem;
}

.radio-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.radio-card {
    display: flex;
    gap: 1rem;
    padding: 1rem;
    border-radius: 1rem;
    border: 1px solid rgba(90, 28, 178, 0.2);
    background: #ffffff;
    cursor: pointer;
    align-items: flex-start;
    transition: border 0.2s, transform 0.2s;
}

.radio-card:hover {
    border-color: rgba(90, 28, 178, 0.5);
    transform: translateY(-2px);
}

.radio-card input {
    margin-top: 0.25rem;
}

.status-strip {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.status-badge {
    padding: 0.35rem 0.85rem;
    border-radius: 999px;
    font-size: 0.875rem;
    font-weight: 600;
}

.status-ok {
    background: #dcfce7;
    color: #166534;
}

.status-warn {
    background: #fef3c7;
    color: #92400e;
}

.status-muted {
    background: #e5e7eb;
    color: #374151;
}

.score-pill {
    background: #ede9fe;
    color: #5b21b6;
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-weight: 600;
}

.button-row {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: 1rem;
}

.test-run {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.test-stack {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.test-card {
    gap: 1.5rem;
}

.test-card-header {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: flex-start;
}

.test-section {
    color: var(--brand-blue-dark);
    font-weight: 700;
    font-size: 0.875rem;
    text-transform: uppercase;
}

.theory-section {
    color: var(--brand-blue-dark);
    font-weight: 700;
    font-size: 0.875rem;
    text-transform: uppercase;
}

.question-list {
    display: grid;
    gap: 1rem;
    padding-left: 1.25rem;
}

.question-item {
    padding: 1rem;
    border: 1px solid rgba(90, 28, 178, 0.14);
    border-radius: 1rem;
    background: #fafafa;
}

.question-text {
    font-weight: 700;
    color: var(--text-main);
}

.choice-list {
    display: grid;
    gap: 0.65rem;
    margin-top: 0.85rem;
}

.choice-row {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    padding: 0.75rem;
    border-radius: 0.85rem;
    background: #ffffff;
    border: 1px solid rgba(90, 28, 178, 0.12);
    color: var(--text-muted);
}

.choice-row input {
    margin-top: 0.3rem;
    flex: 0 0 auto;
}

.result-card {
    margin-top: 0;
}

.report-header {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: flex-start;
    margin-bottom: 2rem;
}

.report-header h2 {
    color: #ffffff;
    font-family: var(--font-brand);
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.report-header p {
    color: rgba(255, 255, 255, 0.88);
    max-width: 760px;
}

.report-layout {
    display: grid;
    grid-template-columns: minmax(260px, 340px) minmax(0, 1fr);
    gap: 1.5rem;
    align-items: flex-start;
}

.report-outline,
.report-section,
.report-actions {
    background: #ffffff;
    border: 1px solid var(--card-border);
    border-radius: 1.25rem;
    box-shadow: var(--shadow-soft);
}

.report-outline {
    position: sticky;
    top: 96px;
    padding: 1.5rem;
}

.report-outline h3,
.report-section h3 {
    color: var(--brand-purple);
    font-family: var(--font-brand);
}

.report-outline ol {
    display: grid;
    gap: 0.75rem;
    margin-top: 1rem;
    padding-left: 1.2rem;
    color: var(--text-muted);
}

.report-form {
    display: grid;
    gap: 1.25rem;
}

.report-form label {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    font-weight: 600;
    color: var(--brand-purple-dark);
}

.report-section {
    display: grid;
    gap: 1.25rem;
    padding: 1.5rem;
}

.report-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    padding: 1.5rem;
}

.editor-back-link {
    margin-bottom: 1.5rem;
}

.editor-back-link a {
    color: #ffffff;
    font-weight: 700;
    text-decoration: none;
}

.document-editor-form {
    display: grid;
    gap: 1.25rem;
}

.editor-error-card {
    padding: 1rem 1.25rem;
    border: 1px solid #fca5a5;
    border-radius: 1rem;
    background: #fef2f2;
    color: #991b1b;
    box-shadow: var(--shadow-soft);
}

.editor-error-card ul {
    margin: 0.5rem 0 0 1.25rem;
}

.document-editor-shell {
    overflow: hidden;
    border: 1px solid rgba(38, 50, 56, 0.18);
    border-radius: 1.15rem;
    background: #e9edf3;
    box-shadow: var(--shadow);
}

.document-toolbar {
    position: relative;
    top: 0;
    z-index: 30;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 0.7rem 0.9rem;
    border-bottom: 1px solid #d8dee8;
    background: rgba(255, 255, 255, 0.97);
    backdrop-filter: blur(12px);
}

.toolbar-document-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 230px;
}

.toolbar-document-meta > div {
    display: grid;
    line-height: 1.25;
}

.toolbar-document-meta strong {
    color: #202124;
    font-size: 0.9rem;
}

.toolbar-document-meta span:last-child {
    color: #6b7280;
    font-size: 0.73rem;
}

.toolbar-file-icon {
    display: inline-grid;
    width: 34px;
    height: 38px;
    place-items: center;
    flex: 0 0 auto;
    border-radius: 5px;
    background: #4285f4;
    color: #ffffff !important;
    font-family: Georgia, serif;
    font-size: 1rem !important;
    font-weight: 700;
}

.toolbar-controls {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.45rem;
    flex-wrap: wrap;
}

.toolbar-select {
    display: grid;
    gap: 0.1rem;
    color: #5f6368;
    font-size: 0.68rem;
    line-height: 1.1;
}

.toolbar-select select {
    min-width: 170px;
    padding: 0.35rem 1.8rem 0.35rem 0.55rem;
    border: 1px solid #d1d5db;
    border-radius: 0.45rem;
    background: #ffffff;
    color: #202124;
    font: 600 0.78rem var(--font-main);
}

.toolbar-divider {
    width: 1px;
    height: 30px;
    margin: 0 0.2rem;
    background: #d8dee8;
}

.toolbar-page-button {
    padding: 0.45rem 0.65rem;
    border: 0;
    border-radius: 0.45rem;
    background: transparent;
    color: #4b5563;
    cursor: pointer;
    font: 600 0.76rem var(--font-main);
}

.toolbar-page-button:hover,
.toolbar-page-button.is-active {
    background: #e8f0fe;
    color: #174ea6;
}

.toolbar-zoom {
    padding: 0.35rem 0.55rem;
    border: 1px solid #d1d5db;
    border-radius: 0.4rem;
    color: #4b5563;
    font-size: 0.75rem;
}

.toolbar-export-button {
    min-height: 36px;
    padding: 0.5rem 0.9rem;
    border-radius: 0.55rem;
    font-size: 0.75rem;
}

.document-hint {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    padding: 0.55rem 1rem;
    border-bottom: 1px solid #d8dee8;
    background: #f8fafd;
    color: #4b5563;
    font-size: 0.78rem;
}

.document-hint span {
    color: #4285f4;
}

.document-workspace {
    max-height: 78vh;
    min-height: 720px;
    overflow: auto;
    padding: 2rem;
    scroll-behavior: smooth;
}

.document-pages {
    display: grid;
    width: max-content;
    min-width: 100%;
    justify-content: center;
    gap: 2rem;
}

.document-page {
    position: relative;
    width: 794px;
    min-height: 1123px;
    padding: 96px 96px 96px 104px;
    background: #ffffff;
    color: #111111;
    font-family: "Times New Roman", Times, serif;
    font-size: 18.67px;
    line-height: 1.15;
    box-shadow: 0 2px 10px rgba(32, 33, 36, 0.22);
    scroll-margin-top: 92px;
}

.document-page p,
.document-page h3 {
    margin: 0;
}

.document-input {
    min-width: 0;
    padding: 1px 4px 0;
    border: 0;
    border-bottom: 1px dashed #4f86d9;
    border-radius: 3px 3px 0 0;
    outline: none;
    background: #edf4ff;
    color: #111111;
    font: inherit;
    line-height: inherit;
    transition: background 0.15s, box-shadow 0.15s;
}

.document-input::placeholder {
    color: #67809f;
    opacity: 0.78;
}

.document-input:hover {
    background: #e2edff;
}

.document-input:focus {
    background: #ffffff;
    box-shadow: 0 0 0 2px rgba(66, 133, 244, 0.24);
}

.doc-college {
    padding-bottom: 3px;
    border-bottom: 1px solid #111111;
    text-align: center;
}

.doc-report-heading {
    margin-top: 198px;
    text-align: center;
}

.doc-report-heading h3,
.doc-report-heading > p {
    font-size: 34.67px;
    font-weight: 700;
    line-height: 1.08;
}

.doc-report-heading h3 {
    margin-bottom: 9px;
}

.doc-specialty-line {
    display: flex;
    justify-content: center;
    align-items: baseline;
    gap: 8px;
    margin-top: 38px;
    font-size: 26.67px;
    font-style: italic;
    font-weight: 700;
}

.doc-specialty-line input {
    width: 245px;
    text-align: center;
}

.doc-title-details {
    display: grid;
    width: 385px;
    margin-top: 153px;
    margin-left: auto;
    gap: 8px;
}

.doc-detail-row {
    display: grid;
    gap: 1px;
}

.doc-detail-row > span {
    white-space: nowrap;
}

.doc-detail-row input {
    width: 100%;
}

.doc-detail-inline {
    grid-template-columns: auto 1fr;
    align-items: baseline;
    column-gap: 6px;
}

.doc-grade-line {
    grid-template-columns: auto 145px;
    margin-top: 14px;
}

.doc-stamp-place {
    margin-top: 24px !important;
    text-align: center;
}

.doc-city-year {
    position: absolute;
    right: 96px;
    bottom: 94px;
    left: 104px;
    display: flex;
    justify-content: center;
    align-items: baseline;
    gap: 5px;
}

.doc-city-year input {
    width: 62px;
    text-align: center;
}

.diary-document-page {
    min-height: 1123px;
    padding: 56px 92px 82px 101px;
}

.diary-document-page > h3 {
    text-align: center;
    font-size: 29.33px;
    font-weight: 700;
}

.doc-diary-practice {
    margin-top: 6px !important;
    text-align: center;
}

.doc-diary-student-line {
    display: grid;
    grid-template-columns: max-content 1fr;
    align-items: end;
    gap: 10px;
    margin-top: 7px !important;
}

.doc-mirrored-value {
    display: inline-block;
    min-height: 1.1em;
    overflow-wrap: anywhere;
    border-bottom: 1px solid #111111;
}

.doc-field-caption {
    margin-top: 5px !important;
    text-align: center;
}

.doc-diary-meta-line {
    display: flex;
    justify-content: center;
    align-items: baseline;
    gap: 5px;
    margin-top: 27px !important;
    white-space: nowrap;
}

.doc-diary-meta-line label {
    display: inline-flex;
    align-items: baseline;
    gap: 4px;
}

.doc-diary-meta-line input {
    width: 68px;
    text-align: center;
}

.doc-meta-specialty {
    width: 150px;
    text-align: center;
}

.doc-meta-group {
    width: 88px;
    text-align: center;
}

.diary-table-wrap {
    margin-top: 54px;
    overflow: visible;
}

.doc-diary-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    font-size: 16px;
    line-height: 1.12;
}

.doc-diary-table th,
.doc-diary-table td {
    border: 1px solid #111111;
    vertical-align: middle;
}

.doc-diary-table th {
    padding: 7px 5px;
    font-size: 17.33px;
    font-weight: 400;
    text-align: center;
}

.doc-diary-table th:nth-child(1),
.doc-diary-table td:nth-child(1) {
    width: 10.5%;
}

.doc-diary-table th:nth-child(2),
.doc-diary-table td:nth-child(2) {
    width: 24%;
}

.doc-diary-table th:nth-child(3),
.doc-diary-table td:nth-child(3) {
    width: 46.5%;
}

.doc-diary-table th:nth-child(4),
.doc-diary-table td:nth-child(4) {
    width: 19%;
}

.diary-column-numbers th {
    padding: 2px 4px;
    font-size: 14.67px;
}

.diary-entry-row td {
    position: relative;
    height: 48px;
    padding: 0;
}

.diary-entry-row input,
.diary-entry-row textarea {
    width: 100%;
    height: 100%;
    min-height: 47px;
    padding: 5px 6px;
    resize: vertical;
    border: 0;
    outline: none;
    background: #f5f8ff;
    color: #111111;
    font: 13px/1.18 "Times New Roman", Times, serif;
}

.diary-entry-row input {
    text-align: center;
}

.diary-entry-row input:focus,
.diary-entry-row textarea:focus {
    background: #ffffff;
    box-shadow: inset 0 0 0 2px rgba(66, 133, 244, 0.38);
}

.remove-diary-row {
    position: absolute;
    top: -8px;
    right: -8px;
    display: grid;
    width: 22px;
    height: 22px;
    place-items: center;
    border: 0;
    border-radius: 50%;
    opacity: 0;
    background: #dc2626;
    color: #ffffff;
    cursor: pointer;
    font: 700 16px/1 Arial, sans-serif;
    transition: opacity 0.15s, transform 0.15s;
}

.diary-entry-row:hover .remove-diary-row,
.remove-diary-row:focus {
    opacity: 1;
}

.remove-diary-row:hover {
    transform: scale(1.08);
}

.add-diary-row {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-top: 9px;
    padding: 6px 10px;
    border: 1px solid #9bbcf0;
    border-radius: 6px;
    background: #edf4ff;
    color: #174ea6;
    cursor: pointer;
    font: 600 12px var(--font-main);
}

.doc-supervisors {
    display: grid;
    gap: 6px;
    margin-top: 45px;
    font-size: 16px;
}

.doc-supervisor-line {
    display: grid;
    grid-template-columns: max-content 88px minmax(150px, 1fr);
    align-items: end;
    gap: 10px;
}

.doc-signature-line {
    min-height: 1em;
    border-bottom: 1px solid #111111;
}

.doc-supervisor-name {
    text-align: center;
}

.doc-signature-captions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    padding-left: 305px;
    text-align: center;
    font-size: 14px;
}

.editor-bottom-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1.25rem;
    padding: 1.25rem 1.5rem;
    border: 1px solid var(--card-border);
    border-radius: 1.1rem;
    background: #ffffff;
    box-shadow: var(--shadow-soft);
}

.editor-bottom-actions > div {
    display: grid;
    gap: 0.2rem;
}

.editor-bottom-actions strong {
    color: var(--brand-purple-dark);
}

.editor-bottom-actions span {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.document-editor-form button:disabled {
    opacity: 0.65;
    cursor: wait;
}

.autosave-banner {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding: 0.8rem 1rem;
    border: 1px solid #bbf7d0;
    border-radius: 0.9rem;
    background: #f0fdf4;
    color: #166534;
}

.autosave-banner > div {
    display: grid;
    gap: 0.12rem;
}

.autosave-banner small {
    color: #3f6f50;
}

.autosave-dot {
    flex: 0 0 0.75rem;
    width: 0.75rem;
    height: 0.75rem;
    border-radius: 50%;
    background: #22c55e;
    box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.13);
}

.autosave-banner.is-saving {
    border-color: #bfdbfe;
    background: #eff6ff;
    color: #1e40af;
}

.autosave-banner.is-saving .autosave-dot {
    background: #3b82f6;
    animation: autosave-pulse 1s ease-in-out infinite;
}

.autosave-banner.is-error {
    border-color: #fecaca;
    background: #fef2f2;
    color: #991b1b;
}

.autosave-banner.is-error .autosave-dot {
    background: #ef4444;
    box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.12);
}

@keyframes autosave-pulse {
    50% { opacity: 0.4; }
}

footer {
    position: relative;
    z-index: 2;
}

/* Situational tasks */
.task-intro {
    max-width: 850px;
    margin: 0.5rem 0 2rem;
    color: var(--text-muted);
}

.task-stack {
    display: grid;
    gap: 1.5rem;
}

.situational-card {
    gap: 1.35rem;
}

.situational-card:hover {
    transform: none;
}

.situational-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
}

.situational-card-header .test-section {
    margin-bottom: 0.2rem;
}

.situation-text {
    padding: 1rem 1.15rem;
    border-left: 4px solid var(--brand-blue);
    border-radius: 0.65rem;
    background: #eff6ff;
    color: var(--text-main) !important;
    font-size: 1.02rem;
    font-weight: 600;
}

.choice-fieldset {
    min-width: 0;
    border: 0;
}

.choice-fieldset legend {
    margin-bottom: 0.75rem;
    color: var(--brand-purple-dark);
    font-weight: 700;
}

.situational-card .choice-row {
    align-items: flex-start;
    border: 1px solid rgba(90, 28, 178, 0.12);
    border-radius: 0.85rem;
    padding: 0.85rem 1rem;
    background: #ffffff;
}

.situational-card .choice-row:hover {
    border-color: rgba(59, 130, 246, 0.45);
    background: #f8fbff;
}

.situational-card .choice-row input {
    flex: 0 0 auto;
    margin-top: 0.3rem;
}

.task-response {
    display: grid;
    gap: 0.65rem;
    padding: 1.1rem;
    border: 1px solid #86efac;
    border-radius: 1rem;
    background: #f0fdf4;
}

.task-response[hidden] {
    display: none;
}

.choice-feedback {
    min-height: 1.5rem;
    color: var(--text-muted) !important;
    font-weight: 700;
}

.choice-feedback.is-correct {
    color: #166534 !important;
}

.choice-feedback.is-incorrect {
    color: #b91c1c !important;
}

.task-response label {
    display: grid;
    gap: 0.25rem;
    color: #166534;
}

.task-response label span {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.task-response textarea {
    width: 100%;
    resize: vertical;
    border: 1px solid #86efac;
    border-radius: 0.75rem;
    padding: 0.8rem;
    background: #ffffff;
    color: var(--text-main);
    font: inherit;
}

.task-response textarea:focus {
    outline: 3px solid rgba(59, 130, 246, 0.18);
    border-color: var(--brand-blue);
}

.word-counter {
    justify-self: end;
    color: var(--text-muted) !important;
    font-size: 0.85rem;
}

.word-counter.is-over-limit {
    color: #b91c1c !important;
    font-weight: 700;
}

.task-has-error {
    border-color: #fca5a5;
}

.task-error {
    padding: 0.75rem 0.9rem;
    border-radius: 0.75rem;
    background: #fee2e2;
    color: #991b1b !important;
    font-weight: 700;
}

.completion-card {
    margin-bottom: 2rem;
    border-color: #86efac;
    background: #f0fdf4;
}

.empty-task-card {
    margin-top: 2rem;
    text-align: center;
}

/* Learning flow and staged assessments */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.stage-back-link,
.editor-back-link {
    margin-bottom: 1rem;
}

.stage-back-link a,
.editor-back-link a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 700;
}

.learning-path {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.65rem;
    margin-bottom: 2rem;
}

.learning-path-step {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    min-width: 0;
    padding: 0.8rem 0.9rem;
    border: 1px solid var(--card-border);
    border-radius: 0.85rem;
    background: #ffffff;
    color: var(--text-main);
    text-decoration: none;
}

.learning-path-step > span {
    display: grid;
    flex: 0 0 1.8rem;
    width: 1.8rem;
    height: 1.8rem;
    place-items: center;
    border-radius: 50%;
    background: #ede9fe;
    color: var(--brand-purple-dark);
    font-weight: 800;
}

.learning-path-step.is-current {
    border-color: var(--brand-blue);
    background: #eff6ff;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.learning-path-step.is-current > span,
.learning-path-step.is-complete > span {
    background: var(--brand-purple);
    color: #ffffff;
}

.learning-path-step.is-locked {
    color: var(--text-muted);
    background: #f8fafc;
}

.stage-heading {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1.5rem;
    margin-bottom: 1.25rem;
}

.stage-heading h2,
.report-fields-intro h3 {
    margin: 0.15rem 0 0.45rem;
}

.stage-heading p,
.report-fields-intro p {
    max-width: 760px;
    color: var(--text-muted);
}

.stage-kicker {
    margin: 0;
    color: var(--brand-purple);
    font-size: 0.8rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.stage-score-summary {
    display: grid;
    min-width: 145px;
    gap: 0.1rem;
    padding: 0.85rem 1rem;
    border-radius: 0.85rem;
    background: #f5f3ff;
    text-align: right;
}

.stage-score-summary span {
    color: var(--text-muted);
    font-size: 0.8rem;
}

.stage-score-summary strong {
    color: var(--brand-purple-dark);
    font-size: 1.5rem;
}

.assessment-privacy-note {
    margin: 0 0 1.25rem;
    padding: 0.9rem 1rem;
    border-left: 4px solid var(--brand-blue);
    border-radius: 0.7rem;
    background: #eff6ff;
    color: #1e3a5f;
}

.test-progress-card {
    display: grid;
    gap: 0.7rem;
    margin-bottom: 1rem;
    padding: 1rem 1.2rem;
    border: 1px solid var(--card-border);
    border-radius: 1rem;
    background: #ffffff;
}

.test-progress-card > div:first-child {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
}

.test-progress-track {
    height: 0.55rem;
    overflow: hidden;
    border-radius: 999px;
    background: #e2e8f0;
}

.test-progress-track span {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--brand-purple), var(--brand-blue));
    transition: width 180ms ease;
}

.test-attempt.is-enhanced .test-question-card {
    display: none;
}

.test-attempt.is-enhanced .test-question-card.is-active {
    display: flex;
}

.test-question-meta {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 700;
}

.choice-letter {
    display: grid;
    flex: 0 0 1.6rem;
    width: 1.6rem;
    height: 1.6rem;
    place-items: center;
    border-radius: 50%;
    background: #ede9fe;
    color: var(--brand-purple-dark);
    font-weight: 800;
}

.test-navigation {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 1rem;
    margin-top: 1rem;
}

.test-navigation p {
    color: var(--text-muted);
    font-size: 0.85rem;
    text-align: center;
}

.test-restart-button {
    display: block;
    margin: 0.85rem auto 0;
    border: 0;
    background: transparent;
    color: var(--brand-purple);
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

/* Full report constructor */
.report-fields-shell {
    scroll-margin-top: 1rem;
    margin-top: 2rem;
    padding: 1.5rem;
    border: 1px solid var(--card-border);
    border-radius: 1.15rem;
    background: #f8fafc;
    box-shadow: var(--shadow-soft);
}

.report-fields-intro {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1.5rem;
    margin-bottom: 1.25rem;
}

.report-completeness {
    flex: 0 0 auto;
    padding: 0.55rem 0.8rem;
    border-radius: 999px;
    background: #ede9fe;
    color: var(--brand-purple-dark);
    font-size: 0.85rem;
    font-weight: 800;
}

.report-form-section {
    margin-top: 1rem;
    padding: 1.25rem;
    border: 1px solid #e2e8f0;
    border-radius: 1rem;
    background: #ffffff;
}

.report-form-section-heading {
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    margin-bottom: 1rem;
}

.report-form-section-heading > span {
    display: grid;
    flex: 0 0 2rem;
    width: 2rem;
    height: 2rem;
    place-items: center;
    border-radius: 0.65rem;
    background: var(--brand-purple);
    color: #ffffff;
    font-weight: 800;
}

.report-form-section-heading h4,
.report-form-section-heading p {
    margin: 0;
}

.report-form-section-heading p {
    margin-top: 0.2rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

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

.report-field-grid label,
.report-textarea-label {
    display: grid;
    gap: 0.45rem;
    color: var(--brand-purple-dark);
    font-size: 0.9rem;
    font-weight: 700;
}

.report-field-grid input,
.report-field-grid select,
.report-field-grid textarea,
.report-textarea-label textarea,
.structure-card textarea,
.organoleptic-row input,
.organoleptic-row textarea {
    width: 100%;
    border: 1px solid #cbd5e1;
    border-radius: 0.7rem;
    padding: 0.7rem 0.75rem;
    background: #ffffff;
    color: var(--text-main);
    font: inherit;
    font-weight: 400;
    resize: vertical;
}

.report-field-grid input:focus,
.report-field-grid select:focus,
.report-field-grid textarea:focus,
.report-textarea-label textarea:focus,
.structure-card textarea:focus,
.organoleptic-row input:focus,
.organoleptic-row textarea:focus {
    outline: 3px solid rgba(59, 130, 246, 0.15);
    border-color: var(--brand-blue);
}

.report-field-wide {
    grid-column: 1 / -1;
}

.report-file-field {
    padding: 0.85rem;
    border: 1px dashed #94a3b8;
    border-radius: 0.8rem;
    background: #f8fafc;
}

.report-file-field input {
    padding: 0;
    border: 0;
}

.report-file-field span {
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 500;
}

.report-help {
    margin: 0 0 1rem;
    border: 1px solid #bfdbfe;
    border-radius: 0.8rem;
    background: #eff6ff;
    color: #1e3a5f;
}

.report-help summary {
    min-height: 2.75rem;
    padding: 0.75rem 0.9rem;
    color: #174ea6;
    font-weight: 800;
    cursor: pointer;
}

.report-help p {
    margin: 0;
    padding: 0 0.9rem 0.9rem;
    line-height: 1.55;
}

.report-help-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    margin-bottom: 0.85rem;
}

.report-help-button {
    padding: 0.65rem 0.8rem;
    border: 1px solid #c4b5fd;
    border-radius: 0.7rem;
    background: #f5f3ff;
    color: var(--brand-purple-dark);
    font: inherit;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
}

.report-help-button:hover {
    background: #ede9fe;
}

.report-dialog {
    width: min(92vw, 640px);
    max-height: 82vh;
    padding: 1.35rem;
    border: 0;
    border-radius: 1rem;
    color: var(--text-main);
    box-shadow: 0 24px 80px rgba(23, 10, 46, 0.4);
}

.report-dialog::backdrop {
    background: rgba(23, 10, 46, 0.62);
}

.report-dialog-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.85rem;
}

.report-dialog-heading h3 {
    margin: 0;
    color: var(--brand-purple-dark);
}

.report-dialog-heading button {
    flex: 0 0 2rem;
    width: 2rem;
    height: 2rem;
    border: 0;
    border-radius: 50%;
    background: #ede9fe;
    color: var(--brand-purple-dark);
    font-size: 1.25rem;
    cursor: pointer;
}

.report-dialog p + p {
    margin-top: 0.85rem;
}

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

.structure-card {
    display: grid;
    gap: 0.75rem;
    padding: 1rem;
    border: 1px solid #ddd6fe;
    border-radius: 0.9rem;
    background: #faf8ff;
}

.structure-card h5 {
    margin: 0;
    color: var(--brand-purple-dark);
    font-size: 1rem;
}

.structure-card label {
    display: grid;
    gap: 0.35rem;
    color: var(--brand-purple-dark);
    font-size: 0.85rem;
    font-weight: 700;
}

.source-selector {
    min-width: 0;
    margin: 0;
    padding: 1rem;
    border: 1px solid #cbd5e1;
    border-radius: 0.9rem;
}

.source-selector legend {
    padding: 0 0.35rem;
    color: var(--brand-purple-dark);
    font-weight: 800;
}

.source-selector > p {
    margin: 0 0 0.75rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.source-list {
    display: grid;
    gap: 0.55rem;
}

.source-option {
    display: flex !important;
    grid-template-columns: none !important;
    align-items: flex-start;
    gap: 0.65rem !important;
    min-height: 2.75rem;
    padding: 0.7rem;
    border: 1px solid #e2e8f0;
    border-radius: 0.7rem;
    background: #ffffff;
    color: var(--text-main) !important;
    font-weight: 400 !important;
    cursor: pointer;
}

.source-option:has(input:checked) {
    border-color: #8b5cf6;
    background: #f5f3ff;
}

.source-option input {
    flex: 0 0 auto;
    width: 1.15rem;
    height: 1.15rem;
    margin-top: 0.15rem;
    accent-color: var(--brand-purple);
}

.organoleptic-editor {
    display: grid;
    gap: 0.75rem;
}

.organoleptic-row {
    display: grid;
    grid-template-columns: 1fr 1.35fr 0.8fr 0.9fr 0.9fr auto;
    align-items: start;
    gap: 0.55rem;
    padding: 0.75rem;
    border-radius: 0.85rem;
    background: #f8fafc;
}

.remove-organoleptic-row {
    display: grid;
    width: 2rem;
    height: 2rem;
    place-items: center;
    border: 0;
    border-radius: 50%;
    background: #fee2e2;
    color: #991b1b;
    font-size: 1.15rem;
    cursor: pointer;
}

.report-textarea-label {
    margin-top: 1rem;
}

/* Responsive */
@media (max-width: 900px) {
    .nav-links {
        display: none;
    }
    .desktop-auth {
        display: none;
    }
    .mobile-menu {
        display: block;
    }
    .report-layout {
        grid-template-columns: 1fr;
    }
    .report-outline {
        position: static;
    }
    .document-toolbar {
        position: static;
        align-items: flex-start;
        flex-direction: column;
    }
    .toolbar-controls {
        justify-content: flex-start;
    }
    .document-workspace {
        max-height: 72vh;
    }
    .organoleptic-row {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .remove-organoleptic-row {
        grid-column: 2;
        justify-self: end;
    }
}

@media (max-width: 768px) {
    nav {
        padding: 0.7rem 1rem;
    }
    .logo {
        font-size: 1rem;
    }
    .stage-blocks {
        grid-template-columns: 1fr;
    }
    .hero h1 {
        font-size: 2.2rem;
    }
    .container {
        padding: 2rem 1.25rem 3rem;
    }
    .test-card-header {
        flex-direction: column;
    }
    .report-header {
        flex-direction: column;
    }
    .report-header h2 {
        font-size: 1.65rem;
    }
    .document-editor-shell {
        margin-right: -0.75rem;
        margin-left: -0.75rem;
        border-radius: 0.75rem;
    }
    .document-toolbar,
    .document-hint {
        padding-right: 0.7rem;
        padding-left: 0.7rem;
    }
    .document-hint {
        justify-content: flex-start;
    }
    .document-workspace {
        min-height: 620px;
        padding: 1rem 0.75rem;
        overflow-x: hidden;
    }
    .document-pages {
        width: 100%;
    }
    .document-page {
        width: 100%;
        min-height: 0;
        padding: 2.5rem 1.25rem;
        font-size: clamp(0.72rem, 2.8vw, 1rem);
    }
    .doc-report-heading {
        margin-top: 5rem;
    }
    .doc-report-heading h3,
    .doc-report-heading > p {
        font-size: clamp(1.25rem, 6vw, 2rem);
    }
    .doc-specialty-line {
        margin-top: 2rem;
        font-size: clamp(1rem, 4vw, 1.4rem);
    }
    .doc-specialty-line input {
        width: min(46vw, 245px);
    }
    .doc-title-details {
        width: min(100%, 385px);
        margin-top: 5rem;
    }
    .diary-document-page {
        overflow-x: auto;
    }
    .diary-table {
        min-width: 620px;
    }
    .editor-bottom-actions {
        position: sticky;
        bottom: 0.5rem;
        z-index: 8;
        align-items: stretch;
        flex-direction: column;
        padding: 0.85rem;
        box-shadow: 0 10px 35px rgba(32, 14, 75, 0.22);
    }
    .editor-bottom-actions .btn {
        width: 100%;
    }
    .learning-path {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .stage-heading,
    .report-fields-intro {
        flex-direction: column;
    }
    .stage-score-summary {
        width: 100%;
        text-align: left;
    }
    .test-navigation {
        grid-template-columns: 1fr 1fr;
    }
    .test-navigation p {
        grid-column: 1 / -1;
        grid-row: 1;
    }
    .report-fields-shell {
        margin-right: -0.5rem;
        margin-left: -0.5rem;
        padding: 0.8rem;
    }
    .report-form-section {
        padding: 0.9rem;
    }
    .report-field-grid,
    .organoleptic-row,
    .structure-editor {
        grid-template-columns: 1fr;
    }
    .report-field-wide,
    .remove-organoleptic-row {
        grid-column: 1;
    }
    .toolbar-controls {
        flex-wrap: nowrap;
        width: 100%;
        padding-bottom: 0.35rem;
        overflow-x: auto;
    }
    .toolbar-page-button,
    .toolbar-export-button,
    .toolbar-select {
        flex: 0 0 auto;
    }
    .autosave-banner {
        align-items: flex-start;
        font-size: 0.9rem;
    }
    .source-selector {
        padding: 0.75rem;
    }
}
