:root {
  --ink: #17212b;
  --muted: #5b6874;
  --line: #dfe4ea;
  --bg: #f4f6f8;
  --card: #ffffff;
  --brand: #0d5c63;
  --brand-dark: #08444a;
  --accent: #e0a526;
  --ok: #1d7a46;
  --warn: #8a5a00;
  --err: #b3261e;
  --radius: 10px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 16px; line-height: 1.5; color: var(--ink); background: var(--bg); }
h1 { font-size: 1.6rem; margin: 0 0 .4rem; line-height: 1.2; }
h2 { font-size: 1.15rem; margin: 0 0 .8rem; }
a { color: var(--brand); }
a:hover { color: var(--brand-dark); }
small { font-size: .85rem; }
hr { border: 0; border-top: 1px solid var(--line); margin: 1.2rem 0; }
.muted { color: var(--muted); }
.opt { color: var(--muted); font-weight: 400; font-size: .85em; }
.center { text-align: center; padding: 2rem 0; }
.inline { display: inline; }

/* Layout */
.topbar { background: var(--brand); color: #fff; position: sticky; top: 0; z-index: 100; box-shadow: 0 1px 4px rgba(0,0,0,.2); }
.topbar-inner { max-width: 1100px; margin: 0 auto; padding: .6rem 16px; display: flex; align-items: center; gap: 1.2rem; flex-wrap: wrap; }
.brand { color: #fff; text-decoration: none; font-weight: 700; display: flex; align-items: center; gap: .6rem; }
.logo-mark { display: inline-grid; place-items: center; width: 2rem; height: 2rem; border-radius: 8px; background: var(--accent); color: #1c1300; font-weight: 800; }
.nav { display: flex; gap: 1rem; flex: 1; }
.nav a { color: #d6eef0; text-decoration: none; padding: .3rem .1rem; border-bottom: 2px solid transparent; }
.nav a:hover { color: #fff; border-bottom-color: var(--accent); }
.usermenu { display: flex; align-items: center; gap: .8rem; }
.who { font-size: .9rem; }
.who small { display: block; color: #b6dde0; }
.page { max-width: 1100px; margin: 0 auto; padding: 1.5rem 16px 3rem; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap; }

/* Cards and grids */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.2rem 1.3rem; margin-bottom: 1rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-bottom: 1rem; }
.grid-3 .card { margin-bottom: 0; }
.stat-num { font-size: 2rem; font-weight: 700; color: var(--brand); line-height: 1.1; }
.stat-label { color: var(--muted); font-size: .9rem; }

/* Tables */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: .6rem .5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.table tr:last-child td { border-bottom: 0; }
.num { text-align: right !important; white-space: nowrap; }

/* Forms */
label { display: block; font-weight: 600; margin: .9rem 0 .25rem; font-size: .95rem; }
input[type=text], input[type=email], input[type=password], input:not([type]), select {
  width: 100%; padding: .6rem .7rem; font: inherit; color: inherit; background: #fff;
  border: 1px solid #b9c2cc; border-radius: 8px;
}
input:focus, select:focus, .btn:focus-visible { outline: 3px solid rgba(13, 92, 99, .35); outline-offset: 1px; border-color: var(--brand); }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.check { display: flex; gap: .6rem; align-items: flex-start; font-weight: 400; margin-top: 1.1rem; }
.check input { margin-top: .3rem; }
.field-error { color: var(--err); font-size: .88rem; margin-top: .3rem; }
.inline-form { display: grid; grid-template-columns: 2fr 1fr auto; gap: 1rem; align-items: start; }
.inline-form label { margin-top: 0; }
.align-end { align-self: end; }

/* Buttons */
.btn { display: inline-block; padding: .6rem 1rem; font: inherit; font-weight: 600; border-radius: 8px; border: 1px solid var(--line); background: #fff; color: var(--ink); text-decoration: none; cursor: pointer; }
.btn:hover { background: #f0f3f6; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-quiet { background: transparent; border-color: transparent; color: inherit; padding: .35rem .6rem; }
.topbar .btn-quiet { color: #fff; }
.topbar .btn-quiet:hover { background: rgba(255,255,255,.12); }
.table .btn-quiet { color: var(--brand); }
.block { display: block; width: 100%; margin-top: 1.2rem; }

/* Alerts and pills */
.alert { padding: .75rem 1rem; border-radius: 8px; margin-bottom: 1rem; border: 1px solid; word-break: break-word; }
.alert-success { background: #e7f5ec; border-color: #a9d9bc; color: #14532d; }
.alert-error { background: #fdecea; border-color: #f2b8b5; color: #7f1d1d; }
.alert-warning { background: #fff4d6; border-color: #ecd08a; color: #6b4600; }
.alert-info { background: #e8f1fb; border-color: #b3cdee; color: #1e3a5f; }
.pill { display: inline-block; padding: .1rem .6rem; border-radius: 999px; background: #e9edf1; font-size: .82rem; text-transform: capitalize; }
.pill-ok { background: #e1f3e8; color: var(--ok); }
.pill-warn { background: #fff0c9; color: var(--warn); }

/* Guest pages */
body.guest { display: grid; place-items: start center; min-height: 100vh; }
.guest-wrap { width: 100%; max-width: 520px; padding: 2.2rem 16px; }
.guest-brand { text-align: center; margin-bottom: 1.2rem; }
.guest-brand .logo-mark { width: 3rem; height: 3rem; font-size: 1.4rem; border-radius: 12px; background: var(--brand); color: #fff; }
.guest-title { font-size: 1.3rem; font-weight: 700; margin-top: .5rem; }
.guest-sub { color: var(--muted); font-size: .92rem; }
.guest-card { padding: 1.6rem; }
.guest-foot { text-align: center; color: var(--muted); font-size: .85rem; }
.links { text-align: center; margin: 1rem 0 0; font-size: .95rem; }

@media (max-width: 720px) {
  .grid-3 { grid-template-columns: 1fr; }
  .row, .inline-form { grid-template-columns: 1fr; }
  .nav { order: 3; flex-basis: 100%; }
  .usermenu { margin-left: auto; }
}

/* ---- Evaluation pages ---- */
h3 { font-size: 1rem; margin: 1.2rem 0 .3rem; }
textarea { width: 100%; padding: .6rem .7rem; font: inherit; color: inherit; background: #fff; border: 1px solid #b9c2cc; border-radius: 8px; resize: vertical; }
textarea:focus { outline: 3px solid rgba(13, 92, 99, .35); outline-offset: 1px; border-color: var(--brand); }
textarea:disabled, input:disabled, select:disabled { background: #f0f3f6; cursor: not-allowed; }
.small-note { font-size: .88rem; }
.crumb { margin: 0 0 .2rem; font-size: .9rem; color: var(--muted); }
.code { display: inline-block; font-variant-numeric: tabular-nums; color: var(--brand); font-weight: 700; margin-right: .3rem; }
.derived { background: #eef6f6; border: 1px solid #cfe5e6; border-radius: 8px; padding: .6rem .8rem; margin: .8rem 0; }
.num-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .2rem 1rem; }
.yearpicker { display: flex; align-items: end; gap: .8rem; flex-wrap: wrap; }
.yearpicker label { margin: 0; flex-basis: 100%; }
.yearpicker select { width: auto; min-width: 9rem; }
.btn-row { display: flex; gap: .8rem; align-items: center; flex-wrap: wrap; }
.steps { margin: 0; padding-left: 1.2rem; }
.steps li { margin-bottom: .5rem; }

/* Progress bars */
.bar { display: inline-block; width: 90px; height: 8px; border-radius: 999px; background: #e3e8ed; vertical-align: middle; margin-right: .5rem; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--brand); }
.bar-agree > span { background: var(--accent); }

/* Area tabs */
.areatabs { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: 1rem; }
.areatab { display: inline-grid; place-items: center; width: 2.4rem; height: 2.4rem; border-radius: 8px; border: 1px solid var(--line); background: #fff; color: var(--ink); text-decoration: none; font-weight: 700; }
.areatab:hover { border-color: var(--brand); }
.areatab.partial { background: #fff4d6; border-color: #ecd08a; }
.areatab.done { background: #e1f3e8; border-color: #a9d9bc; color: var(--ok); }
.areatab.current { outline: 3px solid rgba(13, 92, 99, .45); outline-offset: 1px; }

/* About / guide */
details > summary { cursor: pointer; font-weight: 600; color: var(--brand); padding: .2rem 0; }
.about { margin: .6rem 0 0; }
.about dt { font-weight: 700; margin-top: .6rem; }
.about dd { margin: .1rem 0 0; color: #2c3945; }
.guide td { font-size: .9rem; }

/* Rating rows */
.ind { padding: .9rem 0; border-bottom: 1px solid var(--line); }
.ind:last-child { border-bottom: 0; }
.ind-text { margin-bottom: .5rem; }
.scale { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.scale input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.scale label { margin: 0; display: inline-flex; flex-direction: column; align-items: center; min-width: 4.6rem; padding: .35rem .6rem; border: 1px solid var(--line); border-radius: 8px; background: #fff; cursor: pointer; font-weight: 600; line-height: 1.15; }
.scale label .n { font-size: 1.05rem; }
.scale label .t { font-size: .68rem; font-weight: 500; color: var(--muted); }
.scale label:hover { border-color: var(--brand); }
.scale input:focus-visible + label { outline: 3px solid rgba(13, 92, 99, .5); outline-offset: 1px; }
.scale input:disabled + label { cursor: not-allowed; opacity: .75; }
.scale input:checked + label.r5 { background: #1d7a46; border-color: #1d7a46; color: #fff; }
.scale input:checked + label.r4 { background: #5a9e3f; border-color: #5a9e3f; color: #fff; }
.scale input:checked + label.r3 { background: #c79a00; border-color: #c79a00; color: #fff; }
.scale input:checked + label.r2 { background: #d0701a; border-color: #d0701a; color: #fff; }
.scale input:checked + label.r1 { background: #b3261e; border-color: #b3261e; color: #fff; }
.scale input:checked + label .t { color: rgba(255,255,255,.9); }
.scale.suggested input:checked + label { border-style: dashed; border-width: 2px; }
.sugg-note { font-size: .8rem; color: var(--warn); margin-left: .4rem; }
.cmt { margin-top: .4rem; }
.cmt textarea { margin-top: .3rem; }
.chip { display: inline-grid; place-items: center; min-width: 1.5rem; height: 1.5rem; padding: 0 .3rem; border-radius: 6px; font-weight: 700; font-size: .85rem; color: #fff; }
.chip.r5 { background: #1d7a46; } .chip.r4 { background: #5a9e3f; } .chip.r3 { background: #c79a00; } .chip.r2 { background: #d0701a; } .chip.r1 { background: #b3261e; }
.team { display: flex; flex-wrap: wrap; gap: .4rem .8rem; align-items: center; margin: 0 0 .5rem; font-size: .9rem; }
.team-label { font-weight: 700; color: var(--muted); }
.member { display: inline-flex; gap: .3rem; align-items: center; }
.avg { color: var(--muted); }
.tc { margin: .3rem 0 0; padding-left: 1.1rem; font-size: .9rem; }

/* Sticky action bar */
.actionbar { position: sticky; bottom: 0; background: rgba(244, 246, 248, .96); border-top: 1px solid var(--line); padding: .8rem 0; display: flex; gap: .8rem; align-items: center; flex-wrap: wrap; margin-top: .5rem; }

@media (max-width: 720px) {
  .num-grid { grid-template-columns: 1fr 1fr; }
  .scale label { min-width: 3.4rem; padding: .35rem .4rem; }
  .scale label .t { display: none; }
}

/* ---- Results and improvement plan ---- */
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-bottom: 1rem; }
.grid-4 .card { margin-bottom: 0; }
.stat-num.late { color: var(--err); }
.stat-num.money { font-size: 1.5rem; padding-top: .3rem; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: .6rem; }
.card-head h2 { margin: 0; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem; }
.two-col h3 { margin-top: 0; }
.prewrap { white-space: pre-wrap; margin: .2rem 0 0; }
.filters { display: flex; flex-wrap: wrap; gap: 1rem; align-items: end; }
.filters label { margin-top: 0; }
.filters select { min-width: 12rem; }
.inline-check { margin: 0 0 .5rem; font-weight: 400; }
.block-sm { margin-top: 1rem; }
.btn-danger { background: #fff; border-color: #e3a7a3; color: var(--err); }
.btn-danger:hover { background: #fdecea; }
.danger-zone { border-color: #f0c9c6; }

.pill-late { background: #fdecea; color: var(--err); }
.pill.prio-high { background: #fdecea; color: var(--err); }
.pill.prio-medium { background: #fff0c9; color: var(--warn); }
.pill.prio-low { background: #e9edf1; color: var(--muted); }
.pill.st-completed { background: #e1f3e8; color: var(--ok); }
.pill.st-in_progress { background: #e1eefb; color: #1e4a7a; }
.pill.st-blocked { background: #fdecea; color: var(--err); }
.pill.st-cancelled { background: #eceff2; color: var(--muted); text-decoration: line-through; }
.row-late td { background: #fff8f7; }
.sip td { vertical-align: top; }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { border-left: 3px solid var(--line); padding: 0 0 1rem 1rem; margin-left: .3rem; }
.tl-head { font-size: .9rem; color: var(--muted); }
.tl-head strong { color: var(--ink); }

/* Radar chart */
.radar-wrap { max-width: 640px; margin: 0 auto; }
.radar { width: 100%; height: auto; display: block; }
.radar .ring { fill: none; stroke: #d5dce3; stroke-width: 1; }
.radar .axis { stroke: #d5dce3; stroke-width: 1; }
.radar .ringlabel { font-size: 10px; fill: #8a96a2; }
.radar .axislabel { font-size: 12px; fill: #2c3945; font-family: var(--font); }
.radar .series.s1 { fill: rgba(13, 92, 99, .25); stroke: #0d5c63; stroke-width: 2.5; }
.radar .series.s2 { fill: none; stroke: #c98a00; stroke-width: 2; stroke-dasharray: 6 4; }
.radar .dot.s1 { fill: #0d5c63; }
.radar .dot.s2 { fill: #c98a00; }
.radar .legend.s1 { fill: rgba(13, 92, 99, .35); stroke: #0d5c63; }
.radar .legend.s2 { fill: #fff; stroke: #c98a00; stroke-dasharray: 3 2; }

@media (max-width: 720px) {
  .grid-4 { grid-template-columns: 1fr 1fr; }
  .two-col { grid-template-columns: 1fr; }
}

@media print {
  .topbar, .actionbar, .btn, .filters, .nav, form { display: none !important; }
  body { background: #fff; }
  .page { max-width: none; padding: 0; }
  .card { border: 1px solid #bbb; break-inside: avoid; }
}

/* Release 5: evidence and report */
.evlist { list-style: none; margin: .4rem 0 0; padding: 0; }
.evlist li { padding: .35rem 0; border-top: 1px solid #e3e7ec; }
.evlist li:first-child { border-top: 0; }
.report-cover h1 { margin: .2rem 0 .6rem; }
.report-ind .subhead th { background: #eef2f6; text-align: left; }
.sigline { border-bottom: 1px solid #555; height: 2.4rem; min-width: 10rem; }
@media print {
  .no-print { display: none !important; }
  .report-area { break-before: page; break-inside: auto; }
  .report-ind tr { break-inside: avoid; }
  .chip { border: 1px solid #555; }
}

/* Release 6: district view */
.form-actions { margin-top: 1.2rem; }
.heat td.cell, .heat th.cell { text-align: center; padding-left: .3rem; padding-right: .3rem; }
.heat .avgrow td { font-weight: 600; background: #eef2f6; }
.checklist { max-height: 28rem; overflow: auto; border: 1px solid #e3e7ec; border-radius: 8px; padding: .4rem .8rem; }
.checklist label { display: flex; gap: .6rem; align-items: center; padding: .3rem 0; font-weight: 400; }
.checklist input { width: auto; }

/* Release 7: legal pages, footer */
.legal { max-width: 46rem; line-height: 1.55; }
.legal h2 { margin-top: 1.4rem; font-size: 1.1rem; }
.app-foot { text-align: center; padding: 1.5rem 16px 2rem; font-size: .88rem; color: var(--muted); }
.guest-foot a { color: inherit; }

/* Release 9: active navigation tab */
.nav a.active { color: #fff; font-weight: 700; border-bottom-color: var(--accent); }

/* Release 10: health page */
.logbox { background: #14191f; color: #d9e2ea; padding: .9rem 1rem; border-radius: 8px; overflow: auto; font-size: .8rem; line-height: 1.45; white-space: pre-wrap; word-break: break-word; }

/* Release 11: getting started and help */
.checklist-steps { list-style: none; margin: .5rem 0 0; padding: 0; }
.checklist-steps li { display: flex; gap: .8rem; align-items: flex-start; padding: .55rem 0; border-top: 1px solid #e3e7ec; }
.checklist-steps li:first-child { border-top: 0; }
.checklist-steps .tick { flex: 0 0 1.5rem; height: 1.5rem; border: 2px solid #9db3b6; border-radius: 50%; display: grid; place-items: center; font-size: .85rem; color: #fff; }
.checklist-steps li.done .tick { background: #1d7a46; border-color: #1d7a46; }
.checklist-steps li.done a { color: var(--muted); text-decoration: line-through; }
details > summary { cursor: pointer; font-weight: 600; padding: .5rem 0; }

/* Release 12: logo image */
.brand .logo-img { width: 2rem; height: 2rem; border-radius: 8px; display: inline-block; vertical-align: middle; }
.guest-brand .logo-img-lg { width: 4rem; height: 4rem; display: block; margin: 0 auto .4rem; }

/* Release 13: phones */
html { -webkit-text-size-adjust: 100%; }
input[type=tel], input[type=number], input[type=date], input[type=search], input[type=url] { width: 100%; padding: .6rem .7rem; font: inherit; color: inherit; background: #fff; border: 1px solid #b9c2cc; border-radius: 8px; box-sizing: border-box; }
input[type=file] { max-width: 100%; }
img, svg { max-width: 100%; }
.nav { scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }

@media (max-width: 720px) {
  body { font-size: 16px; }
  h1 { font-size: 1.35rem; }
  h2 { font-size: 1.1rem; }

  /* Compact top bar: logo, name and sign-out on one line; the menu is a single swipeable row underneath */
  .topbar-inner { padding: .4rem 12px 0; gap: .25rem .7rem; flex-wrap: wrap; }
  .brand { font-size: 1rem; gap: .5rem; order: 1; }
  .brand .logo-img { width: 1.8rem; height: 1.8rem; }
  .usermenu { order: 2; margin-left: auto; gap: .4rem; }
  .usermenu .who { display: none; }
  .usermenu .btn { padding: .3rem .7rem; font-size: .9rem; min-height: 0; }
  .nav { order: 3; flex: 0 0 100%; flex-wrap: nowrap; overflow-x: auto; white-space: nowrap; gap: 1.1rem; margin: 0 -12px; padding: 0 12px; -webkit-overflow-scrolling: touch; }
  .nav a { flex: 0 0 auto; padding: .55rem .1rem .5rem; font-size: .95rem; }

  .page { padding: 1rem 12px 2.5rem; }
  .card { padding: 1rem; border-radius: 10px; }
  .page-head { gap: .6rem; }
  .page-head .btn-row { width: 100%; }
  .btn-row { gap: .5rem; }
  .btn { padding: .65rem .9rem; }
  .table th, .table td { padding: .5rem .4rem; font-size: .92rem; }
  .table-wrap { margin: 0 -.2rem; -webkit-overflow-scrolling: touch; }
  .areatabs { flex-wrap: nowrap; overflow-x: auto; padding-bottom: .3rem; }
  .areatab { flex: 0 0 auto; }
  .actionbar { padding: .6rem 0; gap: .5rem; }
  .actionbar .small-note { display: none; }
  .actionbar .btn { flex: 1 1 auto; text-align: center; }
  .guest-wrap { padding: 1.4rem 14px; }
  .checklist { max-height: 22rem; }
}

/* Short screens (a phone turned sideways): do not let the bar eat the page */
@media (max-height: 480px) {
  .topbar { position: static; }
  .actionbar { position: static; }
}
