:root {
  --navy: #1f3864; --navy-2: #2e4a7d; --ink: #1d2433; --muted: #5f6b7a; --line: #dde3ea; --bg: #f4f6f9;
  --card: #fff; --red: #c0392b; --amber: #e08a1e; --green: #2e8b57; --blue: #2f6db5; --yellow: #f2c94c;
  --radius: 10px; --shadow: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.08);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 15px/1.5 -apple-system, "Segoe UI", Roboto, Arial, sans-serif; color: var(--ink); background: var(--bg); }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.6rem; margin: 0 0 .25rem; letter-spacing: -.01em; }
h2 { font-size: 1.1rem; margin: 0 0 .75rem; }
code { background: #eef1f5; padding: 1px 5px; border-radius: 4px; }
.muted { color: var(--muted); } .small { font-size: .85rem; } .mt { margin-top: 1.25rem; }
.right { text-align: right; } .nowrap { white-space: nowrap; } .red { color: var(--red); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* top bar */
.topbar { background: var(--navy); color: #fff; display: flex; align-items: center; justify-content: space-between;
  padding: .7rem 1.5rem; position: sticky; top: 0; z-index: 10; }
.brand { font-weight: 700; display: flex; gap: .5rem; align-items: center; }
.logo { color: #8fb3ff; }
.topbar nav { display: flex; gap: 1.25rem; align-items: center; }
.topbar nav a, .topbar .linkbtn { color: #dfe7f5; font-size: .92rem; }
.linkbtn { background: none; border: 0; cursor: pointer; font: inherit; padding: 0; }
.inline { display: inline; }
.foot { text-align: center; color: var(--muted); font-size: .8rem; padding: 2rem 0; }

/* layout */
.container { max-width: 1180px; margin: 1.5rem auto; padding: 0 1.25rem; }
.container.narrow { max-width: 480px; }
.layout { display: grid; grid-template-columns: 290px 1fr; gap: 1.5rem; max-width: 1400px; margin: 1.25rem auto; padding: 0 1.25rem; }
.content { min-width: 0; }
.pagehead { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
.eyebrow { text-transform: uppercase; letter-spacing: .08em; font-size: .75rem; color: var(--muted); margin: 0 0 .2rem; font-weight: 600; }
.crumbs { font-size: .85rem; color: var(--muted); margin: 0 0 .5rem; }

/* cards & forms */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem; box-shadow: var(--shadow); }
.card.empty { text-align: center; padding: 2.5rem; }
.card.intro { margin-bottom: 1rem; background: #f3f7ff; border-color: #cfdcf5; }
.card.danger summary { color: var(--red); }
details.card summary { cursor: pointer; }
details.card[open] summary { margin-bottom: .75rem; }
label { display: block; font-size: .88rem; font-weight: 600; color: #344054; margin-bottom: .8rem; }
input, select, textarea { display: block; width: 100%; margin-top: .3rem; font: inherit; font-weight: 400; color: var(--ink);
  padding: .5rem .65rem; border: 1px solid #c9d1db; border-radius: 7px; background: #fff; }
input:focus, select:focus, textarea:focus { outline: 2px solid #8fb3ff; outline-offset: 0; border-color: var(--blue); }
label.check { display: flex; gap: .5rem; align-items: center; font-weight: 400; }
label.check input { width: auto; margin: 0; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1.25rem; }
.form-grid .full { grid-column: 1 / -1; }
.callout { background: #eef4ff; border: 1px solid #cfdcf5; border-radius: 8px; padding: .8rem 1rem; margin-bottom: 1rem; }
.btn { display: inline-block; border: 1px solid #c9d1db; background: #fff; color: var(--ink); border-radius: 7px;
  padding: .5rem .9rem; font: inherit; font-size: .9rem; font-weight: 600; cursor: pointer; text-decoration: none; }
.btn:hover { background: #f2f4f7; text-decoration: none; }
.btn.primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn.primary:hover { background: var(--navy-2); }
.btn.wide { width: 100%; }
.dangerbtn { background: var(--red); border: 0; color: #fff; margin-top: .5rem; }
.login { margin-top: 4rem; }
.dropdown { position: relative; }
.dropdown summary { list-style: none; }
.dropdown summary::-webkit-details-marker { display: none; }
.popover { position: absolute; right: 0; top: 2.8rem; width: 360px; z-index: 5; }

/* flash */
.flash { padding: .75rem 1rem; border-radius: 8px; margin-bottom: 1rem; border: 1px solid; }
.flash-ok { background: #edf7ef; border-color: #b7dfc0; }
.flash-error { background: #fdeeee; border-color: #f1b8b3; }
.flash-info { background: #f3f7ff; border-color: #cfdcf5; }
.flash-link { background: #fff8e6; border-color: #f2d58a; }
.copyfield { font-family: ui-monospace, Consolas, monospace; font-size: .85rem; }

/* tables */
.table { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.table th, .table td { padding: .65rem .8rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.table th { background: #f7f9fc; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.table.compact th, .table.compact td { padding: .45rem .6rem; }
.card .table { border: 0; }
.num { text-align: right !important; }
.w40 { width: 40%; text-transform: none !important; letter-spacing: 0 !important; font-size: .88rem !important; }
.table tr:last-child td { border-bottom: 0; }
.barcol { width: 34%; white-space: nowrap; }
.pill { display: inline-block; padding: .1rem .55rem; border-radius: 99px; font-size: .78rem; font-weight: 600; }
.pill-ok { background: #e3f4e8; color: #1f6b3d; } .pill-wip { background: #fff3d6; color: #8a5a00; }
.pill-info { background: #e6eefc; color: #234a8a; }
.mat-low { color: var(--red); } .mat-mid { color: #b06d00; } .mat-high { color: var(--green); }
.mat { font-weight: 700; }

/* bars */
.bar { background: #e8ecf1; border-radius: 99px; height: 8px; overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--blue); border-radius: 99px; width: 0; transition: width .3s; }
.bar.small { width: 80px; display: inline-block; vertical-align: middle; margin-right: .4rem; }
.mbar { display: inline-block; width: calc(100% - 3.2rem); vertical-align: middle; }
.mbar span.mat-low { background: var(--red); } .mbar span.mat-mid { background: var(--amber); } .mbar span.mat-high { background: var(--green); }
.pct { display: inline-block; width: 2.8rem; text-align: right; font-weight: 600; font-size: .85rem; }

/* sidebar */
.sidebar { position: sticky; top: 4.2rem; align-self: start; max-height: calc(100vh - 5rem); overflow: auto;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; box-shadow: var(--shadow); }
.sidetitle { font-size: .95rem; margin-bottom: .6rem; }
.overall small { color: var(--muted); }
.steps { list-style: none; margin: .9rem 0 0; padding: 0; }
.steps li a { display: flex; gap: .5rem; align-items: center; padding: .38rem .5rem; border-radius: 6px; color: var(--ink); font-size: .87rem; }
.steps li a:hover { background: #f2f5f9; text-decoration: none; }
.steps li.active a { background: #e8eefb; font-weight: 700; color: var(--navy); }
.cnum { display: inline-grid; place-items: center; min-width: 1.6rem; height: 1.6rem; border-radius: 50%;
  background: #eef1f5; font-size: .75rem; font-weight: 700; color: var(--muted); }
.steps li.done .cnum { background: var(--green); color: #fff; }
.cprog { margin-left: auto; font-size: .75rem; color: var(--muted); }

/* questionnaire */
.savestate { font-size: .85rem; color: var(--muted); padding: .35rem .7rem; border-radius: 99px; background: #eef1f5; }
.savestate.ok { background: #e3f4e8; color: #1f6b3d; }
.savestate.busy { background: #fff3d6; color: #8a5a00; }
.savestate.err { background: #fdeeee; color: var(--red); }
.qcard { background: #fff; border: 1px solid var(--line); border-left: 4px solid #c9d1db; border-radius: var(--radius);
  padding: 1.1rem 1.25rem; margin-bottom: 1rem; box-shadow: var(--shadow); scroll-margin-top: 5rem; }
.qcard.answered { border-left-color: var(--green); }
.qcard.flashcard { outline: 3px solid #8fb3ff; }
.qcard header { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; margin-bottom: .5rem; }
.sid { background: var(--navy); color: #fff; font-weight: 700; font-size: .8rem; padding: .15rem .5rem; border-radius: 5px; }
.stitle { font-weight: 600; color: var(--muted); font-size: .88rem; }
.tag { font-size: .72rem; background: #eef1f5; color: var(--muted); padding: .1rem .5rem; border-radius: 99px; font-weight: 600; }
.weight-high { background: #fdeeee; color: var(--red); } .weight-medium { background: #fff3d6; color: #8a5a00; }
.question { font-size: 1.05rem; margin: .2rem 0 .5rem; }
.evidence summary { font-size: .85rem; color: var(--blue); cursor: pointer; }
.evidence p { font-size: .88rem; color: var(--muted); background: #f7f9fc; padding: .5rem .75rem; border-radius: 6px; margin: .4rem 0 0; }
.responses { border: 0; padding: 0; margin: .9rem 0 .6rem; display: flex; flex-wrap: wrap; gap: .45rem; }
.resp { margin: 0; font-weight: 500; }
.resp input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.resp span { display: inline-block; padding: .45rem .8rem; border: 1px solid #c9d1db; border-radius: 99px; cursor: pointer;
  font-size: .87rem; background: #fff; user-select: none; }
.resp span:hover { background: #f2f5f9; }
.resp input:focus-visible + span { outline: 2px solid #8fb3ff; }
.resp-implemented_documented input:checked + span { background: var(--green); border-color: var(--green); color: #fff; }
.resp-implemented input:checked + span { background: #6aa84f; border-color: #6aa84f; color: #fff; }
.resp-partial input:checked + span { background: var(--amber); border-color: var(--amber); color: #fff; }
.resp-not_implemented input:checked + span { background: var(--red); border-color: var(--red); color: #fff; }
.resp-unknown input:checked + span { background: #6b7280; border-color: #6b7280; color: #fff; }
.resp-na input:checked + span { background: #cfd6df; border-color: #aab4c0; color: var(--ink); }
.fields label { font-weight: 500; font-size: .82rem; color: var(--muted); margin-bottom: .5rem; }
.fields textarea { min-height: 2.6rem; }
.row2 { display: grid; grid-template-columns: 1fr 180px; gap: 1rem; }
.pager { display: flex; justify-content: space-between; margin: 1.5rem 0 2rem; }

/* scorecard */
.kpis { display: grid; grid-template-columns: 1.4fr repeat(4, 1fr); gap: 1rem; margin-bottom: 1.25rem; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.kpi .label { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; }
.kpi .value { font-size: 1.8rem; font-weight: 700; }
.kpi .value small { font-size: 1rem; color: var(--muted); }
.kpi.big .value { font-size: 2.4rem; }
.delta { font-size: .8rem; font-weight: 700; color: var(--muted); }
.delta.up { color: var(--green); } .delta.down { color: var(--red); }
.prio { display: inline-block; font-size: .75rem; font-weight: 700; padding: .12rem .5rem; border-radius: 5px; }
.prio-high { background: var(--red); color: #fff; } .prio-medium { background: var(--amber); color: #fff; }
.prio-low { background: var(--yellow); } .prio-document { background: #dde9f7; color: #234a8a; }

/* report */
.reportbar { display: flex; justify-content: space-between; margin-bottom: 1rem; }
.report { background: #fff; padding: 2.5rem 3rem; border: 1px solid var(--line); border-radius: var(--radius); }
.report h2 { margin-top: 2rem; color: var(--navy); border-bottom: 2px solid var(--navy); padding-bottom: .3rem; }
.rhead { border-bottom: 4px solid var(--navy); padding-bottom: 1rem; }
.rsub { margin: .2rem 0; color: var(--muted); }
.report .kpis { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; } .sidebar { position: static; max-height: none; }
  .grid2, .form-grid, .kpis { grid-template-columns: 1fr; } .row2 { grid-template-columns: 1fr; }
}
@media print {
  .no-print, .topbar, .foot { display: none !important; }
  body { background: #fff; font-size: 11pt; }
  .container { max-width: none; margin: 0; padding: 0; }
  .report { border: 0; padding: 0; }
  .kpi, .table { box-shadow: none; }
  .pagebreak { break-before: page; }
  tr { break-inside: avoid; }
  .bar span { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .prio, .kpi { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
.layout > .flash { grid-column: 1 / -1; margin-bottom: 0; }
