:root {
    --bg: #F5F7FA;
    --card: #ffffff;
    --text: #1f2937;
    --muted: #64748B;
    --border: #D8E0E8;
    --primary: #1f3b57;
    --primary-hover: #162a3e;
    --danger: #b91c1c;
    --shadow: 0 10px 25px rgba(31, 41, 55, 0.08);
    --soft-shadow: 0 3px 12px rgba(31, 41, 55, 0.08);
    --sample-accent: #0F766E;
    --exam-accent: #2563A6;
    --theory-accent: #B7791F;
    --admin-accent: #56616F;
    --soft-header: #F1F4F7;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: Arial, Helvetica, sans-serif; color: var(--text); background: var(--bg); }
.topbar { background: #ffffff; border-bottom: 1px solid var(--border); min-height: 86px; display: grid; grid-template-columns: auto minmax(240px, 1fr) auto; align-items: center; gap: 20px; padding: 6px 24px; position: sticky; top: 0; z-index: 10; }
.brand { display: inline-flex; align-items: center; flex: 0 0 auto; line-height: 0; text-decoration: none; }
.brand-logo { display: block; width: auto; height: 74px; max-width: 150px; object-fit: contain; }
.header-status-group { justify-self: center; width: min(100%, 780px); display: flex; align-items: stretch; justify-content: center; gap: 8px; }
.header-welcome, .header-date, .header-activity { padding: 9px 18px; background: #f8fafc; border: 1px solid var(--border); border-radius: 10px; text-align: center; line-height: 1.3; }
.header-welcome { flex: 1 1 430px; min-width: 0; }
.header-date { flex: 0 0 142px; }
.header-activity { flex: 0 0 170px; color: var(--text); text-decoration: none; transition: border-color .15s ease, background-color .15s ease, box-shadow .15s ease; }
.header-activity:hover, .header-activity:focus-visible { border-color: #9AA4B0; background: #ffffff; box-shadow: var(--soft-shadow); }
.header-activity.is-active { border-color: #7B8794; background: #EEF1F4; }
.header-welcome strong, .header-welcome span, .header-date strong, .header-date span, .header-activity strong, .header-activity span { display: block; overflow-wrap: anywhere; }
.header-welcome strong, .header-date strong, .header-activity strong { color: var(--text); font-size: 14px; font-weight: 800; }
.header-welcome span, .header-date span, .header-activity span { margin-top: 2px; color: var(--muted); font-size: 12px; font-weight: 600; }
.nav { display: flex; gap: 6px; align-items: center; justify-content: flex-end; flex-wrap: wrap; }
.nav a { color: var(--text); text-decoration: none; font-weight: 600; padding: 9px 12px; border: 1px solid transparent; border-radius: 8px; transition: color .15s ease, background-color .15s ease, border-color .15s ease; }
.nav a:hover { color: var(--primary); background: #f8fafc; }
.nav a.is-active { color: var(--text); background: #f8fafc; border-color: var(--border); }
.nav .logout { color: var(--danger); }
.container { max-width: 1280px; margin: 24px auto; padding: 0 16px 48px; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow); padding: 22px; margin-bottom: 18px; }
.login-card { max-width: 420px; margin: 60px auto; }
h1, h2 { margin-top: 0; }
p { color: var(--muted); }
label { display: flex; flex-direction: column; gap: 6px; font-weight: 700; color: #374151; }
input, select, textarea { border: 1px solid var(--border); border-radius: 9px; padding: 10px 11px; font-size: 14px; background: #fff; box-shadow: var(--soft-shadow); }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(31, 59, 87, 0.18); border-color: var(--primary); }
button, .button { display: inline-flex; align-items: center; justify-content: center; border: 1px solid #cbd5e1; border-radius: 10px; padding: 10px 14px; background: #fff; color: var(--text); text-decoration: none; font-weight: 800; cursor: pointer; box-shadow: var(--soft-shadow); }
button:hover, .button:hover { transform: translateY(-1px); }
.button.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.button.primary:hover { background: var(--primary-hover); }
.grid { display: grid; gap: 16px; }
.form-grid { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); margin-bottom: 18px; }
.full { grid-column: 1 / -1; }
.section-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.table-wrap { overflow-x: auto; }
.table-wrap.wide { max-height: 70vh; border: 1px solid var(--border); border-radius: 10px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { border-bottom: 1px solid var(--border); padding: 9px; vertical-align: top; text-align: left; }
th { background: #f8fafc; color: #374151; position: sticky; top: 0; z-index: 1; font-weight: 400; }
tbody td { font-size: 15px; font-weight: 700; }
tbody td input, tbody td select, tbody td textarea { font-size: 15px; font-weight: 700; }

/* Zebra striping: gently shade every second body row for easier row tracking. */
:where(table:not(.matrix-table) tbody tr:nth-child(even)) > td {
    background-color: var(--soft-header);
}

/* Keep the matrix column colours, while still giving every second row a subtle grey tint. */
:where(table.matrix-table tbody tr:nth-child(even)) > td {
    background-image: linear-gradient(rgba(100, 116, 139, 0.08), rgba(100, 116, 139, 0.08));
}

/* Semantic warning and selected rows retain their dedicated highlight colours. */
:where(.unfinished-sample-collection-row,
       .expiring-soon-sample-collection-row,
       .reference-review-exam-row,
       .selected-result-row) > td {
    background-image: none;
}
.matrix-table th, .matrix-table td { min-width: 110px; }
.matrix-table input, .matrix-table select { width: 100%; min-width: 82px; padding: 7px; }
.matrix-table input.tiny { width: 52px; min-width: 52px; text-align: center; }
.inline-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.inline-actions form { display: inline; }
.link-button { border: 0; background: transparent; box-shadow: none; padding: 0; color: var(--primary); font-weight: 700; }
.link-button.danger, .danger { color: var(--danger); }
.flash { padding: 12px 14px; border-radius: 10px; margin-bottom: 14px; border: 1px solid; }
.flash.error { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.flash.success { background: #ecfdf5; border-color: #a7f3d0; color: #065f46; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.result-list { display: grid; gap: 10px; margin-bottom: 18px; }
.result-line { padding: 12px; border: 1px solid var(--border); border-radius: 10px; background: #f9fafb; font-size: 18px; }
.check { flex-direction: row; align-items: center; }
small { color: var(--muted); font-weight: 500; }
@media (max-width: 1080px) {
    .topbar { grid-template-columns: auto 1fr; gap: 8px 16px; padding: 8px 18px 12px; }
    .brand { grid-column: 1; grid-row: 1; }
    .nav { grid-column: 2; grid-row: 1; }
    .header-status-group { grid-column: 1 / -1; grid-row: 2; width: 100%; max-width: none; }
}
@media (max-width: 720px) {
    .topbar { grid-template-columns: 1fr; align-items: stretch; padding: 8px 14px 12px; }
    .brand { grid-column: 1; grid-row: 1; justify-self: start; }
    .brand-logo { height: 64px; max-width: 135px; }
    .header-status-group { grid-column: 1; grid-row: 2; flex-direction: column; }
    .header-welcome, .header-date, .header-activity { width: 100%; flex: 0 0 auto; }
    .nav { grid-column: 1; grid-row: 3; justify-content: flex-start; margin-top: 2px; }
}
.flash.info { background: #eff6ff; border-color: #bfdbfe; color: #1e3a8a; }
.import-box { border: 1px dashed var(--border); border-radius: 12px; background: #f8fafc; padding: 16px; margin: 18px 0; }
.import-box h2 { font-size: 18px; margin-bottom: 8px; }
.import-box textarea { width: 100%; font-family: Consolas, Monaco, monospace; font-size: 13px; }
.mono { font-family: Consolas, Monaco, monospace; background: #eef2f7; border-radius: 6px; padding: 2px 5px; color: #111827; }
.paste-help { border: 1px dashed var(--border); border-radius: 12px; background: #f8fafc; padding: 16px; margin: 18px 0; }
.paste-help h2 { font-size: 18px; margin-bottom: 8px; }
.paste-matrix .paste-cell:focus { outline: 3px solid rgba(31, 59, 87, 0.25); }
.paste-status { display: inline-block; margin-top: 10px; padding: 9px 12px; border-radius: 9px; border: 1px solid var(--border); background: #fff; font-weight: 700; color: #374151; }
.paste-status.ok { background: #ecfdf5; border-color: #a7f3d0; color: #065f46; }
.paste-status.warning { background: #fffbeb; border-color: #fde68a; color: #92400e; }
.paste-matrix .matrix-cell-missing { border-color: #f59e0b; background: #fffbeb; }
.paste-matrix .matrix-cell-invalid { border-color: var(--danger); background: #fef2f2; }

/* Sample collection statistics and distribution */
.sample-stats-layout { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(340px, 1fr); gap: 18px; align-items: stretch; }
.balance-label { display: inline-flex; align-items: center; margin-left: 7px; padding: 3px 8px; border-radius: 999px; font-size: 12px; font-weight: 800; line-height: 1.2; vertical-align: middle; }
.balance-symmetrical { color: #166534; background: #dcfce7; border: 1px solid #86efac; }
.balance-asymmetrical { color: #92400e; background: #fffbeb; border: 1px solid #fcd34d; }
.balance-significant { color: #991b1b; background: #fef2f2; border: 1px solid #fca5a5; }
.balance-neutral { color: #4b5563; background: #f3f4f6; border: 1px solid #d1d5db; }
.sample-distribution { min-height: 100%; border: 1px solid var(--border); border-radius: 10px; background: #f8fafc; padding: 12px 14px; display: flex; flex-direction: column; justify-content: center; }
.sample-distribution h3 { margin: 0 0 8px; text-align: center; font-size: 14px; }
.sample-donut-chart { display: block; width: 168px; max-width: 168px; height: 168px; margin: 0 auto 10px; overflow: visible; }
.sample-donut-total { fill: var(--text); font-size: 31px; font-weight: 800; }
.sample-donut-total-label { fill: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.pie-legend { display: grid; gap: 5px; }
.pie-legend-item { display: grid; grid-template-columns: 11px minmax(0, 1fr) auto; gap: 6px; align-items: center; font-size: 11px; }
.pie-legend-color { width: 11px; height: 11px; border-radius: 3px; border: 1px solid rgba(17, 24, 39, 0.15); }
.pie-legend-item strong { font-size: 11px; white-space: nowrap; }
@media (max-width: 860px) { .sample-stats-layout { grid-template-columns: 1fr; } .sample-distribution { width: 100%; min-height: auto; } }



/* Exam result study properties */
.exam-properties-card h2 { margin-bottom: 14px; }
.exam-properties-grid { display: grid; gap: 0; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; margin-bottom: 12px; background: #fff; }
.exam-properties-primary { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.exam-properties-secondary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.exam-property { min-width: 0; padding: 12px 14px; background: #f8fafc; border-right: 1px solid var(--border); display: flex; flex-direction: column; gap: 6px; }
.exam-property:last-child { border-right: 0; }
.exam-property-label { color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; }
.exam-property strong { color: var(--text); font-size: 15px; line-height: 1.35; overflow-wrap: anywhere; }
.exam-property .balance-label { margin-left: 0; }
.exam-property-full { border: 1px solid var(--border); border-radius: 10px; background: #f8fafc; }
@media (max-width: 900px) {
    .exam-properties-primary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .exam-properties-primary .exam-property:nth-child(2) { border-right: 0; }
    .exam-properties-primary .exam-property:nth-child(-n+2) { border-bottom: 1px solid var(--border); }
}
@media (max-width: 620px) {
    .exam-properties-primary, .exam-properties-secondary { grid-template-columns: 1fr; }
    .exam-properties-grid .exam-property { border-right: 0; border-bottom: 1px solid var(--border); }
    .exam-properties-grid .exam-property:last-child { border-bottom: 0; }
}


/* Reusable field tooltip (also used for the repetition limit). */
.field-title-with-tooltip {
    position: relative;
    display: inline-flex;
    width: fit-content;
    cursor: help;
    border-bottom: 1px dotted currentColor;
}
.field-tooltip {
    position: absolute;
    left: 0;
    bottom: calc(100% + 8px);
    z-index: 30;
    width: max-content;
    max-width: 260px;
    padding: 8px 10px;
    border-radius: 7px;
    background: #1f2937;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.35;
    box-shadow: 0 4px 12px rgba(31, 41, 55, .22);
    opacity: 0;
    visibility: hidden;
    transform: translateY(3px);
    transition: opacity .15s ease, transform .15s ease, visibility .15s ease;
    pointer-events: none;
}
.field-title-with-tooltip:hover .field-tooltip,
.field-title-with-tooltip:focus .field-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Unified exam-result presentation. */
.exam-results-card { overflow: hidden; }
.result-block-title { margin: 18px 0 9px; font-size: 18px; }
.result-block-title:first-of-type { margin-top: 4px; }
.detailed-statistics-title { margin-top: 28px; }
.detailed-statistics-section { margin-top: 18px; }
.detailed-statistics-section h4 { margin: 0 0 7px; font-size: 14px; color: #374151; }
.result-table-scroll { width: max-content; max-width: 100%; overflow-x: auto; border: 1px solid var(--border); border-radius: 10px; }
.exam-result-table { width: max-content; min-width: 0; border-collapse: separate; border-spacing: 0; table-layout: fixed; }
.exam-result-table th,
.exam-result-table td { width: 120px; min-width: 120px; max-width: 120px; text-align: center; border-right: 1px solid var(--border); white-space: normal; overflow-wrap: anywhere; }
.exam-result-table th:last-child,
.exam-result-table td:last-child { border-right: 0; }
.exam-result-table .result-metric-column {
    position: sticky;
    left: 0;
    z-index: 2;
    width: 240px;
    min-width: 240px;
    max-width: 240px;
    text-align: left;
    background: #f8fafc;
    white-space: normal;
}
.exam-result-table thead .result-metric-column { z-index: 4; }
.exam-result-table .selected-result-row td { background: #fff4bf; }
.exam-result-table .selected-result-row .result-metric-column { background: #ffe88a; }
.selected-result-badge {
    display: inline-flex;
    margin-left: 8px;
    padding: 2px 7px;
    border-radius: 999px;
    background: #1f3b57;
    color: #fff;
    font-size: 11px;
    line-height: 1.25;
    vertical-align: middle;
}
.result-recalculation-note { margin: 16px 0 0; font-size: 13px; }
@media (max-width: 720px) {
    .exam-result-table .result-metric-column { width: 180px; min-width: 180px; max-width: 180px; }
    .exam-result-table th, .exam-result-table td { width: 105px; min-width: 105px; max-width: 105px; }
}

/* Sample collection statistics cells, aligned with the Exam Results property boxes. */
.sample-statistics-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 1px;
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    background: var(--border);
}
.sample-statistic {
    grid-column: span 2;
    min-width: 0;
    min-height: 68px;
    padding: 10px 12px;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
}
.sample-statistic:nth-child(7),
.sample-statistic:nth-child(8) { grid-column: span 3; }
.sample-statistic-label {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .03em;
}
.sample-statistic strong {
    color: var(--text);
    font-size: 16px;
    line-height: 1.25;
    overflow-wrap: anywhere;
}
.sample-statistic-value-with-badge {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
}
.sample-statistic-value-with-badge .balance-label { margin-left: 0; font-size: 13px; }
.sample-statistic-danger { background: #fff7f7; }
.sample-statistic-danger .sample-statistic-label,
.sample-statistic-danger > strong { color: var(--danger); }
@media (max-width: 760px) {
    .sample-statistic,
    .sample-statistic:nth-child(7),
    .sample-statistic:nth-child(8) { grid-column: span 3; }
}
@media (max-width: 500px) {
    .sample-statistic,
    .sample-statistic:nth-child(7),
    .sample-statistic:nth-child(8) { grid-column: span 6; }
}

/* Unfinished sample collection status on the dashboard. */
.sample-collections-heading,
.exam-properties-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}
.sample-collections-heading h2,
.exam-properties-heading h2 { margin: 0; }
.sample-collection-warnings {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}
.unfinished-collections-warning,
.expiring-soon-collections-warning,
.reference-decision-warning {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 11px;
    border: 1px solid #fca5a5;
    border-radius: 9px;
    background: #fef2f2;
    color: #991b1b;
    font-size: 13px;
    font-weight: 800;
    line-height: 1.3;
}
.unfinished-collections-warning-icon,
.expiring-soon-collections-warning-icon,
.reference-decision-warning-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    flex: 0 0 20px;
    border-radius: 50%;
    background: #b91c1c;
    color: #fff;
    font-size: 13px;
    font-weight: 900;
}
.expiring-soon-collections-warning {
    border-color: #f2c97d;
    background: #fffbeb;
    color: #92400e;
}
.expiring-soon-collections-warning-icon { background: #b7791f; }
.reference-decision-warning {
    flex: 1 1 560px;
    max-width: 920px;
    margin-left: auto;
}
.unfinished-sample-collection-row > td { background: #fca5a5; }
.unfinished-sample-collection-row:hover > td { background: #f99191; }
.expiring-soon-sample-collection-row > td { background: #fef3c7; }
.expiring-soon-sample-collection-row:hover > td { background: #fde7a5; }
.expiring-soon-badge {
    display: inline-flex;
    align-items: center;
    margin-left: 8px;
    padding: 3px 7px;
    border: 1px solid #f2c97d;
    border-radius: 999px;
    background: #fffbeb;
    color: #92400e;
    font-size: 11px;
    font-weight: 800;
    line-height: 1.2;
    white-space: nowrap;
}

/* Dashboard module hub and hierarchical navigation */
.page-back-row { margin: 0 0 12px; }
.page-back-link {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: var(--primary);
    text-decoration: none;
    font-size: 13px;
    font-weight: 800;
    padding: 7px 10px;
    border: 1px solid transparent;
    border-radius: 8px;
    transition: background-color .15s ease, border-color .15s ease, transform .15s ease;
}
.page-back-link:hover {
    background: #fff;
    border-color: var(--border);
    transform: translateX(-1px);
}

.dashboard-intro {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    margin: 4px 0 18px;
}
.dashboard-intro h1 { margin: 0 0 5px; font-size: 29px; }
.dashboard-intro p { margin: 0; }

.module-card-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
    margin-bottom: 18px;
}
.module-card {
    --module-accent: var(--primary);
    position: relative;
    min-width: 0;
    min-height: 230px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 24px 22px 20px;
    overflow: hidden;
    color: var(--text);
    text-decoration: none;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.04);
    transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}
.module-card:hover,
.module-card:focus-visible {
    border-color: var(--module-accent);
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.10);
    transform: translateY(-2px);
    outline: none;
}
.module-card-samples { --module-accent: var(--sample-accent); }
.module-card-exams { --module-accent: var(--exam-accent); }
.module-card-theory { --module-accent: var(--theory-accent); }
.module-card-accent {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 5px;
    background: var(--module-accent);
}
.module-card-icon {
    width: 48px;
    height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--module-accent);
    background: color-mix(in srgb, var(--module-accent) 9%, white);
    border: 1px solid color-mix(in srgb, var(--module-accent) 22%, white);
    border-radius: 10px;
}
.module-card-icon svg,
.admin-module-icon svg {
    width: 27px;
    height: 27px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.module-card-content { display: flex; flex: 1; flex-direction: column; min-width: 0; }
.module-card-title { display: block; margin-bottom: 8px; font-size: 21px; font-weight: 800; }
.module-card-description { display: block; min-height: 44px; color: var(--muted); font-size: 14px; font-weight: 600; line-height: 1.5; }
.module-card-stat-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-top: auto;
    padding-top: 22px;
}
.module-card-stat-grid-three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.module-card-stat {
    min-width: 0;
    padding: 10px;
    background: #F8FAFC;
    border: 1px solid var(--border);
    border-radius: 8px;
}
.module-card-stat strong { display: block; color: var(--text); font-size: 20px; line-height: 1.1; }
.module-card-stat small { display: block; margin-top: 5px; color: var(--muted); font-size: 11px; line-height: 1.25; }
.module-card-stat.is-alert { background: #FEF2F2; border-color: #FECACA; }
.module-card-stat.is-alert strong { color: #991B1B; }
.module-card-stat.is-warning { background: #FFFBEB; border-color: #FDE68A; }
.module-card-stat.is-warning strong { color: #92400E; }
.module-card-arrow {
    position: absolute;
    right: 20px;
    bottom: 17px;
    color: var(--module-accent);
    font-size: 23px;
    font-weight: 800;
    transition: transform .18s ease;
}
.module-card:hover .module-card-arrow,
.module-card:focus-visible .module-card-arrow { transform: translateX(4px); }
.module-card-samples .module-card-content,
.module-card-exams .module-card-content,
.module-card-theory .module-card-content { padding-bottom: 44px; }

.attention-card {
    margin-bottom: 18px;
    padding: 18px 20px;
    background: #fff;
    border: 1px solid #F4B8B8;
    border-radius: 10px;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.04);
}
.attention-card.is-clear { border-color: #B7DFC9; }
.attention-card-heading { display: flex; align-items: center; gap: 13px; }
.attention-card-heading h2 { margin: 0; font-size: 18px; }
.attention-card-heading p { margin: 3px 0 0; font-size: 13px; }
.attention-card-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    flex: 0 0 32px;
    border-radius: 50%;
    background: #B91C1C;
    color: #fff;
    font-size: 17px;
    font-weight: 900;
}
.attention-card.is-clear .attention-card-icon { background: #15803D; }
.attention-list { display: grid; gap: 7px; margin-top: 14px; }
.attention-item {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    color: var(--text);
    text-decoration: none;
    background: #F8FAFC;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 13px;
    font-weight: 700;
    transition: border-color .15s ease, background-color .15s ease;
}
.attention-item:hover { background: #fff; border-color: #94A3B8; }
.attention-dot { width: 8px; height: 8px; border-radius: 50%; background: #B91C1C; }
.attention-item-warning .attention-dot { background: #B7791F; }
.attention-arrow { color: var(--muted); font-size: 17px; }

.admin-module-card {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 15px;
    padding: 17px 20px;
    color: var(--text);
    text-decoration: none;
    background: #fff;
    border: 1px solid var(--border);
    border-left: 5px solid var(--admin-accent);
    border-radius: 10px;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.04);
    transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}
.admin-module-card:hover,
.admin-module-card:focus-visible {
    border-color: var(--admin-accent);
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.09);
    transform: translateY(-1px);
    outline: none;
}
.admin-module-icon {
    width: 42px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--admin-accent);
    background: #F1F4F7;
    border-radius: 9px;
}
.admin-module-card strong { display: block; font-size: 16px; }
.admin-module-card small { display: block; margin-top: 3px; color: var(--muted); font-size: 12px; }
.admin-module-arrow { color: var(--admin-accent); font-size: 21px; font-weight: 800; }

/* Second-level module overview tiles */
.module-overview-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    margin: 4px 0 18px;
}
.module-overview-header h1 { margin: 0 0 5px; font-size: 29px; }
.module-overview-header p { margin: 0; }
.module-overview-grid {
    display: grid;
    gap: 18px;
    margin-bottom: 18px;
}
.module-overview-grid-five { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.module-overview-grid-four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.module-overview-grid-three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.module-overview-grid-two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.module-overview-card {
    --module-overview-accent: var(--primary);
    position: relative;
    min-width: 0;
    min-height: 220px;
    display: flex;
    flex-direction: column;
    padding: 28px 24px 24px;
    overflow: hidden;
    color: var(--text);
    text-decoration: none;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.04);
    transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}
.module-overview-card-sample { --module-overview-accent: var(--sample-accent); }
.module-overview-card-exam { --module-overview-accent: var(--exam-accent); }
.module-overview-card:hover,
.module-overview-card:focus-visible {
    border-color: var(--module-overview-accent);
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.10);
    transform: translateY(-2px);
    outline: none;
}
.module-overview-accent {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 5px;
    background: var(--module-overview-accent);
}
.module-overview-card > strong {
    display: block;
    margin-top: 4px;
    color: var(--module-overview-accent);
    font-size: 44px;
    line-height: 1;
    font-weight: 800;
}
.module-overview-card > span:not(.module-overview-accent):not(.module-overview-arrow) {
    display: block;
    margin-top: 18px;
    font-size: 18px;
    font-weight: 800;
    line-height: 1.25;
}
.module-overview-card > small {
    display: block;
    margin-top: 8px;
    padding-right: 34px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
    line-height: 1.45;
}
.module-overview-card.is-alert { background: #FEF7F7; border-color: #F3CCCC; }
.module-overview-card.is-alert > strong { color: #991B1B; }
.module-overview-card.is-warning { background: #FFFDF5; border-color: #F2D99B; }
.module-overview-card.is-warning > strong { color: #92400E; }
.module-overview-arrow {
    position: absolute;
    right: 20px;
    bottom: 17px;
    color: var(--module-overview-accent);
    font-size: 23px;
    font-weight: 800;
    transition: transform .18s ease;
}
.module-overview-card:hover .module-overview-arrow,
.module-overview-card:focus-visible .module-overview-arrow { transform: translateX(4px); }

/* Consistent module accent line on every internal page level */
.container.section-sample > .card { border-top: 5px solid var(--sample-accent); }
.container.section-exam > .card { border-top: 5px solid var(--exam-accent); }
.container.section-theory > .card { border-top: 5px solid var(--theory-accent); }
.container.section-admin > .card { border-top: 5px solid var(--admin-accent); }

/* Module list status indicators */
.list-status-group { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 8px; }
.reference-review-list-warning {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 11px;
    border: 1px solid #FDE68A;
    border-radius: 9px;
    background: #FFFBEB;
    color: #92400E;
    font-size: 13px;
    font-weight: 800;
    line-height: 1.3;
}
.reference-review-list-warning-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    flex: 0 0 20px;
    border-radius: 50%;
    background: #B7791F;
    color: #fff;
    font-size: 13px;
    font-weight: 900;
}
.reference-review-exam-row > td { background: #FFF9E8; }
.reference-review-exam-row:hover > td { background: #FFF4CF; }
.reference-review-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 7px;
    border: 1px solid #FDE68A;
    border-radius: 999px;
    background: #FFFBEB;
    color: #92400E;
    font-size: 11px;
    font-weight: 800;
    white-space: nowrap;
}

/* VQI-System Description overview, brick cards and article pages */
.theory-summary-placeholder {
    margin-top: 18px;
    padding: 22px;
    background: #FFFCF4;
    border: 1px solid #D9B875;
    border-radius: 10px;
}
.theory-summary-placeholder h2 { margin: 0 0 12px; font-size: 20px; }
.theory-summary-placeholder h3 { margin: 0 0 6px; color: #7A4F12; font-size: 17px; }
.theory-summary-placeholder p { margin: 4px 0; max-width: 900px; line-height: 1.55; }
.theory-overview-list {
    columns: 2;
    column-gap: 42px;
    margin: 20px 0 0;
    padding-left: 24px;
}
.theory-overview-list li {
    break-inside: avoid;
    margin: 0 0 8px;
    padding-left: 4px;
    color: var(--theory-accent);
    font-weight: 800;
}
.theory-overview-list a {
    color: var(--text);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: color .15s ease, border-color .15s ease;
}
.theory-overview-list a:hover,
.theory-overview-list a:focus-visible {
    color: #7A4F12;
    border-bottom-color: #D9B875;
    outline: none;
}
.theory-modules-heading p { margin-bottom: 0; }
.theory-module-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-top: 18px;
}
.theory-module-card {
    min-height: 150px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 17px;
    color: var(--text);
    text-decoration: none;
    background: #fff;
    border: 1px solid var(--border);
    border-top: 4px solid #D9B875;
    border-radius: 9px;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.04);
    transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}
.theory-module-card:hover,
.theory-module-card:focus-visible {
    border-color: var(--theory-accent);
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.09);
    transform: translateY(-2px);
    outline: none;
}
.theory-module-number {
    color: var(--theory-accent);
    font-size: 12px;
    font-weight: 900;
    letter-spacing: .06em;
    text-transform: uppercase;
}
.theory-module-title {
    color: var(--text);
    font-size: 16px;
    font-weight: 800;
    line-height: 1.35;
}
.theory-module-status {
    margin-top: auto;
    color: #7A4F12;
    font-size: 12px;
    font-weight: 800;
}


/* VQI-System Description navigation and interactive diagrams */
.theory-maps-overview-card {
    position: relative;
    overflow: hidden;
    padding: 30px;
}
.theory-description-header {
    align-items: flex-start;
}
.theory-page-kicker {
    margin-bottom: 8px;
    color: var(--theory-accent);
    font-size: 12px;
    font-weight: 900;
    letter-spacing: .09em;
    text-transform: uppercase;
}
.theory-description-header h1,
.theory-map-detail-heading h1 {
    margin-bottom: 8px;
    color: var(--text);
    font-size: 30px;
    line-height: 1.2;
}
.theory-selector-intro,
.theory-map-detail-heading p {
    max-width: 760px;
    margin: 0;
    line-height: 1.6;
}
.theory-map-selector-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
    margin-top: 26px;
}
.theory-map-selector-card {
    position: relative;
    min-height: 245px;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 20px;
    align-items: start;
    overflow: hidden;
    padding: 28px 28px 24px;
    color: var(--text);
    text-decoration: none;
    background:
        linear-gradient(145deg, rgba(255,252,244,.98), rgba(255,255,255,.98));
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, .06);
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.theory-map-selector-card:hover,
.theory-map-selector-card:focus-visible {
    transform: translateY(-3px);
    border-color: #D6B66F;
    box-shadow: 0 16px 34px rgba(15, 23, 42, .10);
    outline: none;
}
.theory-map-selector-accent {
    position: absolute;
    inset: 0 auto 0 0;
    width: 6px;
    background: var(--theory-accent);
}
.theory-map-selector-number {
    position: absolute;
    top: 18px;
    right: 22px;
    color: rgba(183, 121, 31, .18);
    font-size: 54px;
    font-weight: 900;
    line-height: 1;
}
.theory-map-selector-icon {
    width: 58px;
    height: 58px;
    display: grid;
    place-items: center;
    margin-top: 4px;
    color: #7A4F12;
    background: #FFF8E7;
    border: 1px solid #E8D7B5;
    border-radius: 14px;
}
.theory-map-selector-icon svg {
    width: 34px;
    height: 34px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.theory-map-selector-content {
    min-width: 0;
    display: flex;
    flex-direction: column;
    min-height: 190px;
}
.theory-map-selector-title {
    max-width: 520px;
    padding-right: 52px;
    color: var(--text);
    font-size: 20px;
    font-weight: 850;
    line-height: 1.32;
}
.theory-map-selector-description {
    margin-top: 12px;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.55;
}
.theory-map-selector-action {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: auto;
    padding-top: 22px;
    color: #7A4F12;
    font-size: 13px;
    font-weight: 900;
}
.theory-map-selector-card:hover .theory-map-selector-action span,
.theory-map-selector-card:focus-visible .theory-map-selector-action span {
    transform: translateX(3px);
}
.theory-map-selector-action span { transition: transform .18s ease; }

.theory-map-selector-card-overview {
    background:
        radial-gradient(circle at 88% 12%, rgba(183,121,31,.10), transparent 32%),
        linear-gradient(145deg, rgba(255,252,244,.99), rgba(255,255,255,.98));
}
.theory-summary-detail-heading { margin-bottom: 18px; }
.theory-summary-article {
    max-width: 1120px;
    margin: 0 auto;
    padding: 8px 12px 4px;
}
.theory-summary-article > h2 {
    margin: 34px 0 15px;
    color: var(--text);
    font-size: 22px;
    line-height: 1.3;
}
.theory-summary-identity {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 18px;
    padding: 10px 14px;
    color: #7A4F12;
    background: #FFF8E7;
    border: 1px solid #E8D7B5;
    border-radius: 12px;
    font-size: 14px;
}
.theory-summary-label {
    font-weight: 900;
    letter-spacing: .05em;
}
.theory-summary-equals { color: #B7791F; font-weight: 900; }
.theory-summary-identity strong { color: var(--text); }
.theory-summary-opening {
    position: relative;
    overflow: hidden;
    margin-bottom: 30px;
    padding: 26px 28px 24px;
    background: linear-gradient(135deg, #FFFCF4, #FFFFFF);
    border: 1px solid #E7C98E;
    border-radius: 16px;
}
.theory-summary-opening::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 6px;
    background: var(--theory-accent);
}
.theory-summary-question {
    color: #7A4F12;
    font-size: 13px;
    font-weight: 900;
    letter-spacing: .07em;
    text-transform: uppercase;
}
.theory-summary-answer {
    margin: 7px 0 10px;
    color: var(--text);
    font-size: clamp(28px, 4vw, 42px);
    font-weight: 900;
    line-height: 1.05;
}
.theory-summary-opening p { max-width: 930px; margin: 0; line-height: 1.7; }
.theory-summary-benefits {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}
.theory-summary-benefit {
    position: relative;
    padding: 20px 20px 18px;
    background: #FFFFFF;
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: 0 5px 16px rgba(15,23,42,.04);
}
.theory-summary-benefit-no {
    display: block;
    margin-bottom: 9px;
    color: rgba(183,121,31,.62);
    font-size: 12px;
    font-weight: 900;
    letter-spacing: .08em;
}
.theory-summary-benefit h3 {
    margin: 0 0 9px;
    color: var(--text);
    font-size: 17px;
    line-height: 1.35;
}
.theory-summary-benefit p { margin: 0; font-size: 14px; line-height: 1.65; }
.theory-summary-principles {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 14px;
    margin-top: 18px;
}
.theory-summary-principle {
    display: grid;
    grid-template-columns: minmax(160px, .72fr) minmax(0, 1.45fr);
    gap: 14px;
    align-items: start;
    padding: 14px 16px;
    background: #F8FAFC;
    border: 1px solid var(--border);
    border-radius: 12px;
}
.theory-summary-principle strong {
    color: #7A4F12;
    font-size: 14px;
    line-height: 1.45;
}
.theory-summary-principle span {
    color: var(--muted);
    font-size: 14px;
    line-height: 1.55;
}
.theory-summary-conclusion {
    margin-top: 26px;
    font-size: 15px;
    line-height: 1.7;
}

.theory-map-detail-card { padding-bottom: 26px; }
.theory-map-detail-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 22px;
}
.theory-map-interaction-note {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 9px;
    margin-top: 5px;
    padding: 10px 13px;
    color: #7A4F12;
    background: #FFFCF4;
    border: 1px solid #E7C98E;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
}
.theory-map-interaction-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--theory-accent);
    box-shadow: 0 0 0 4px rgba(183, 121, 31, .12);
}
.theory-map-card {
    overflow: hidden;
    background: #F8FAFC;
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: inset 0 1px 0 #fff, 0 5px 16px rgba(15, 23, 42, .05);
}
.theory-map-scroll {
    overflow: auto;
    padding: 18px;
    background:
        linear-gradient(#fff, #fff) padding-box,
        linear-gradient(180deg, #F8FAFC, #EEF2F6) border-box;
    scrollbar-width: thin;
    overscroll-behavior: contain;
}
.theory-map-canvas {
    position: relative;
    margin: 0 auto;
}
.theory-map-scroll-strategy {
    padding-top: 18px;
    padding-bottom: 18px;
}
.theory-map-canvas-strategy {
    width: 1120px;
    min-width: 760px;
    max-width: 100%;
}
.theory-map-scroll-deployment {
    max-height: 78vh;
}
.theory-map-canvas-deployment {
    width: 1900px;
    min-width: 1900px;
    max-width: none;
    margin-left: 0;
    margin-right: 0;
}
.theory-map-canvas img {
    display: block;
    width: 100%;
    height: auto;
    border: 0;
    border-radius: 11px;
    background: #F8FAFC;
}
.theory-map-hotspot {
    position: absolute;
    z-index: 3;
    display: block;
    border: 2px solid transparent;
    border-radius: 13px;
    background: transparent;
    cursor: pointer;
    transition: border-color .14s ease, background-color .14s ease, box-shadow .14s ease;
}
.theory-map-hotspot:hover,
.theory-map-hotspot:focus-visible {
    border-color: var(--theory-accent);
    background: rgba(183, 121, 31, .08);
    box-shadow:
        0 0 0 3px rgba(255, 255, 255, .88),
        0 0 0 6px rgba(183, 121, 31, .26);
    outline: none;
}
.theory-map-connector {
    position: absolute;
    z-index: 2;
    display: block;
    width: 0;
    pointer-events: none;
}
.theory-map-connector-down {
    border-left: 3px dashed var(--theory-accent);
    transform: translateX(-1.5px);
}
.theory-map-connector-down::after {
    content: "";
    position: absolute;
    left: -7px;
    bottom: -1px;
    width: 11px;
    height: 11px;
    border-right: 3px solid var(--theory-accent);
    border-bottom: 3px solid var(--theory-accent);
    transform: rotate(45deg);
    transform-origin: center;
}

.theory-brick-card { padding: 30px; }
.theory-brick-header {
    padding-bottom: 22px;
    border-bottom: 1px solid var(--border);
}
.theory-brick-kicker {
    margin-bottom: 7px;
    color: var(--theory-accent);
    font-size: 12px;
    font-weight: 900;
    letter-spacing: .08em;
    text-transform: uppercase;
}
.theory-brick-header h1 {
    margin: 0;
    max-width: 980px;
    font-size: 30px;
    line-height: 1.2;
}
.theory-guidance-note {
    margin-top: 17px;
    padding: 12px 14px;
    color: #7A4F12;
    background: #FFFCF4;
    border: 1px solid #E7C98E;
    border-left: 4px solid var(--theory-accent);
    border-radius: 8px;
    font-size: 14px;
    font-style: italic;
    font-weight: 700;
    line-height: 1.5;
}
.theory-article {
    max-width: 980px;
    margin: 0 auto;
    padding: 28px 10px 10px;
    color: var(--text);
    font-size: 16px;
    line-height: 1.72;
}
.theory-article p { margin: 0 0 16px; }
.theory-article h3 {
    margin: 30px 0 11px;
    padding-bottom: 6px;
    color: #7A4F12;
    font-size: 19px;
    line-height: 1.35;
    border-bottom: 1px solid #F0DEB7;
}
.theory-article h3:first-child { margin-top: 0; }
.theory-list {
    margin: 10px 0 20px;
    padding-left: 26px;
}
.theory-list li { margin: 6px 0; padding-left: 3px; }
.theory-list li::marker { color: var(--theory-accent); font-weight: 800; }
.theory-list p { margin: 0; }
.theory-list .theory-list { margin: 7px 0 8px; }
.theory-callout {
    margin: 22px 0;
    padding: 18px 20px;
    color: #4C3A1B;
    background: #FFFCF4;
    border: 1px solid #E7C98E;
    border-left: 4px solid var(--theory-accent);
    border-radius: 8px;
}
.theory-callout p:last-child { margin-bottom: 0; }
.theory-formula {
    margin: 12px 0 !important;
    padding: 11px 14px;
    color: #4C3A1B;
    background: #F8F3E8;
    border: 1px solid #E8D7B5;
    border-radius: 7px;
    font-weight: 800;
}
.theory-figure {
    margin: 24px auto 28px;
    text-align: center;
}
.theory-figure img {
    display: block;
    max-width: 100%;
    height: auto;
    margin: 0 auto;
    border: 1px solid #E5E7EB;
    border-radius: 8px;
    background: #fff;
}
.theory-figure-chart { max-width: 665px; }
.theory-figure-qualification { max-width: 640px; }
.theory-figure figcaption {
    margin-top: 8px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}
.theory-brick-navigation {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    gap: 12px;
    align-items: stretch;
    margin-top: 28px;
    padding-top: 22px;
    border-top: 1px solid var(--border);
}
.theory-brick-nav-slot a,
.theory-brick-overview-link {
    min-height: 66px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    color: var(--text);
    text-decoration: none;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 9px;
    transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}
.theory-brick-nav-slot a:hover,
.theory-brick-nav-slot a:focus-visible,
.theory-brick-overview-link:hover,
.theory-brick-overview-link:focus-visible {
    border-color: var(--theory-accent);
    box-shadow: 0 6px 14px rgba(15, 23, 42, 0.08);
    transform: translateY(-1px);
    outline: none;
}
.theory-brick-nav-slot small {
    display: block;
    margin-bottom: 2px;
    color: var(--theory-accent);
    font-size: 11px;
    font-weight: 900;
    letter-spacing: .04em;
    text-transform: uppercase;
}
.theory-brick-nav-slot strong {
    display: block;
    font-size: 13px;
    line-height: 1.35;
}
.theory-brick-nav-next a { justify-content: flex-end; text-align: right; }
.theory-brick-overview-link {
    min-width: 112px;
    justify-content: center;
    color: #7A4F12;
    font-size: 13px;
    font-weight: 900;
}

.theory-brick-navigation-single {
    grid-template-columns: 1fr;
    justify-items: center;
}
.theory-brick-navigation-single .theory-brick-overview-link {
    min-width: 220px;
    justify-content: center;
}

@media (max-width: 1050px) {
    .module-card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .module-overview-grid-five,
    .module-overview-grid-four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .module-card-theory { grid-column: 1 / -1; min-height: 220px; }
    .theory-module-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .theory-map-selector-grid { grid-template-columns: 1fr; }
    .theory-summary-benefits { grid-template-columns: 1fr; }
    .theory-overview-list { columns: 1; }
}
@media (max-width: 720px) {
    .dashboard-intro h1,
    .module-overview-header h1 { font-size: 25px; }
    .module-card-grid { grid-template-columns: 1fr; }
    .module-overview-grid-five,
    .module-overview-grid-four,
    .module-overview-grid-three,
    .module-overview-grid-two { grid-template-columns: 1fr; }
    .module-card,
    .module-card-theory { grid-column: auto; min-height: 0; }
    .module-card-stat-grid-three { grid-template-columns: 1fr; }
    .theory-module-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .theory-maps-overview-card { padding: 22px; }
    .theory-map-detail-heading { flex-direction: column; }
    .theory-summary-principles { grid-template-columns: 1fr; }
    .theory-map-interaction-note { white-space: normal; }
    .theory-map-canvas-strategy { min-width: 720px; max-width: none; }
    .theory-brick-card { padding: 22px; }
    .theory-brick-header h1 { font-size: 25px; }
    .theory-article { padding-left: 0; padding-right: 0; }
    .theory-brick-navigation { grid-template-columns: 1fr; }
    .theory-brick-nav-next { grid-row: 3; }
    .theory-brick-overview-link { grid-row: 2; }
    .list-status-group { justify-content: flex-start; }
}
@media (max-width: 480px) {
    .module-card-stat-grid { grid-template-columns: 1fr; }
    .theory-module-grid { grid-template-columns: 1fr; }
    .theory-maps-overview-card { padding: 17px; }
    .theory-map-selector-card { grid-template-columns: 1fr; min-height: 0; padding: 24px 22px 20px; }
    .theory-map-selector-content { min-height: 0; }
    .theory-map-selector-title { padding-right: 42px; }
    .theory-map-selector-action { margin-top: 18px; padding-top: 0; }
    .theory-summary-article { padding-left: 0; padding-right: 0; }
    .theory-summary-opening { padding: 22px 20px 20px; }
    .theory-summary-principle { grid-template-columns: 1fr; gap: 5px; }
    .theory-map-scroll { padding: 10px; }
    .theory-summary-placeholder { padding: 17px; }
    .theory-brick-card { padding: 17px; }
    .theory-article { font-size: 15px; }
    .admin-module-card { grid-template-columns: auto minmax(0, 1fr); }
    .admin-module-arrow { display: none; }
}


/* Activity History */
:root { --activity-accent: #7B8794; }
.activity-overview-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.module-overview-card-activity { --module-overview-accent: var(--activity-accent); }
.module-overview-card-activity.is-selected { border-color: var(--activity-accent); background: #F7F8FA; }
.activity-panel { position: relative; overflow: hidden; padding-top: 26px; }
.activity-panel::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 6px;
    background: var(--activity-accent);
}
.activity-section-header h2 { margin-bottom: 5px; }
.activity-section-header p { margin: 0; }
.activity-filter-form {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) minmax(220px, 1fr) auto;
    gap: 16px;
    align-items: end;
    margin: 20px 0 22px;
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #F8FAFC;
}
.activity-filter-action { display: flex; align-items: end; }
.activity-filter-button { min-height: 40px; border-color: var(--activity-accent); }
.activity-table-wrap { border: 1px solid var(--border); border-radius: 10px; overflow-x: auto; }
.activity-table { min-width: 850px; }
.activity-table th { background: #EEF1F4; }
.activity-table th:nth-child(1), .activity-table td:nth-child(1) { width: 165px; white-space: nowrap; }
.activity-table th:nth-child(2), .activity-table td:nth-child(2) { width: 150px; }
.activity-table th:nth-child(3), .activity-table td:nth-child(3) { width: 155px; }
.activity-empty-state {
    margin-top: 18px;
    padding: 18px;
    border: 1px dashed #B8C0C8;
    border-radius: 10px;
    background: #F8FAFC;
    color: var(--muted);
    font-weight: 700;
    text-align: center;
}
@media (max-width: 820px) {
    .activity-overview-grid { grid-template-columns: 1fr; }
    .activity-filter-form { grid-template-columns: 1fr; }
    .activity-filter-action, .activity-filter-button { width: 100%; }
}

/* Administrator Audit Log extensions */
.activity-filter-form.is-admin {
    grid-template-columns: minmax(190px, 1fr) minmax(190px, 1fr) minmax(190px, 1fr) auto;
}
.activity-table-admin { min-width: 1120px; }
.activity-table-admin th:nth-child(1), .activity-table-admin td:nth-child(1) { width: 150px; white-space: normal; }
.activity-table-admin th:nth-child(2), .activity-table-admin td:nth-child(2) { width: 190px; white-space: normal; }
.activity-table-admin th:nth-child(3), .activity-table-admin td:nth-child(3) { width: 165px; white-space: nowrap; }
.activity-table-admin th:nth-child(4), .activity-table-admin td:nth-child(4) { width: 150px; }
.activity-table-admin th:nth-child(5), .activity-table-admin td:nth-child(5) { width: 155px; }
@media (max-width: 1040px) {
    .activity-filter-form.is-admin { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .activity-filter-form.is-admin .activity-filter-action { align-self: end; }
}
@media (max-width: 820px) {
    .activity-filter-form.is-admin { grid-template-columns: 1fr; }
}

.module-overview-card-new { background:#f8fbff; }
.module-overview-card-new .module-overview-new-symbol { font-size:52px; line-height:.85; }


/* Public-site continuity for unauthenticated client access (2026-09-24). */
.client-login-page {
    position: relative;
    min-height: 100vh;
    overflow-x: hidden;
    background:
        linear-gradient(rgba(181,160,106,.08) 1px, transparent 1px),
        linear-gradient(90deg, rgba(181,160,106,.08) 1px, transparent 1px),
        linear-gradient(135deg, #ffffff 0%, #fbfbf8 55%, #f4f1e9 100%);
    background-size: 42px 42px, 42px 42px, auto;
}
.client-login-page::before {
    content: "";
    position: fixed;
    z-index: 0;
    width: 560px;
    height: 560px;
    right: -170px;
    top: 52%;
    transform: translateY(-50%);
    border: 1px solid rgba(181,160,106,.30);
    border-radius: 50%;
    box-shadow:
        0 0 0 78px rgba(181,160,106,.045),
        0 0 0 154px rgba(181,160,106,.025);
    pointer-events: none;
}
.client-login-page::after {
    content: "";
    position: fixed;
    z-index: 0;
    left: 7vw;
    bottom: 8vh;
    width: 86px;
    height: 86px;
    border-left: 1px solid rgba(23,27,29,.16);
    border-bottom: 1px solid rgba(23,27,29,.16);
    pointer-events: none;
}
.client-login-page .topbar {
    position: relative;
    z-index: 2;
    background: rgba(255,255,255,.92);
    backdrop-filter: blur(18px);
    border-bottom-color: rgba(221,225,223,.92);
}
.client-login-page > .container {
    position: relative;
    z-index: 1;
    min-height: calc(100vh - 86px);
    margin-top: 0;
    margin-bottom: 0;
    padding-top: 64px;
}
.public-login-label {
    justify-self: end;
    display: flex;
    align-items: center;
    gap: 14px;
}
.public-login-label span {
    color: #806f47;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: .14em;
}
.public-login-label a {
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: 9px;
    color: var(--text);
    text-decoration: none;
    font-size: 13px;
    font-weight: 750;
    background: #fff;
}
.public-login-label a:hover { border-color: #b5a06a; }
.login-card {
    max-width: 460px;
    margin: 26px auto 68px;
    padding: 34px;
    border: 1px solid rgba(200,206,203,.92);
    border-top: 3px solid #b5a06a;
    background: rgba(255,255,255,.94);
    box-shadow: 0 22px 55px rgba(23,27,29,.10);
    backdrop-filter: blur(10px);
}
.login-card h1 { margin-bottom: 10px; font-size: 30px; letter-spacing: -.02em; }
.login-eyebrow {
    margin-bottom: 12px;
    color: #806f47;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: .14em;
    text-transform: uppercase;
}
.login-intro { margin: 0 0 24px; line-height: 1.55; }
.login-card form { display: grid; gap: 16px; }
.login-card .button.primary { margin-top: 2px; min-height: 44px; }
.login-back-link {
    display: inline-flex;
    margin-top: 22px;
    color: var(--muted);
    text-decoration: none;
    font-size: 13px;
    font-weight: 700;
}
.login-back-link:hover { color: var(--primary); }
@media (max-width: 1080px) {
    .public-login-label { grid-column: 2; grid-row: 1; }
}
@media (max-width: 720px) {
    .public-login-label { grid-column: 1; grid-row: 2; justify-self: stretch; justify-content: space-between; }
    .client-login-page::before { width: 390px; height: 390px; right: -205px; }
    .client-login-page > .container { padding-top: 34px; }
    .login-card { margin: 18px auto 34px; padding: 24px; }
}
