:root {
    --bg: #f4f5f7; --card: #fff; --ink: #1b1f24; --muted: #6b7280; --line: #e2e5ea;
    --primary: #0f6b4f; --primary-ink: #fff; --accent: #e8f3ee; --error: #b42318;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 17px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--primary); }
h1 { font-size: 1.5rem; margin: 0 0 .5rem; }
h1 small, h2 small { font-weight: 400; font-size: .85rem; margin-left: .5rem; }
h2 { font-size: 1.15rem; margin: 0 0 .5rem; }
h3 { font-size: 1rem; margin: 1rem 0 .25rem; }
.muted { color: var(--muted); }
.error { color: var(--error); font-weight: 600; }

.topbar { display: flex; align-items: center; gap: 1.5rem; padding: .6rem 1rem; background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.brand { font-weight: 700; text-decoration: none; color: var(--ink); }
.brand span { color: var(--primary); }
.topbar nav a { margin-right: 1rem; text-decoration: none; }
.logout { margin-left: auto; display: flex; align-items: center; gap: .75rem; }
.who { color: var(--muted); }

.page { max-width: 960px; margin: 0 auto; padding: 1rem; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 1rem; margin-bottom: 1rem; }
.row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.row.between { justify-content: space-between; }
.row > input, .row > select, .row > textarea { flex: 1 1 160px; }

input, select, textarea, button, .button {
    font: inherit; min-height: 48px; padding: .5rem .75rem; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink);
}
textarea { width: 100%; resize: vertical; }
button, .button { cursor: pointer; background: #fff; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }
button:hover, .button:hover { background: var(--accent); }
button:disabled { opacity: .5; cursor: default; }
button.primary, .button.primary { background: var(--primary); color: var(--primary-ink); border-color: var(--primary); }
button.primary:hover, .button.primary:hover { filter: brightness(1.1); }
button.big { width: 100%; font-size: 1.2rem; }
button.small { min-height: 36px; padding: .25rem .6rem; font-size: .9rem; }

.login { max-width: 360px; margin: 10vh auto; text-align: center; }
.login .pin { width: 100%; font-size: 2rem; text-align: center; letter-spacing: .5rem; margin-bottom: .75rem; }

.visits { list-style: none; padding: 0; margin: 0; }
.visits li { display: flex; justify-content: space-between; align-items: center; padding: .5rem 0; border-top: 1px solid var(--line); }
.tag { font-size: .8rem; padding: .15rem .5rem; border-radius: 99px; background: var(--accent); color: var(--primary); }
.tag.closed { background: #eee; color: var(--muted); }
.newvisit { margin-top: .75rem; padding-top: .75rem; border-top: 1px dashed var(--line); }

.sections { display: flex; gap: .4rem; flex-wrap: wrap; margin: .75rem 0 1rem; }
.sections button { min-height: 42px; }
.sections button.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.sections small { opacity: .75; margin-left: .35rem; }

.question { margin-bottom: 1rem; }
.question label { display: block; font-weight: 600; margin-bottom: .3rem; }
.notes { padding-left: 1.2rem; }
.notes li { margin-bottom: .35rem; }
.notes .muted { margin-right: .5rem; }

.report { white-space: pre-wrap; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 1rem; font-size: .9rem; overflow-x: auto; }
.tsection ol li { display: flex; gap: .5rem; align-items: center; margin-bottom: .35rem; }
.tsection ol li input { flex: 1; }

#blazor-error-ui { color-scheme: light only; background: lightyellow; bottom: 0; box-shadow: 0 -1px 2px rgba(0,0,0,.2); box-sizing: border-box; display: none; left: 0; padding: .6rem 1.25rem .7rem 1.25rem; position: fixed; width: 100%; z-index: 1000; }
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: .75rem; top: .5rem; }

@media (max-width: 600px) {
    .topbar { gap: .75rem; }
    .topbar nav a { margin-right: .5rem; }
    .who { display: none; }
}
