/* One stylesheet. One card style, one primary button per view. Phone (390 px) and desktop (1440 px) are both first-class:
   44 px tap targets, AA contrast, labels wrap instead of clipping, nothing scrolls sideways. Brand colors: /brand/theme.css. */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; color: var(--ink); background: var(--page); overflow-wrap: anywhere; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 1.5rem; line-height: 1.25; }
h2 { font-size: 1.15rem; line-height: 1.3; }
h3 { font-size: 1rem; line-height: 1.35; }
a { color: var(--brand); }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.hidden, [hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.top { background: #fff; border-bottom: 1px solid var(--line); }
.top .wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; padding-top: 8px; padding-bottom: 8px; }
.logo { display: inline-flex; align-items: center; min-height: 44px; }
.logo img { height: 28px; width: auto; display: block; }
.top .spacer { flex: 1 1 auto; }
.nav { display: flex; flex-wrap: wrap; gap: 4px; width: 100%; }
.nav a { display: inline-flex; align-items: center; min-height: 44px; padding: 8px 12px; border-radius: 8px; color: var(--ink); text-decoration: none; font-weight: 600; }
.nav a[aria-current="page"] { background: var(--brand-soft); color: var(--brand-ink); }
.nav .sep { flex-basis: 100%; height: 0; }
.nav .label { display: inline-flex; align-items: center; min-height: 44px; padding: 8px 4px 8px 12px; color: var(--muted); font-size: .875rem; font-weight: 600; }
main.wrap { padding-top: 20px; padding-bottom: 48px; display: grid; gap: 16px; }
.head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; justify-content: space-between; }
.head > div { min-width: 0; flex: 1 1 240px; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.stack { display: grid; gap: 12px; }
.grid2 { display: grid; gap: 16px; grid-template-columns: 1fr; }
.grid3 { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 768px) { .grid2 { grid-template-columns: 1fr 1fr; } .grid3 { grid-template-columns: repeat(3, 1fr); } }

.card { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 16px; display: grid; gap: 12px; min-width: 0; }
.card > .head h2 { flex: 1 1 auto; }
.card.flat { box-shadow: none; }
.notice { border-left: 4px solid var(--brand); }
.notice.warn { border-left-color: #b45309; }
.notice.good { border-left-color: #15803d; }

.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; min-width: 44px; padding: 8px 16px; border-radius: 8px; border: 1px solid #6b7280; background: #fff; color: var(--ink); font: inherit; font-weight: 600; text-align: center; text-decoration: none; cursor: pointer; }
.btn:hover { background: #f3f4f6; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-ink); }
.btn-danger { border-color: #b91c1c; color: #991b1b; }
.btn-quiet { border-color: transparent; background: transparent; color: var(--brand); padding-left: 8px; padding-right: 8px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
form.inline { display: inline; }

label { font-weight: 600; display: block; }
.field { display: grid; gap: 4px; min-width: 0; }
.hint { color: var(--muted); font-size: .875rem; font-weight: 400; }
input[type=text], input[type=email], input[type=number], input[type=date], input[type=month], input[type=url], input[type=tel], input[type=file], select, textarea {
  width: 100%; min-height: 44px; padding: 8px 12px; border: 1px solid #6b7280; border-radius: 8px; font: inherit; color: var(--ink); background: #fff; }
textarea { min-height: 96px; resize: vertical; }
.choice { display: flex; align-items: flex-start; gap: 10px; min-height: 44px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; font-weight: 500; cursor: pointer; }
.choice input { width: 20px; height: 20px; margin: 2px 0 0; flex: none; accent-color: var(--brand); }
.choices { display: grid; gap: 8px; }
@media (min-width: 768px) { .choices.wide { grid-template-columns: 1fr 1fr; } }
fieldset { border: 0; padding: 0; margin: 0; display: grid; gap: 8px; min-width: 0; }
legend { font-weight: 600; padding: 0; margin-bottom: 4px; }

.chip { display: inline-flex; align-items: center; padding: 2px 10px; border-radius: 999px; font-size: .8125rem; font-weight: 600; background: #e5e7eb; color: #1f2937; white-space: normal; }
.chip.pass, .chip.connected, .chip.approved, .chip.done { background: #dcfce7; color: #14532d; }
.chip.fail, .chip.declined { background: #fee2e2; color: #7f1d1d; }
.chip.cant_check, .chip.waiting_on_owner, .chip.pending, .chip.in_progress { background: #fef3c7; color: #713f12; }
.chip.rule { background: #1f2937; color: #fff; }
.chip.proven { background: #dbeafe; color: #1e3a8a; }
.chip.code { background: #fff; border: 1px solid #6b7280; }

.flash { background: #dcfce7; color: #14532d; border: 1px solid #86efac; border-radius: 8px; padding: 10px 14px; font-weight: 600; }
.formerror { background: #fee2e2; color: #7f1d1d; border: 1px solid #fca5a5; border-radius: 8px; padding: 10px 14px; font-weight: 600; }

/* Score */
.score { display: flex; flex-wrap: wrap; gap: 16px 24px; align-items: center; }
.ring { width: 112px; height: 112px; flex: none; }
.ring .track { fill: none; stroke: #e5e7eb; stroke-width: 10; }
.ring .value { fill: none; stroke: var(--brand); stroke-width: 10; stroke-linecap: round; }
.ring text { font-size: 26px; font-weight: 700; fill: var(--ink); }
.counts { display: flex; flex-wrap: wrap; gap: 8px; }
.areas { display: grid; gap: 10px; grid-template-columns: 1fr; }
@media (min-width: 768px) { .areas { grid-template-columns: 1fr 1fr; } }
.area-row { display: grid; gap: 4px; }
.area-row .line { display: flex; justify-content: space-between; gap: 12px; }
.bar { width: 100%; height: 8px; display: block; border-radius: 4px; background: #e5e7eb; }
.bar rect { fill: var(--brand); }

/* Checklist items */
details.area > summary { cursor: pointer; min-height: 44px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-weight: 700; font-size: 1.05rem; }
details.area[open] > summary { margin-bottom: 4px; }
.item { border-top: 1px solid var(--line); padding: 12px 0; display: grid; gap: 8px; }
.item .what { display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; }
.item .what strong { flex: 1 1 260px; }
.results { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
@media (min-width: 768px) { .results { grid-template-columns: repeat(4, 1fr); } }
.results .btn { padding: 6px 8px; font-size: .9375rem; }
.results .btn[aria-pressed="true"].pass { background: #166534; border-color: #166534; color: #fff; }
.results .btn[aria-pressed="true"].fail { background: #b91c1c; border-color: #b91c1c; color: #fff; }
.results .btn[aria-pressed="true"].cant_check { background: #fef3c7; border-color: #92400e; color: #713f12; box-shadow: inset 0 0 0 1px #92400e; }
.results .btn[aria-pressed="true"].not_applicable { background: #e5e7eb; border-color: #374151; color: #111827; box-shadow: inset 0 0 0 1px #374151; }
details.more > summary { cursor: pointer; min-height: 44px; display: inline-flex; align-items: center; color: var(--brand); font-weight: 600; }
details.more .stack { padding-top: 4px; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 8px; border-top: 1px solid var(--line); vertical-align: top; }
th { font-size: .875rem; color: var(--muted); border-top: 0; }
.tablewrap { overflow-x: auto; }
@media (max-width: 767px) {
  table.stacked thead { display: none; }
  table.stacked tr { display: grid; gap: 2px; padding: 10px 0; border-top: 1px solid var(--line); }
  table.stacked td { border: 0; padding: 2px 0; }
  table.stacked td[data-label]::before { content: attr(data-label) ": "; color: var(--muted); font-size: .875rem; font-weight: 600; }
}

.steps-bar { display: flex; gap: 6px; }
.steps-bar span { flex: 1; height: 6px; border-radius: 3px; background: #d1d5db; }
.steps-bar span.on { background: var(--brand); }
.pre { white-space: pre-wrap; }
.task { scroll-margin-top: 12px; }
.task .actions { display: flex; flex-wrap: wrap; gap: 8px; }
.task .actions .btn, .task .actions form { flex: 1 1 150px; }
.task .actions form .btn { width: 100%; }
.minutes { display: grid; gap: 8px; grid-template-columns: 1fr; }
@media (min-width: 768px) { .minutes { grid-template-columns: repeat(3, 1fr); } }
.minutes div { display: flex; justify-content: space-between; gap: 12px; padding: 8px 12px; background: var(--page); border-radius: 8px; }
.linkbox { display: grid; gap: 8px; }
.linkbox input { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .875rem; }
.chart { width: 100%; height: auto; display: block; }
.chart .gridline { stroke: #e5e7eb; stroke-width: 1; }
.chart .line { fill: none; stroke: var(--brand); stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; }
.chart .dot { fill: var(--brand); }
.chart text { font-size: 12px; fill: var(--muted); }

dialog { border: 1px solid var(--line); border-radius: 12px; padding: 20px; width: min(520px, calc(100vw - 32px)); max-height: calc(100vh - 32px); overflow: auto; color: var(--ink); }
dialog::backdrop { background: rgba(17, 24, 39, .55); }
dialog form, dialog .stack { display: grid; gap: 12px; }
.center { max-width: 460px; margin: 6vh auto 0; }
.foot { color: var(--muted); font-size: .875rem; text-align: center; padding: 24px 16px; }
