@import url("local-fonts.css");

:root {
    --bg: #f4f4f4;
    --panel: #ffffff;
    --line: #d1d3d4;
    --text: #1f2935;
    --muted: #808285;
    --accent: #00a14b;
    --accent-dark: #0b983a;
    --nav-bg: #1f2935;
    --warning: #a35c00;
    --danger: #9f2836;
    --ok: #237044;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: "Titillium Web", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.5;
}

a {
    color: var(--accent-dark);
}

.shell {
    max-width: 1120px;
    margin: 0 auto;
    padding: 24px;
}

.topbar {
    background: var(--nav-bg);
    border-bottom: none;
}

.topbar .shell {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding-top: 14px;
    padding-bottom: 14px;
}

.brand {
    display: inline-flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    min-width: 0;
    font-size: 0.98rem;
    font-weight: 600;
    color: #ffffff;
    text-decoration: none;
    letter-spacing: 0.01em;
}

.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 156px;
}

.brand-mark img {
    display: block;
    width: 100%;
    max-width: none;
    height: auto;
}

.topbar .nav a {
    color: rgba(255, 255, 255, 0.82);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    transition: color 0.15s;
}

.topbar .nav a:hover {
    color: #ffffff;
}

.nav {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 24px;
}

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

.field {
    margin: 0 0 22px;
}

.field.is-hidden {
    display: none;
}

.name-fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(180px, 320px));
    gap: 14px;
}

.field label.name-part {
    display: block;
    margin: 0;
    font-weight: 400;
}

.name-part input {
    max-width: none;
}

.name-part span {
    display: block;
    margin-top: 4px;
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 400;
}

.field label,
.legend {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
}

input[type="text"],
input[type="email"],
input[type="number"],
input[type="url"],
input[type="password"],
select,
textarea {
    width: 100%;
    max-width: 720px;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 10px 12px;
    font: inherit;
    background: #ffffff;
    transition: border-color 0.15s;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="number"]:focus,
input[type="url"]:focus,
input[type="password"]:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(0, 161, 75, 0.12);
}

textarea {
    min-height: 120px;
}

.choice {
    display: block;
    margin: 8px 0;
    font-weight: 400;
}

.field label.choice {
    font-weight: 400;
}

.required {
    color: var(--danger);
}

.external-link {
    white-space: nowrap;
}

.external-link::after {
    content: "\2197";
    display: inline-block;
    margin-left: 0.15em;
    font-size: 0.72em;
    line-height: 1;
    vertical-align: 0.35em;
}

.question-help {
    position: relative;
    display: inline;
    text-decoration: underline;
    text-decoration-color: rgba(0, 161, 75, 0.35);
    text-decoration-thickness: 1px;
    text-underline-offset: 0.18em;
    cursor: help;
}

.question-tooltip {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    z-index: 30;
    display: block;
    width: min(420px, calc(100vw - 56px));
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 8px 24px rgba(32, 36, 44, 0.12);
    color: var(--text);
    font-size: 0.9rem;
    font-weight: 400;
    line-height: 1.45;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-2px);
    transition: opacity 0.15s, transform 0.15s;
}

.question-help:hover .question-tooltip,
.question-help:focus .question-tooltip,
.question-help:focus-within .question-tooltip {
    opacity: 1;
    transform: translateY(0);
}

.button,
button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    border: 1px solid var(--accent);
    border-radius: 6px;
    background: var(--accent);
    color: #ffffff;
    padding: 8px 18px;
    font: inherit;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.button:hover,
button:hover {
    background: var(--accent-dark);
    border-color: var(--accent-dark);
}

.button.secondary,
button.secondary {
    background: #ffffff;
    color: var(--accent);
    border-color: var(--line);
}

.button.secondary:hover,
button.secondary:hover {
    background: var(--bg);
    border-color: var(--accent);
}

button.danger,
.button.danger {
    border-color: var(--danger);
    background: var(--danger);
    color: #ffffff;
}

button.danger:hover,
.button.danger:hover {
    background: #7d1e2a;
    border-color: #7d1e2a;
}

.steps {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin: 20px 0 28px;
}

.step {
    border-bottom: 3px solid var(--line);
    padding: 8px 0;
    color: var(--muted);
    font-weight: 600;
}

.step.active {
    border-color: var(--accent);
    color: var(--text);
}

.summary-table,
.score-table {
    width: 100%;
    border-collapse: collapse;
}

.summary-table th,
.summary-table td,
.score-table th,
.score-table td {
    border-bottom: 1px solid var(--line);
    padding: 10px;
    text-align: left;
    vertical-align: top;
}

/* Submitted-answers table: label as quiet annotation, value as primary content */
.summary-table th {
    width: 36%;
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--muted);
}

.summary-table td {
    font-weight: 400;
}

/* Score table header row */
.score-table thead th {
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.055em;
    text-transform: uppercase;
    color: var(--muted);
    background: var(--bg);
    padding: 8px 10px;
}

.score-table tbody td {
    font-size: 0.925rem;
    vertical-align: middle;
}

/* Keep reason and action cells top-aligned */
.score-table tbody td:nth-child(4),
.score-table tbody td:nth-child(5) {
    vertical-align: top;
}

/* Numeric score value colours */
.score-pos { color: var(--accent);  font-weight: 600; }
.score-neg { color: var(--danger); font-weight: 600; }
.score-nil { color: var(--muted);  }

.badge {
    display: inline-block;
    border-radius: 999px;
    padding: 2px 9px;
    font-size: 0.85rem;
    font-weight: 600;
}

.badge.warn {
    color: #5e3700;
    background: #fff0d6;
}

.badge.ok {
    color: #004d22;
    background: #d6f0e2;
}

.badge.danger {
    color: #651722;
    background: #f9d9de;
}

.muted {
    color: var(--muted);
}

.topbar .muted {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.85rem;
}

.alert {
    border: 1px solid var(--line);
    border-radius: 6px;
    margin: 16px 0 22px;
    padding: 14px 16px;
}

.alert ul {
    margin-bottom: 0;
}

.alert.danger {
    border-color: #e2a8b0;
    background: #fff4f5;
    color: #651722;
}

.field-alert {
    max-width: 720px;
    margin-top: -10px;
    margin-bottom: 22px;
    padding: 10px 12px;
}

.guidance-panel {
    max-width: 760px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #ffffff;
    padding: 14px;
}

.guidance-panel p {
    margin: 0 0 12px;
}

.guidance-panel img {
    display: block;
    width: min(100%, 420px);
    height: auto;
    border: 1px solid var(--line);
    border-radius: 4px;
}

.consent-section {
    max-width: 820px;
    margin-top: 32px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
}

.consent-section h2 {
    margin: 0 0 10px;
    font-size: 1.05rem;
}

.consent-section p {
    margin: 0;
    color: var(--muted);
    font-size: 0.94rem;
    line-height: 1.6;
}

.actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 20px;
}

.inline-form {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.inline-form select {
    width: auto;
    min-width: 140px;
}

.admin-form {
    margin-bottom: 28px;
}

.score-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    margin: 12px 0 24px;
}

.evaluator-panel {
    padding-top: 0;
}

.evaluator-sticky-summary {
    position: sticky;
    top: 0;
    z-index: 20;
    margin: 0 -24px 24px;
    padding: 14px 24px;
    background: rgba(255, 255, 255, 0.98);
    border-bottom: 1px solid var(--line);
    box-shadow: 0 6px 18px rgba(32, 36, 44, 0.08);
}

.evaluator-title {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 12px;
}

.evaluator-title h1 {
    margin: 0;
    font-size: 1.35rem;
}

.evaluator-title p {
    margin: 0;
}

.score-summary.compact {
    grid-template-columns: repeat(5, minmax(120px, 1fr));
    gap: 8px;
    margin: 0;
}

.score-summary.compact > div {
    padding: 8px 10px;
}

.score-summary > div {
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #ffffff;
    padding: 12px;
}

.summary-label {
    display: block;
    color: var(--muted);
    font-size: 0.85rem;
    font-weight: 600;
}

.score-summary strong {
    display: block;
    margin-top: 4px;
    font-size: 1.25rem;
}

.score-summary.compact strong {
    font-size: 1.05rem;
}

@media (max-width: 720px) {
    .shell {
        padding: 16px;
    }

    .topbar .shell {
        align-items: flex-start;
        flex-direction: column;
    }

    .brand-mark {
        width: 132px;
    }

    .name-fields {
        grid-template-columns: 1fr;
    }

    .steps {
        grid-template-columns: 1fr;
    }

    .evaluator-sticky-summary {
        margin-right: -16px;
        margin-left: -16px;
        padding-right: 16px;
        padding-left: 16px;
    }

    .evaluator-title {
        display: block;
    }

    .score-summary.compact {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* Survey intro panel shown on login / register pages */
.intro-panel {
    border-left: 4px solid var(--accent);
    margin-bottom: 16px;
}

.intro-kicker {
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--accent);
    margin: 0 0 10px;
}

.intro-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0 0 12px;
    line-height: 1.2;
}

.intro-body {
    color: var(--muted);
    margin: 0 0 14px;
    max-width: 72ch;
    line-height: 1.6;
}

.intro-steps {
    margin: 0;
    padding-left: 1.3em;
    color: var(--muted);
    line-height: 1.7;
}

/* Section headers inside the evaluator panel */
.evaluator-panel h2 {
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
    border-bottom: 1px solid var(--line);
    padding-bottom: 8px;
    margin-top: 32px;
    margin-bottom: 0;
}

/* Manual-review form: compact, self-contained inside a table cell */
.manual-review-form {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 180px;
}

.score-decision-row {
    display: flex;
    gap: 6px;
}

.score-decision-row select {
    flex: 1;
    min-width: 0;
}

.manual-review-form select,
.manual-review-form textarea {
    max-width: none;
    width: 100%;
    padding: 6px 8px;
    font-size: 0.875rem;
    min-height: unset;
}

.manual-review-form textarea {
    min-height: 60px;
    resize: vertical;
}

.manual-review-form button {
    align-self: flex-start;
    min-height: 30px;
    padding: 4px 12px;
    font-size: 0.875rem;
}

.audit-log {
    list-style: none;
    margin: 0;
    padding: 0;
    font-size: 0.85rem;
}

.audit-entry {
    padding: 0.45rem 0;
    border-bottom: 1px solid var(--line);
    color: var(--text);
    line-height: 1.4;
}

.audit-entry:last-child {
    border-bottom: none;
}

.audit-time {
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}

.audit-who {
    font-weight: 600;
}

.audit-criterion {
    font-style: italic;
}

.audit-changes {
    color: var(--muted);
}


.site-footer {
    margin-top: 32px;
    border-top: 1px solid var(--line);
    background: var(--panel);
}

.site-footer .shell {
    padding-top: 16px;
    padding-bottom: 16px;
    font-size: 0.85rem;
}

.privacy-page {
    max-width: 820px;
}

.privacy-page h2 {
    margin-top: 1.8rem;
    font-size: 1.15rem;
}

.privacy-page code {
    font: 0.9em ui-monospace, SFMono-Regular, Consolas, monospace;
}


.nav-form {
    margin: 0;
}

.nav-form button {
    border: 0;
    padding: 0;
    background: transparent;
    color: rgba(255, 255, 255, 0.82);
    font: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    cursor: pointer;
}

.nav-form button:hover {
    color: #ffffff;
}

/* The single-editor guard disables all controls without altering their individual state. */
.survey-fields { border: 0; padding: 0; margin: 0; min-width: 0; }

.manual-save-status { margin-inline-start: .75rem; }
