/* Responder CPD — single hand-written stylesheet. Mobile first.
   No build step, no framework, no external fonts (D-090). */

:root {
    --ink:        #1b2227;
    --ink-muted:  #5a666f;
    --line:       #d5dce1;
    --page:       #ffffff;
    --panel:      #f5f8fa;
    --accent:     #10656d;
    --accent-ink: #ffffff;
    --ok:         #1d6b3f;
    --warn:       #8a5a00;
    --danger:     #a32020;
    --radius:     6px;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    background: var(--page);
    color: var(--ink);
    font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* ---------- Layout ---------- */

.wrap {
    max-width: 44rem;
    margin: 0 auto;
    padding: 1.25rem 1rem 3rem;
}

.site-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: .5rem 1rem;
    padding: .75rem 1rem;
    background: var(--accent);
    color: var(--accent-ink);
}

.brand {
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--accent-ink);
    text-decoration: none;
}

.site-nav {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.site-nav a {
    color: var(--accent-ink);
    text-decoration: none;
    border-bottom: 2px solid transparent;
}

.site-nav a:hover,
.site-nav a:focus { border-bottom-color: var(--accent-ink); }

.inline-form { display: inline; margin: 0; }

.site-footer {
    max-width: 44rem;
    margin: 0 auto;
    padding: 1rem;
    border-top: 1px solid var(--line);
    font-size: .875rem;
    color: var(--ink-muted);
}

/* ---------- Typography ---------- */

h1 { font-size: 1.5rem; line-height: 1.25; margin: 0 0 1rem; }
h2 { font-size: 1.15rem; margin: 1.75rem 0 .5rem; }

.lead  { font-size: 1.05rem; }
.muted { color: var(--ink-muted); font-size: .9375rem; }
.hint  { color: var(--ink-muted); font-size: .875rem; margin: -.35rem 0 .5rem; }

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

/* ---------- Forms ---------- */

.stack { display: flex; flex-direction: column; max-width: 26rem; }

label { font-weight: 600; margin-top: .9rem; margin-bottom: .25rem; }

input[type="text"],
input[type="password"],
input[type="date"],
input[type="number"],
select,
textarea {
    width: 100%;
    padding: .6rem .65rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--page);
    color: var(--ink);
    font: inherit;
    /* 16px minimum, or iOS zooms the viewport on focus. */
    font-size: 1rem;
}

input:focus, select:focus, textarea:focus, button:focus {
    outline: 3px solid var(--accent);
    outline-offset: 1px;
}

button, .button-primary, .button-danger {
    display: inline-block;
    margin-top: 1.25rem;
    padding: .7rem 1.1rem;
    border: 0;
    border-radius: var(--radius);
    background: var(--accent);
    color: var(--accent-ink);
    font: inherit;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    /* Comfortable target on a phone, often one-handed in the dark. */
    min-height: 44px;
}

.button-danger { background: var(--danger); }

.link-button {
    margin: 0;
    padding: 0;
    min-height: 0;
    background: none;
    color: var(--accent-ink);
    font-weight: 400;
    text-decoration: underline;
    cursor: pointer;
}

/* ---------- Panels, alerts, tags ---------- */

.panel {
    margin: 1.25rem 0;
    padding: 1rem;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.panel h2 { margin-top: 0; }

.panel-highlight { border-left: 4px solid var(--accent); }

.alert {
    margin: 0 0 1rem;
    padding: .75rem 1rem;
    border-radius: var(--radius);
    border-left: 4px solid;
}

.alert-error   { background: #fbeaea; border-color: var(--danger); }
.alert-success { background: #e9f5ee; border-color: var(--ok); }
.alert-notice  { background: #fdf3e0; border-color: var(--warn); }

.warning-inline { color: var(--warn); font-weight: 600; }

.credential {
    padding: .75rem;
    background: var(--page);
    border: 1px dashed var(--accent);
    border-radius: var(--radius);
    font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
    font-size: 1.125rem;
    word-break: break-all;
}

.tag {
    display: inline-block;
    padding: .1rem .45rem;
    border-radius: 999px;
    font-size: .75rem;
    font-weight: 600;
    white-space: nowrap;
}

.tag-ok   { background: #e9f5ee; color: var(--ok); }
.tag-off  { background: #eceff1; color: var(--ink-muted); }
.tag-warn { background: #fdf3e0; color: var(--warn); }

/* ---------- Tables ---------- */

/* Wide content scrolls inside its own container so the page body never does. */
.table-scroll { overflow-x: auto; }

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .9375rem;
}

.data-table th,
.data-table td {
    padding: .55rem .5rem;
    text-align: left;
    border-bottom: 1px solid var(--line);
    vertical-align: top;
}

.data-table th { font-size: .8125rem; text-transform: uppercase; letter-spacing: .03em; color: var(--ink-muted); }

.numeric { font-variant-numeric: tabular-nums; }

.detail-list { display: grid; grid-template-columns: 1fr; gap: .1rem 1rem; margin: 1rem 0; }
.detail-list dt { font-weight: 600; color: var(--ink-muted); font-size: .875rem; }
.detail-list dd { margin: 0 0 .6rem; }

/* ---------- Wider screens ---------- */

@media (min-width: 40rem) {
    h1 { font-size: 1.75rem; }
    .detail-list { grid-template-columns: 10rem 1fr; }
    .detail-list dd { margin-bottom: .2rem; }
}

/* ---------- Print ----------
   Expanded in Phase 6 for the per-portfolio report, which must print cleanly
   as evidence for an assessor. */

@media print {
    .site-header,
    .site-nav,
    .button-primary,
    .button-danger,
    button { display: none !important; }

    body { font-size: 11pt; color: #000; }
    .wrap { max-width: none; padding: 0; }
    .panel { border: 1px solid #999; background: none; }
    a { color: #000; text-decoration: none; }

    /* Keep a table row and its heading together across a page break. */
    thead { display: table-header-group; }
    tr, .panel { break-inside: avoid; }
}

/* ---------- Progress meter ---------- */

.meter {
    height: .6rem;
    margin: .5rem 0;
    background: #e3e9ec;
    border-radius: 999px;
    overflow: hidden;
}

.meter-fill {
    display: block;
    height: 100%;
    background: var(--accent);
}

.big-number { font-size: 1.6rem; font-weight: 700; margin: .25rem 0; }
.big-number .muted { font-size: 1rem; font-weight: 400; }

/* ---------- Panels with a trailing tag ---------- */

.panel-title {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: .5rem;
    margin: 0 0 .35rem;
    font-size: 1.1rem;
}

.action-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0;
}

.plain-list { list-style: none; margin: 0; padding: 0; }
.plain-list li { padding: .45rem 0; border-bottom: 1px solid var(--line); }

.attachment-row { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; }

/* Buttons that need to read as links inside a body of text. */
.link-button-dark,
.link-button-danger {
    margin: 0;
    padding: 0;
    min-height: 0;
    background: none;
    font-weight: 400;
    text-decoration: underline;
    cursor: pointer;
}

.link-button-dark   { color: var(--accent); }
.link-button-danger { color: var(--danger); }

/* ---------- Checkbox groups ---------- */

.field-group {
    margin: 1.25rem 0 0;
    padding: .75rem 1rem 1rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.field-group legend { font-weight: 600; padding: 0 .35rem; }

.check {
    display: flex;
    align-items: flex-start;
    gap: .6rem;
    margin: 0;
    padding: .5rem 0;
    font-weight: 400;
    /* Comfortable to tap on a phone, often one-handed. */
    min-height: 44px;
}

.check input { margin-top: .25rem; width: 1.15rem; height: 1.15rem; flex: none; }

.checklist { max-height: 22rem; overflow-y: auto; }

@media (min-width: 40rem) {
    .checklist { column-count: 2; column-gap: 1.5rem; max-height: none; }
    .checklist .check { break-inside: avoid; }
}

/* ---------- Report ---------- */

.report-meta { color: var(--ink-muted); font-size: .9375rem; margin-top: -.5rem; }

.coverage-table td { font-size: .9rem; }
.coverage-table .is-gap { background: #fffaf2; }
.gap-marker { color: var(--warn); font-weight: 600; }

.reflection-cell {
    max-width: 22rem;
    /* Long reflections must not stretch the table off-screen. */
    overflow-wrap: anywhere;
}

@media print {
    .no-print { display: none !important; }

    .checklist { max-height: none; overflow: visible; }
    .meter { border: 1px solid #999; }
    .meter-fill { background: #666; }
    .coverage-table .is-gap { background: none; }
    .gap-marker { color: #000; }

    /* The report is evidence for an assessor, so nothing may be cut off. */
    .table-scroll { overflow: visible; }
    .reflection-cell { max-width: none; }
}

/* ---------- Entry form additions ---------- */

.button-row { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; }

.button-secondary {
    background: var(--page);
    color: var(--accent);
    border: 1px solid var(--accent);
}

.optional-marker {
    margin-left: .4rem;
    font-weight: 400;
    font-size: .8125rem;
    color: var(--ink-muted);
}

.more-topics { margin-top: .75rem; }
.more-topics summary { cursor: pointer; font-weight: 600; color: var(--accent); padding: .4rem 0; }

/* A draft is visibly provisional in the entry list. */
.is-draft td { opacity: .72; }

/* ---------- Report additions ---------- */

.compact-table { width: auto; margin-top: .75rem; }
.compact-table th { text-transform: none; font-size: .9375rem; color: var(--ink); padding-right: 1.5rem; }

/* The three narrative fields stacked inside one report cell. */
.narrative { margin: 0 0 .4rem; font-size: .875rem; }
.narrative:last-child { margin-bottom: 0; }
.narrative strong { color: var(--ink-muted); }

@media print {
    .more-topics summary { display: none; }
    .is-draft { display: none; }
    .narrative { font-size: 9pt; }
}

/* ---------- Portfolio card figures ---------- */

.portfolio-card .panel-title a { text-decoration: none; }

.subhead {
    margin: 1.1rem 0 .35rem;
    font-size: .9375rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--ink-muted);
}

.figure-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .9375rem;
    background: var(--page);
}

.figure-table th,
.figure-table td {
    padding: .4rem .6rem;
    border: 1px solid var(--line);
    text-align: left;
}

.figure-table tbody th { font-weight: 600; }

.figure-table td.numeric,
.figure-table th.numeric {
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

/* Column header band on the activity table, mirroring the source spreadsheet. */
.activity-figures thead th {
    background: var(--accent);
    color: var(--accent-ink);
    font-size: .8125rem;
    text-transform: uppercase;
    letter-spacing: .03em;
    border-color: var(--accent);
}

/* An activity type with no hours still earns its row — the gap is the signal. */
.activity-figures .is-zero td { color: var(--ink-muted); }

@media print {
    .activity-figures thead th { background: none; color: #000; border-color: #999; }
    .figure-table { font-size: 10pt; }
}

/* ---------- Topic groups ---------- */

.topic-group {
    border-top: 1px solid var(--line);
}

.topic-group:last-of-type { border-bottom: 1px solid var(--line); }

.topic-group > summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    /* Comfortable to tap on a phone. */
    min-height: 44px;
    padding: .5rem .25rem;
    cursor: pointer;
    font-weight: 600;
}

.topic-group > summary:hover { color: var(--accent); }

.group-count {
    font-weight: 400;
    font-size: .8125rem;
    color: var(--accent);
    white-space: nowrap;
}

.topic-group .checklist { padding: 0 .25rem .5rem; max-height: none; }

/*
 * Topics outside the selected portfolio's framework are hidden via the `hidden`
 * attribute, set by the server and toggled by the script. `display: flex` on
 * .check would otherwise beat `hidden`, which is only `display: none` in the UA
 * stylesheet, so it has to be restated here.
 */
.check[hidden] { display: none; }

.logged-late {
    display: block;
    font-size: .75rem;
    font-weight: 400;
    color: var(--ink-muted);
    white-space: nowrap;
}

@media (min-width: 40rem) {
    .topic-group .checklist { column-count: 2; column-gap: 1.5rem; }
}
