/* PADI brand tokens, mirrored from padi.com src/styles/tokens.css */
:root {
  --padi-blue: #0070d3;
  --padi-blue-subtle: #f5f8ff;
  --padi-red: #f23d4e;
  --blue: #10497c;
  --blue-light: #4f96d1;
  --blue-dark: #05283e;
  --aqua: #03607b;
  --aqua-dark: #043a47;
  --caribbean: #32d7ff;
  --teal: #018181;
  --text-primary: #05283e;
  --text-secondary: #343e41;
  --text-muted: #5c6672;
  --surface: #ffffff;
  --surface-light: #e9f0f6;
  --border-subtle: rgba(0, 0, 0, 0.12);
  --border-default: #d8dee4;
  --success: #27bbab;
  --warning: #ffc700;
  --error: #dc2626;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --shadow-lg: 0 4px 8px -2px rgba(5, 40, 62, 0.08), 0 8px 16px -2px rgba(5, 40, 62, 0.12);
  --header-h: 64px;
  --sidebar-w: 272px;
  --font: Inter, -apple-system, 'Segoe UI', Helvetica, Arial, sans-serif;
  --mono: 'Roboto Mono', ui-monospace, Menlo, monospace;
}

* { box-sizing: border-box; }
html { scroll-padding-top: calc(var(--header-h) + 16px); }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-secondary);
  background: var(--surface);
  -webkit-font-smoothing: antialiased;
}

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 20;
  height: var(--header-h);
  display: flex; align-items: center; gap: 24px;
  padding: 0 24px;
  background: var(--blue-dark);
  color: #fff;
  border-bottom: 3px solid var(--padi-blue);
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: #fff; flex-shrink: 0; }
.logo-padi { height: 26px; width: auto; }
.logo-axel { height: 26px; width: auto; }
.brand-x { opacity: 0.6; font-size: 18px; }
.header-title { font-weight: 600; font-size: 15px; letter-spacing: 0.01em; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.header-meta { font-size: 13px; opacity: 0.75; white-space: nowrap; }

/* ---------- layout ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: calc(100vh - var(--header-h)); background: linear-gradient(to right, var(--surface-light) var(--sidebar-w), var(--surface) var(--sidebar-w)); }
.sidebar {
  position: sticky; top: var(--header-h); align-self: start;
  height: calc(100vh - var(--header-h)); overflow-y: auto;
  background: var(--surface-light);
  border-right: 1px solid var(--border-default);
  padding: 20px 12px 32px;
}
.nav-mobile { display: none; }
.nav-group { margin-bottom: 18px; }
.nav-group-title {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--aqua); padding: 0 12px 6px;
}
.sidebar ul { list-style: none; margin: 0; padding: 0; }
.sidebar a {
  display: block; padding: 6px 12px; border-radius: var(--radius-md);
  color: var(--text-primary); text-decoration: none; font-size: 14px; font-weight: 500;
}
.sidebar a:hover { background: #fff; color: var(--padi-blue); }
.sidebar a[aria-current='page'] { background: var(--blue-dark); color: #fff; }

.content { padding: 0 48px 48px; max-width: 1180px; }
.page-hero {
  margin: 0 -48px 32px; padding: 40px 48px 32px;
  background: linear-gradient(135deg, var(--blue-dark) 0%, var(--blue) 70%, var(--aqua) 100%);
  color: #fff;
}
.eyebrow { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: var(--caribbean); }
.page-hero h1 { margin: 6px 0 8px; font-size: 34px; line-height: 1.2; font-weight: 800; color: #fff; }
.page-hero .lead { margin: 0; max-width: 820px; font-size: 17px; color: rgba(255, 255, 255, 0.88); }

/* ---------- prose ---------- */
.prose { max-width: 1080px; }
.prose h2 {
  margin: 44px 0 12px; padding-top: 4px;
  font-size: 23px; font-weight: 700; color: var(--text-primary);
  border-top: 1px solid var(--border-default); padding-top: 28px;
}
.prose > h2:first-child { border-top: 0; margin-top: 0; padding-top: 0; }
.prose h3 { margin: 28px 0 8px; font-size: 17px; font-weight: 700; color: var(--blue); }
.prose p { margin: 0 0 14px; max-width: 820px; }
.prose ul, .prose ol { margin: 0 0 14px; padding-left: 22px; max-width: 860px; }
.prose li { margin: 3px 0; }
.prose li:has(> input[type='checkbox']) { list-style: none; margin-left: -22px; }
.prose input[type='checkbox'] { accent-color: var(--padi-blue); margin-right: 6px; }
.prose a { color: var(--blue); text-decoration-color: rgba(16, 73, 124, 0.35); text-underline-offset: 2px; }
.prose a:hover { color: var(--padi-blue); }
.prose strong { color: var(--text-primary); }
.prose code {
  font-family: var(--mono); font-size: 0.86em;
  background: var(--padi-blue-subtle); color: var(--blue-dark);
  padding: 1px 5px; border-radius: 4px; border: 1px solid #dbe5f3;
}
.prose pre { background: var(--blue-dark); color: #e9f0f6; padding: 16px; border-radius: var(--radius-md); overflow-x: auto; }
.prose pre code { background: none; border: 0; color: inherit; padding: 0; }
.prose blockquote, .callout {
  margin: 16px 0; padding: 14px 18px; max-width: 860px;
  background: var(--padi-blue-subtle); border-left: 4px solid var(--padi-blue);
  border-radius: 0 var(--radius-md) var(--radius-md) 0; color: var(--text-primary);
}
.prose blockquote p:last-child { margin-bottom: 0; }

/* key figures */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin: 8px 0 24px; }
.kpi { background: #fff; border: 1px solid var(--border-default); border-radius: var(--radius-lg); padding: 14px 16px; box-shadow: var(--shadow-lg); }
.kpi .v { font-size: 26px; font-weight: 800; color: var(--text-primary); line-height: 1.1; }
.kpi .l { font-size: 12.5px; color: var(--text-muted); margin-top: 4px; }

/* status pills inside tables: write as `ok`, `warn`, `gap` code spans prefixed */
.pill { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.pill.ok { background: rgba(39, 187, 171, 0.16); color: #0b6b61; }
.pill.warn { background: rgba(255, 199, 0, 0.22); color: #7a5a00; }
.pill.gap { background: rgba(242, 61, 78, 0.14); color: #a3122b; }
.pill.info { background: rgba(0, 112, 211, 0.12); color: var(--blue); }

/* tables */
.table-wrap { overflow-x: auto; margin: 12px 0 22px; border: 1px solid var(--border-default); border-radius: var(--radius-lg); }
.prose table { border-collapse: collapse; width: 100%; font-size: 13.5px; line-height: 1.45; }
.prose th {
  background: var(--blue-dark); color: #fff; text-align: left; font-weight: 600;
  padding: 9px 12px; white-space: nowrap; font-size: 12.5px; letter-spacing: 0.01em;
}
.prose td { padding: 8px 12px; border-top: 1px solid var(--border-default); vertical-align: top; }
.prose tbody tr:nth-child(even) td { background: #f7fafc; }
.prose td:first-child { font-weight: 600; color: var(--text-primary); }

/* diagrams */
.diagram {
  margin: 16px 0 26px; padding: 20px; background: #fff;
  border: 1px solid var(--border-default); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); text-align: center; overflow-x: auto;
}
.diagram img { max-width: 100%; height: auto; }
.diagram a { display: block; }
.diagram figcaption { margin-top: 12px; font-size: 13px; color: var(--text-muted); text-align: left; }
.diagram-error { color: var(--error); }

/* pager + footer */
.pager { display: flex; justify-content: space-between; gap: 16px; margin-top: 48px; }
.pager a {
  flex: 1; max-width: 48%; padding: 14px 18px; border: 1px solid var(--border-default); border-radius: var(--radius-lg);
  text-decoration: none; color: var(--text-primary); font-weight: 600;
}
.pager a span { display: block; font-size: 12px; font-weight: 500; color: var(--text-muted); }
.pager a.next { text-align: right; margin-left: auto; }
.pager a:hover { border-color: var(--padi-blue); color: var(--padi-blue); }
.site-footer { margin-top: 32px; padding-top: 16px; border-top: 1px solid var(--border-default); font-size: 12px; color: var(--text-muted); }

/* ---------- small screens ---------- */
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; background: var(--surface); }
  .sidebar { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--border-default); padding: 8px 16px; }
  .nav-desktop { display: none; }
  .nav-mobile { display: block; }
  .nav-mobile summary { cursor: pointer; font-weight: 600; color: var(--text-primary); padding: 8px 0; }
  .content { padding: 0 16px 32px; }
  .page-hero { margin: 0 -16px 24px; padding: 28px 16px 24px; }
  .page-hero h1 { font-size: 26px; }
  .header-title, .header-meta { display: none; }
  .site-header { padding: 0 16px; }
  .pager { flex-direction: column; }
  .pager a { max-width: none; }
}

/* ---------- print / PDF ---------- */
body.print { font-size: 11.5px; background: #fff; }
body.print .cover {
  height: 180mm; display: flex; flex-direction: column; justify-content: center; align-items: flex-start;
  padding: 0 24mm; background: linear-gradient(135deg, var(--blue-dark), var(--blue) 70%, var(--aqua));
  color: #fff; page-break-after: always;
}
body.print .cover-padi, body.print .cover-axel { height: 40px; }
body.print .cover-x { font-size: 22px; opacity: 0.6; margin: 6px 0; }
body.print .cover h1 { font-size: 40px; margin: 28px 0 8px; color: #fff; }
body.print .print-page { page-break-before: always; padding: 0 2mm; }
body.print .print-page h1 { font-size: 26px; color: var(--text-primary); margin: 4px 0 6px; }
body.print .print-page .eyebrow { color: var(--aqua); }
body.print .print-page .lead { font-size: 13px; color: var(--text-secondary); }
body.print h2 { font-size: 17px; color: var(--text-primary); margin: 20px 0 8px; page-break-after: avoid; }
body.print h3 { font-size: 13.5px; color: var(--blue); page-break-after: avoid; }
body.print table { border-collapse: collapse; width: 100%; font-size: 9.5px; page-break-inside: auto; }
body.print tr { page-break-inside: avoid; }
body.print th { background: var(--blue-dark); color: #fff; text-align: left; padding: 4px 6px; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
body.print td { padding: 4px 6px; border-top: 1px solid var(--border-default); vertical-align: top; }
body.print .table-wrap { border: 1px solid var(--border-default); margin: 8px 0 14px; }
body.print .diagram { page-break-inside: avoid; border: 1px solid var(--border-default); padding: 8px; margin: 8px 0 14px; text-align: center; }
body.print .diagram img { max-height: 160mm; max-width: 100%; }
body.print code { font-family: var(--mono); font-size: 0.9em; background: var(--padi-blue-subtle); padding: 0 3px; }
body.print .kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
body.print .kpi { border: 1px solid var(--border-default); padding: 6px 8px; }
body.print .kpi .v { font-size: 18px; font-weight: 800; color: var(--text-primary); }
body.print .pill { padding: 0 5px; border-radius: 8px; font-size: 9px; }
body.print .pill.ok { background: #d4f1ee; } body.print .pill.warn { background: #fff1c2; } body.print .pill.gap { background: #fcd9dd; } body.print .pill.info { background: #dbeafb; }
@page { size: A4 landscape; }

/* risk heat map */
.heat { display: grid; grid-template-columns: 130px repeat(3, 1fr); gap: 6px; margin: 8px 0 18px; max-width: 900px; font-size: 13px; }
.heat-col, .heat-row { font-weight: 700; color: var(--text-primary); font-size: 12px; display: flex; align-items: center; }
.heat-col { justify-content: center; padding: 4px; }
.heat .cell { min-height: 74px; padding: 10px 12px; border-radius: var(--radius-md); color: var(--text-primary); line-height: 1.5; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.c-red { background: #fde2e5; border: 1px solid #f5a3ad; }
.c-amber { background: #fff3cc; border: 1px solid #f2d27a; }
.c-green { background: #dff5f1; border: 1px solid #9fdccf; }

/* review copy only (REVIEW=1): items that sit with the delivery lead */
.wip-banner { background: var(--warning); color: var(--blue-dark); padding: 8px 24px; font-size: 14px; }
.wip-banner strong { font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; font-size: 13px; }
@media (max-width: 900px) { .wip-banner { padding: 8px 16px; } }
body.print .cover .cover-wip { display: inline-block; background: var(--warning); color: var(--blue-dark); font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; padding: 4px 10px; border-radius: 4px; }
.review-banner { background: var(--padi-red); color: #fff; padding: 10px 24px; font-weight: 600; font-size: 14px; }
.review-banner a { color: #fff; text-decoration: underline; margin-left: 8px; }
.nav-count { display: inline-block; background: var(--padi-red); color: #fff; border-radius: 999px; font-size: 10px; font-weight: 700; padding: 0 6px; margin-left: 4px; line-height: 16px; vertical-align: 1px; }
.me-badge { display: inline-block; background: var(--padi-red); color: #fff !important; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 4px; margin-right: 8px; text-decoration: none; white-space: nowrap; vertical-align: 1px; }
.me-note { display: block; color: #a3122b; font-size: 13px; font-weight: 500; margin-top: 4px; }
.prose p.me, .prose li.me { background: #fde8ea; box-shadow: inset 4px 0 0 var(--padi-red); padding: 8px 12px; border-radius: 4px; }
.prose tr.me td, .prose tbody tr.me:nth-child(even) td { background: #fde8ea; }
.prose tr.me td:first-child { box-shadow: inset 4px 0 0 var(--padi-red); }
.prose section.me-sec { box-shadow: inset 4px 0 0 var(--padi-red); background: linear-gradient(to right, #fde8ea, rgba(253, 232, 234, 0) 60%); padding: 2px 0 8px 18px; margin: 0 0 18px -22px; border-radius: 4px; }
.prose section.me-sec > p.me-note { margin: -6px 0 14px; }
.me-kind { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.me-action { background: rgba(242, 61, 78, 0.14); color: #a3122b; }
.me-confirm { background: rgba(255, 199, 0, 0.22); color: #7a5a00; }
.me-sensitive { background: rgba(0, 112, 211, 0.12); color: var(--blue); }
:target { scroll-margin-top: 16px; }
.prose tr[id^="M-"] td:first-child, .me-badge { white-space: nowrap; }
.prose section.me-sec > h2 { margin-top: 14px; }
