:root {
    /* Aqua theme — cool surfaces */
    --sidebar: #f5f6f7;
    --sidebar-mid: #ebedef;
    --sidebar-dark: #dde0e3;
    --sidebar-border: #e2e5e8;

    --brand: #3a8f8a;
    --brand-dark: #2c6f6b;
    --brand-light: #5faea9;
    --brand-pale: rgba(58, 143, 138, 0.10);

    --amber: #c98a3a;
    --amber-pale: rgba(201, 138, 58, 0.12);
    --sky: #5a8ba0;
    --sky-pale: rgba(90, 139, 160, 0.12);
    --red: #b04a3d;
    --red-pale: rgba(176, 74, 61, 0.12);
    --green: #6a9270;
    --green-pale: rgba(106, 146, 112, 0.12);

    --slate: #4a5d62;
    --slate-dim: #768a8e;

    --paper: #f3f6f7;
    --paper-dark: #dde6e8;
    --ink: #14262a;
    --ink-mid: #355058;
    --ink-light: #5e7a80;

    /* Font families */
    --font-display: 'Ubuntu', system-ui, sans-serif;
    --font-body: 'Ubuntu', system-ui, sans-serif;
    --font-mono: 'Ubuntu Mono', monospace;

    /* Font size scale (5 tokens) */
    --fs-xs:   12px;   /* uppercase micro labels, section labels */
    --fs-sm:   14px;   /* secondary text, breadcrumb, sub-labels */
    --fs-base: 16px;   /* body default, nav items, body copy */
    --fs-lg:   20px;   /* card titles, logo wordmark */
    --fs-xl:   32px;   /* page / KPI / display values */
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    font-family: var(--font-body);
    font-size: var(--fs-base);
    color: var(--ink);
    background: var(--paper);
}

/* Topbar */
.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    height: 56px;
    background: #fff;
    border-bottom: 1px solid var(--paper-dark);
    display: flex;
    align-items: center;
}

.topbar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 32px;
}

.topbar-logo {
    display: flex;
    align-items: baseline;
    gap: 12px;
    text-decoration: none;
    transition: opacity 0.15s;
}

.topbar-logo:hover {
    opacity: 0.75;
}

.logo-wordmark {
    font-family: var(--font-display);
    font-size: var(--fs-lg);
    font-weight: 700;
    color: var(--ink);
    letter-spacing: 0.01em;
}

.logo-sublabel {
    font-size: var(--fs-xs);
    color: var(--ink-light);
    text-transform: uppercase;
    letter-spacing: 0.12em;
}

.breadcrumb {
    font-size: var(--fs-sm);
    color: var(--ink-light);
}

.breadcrumb-current {
    font-weight: 500;
    color: var(--ink);
}

/* Content */
.content {
    flex: 1;
    padding: 32px;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
}

/* Footer */
.footer {
    flex-shrink: 0;
    background: #fff;
    border-top: 1px solid var(--paper-dark);
    display: flex;
    align-items: center;
}

.footer-inner {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 16px 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.footer-copy {
    font-family: var(--font-body);
    font-size: var(--fs-base);
    color: var(--ink-light);
}

.footer-link {
    font-family: var(--font-body);
    font-size: var(--fs-base);
    color: var(--ink-light);
    text-decoration: none;
    transition: color 0.15s;
}

.footer-link:hover {
    color: var(--brand);
    text-decoration: underline;
}

/* Page title */
.page-title {
    font-family: var(--font-display);
    font-size: var(--fs-xl);
    font-weight: 600;
    color: var(--ink);
    margin: 0 0 16px;
    line-height: 1.2;
}

/* Cards */
.card {
    background: #fff;
    border: 1px solid var(--paper-dark);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 24px;
}

.card-header {
    padding: 18px 22px 14px;
    border-bottom: 1px solid var(--paper-dark);
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-title {
    font-family: var(--font-display);
    font-size: var(--fs-lg);
    font-weight: 600;
    color: var(--ink);
    margin: 0;
    flex: 1;
}
.card-header-meta {
    font-family: var(--font-body);
    font-size: var(--fs-sm);
    color: var(--ink-light);
    font-weight: 500;
}
.results-footer {
    display: flex;
    justify-content: flex-end;
    margin-top: 8px;
    padding-top: 8px;
}
.results-footer form {
    margin: 0;
}

.card-body {
    padding: 22px 24px;
}

/* Acknowledgements list */
.ack-list {
    list-style: none;
    margin: 12px 0;
    padding: 0;
}
.ack-list li {
    display: flex;
    align-items: baseline;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--paper-dark);
}
.ack-list li:last-child {
    border-bottom: none;
}
.ack-name {
    font-size: var(--fs-base);
    font-weight: 500;
    color: var(--ink);
    flex: 1;
}
.ack-email {
    font-family: var(--font-mono);
    font-size: var(--fs-sm);
    color: var(--brand);
    text-decoration: none;
}
.ack-email:hover {
    text-decoration: underline;
}
.ack-version {
    font-family: var(--font-mono);
    font-size: var(--fs-sm);
    color: var(--ink-light);
}
.card-body .body-text + .ack-list {
    margin-top: 16px;
}
.card-body .ack-list + .body-text {
    margin-top: 16px;
}

.body-text {
    font-size: var(--fs-base);
    color: var(--ink-light);
    line-height: 1.6;
    margin: 0;
}

/* Motion */
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

.animate { animation: fadeUp 0.4s ease both; }
.d1 { animation-delay: 0.05s; }
.d2 { animation-delay: 0.10s; }
.d3 { animation-delay: 0.15s; }
.d4 { animation-delay: 0.20s; }
.d5 { animation-delay: 0.25s; }
.d6 { animation-delay: 0.30s; }

/* Utility */
.visually-hidden {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px; overflow: hidden;
    clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.actions {
    display: flex;
    gap: 10px;
    margin-top: 18px;
    flex-wrap: wrap;
}

/* Topbar action area */
.topbar-actions {
    margin-left: auto;
    display: flex;
    gap: 10px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 16px;
    border-radius: 5px;
    font-family: var(--font-body);
    font-size: var(--fs-sm);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    border: 1px solid transparent;
    text-decoration: none;
}

.btn-ghost {
    background: transparent;
    color: var(--ink-mid);
    border-color: var(--paper-dark);
}
.btn-ghost:hover {
    background: var(--paper);
    border-color: var(--sidebar-border);
}

.btn-brand {
    background: var(--brand);
    color: #fff;
}
.btn-brand:hover {
    background: var(--brand-dark);
}
.btn:disabled,
.btn[disabled] {
    cursor: not-allowed;
    opacity: 0.45;
    background: var(--paper-dark);
    color: var(--ink-light);
}
.btn:disabled:hover,
.btn[disabled]:hover {
    background: var(--paper-dark);
    color: var(--ink-light);
}

/* Sidebar nav markers + progress badge */
.nav-marker {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--sidebar-mid);
    color: var(--slate-dim);
    font-size: var(--fs-xs);
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.nav-marker.answered {
    background: var(--brand);
    color: #fff;
}
.nav-item.active .nav-marker {
    background: var(--brand);
    color: #fff;
}
.nav-label {
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.nav-progress {
    font-family: var(--font-mono);
    font-size: var(--fs-xs);
    color: var(--ink-light);
    margin-left: auto;
}
.nav-item.is-disabled {
    pointer-events: none;
    opacity: 0.55;
}

/* Topic page — matrix */
.topic-meta {
    font-size: var(--fs-sm);
    color: var(--ink-light);
    margin-left: auto;
}

.matrix {
    display: grid;
    grid-template-columns: 96px repeat(4, 1fr);
    grid-template-rows: auto;
    grid-auto-rows: 1fr;
    align-items: stretch;
    gap: 8px;
}

.matrix-cell {
    padding: 12px 14px;
    border-radius: 8px;
    background: var(--paper);
    border: 1px solid var(--paper-dark);
    height: 100%;
    min-height: 0;
    box-sizing: border-box;
}

.matrix-corner,
.matrix-row-header {
    background: transparent;
    border-color: transparent;
}

.matrix-col-header {
    background: transparent;
    border-color: transparent;
    text-align: center;
}

.matrix-system-code {
    font-family: var(--font-display);
    font-size: var(--fs-lg);
    font-weight: 600;
    color: var(--brand);
}

.matrix-system-name {
    font-size: var(--fs-xs);
    color: var(--ink-light);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-top: 2px;
}

.matrix-row-header {
    font-family: var(--font-display);
    font-size: var(--fs-base);
    font-weight: 600;
    color: var(--ink-mid);
    display: flex;
    align-items: center;
    justify-content: center;
}

.matrix-option {
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 6px;
    transition: all 0.15s;
    background: #fff;
}
.matrix-option:hover {
    border-color: var(--brand-light);
    background: var(--brand-pale);
}
.matrix-option:has(input:checked) {
    border-color: var(--brand);
    background: var(--brand-pale);
    box-shadow: 0 0 0 1px var(--brand) inset;
}
.matrix-option:focus-within {
    outline: 2px solid var(--brand-light);
    outline-offset: 2px;
}

.option-code {
    font-family: var(--font-mono);
    font-size: var(--fs-sm);
    font-weight: 500;
    color: var(--ink);
}
.option-score {
    color: var(--ink-light);
    font-weight: 400;
    margin-left: 6px;
}
.option-desc {
    font-size: var(--fs-sm);
    color: var(--ink-mid);
    line-height: 1.5;
}

/* Topic page — bottom navigation bar */
.topic-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.topic-nav {
    display: flex;
    align-items: center;
    gap: 10px;
}

.topic-nav-side {
    display: flex;
    gap: 10px;
}
.topic-nav-side-right {
    margin-left: auto;
}
.topic-error {
    margin: 0 0 8px;
    padding: 10px 14px;
    background: var(--amber-pale);
    border: 1px solid var(--amber);
    border-radius: 6px;
    color: var(--ink);
    font-size: var(--fs-sm);
}

.topic-nav-back {
    font-family: var(--font-body);
    font-size: var(--fs-sm);
    color: var(--ink-light);
    text-decoration: none;
    border-bottom: 1px dotted var(--paper-dark);
    padding-bottom: 1px;
    transition: color 0.15s, border-color 0.15s;
}
.topic-nav-back:hover {
    color: var(--brand);
    border-bottom-color: var(--brand);
}

/* Results page — header block */
.report-header {
    background: #fff;
    border: 1px solid var(--paper-dark);
    border-radius: 10px;
    padding: 28px 32px;
    margin-bottom: 24px;
    display: flex;
    align-items: flex-start;
    gap: 24px;
}
.report-header-content {
    flex: 1;
}
.report-title {
    font-family: var(--font-display);
    font-size: var(--fs-xl);
    font-weight: 600;
    color: var(--ink);
    margin: 0 0 8px;
    line-height: 1.2;
}
.report-subtitle {
    font-size: var(--fs-base);
    color: var(--ink-light);
    margin: 0;
    max-width: 600px;
    line-height: 1.5;
}

.report-score-box {
    flex-shrink: 0;
    min-width: 160px;
    background: #fff;
    border: 2px solid var(--brand);
    border-radius: 10px;
    padding: 20px 28px;
    text-align: center;
}
.report-score-box-incomplete {
    border-color: var(--amber);
}
.score-label {
    font-size: var(--fs-xs);
    font-weight: 600;
    color: var(--ink-light);
    text-transform: uppercase;
    letter-spacing: 0.14em;
}
.score-value {
    font-family: var(--font-display);
    font-size: var(--fs-xl);
    font-weight: 700;
    color: var(--ink);
    line-height: 1;
    margin-top: 10px;
}
.score-denominator,
.score-denominator-inline {
    font-size: var(--fs-sm);
    color: var(--ink-light);
}
.score-denominator { margin-top: 4px; }
.score-denominator-inline { margin-left: 4px; }
.score-badge {
    margin-top: 10px;
    display: inline-block;
    background: var(--brand);
    color: #fff;
    font-size: var(--fs-xs);
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 4px;
    letter-spacing: 0.04em;
}

/* Score progress bar */
.score-bar {
    position: relative;
    margin-top: 28px;
    padding-top: 60px;
}
.score-bar-marker {
    position: absolute;
    top: 0;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    pointer-events: none;
}
.score-bar-marker-value {
    font-family: var(--font-display);
    font-size: 28px;
    font-weight: 700;
    color: var(--ink);
    background: #fff;
    border: 1px solid var(--paper-dark);
    border-radius: 6px;
    padding: 4px 12px;
    line-height: 1;
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.02);
}
.score-bar-marker::after {
    content: '';
    width: 0;
    height: 0;
    margin-top: 5px;
    border-left: 7px solid transparent;
    border-right: 7px solid transparent;
    border-top: 9px solid var(--ink);
}
.score-bar-track {
    position: relative;
    height: 12px;
    border-radius: 6px;
    background: var(--paper-dark);
    overflow: hidden;
}
.score-bar-fill {
    position: absolute;
    inset: 0;
    border-radius: 6px;
    background: linear-gradient(
        to right,
        #e6c34a 0%,
        #cdbf4a 25%,
        #a8bd4f 55%,
        #7ea957 80%,
        var(--green) 100%
    );
}
.score-bar-tick {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 1px;
    background: rgba(255, 255, 255, 0.55);
    transform: translateX(-0.5px);
    pointer-events: none;
}
.score-bar-regions {
    position: relative;
    height: 26px;
    margin-top: 8px;
}
.score-bar-region {
    position: absolute;
    top: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-left: 1px solid var(--paper-dark);
}
.score-bar-region:last-child {
    border-right: 1px solid var(--paper-dark);
}
.score-bar-region-label {
    font-family: var(--font-body);
    font-size: var(--fs-sm);
    font-weight: 500;
    color: var(--ink-light);
    letter-spacing: 0.04em;
}
.score-bar-region.is-active .score-bar-region-label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--brand);
    color: #fff;
    font-weight: 700;
    font-size: var(--fs-lg);
}
.score-bar-scale {
    position: relative;
    height: 14px;
    margin-top: 4px;
}
.score-bar-scale-num {
    position: absolute;
    top: 0;
    transform: translateX(-50%);
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--ink-light);
    line-height: 1;
}

/* Band list */
.band-list {
    list-style: none;
    margin: 0;
    padding: 0;
    border-top: 1px solid var(--paper-dark);
}
.band-item {
    position: relative;
    display: grid;
    grid-template-columns: 56px 80px 1fr;
    align-items: center;
    gap: 18px;
    padding: 14px 22px;
    border-bottom: 1px solid var(--paper-dark);
    background: var(--paper);
}
.band-item:last-child {
    border-bottom: none;
}
.band-item-class {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    justify-self: center;
    width: 40px;
    height: 40px;
    font-family: var(--font-display);
    font-size: 22px;
    font-weight: 700;
    color: var(--ink);
    border-radius: 50%;
    background: #fff;
    border: 1px solid var(--paper-dark);
}
.band-item-range {
    font-family: var(--font-mono);
    font-size: var(--fs-sm);
    color: var(--ink-mid);
    white-space: nowrap;
}
.band-item-remarks {
    font-size: var(--fs-sm);
    color: var(--ink);
    line-height: 1.5;
}
.band-item.is-active {
    box-shadow: inset 0 0 0 3px var(--brand);
    z-index: 1;
}
.band-item.is-active .band-item-class {
    background: var(--brand);
    color: #fff;
    border-color: var(--brand);
}

/* Results table */
.card-body-flush { padding: 0; }

.results-table {
    width: 100%;
    border-collapse: collapse;
}
.results-table th,
.results-table td {
    padding: 14px 22px;
    text-align: left;
    border-bottom: 1px solid var(--paper-dark);
    font-size: var(--fs-sm);
    color: var(--ink);
    vertical-align: middle;
}
.results-table th {
    font-size: var(--fs-xs);
    font-weight: 600;
    color: var(--ink-light);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    background: var(--paper);
}
.results-table-num {
    text-align: right;
    font-family: var(--font-mono);
    color: var(--ink-mid);
}
.results-choice {
    font-family: var(--font-mono);
    font-weight: 500;
    color: var(--brand);
}
.results-link {
    color: var(--ink);
    text-decoration: none;
    border-bottom: 1px dotted var(--paper-dark);
}
.results-link:hover {
    color: var(--brand);
    border-bottom-color: var(--brand);
}
.results-total-row td {
    font-weight: 600;
    background: var(--sidebar);
}
.results-total-row td:first-child {
    text-align: right;
}
