:root {
  --bg: #f4f6f8; --panel: #ffffff; --ink: #1c2833; --muted: #5d6d7e; --line: #d9dee3;
  --accent: #1f5f8b; --accent-ink: #ffffff; --accent-soft: #e6f0f7;
  --red: #b3261e; --red-soft: #fbe9e7; --amber: #9a5b00; --amber-soft: #fff1d6;
  --green: #1e7a46; --green-soft: #e3f4ea; --grey: #6b7785; --grey-soft: #eceff2;
  --radius: 8px; --shadow: 0 1px 2px rgba(0,0,0,.06);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; font-size: 15px; color: var(--ink);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.topbar { display: flex; align-items: center; gap: 24px; padding: 10px 20px; background: #16324a; color: #fff; position: sticky; top: 0; z-index: 5; }
.brand { font-weight: 700; letter-spacing: .02em; }
.nav { display: flex; flex-wrap: wrap; gap: 4px; flex: 1; min-width: 0; }
.nav-item { padding: 6px 12px; border-radius: 6px; color: #cfdbe6; text-decoration: none; }
.nav-item.active { background: rgba(255,255,255,.16); color: #fff; font-weight: 600; }
.nav-item.soon { opacity: .5; cursor: default; }
.site-picker select { background: #fff; color: var(--ink); border: 0; border-radius: 6px; padding: 6px 8px; max-width: 280px; }

.layout { display: grid; grid-template-columns: minmax(320px, 400px) 1fr; gap: 16px; padding: 16px 20px; align-items: start; }
.list-pane, .detail-pane { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.list-pane { position: sticky; top: 64px; max-height: calc(100vh - 80px); display: flex; flex-direction: column; }
.detail-pane { padding: 20px 24px 28px; min-height: 60vh; }

.filters { padding: 12px; border-bottom: 1px solid var(--line); display: grid; gap: 8px; }
.filters .row { display: flex; gap: 8px; align-items: center; justify-content: space-between; }
.filters .row.two > * { flex: 1; min-width: 0; }
.filters input[type=search] { flex: 1; }
.count { padding: 8px 12px; color: var(--muted); font-size: 13px; border-bottom: 1px solid var(--line); }
.list { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; }
.item { display: block; width: 100%; text-align: left; background: none; border: 0; border-bottom: 1px solid var(--line);
  padding: 10px 12px 10px 14px; cursor: pointer; border-left: 4px solid transparent; font: inherit; color: inherit; }
.item:hover { background: #f7f9fb; }
.item.selected { background: var(--accent-soft); }
.item.s-overdue { border-left-color: var(--red); } .item.s-nearly_due { border-left-color: var(--amber); }
.item.s-ok { border-left-color: var(--green); } .item.s-no_date { border-left-color: var(--grey); } .item.s-closed { border-left-color: #c3cad1; }
.item .top { display: flex; gap: 8px; align-items: center; font-size: 13px; color: var(--muted); }
.item .num { font-weight: 700; color: var(--ink); }
.item .txt { margin: 4px 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.item .meta { font-size: 12.5px; color: var(--muted); }

.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.b-overdue { background: var(--red-soft); color: var(--red); } .b-nearly_due { background: var(--amber-soft); color: var(--amber); }
.b-ok { background: var(--green-soft); color: var(--green); } .b-no_date { background: var(--grey-soft); color: var(--grey); }
.b-closed { background: var(--grey-soft); color: var(--grey); } .b-type { background: var(--accent-soft); color: var(--accent); }

input, select, textarea, button { font: inherit; }
input[type=email], input[type=password], input[type=text], input[type=number], input[type=date], input[type=search], select, textarea {
  width: 100%; padding: 7px 9px; border: 1px solid #b9c2cb; border-radius: 6px; background: #fff; color: var(--ink); }
textarea { min-height: 84px; resize: vertical; line-height: 1.4; }
:focus-visible { outline: 3px solid #7fb4dc; outline-offset: 1px; }
button { cursor: pointer; border-radius: 6px; border: 1px solid #b9c2cb; background: #fff; padding: 6px 12px; color: var(--ink); }
button:hover { background: #f1f4f7; }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
button.primary:hover { background: #184d72; }
button.danger { color: var(--red); border-color: #e3b5b1; }
button.link { border: 0; background: none; color: var(--accent); padding: 2px 4px; text-decoration: underline; }
button:disabled { opacity: .5; cursor: not-allowed; }
.seg { display: inline-flex; border: 1px solid #b9c2cb; border-radius: 6px; overflow: hidden; }
.seg button { border: 0; border-radius: 0; background: #fff; padding: 6px 12px; }
.seg button.on { background: var(--accent); color: #fff; font-weight: 600; }
.check { display: inline-flex; gap: 6px; align-items: center; font-size: 14px; }

.dhead { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.dhead h2 { margin: 0; font-size: 20px; }
.dactions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.back { display: none; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px 16px; margin: 14px 0; }
.field.full { grid-column: 1 / -1; }
.field { display: grid; gap: 4px; align-content: start; }
.field > label, .legend { font-weight: 600; font-size: 13.5px; color: #34495e; }
.field.wide { grid-column: 1 / -1; }
.hint { color: var(--muted); font-size: 12.5px; font-weight: 400; }
.radios { display: flex; gap: 16px; align-items: center; padding-top: 4px; }
.radios label { font-weight: 500; display: inline-flex; gap: 6px; align-items: center; }
fieldset.section { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px 14px; margin: 16px 0 0; }
fieldset.section legend { padding: 0 6px; font-weight: 700; }
[hidden] { display: none !important; }

table.items { width: 100%; border-collapse: collapse; margin-top: 8px; font-size: 14px; }
table.items th { text-align: left; font-size: 12.5px; color: var(--muted); font-weight: 600; padding: 4px 6px; }
table.items td { padding: 4px 6px; vertical-align: top; border-top: 1px solid var(--line); }
table.items td.desc { width: 38%; } table.items td.own { width: 16%; } table.items td.dt { width: 13%; } table.items td.evd { width: 20%; }
table.items td.x { width: 1%; }
.itemwarn { color: var(--amber); font-size: 12.5px; }
.closebox { background: var(--grey-soft); border-radius: var(--radius); padding: 12px 14px; margin-top: 16px; display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.closebox.is-closed { background: var(--green-soft); }
.links h3 { margin: 18px 0 6px; font-size: 15px; }
.links ul { margin: 0 0 8px; padding-left: 18px; }
.links .mod { font-weight: 600; color: #34495e; }
.error { background: var(--red-soft); color: var(--red); border: 1px solid #efc4c0; padding: 10px 12px; border-radius: 6px; margin: 10px 0; }
.empty { color: var(--muted); padding: 40px 10px; text-align: center; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px); background: #16324a; color: #fff; padding: 10px 18px;
  border-radius: 8px; opacity: 0; transition: .2s; pointer-events: none; }
.toast.show { opacity: 1; transform: translateX(-50%); }
.unsaved { color: var(--amber); font-weight: 600; font-size: 13px; }

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; padding: 10px; }
  .list-pane { position: static; max-height: none; }
  .list { max-height: 60vh; }
  .detail-pane { display: none; }
  .layout.show-detail .list-pane { display: none; }
  .layout.show-detail .detail-pane { display: block; }
  .back { display: inline-block; }
  .nav { display: none; }
}

/* lists screen */
table.lists td input[type=text], table.lists td input[type=number] { width: 100%; }
table.lists td.lc-int { width: 14%; } table.lists td.lc-bool { width: 8%; text-align: center; }
table.lists td.lc-act { white-space: nowrap; width: 1%; }
table.lists tr.changed td { background: var(--amber-soft); }
table.lists tr.addrow td { background: var(--accent-soft); border-top: 2px solid var(--line); }
.fixed { color: var(--muted); font-family: ui-monospace, Consolas, monospace; }

/* objectives screen */
.item.s-ongoing { border-left-color: var(--green); } .item.s-finished { border-left-color: #c3cad1; }
.b-ongoing { background: var(--green-soft); color: var(--green); } .b-finished { background: var(--grey-soft); color: var(--grey); }
.history { list-style: none; margin: 8px 0 0; padding: 0; }
.history li { border-top: 1px solid var(--line); padding: 8px 0; display: grid; grid-template-columns: 90px 1fr auto; gap: 8px; align-items: start; }
.history .when { color: var(--muted); font-size: 13px; }
.history .note { white-space: pre-wrap; }
.addupdate { display: grid; grid-template-columns: 150px 200px 1fr auto; gap: 8px; align-items: end; margin-top: 10px; }
.addupdate .field { margin: 0; }
@media (max-width: 900px) { .addupdate { grid-template-columns: 1fr; } }

/* home page */
.home { max-width: 1200px; margin: 0 auto; padding: 16px 20px 40px; }
.homehead { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; }
.homehead h1 { margin: 0; font-size: 22px; }
.whoami { display: inline-flex; gap: 8px; align-items: center; font-weight: 600; }
.whoami select { width: auto; min-width: 200px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 20px; margin-top: 16px; }
.card h2 { margin: 0 0 10px; font-size: 17px; display: flex; justify-content: space-between; align-items: baseline; }
.card h2 .link { font-size: 13px; font-weight: 400; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
@media (max-width: 900px) { .two-col { grid-template-columns: 1fr; } }
.scorewrap { display: flex; gap: 18px; align-items: center; margin-bottom: 8px; }
.score { width: 84px; height: 84px; border-radius: 50%; display: grid; place-items: center; font-size: 30px; font-weight: 700; color: #fff; background: var(--grey); }
.score.light-red { background: var(--red); } .score.light-amber { background: #d28b00; } .score.light-green { background: var(--green); }
ul.mine { list-style: none; margin: 0; padding: 0; }
ul.mine li { border-top: 1px solid var(--line); border-left: 4px solid transparent; padding: 8px 8px 8px 10px; }
ul.mine li:first-child { border-top: 0; }
ul.mine li.s-overdue { border-left-color: var(--red); } ul.mine li.s-nearly_due { border-left-color: var(--amber); }
ul.mine li.s-ok, ul.mine li.s-ongoing { border-left-color: var(--green); } ul.mine li.s-no_date { border-left-color: var(--grey); }
ul.mine .top { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* legal screen */
.regresults { list-style: none; margin: 8px 0 0; padding: 0; max-height: 320px; overflow-y: auto; }
.regresults li { display: flex; gap: 10px; justify-content: space-between; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); }
.regresults li:first-child { border-top: 0; }
ul.linklist { margin: 8px 0 0; padding-left: 18px; }
.b-to_review { background: var(--red-soft); color: var(--red); }
.sharedwarn { background: var(--amber-soft); color: var(--amber); border: 1px solid #f0d49a; border-radius: 6px; padding: 8px 12px; margin-bottom: 14px; }

/* linked records box */
ul.linkrows { margin: 0 0 8px; padding: 0; list-style: none; }
ul.linkrows li { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; padding: 4px 0; border-top: 1px solid var(--line); }
ul.linkrows li:first-child { border-top: 0; }
.addlink { margin-top: 10px; display: grid; gap: 8px; max-width: 520px; }

/* risks */
.rating { font-size: 22px; font-weight: 700; padding-top: 2px; }
.reviewbar { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; margin-bottom: 12px; background: #fff; display: grid; gap: 6px; font-size: 14px; }
.reviewbar .rv-line { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.reviewbar input[type=number] { width: 70px; } .reviewbar input[type=text] { flex: 1 1 140px; min-width: 120px; }
.grid.wide2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); margin: 10px 0 0; }
.grid.wide2 select { width: 100%; }

/* management review */
.newcycle { display: grid; gap: 8px; padding: 8px 0; }
.topic { border-top: 1px solid var(--line); padding: 10px 0; display: grid; gap: 6px; }
.topic:first-of-type { border-top: 0; }
.topic textarea { width: 100%; }
.sumline { font-size: 13.5px; color: var(--muted); }
.sum-bad { color: var(--red); font-weight: 600; }
.sessions { list-style: none; margin: 0 0 6px; padding: 0; display: grid; gap: 6px; }
.sessions li { display: flex; gap: 10px; align-items: center; }
.progress { margin: 4px 0 0; }

/* audits */
.sample { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; margin: 8px 0; display: grid; gap: 4px; background: #fff; }
.sample.editing { background: #f7fafc; gap: 8px; }
.sample .top { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.sample .sbtns { margin-left: auto; display: flex; gap: 12px; }
.sample .sfind { white-space: pre-wrap; }
.sample .sact { font-size: 13.5px; }
ul.plain { list-style: none; padding: 0; margin: 6px 0 0; display: grid; gap: 4px; }
.linkpick { display: grid; gap: 6px; }
.l_list { display: grid; gap: 4px; max-height: 220px; overflow: auto; }
.l_row { display: flex; gap: 10px; justify-content: space-between; align-items: center; font-size: 13.5px; border-top: 1px solid var(--line); padding-top: 4px; }
.list li.movable { display: flex; align-items: stretch; }
.list li.movable > .item { flex: 1; }
.mv { display: grid; align-content: center; gap: 2px; padding: 0 6px; }
.mvbtn { border: 1px solid var(--line); background: #fff; border-radius: 4px; padding: 0 6px; font-size: 11px; line-height: 18px; cursor: pointer; }
.mvbtn:disabled { opacity: .3; cursor: default; }

/* add an action during the audit */
.af { display: grid; gap: 8px; border: 1px solid var(--line, #cfd6dd); border-radius: 6px; padding: 10px; margin-top: 8px; background: #fbfcfd; }
.af .a_item { border-top: 1px dashed var(--line, #cfd6dd); padding-top: 6px; display: grid; gap: 6px; }

/* attendance grid */
.attgrid { border-collapse: collapse; width: 100%; font-size: 14px; }
.attgrid th, .attgrid td { padding: 4px 8px; border-bottom: 1px solid var(--line, #e1e6eb); text-align: left; }
.attgrid td.tick { text-align: center; }
.attgrid .attRole { width: 9em; }
.attadd { flex-wrap: wrap; gap: 6px; margin-top: 8px; }

/* training */
.comp { border: 1px solid var(--line, #cfd6dd); border-radius: 6px; padding: 10px; margin-bottom: 10px; display: grid; gap: 8px; }
.plan, .addcomp { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; align-items: center; }
.plan input[type=text] { flex: 1 1 12em; }
.mxwrap { overflow-x: auto; }
.mxtable td.mx { text-align: center; }
.mxtable th[scope=col] { writing-mode: vertical-rl; transform: rotate(180deg); white-space: nowrap; text-align: left; vertical-align: bottom; }

/* periodic register */
.reading { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; align-items: center; }
.reading input[type=number] { width: 9em; }
.reading .r_note { flex: 1 1 10em; }

.pickrow { display: flex; align-items: stretch; gap: 6px; }
.pickrow .pick { margin: 14px 0 0 6px; flex: 0 0 auto; }
.pickrow .item { flex: 1 1 auto; }
.moverow { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 4px 8px; }

/* reports screen */
.page { max-width: 900px; margin: 0 auto; padding: 16px; }
.page h1 { margin: 8px 0 2px; font-size: 22px; }
.report-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--line, #e1e6eb); }
.report-row:last-child { border-bottom: 0; }
.report-main { flex: 1 1 auto; }
.report-opts { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 6px; font-size: 13px; }
.report-act { flex: 0 0 auto; display: flex; gap: 6px; }

/* compliance dial */
.dialwrap { display: flex; flex-direction: column; align-items: center; }
.dial { width: 100%; max-width: 660px; height: auto; font-family: inherit; }
.dial .w-bg { fill: var(--bg); }
.dial .w-fill { opacity: .22; transition: opacity .15s; }
.dial .w-line { fill: none; stroke: #9aa7b3; stroke-width: .6; }
.dial .w-name { font-size: 12.5px; fill: var(--ink); letter-spacing: .02em; }
.dial .w-pct { font-size: 12px; font-weight: 600; }
.dial a.wedge { cursor: pointer; }
.dial a.wedge:hover .w-fill, .dial a.wedge:focus .w-fill { opacity: .45; }
.dial a.wedge:hover .w-line, .dial a.wedge:focus .w-line { stroke: var(--accent); stroke-width: 1.2; }
.dial a.wedge:focus { outline: none; }
.dial .c-num { font-size: 34px; font-weight: 300; letter-spacing: -.01em; }
.dial .c-lab { font-size: 11px; fill: var(--muted); letter-spacing: .12em; text-transform: uppercase; }
.dialnote { max-width: 560px; text-align: center; margin: 0 0 6px; }
details.figures { margin-top: 6px; } details.figures summary { cursor: pointer; color: var(--accent); font-size: 13px; }
#scoreCard { background: transparent; border: 0; box-shadow: none; padding: 0; }
.home .card { background: #eeedf8; border-color: #d9d6ee; box-shadow: none; }
#scoreCard { background: transparent; }

/* sign-in and the signed-in name in the top bar */
.userbox { flex-shrink: 0; display: flex; align-items: center; gap: 10px; font-size: 13px; color: #cfdbe6; white-space: nowrap; }
.userbox .signout { background: transparent; color: #fff; border: 1px solid rgba(255,255,255,.4); border-radius: 6px; padding: 4px 10px; cursor: pointer; }
.userbox .signout:hover { background: rgba(255,255,255,.14); }
.loginpage { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.logincard { width: 100%; max-width: 400px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 2px 10px rgba(22,50,74,.08); padding: 28px 30px 24px; }
.loginbrand { font-weight: 700; letter-spacing: .03em; color: #16324a; margin-bottom: 4px; }
.logincard h1 { margin: 0 0 16px; font-size: 21px; }
.logincard .field { margin-bottom: 14px; }
.logincard input[type=email], .logincard input[type=password], .logincard input[type=text] { width: 100%; }
.logincard button.wide { width: 100%; margin-top: 4px; }
.loginlinks { margin: 14px 0 0; text-align: center; font-size: 14px; }
.logincard .steps { padding-left: 20px; margin: 8px 0; }
.logincard .qr { display: flex; justify-content: center; margin: 8px 0; }
.logincard .secret { font-family: ui-monospace, Consolas, monospace; letter-spacing: .08em; word-break: break-all; background: var(--grey-soft); padding: 8px 10px; border-radius: 6px; }
.logincard .notice { background: var(--accent-soft); padding: 8px 12px; border-radius: 6px; margin-bottom: 12px; }
