/* EDIMS — MAT-SA house style: black on white / white on black, greys only.
   The only colour in the interface is on the points: green / amber / red for a business's health,
   and green / yellow / orange / red for how far an initiative's public evidence goes.
   Layout utilities still come from Tailwind; this file owns every colour, the type and the page frame. */
:root {
  --bg: #ffffff; --bg-2: #fafafa; --surface: #ffffff; --line: #eaeaea; --line-2: #d4d4d4;
  --ink: #0a0a0a; --ink-2: #444444; --ink-3: #737373; --ink-4: #a3a3a3;
  --seq-1: #e5e5e5; --seq-2: #c4c4c4; --seq-3: #8f8f8f; --seq-4: #525252; --seq-5: #171717;
  --ok: #16a34a; --warn: #d97706; --bad: #dc2626;
  --pt-green: #16a34a; --pt-yellow: #eab308; --pt-orange: #f97316; --pt-red: #dc2626; --pt-gray: #a3a3a3;
  --radius: 10px; --shadow: 0 1px 2px rgba(0,0,0,.04), 0 4px 16px rgba(0,0,0,.04);
  --mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #000000; --bg-2: #0a0a0a; --surface: #0a0a0a; --line: #1f1f1f; --line-2: #333333;
    --ink: #ededed; --ink-2: #b4b4b4; --ink-3: #8a8a8a; --ink-4: #5e5e5e;
    --seq-1: #262626; --seq-2: #404040; --seq-3: #6b6b6b; --seq-4: #a3a3a3; --seq-5: #ededed;
    --ok: #22c55e; --warn: #f59e0b; --bad: #ef4444; --pt-gray: #5e5e5e;
    --shadow: none; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #000000; --bg-2: #0a0a0a; --surface: #0a0a0a; --line: #1f1f1f; --line-2: #333333;
  --ink: #ededed; --ink-2: #b4b4b4; --ink-3: #8a8a8a; --ink-4: #5e5e5e;
  --seq-1: #262626; --seq-2: #404040; --seq-3: #6b6b6b; --seq-4: #a3a3a3; --seq-5: #ededed;
  --ok: #22c55e; --warn: #f59e0b; --bad: #ef4444; --pt-gray: #5e5e5e;
  --shadow: none; color-scheme: dark;
}

/* ---------- reset (Tailwind's own is switched off so this file decides the order) */
*, ::before, ::after { box-sizing: border-box; border: 0 solid var(--line); }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--sans); font-size: 14px; line-height: 1.55;
  -webkit-font-smoothing: antialiased; min-height: 100vh; display: flex; flex-direction: column; overflow-x: hidden; }
h1, h2, h3, h4, p, dl, dd, figure, pre { margin: 0; }
h1, h2, h3 { letter-spacing: -0.02em; font-weight: 600; }
ul, ol { list-style: none; margin: 0; padding: 0; }
a { color: inherit; text-decoration: none; }
img, svg, video, canvas { display: block; max-width: 100%; }
img, video { height: auto; }
button, input, select, textarea { font: inherit; color: inherit; margin: 0; }
button { background: transparent; cursor: pointer; padding: 0; }
hr { height: 0; border-top-width: 1px; }
table { border-collapse: collapse; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: 4px; }
input:not([type=checkbox]):not([type=radio]):not([type=color]):not([type=file]), select, textarea {
  background: var(--surface); color: var(--ink); min-height: 38px; }
input[type=file] { background: var(--surface); }
input::placeholder, textarea::placeholder { color: var(--ink-4); }
input[type=checkbox], input[type=radio] { accent-color: var(--ink); }
label { color: var(--ink-2); }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.muted { color: var(--ink-3); }

/* ---------- page frame: the same top bar, width and footer as the other MAT-SA sites */
.wrap { max-width: 1240px; margin: 0 auto; padding: 0 24px; width: 100%; }
.top { position: sticky; top: 0; z-index: 40; background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line); }
.top .wrap { display: flex; align-items: center; gap: 24px; height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; min-height: 36px; font-weight: 600; letter-spacing: -0.01em; white-space: nowrap; min-width: 0; }
.brand .mark { width: 22px; height: 22px; flex: none; }
.brand img.logo { width: 22px; height: 22px; border-radius: 5px; object-fit: cover; flex: none; border: 1px solid var(--line); }
.brand small { font-weight: 400; color: var(--ink-3); font-size: 12px; border-left: 1px solid var(--line-2); padding-left: 10px;
  overflow: hidden; text-overflow: ellipsis; max-width: 420px; }
.top.in .brand small { max-width: 260px; }
.nav { display: flex; gap: 2px; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a { padding: 6px 10px; border-radius: 6px; color: var(--ink-3); white-space: nowrap; font-size: 13.5px; }
.nav a:hover { color: var(--ink); background: var(--bg-2); }
.nav a.on { color: var(--ink); font-weight: 500; }
.top-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.chart-box { position: relative; height: 250px; }
.top-actions .who { font-size: 12.5px; color: var(--ink-3); max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.icon-btn { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); }
.icon-btn:hover { color: var(--ink); border-color: var(--line-2); }
.icon-btn svg { width: 16px; height: 16px; }
.org-switch { height: 32px; min-height: 32px !important; padding: 0 28px 0 10px; border-radius: 8px; border: 1px solid var(--line-2);
  font-size: 12.5px; max-width: 190px; appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-3) 50%), linear-gradient(135deg, var(--ink-3) 50%, transparent 50%);
  background-position: calc(100% - 15px) 13px, calc(100% - 10px) 13px; background-size: 5px 5px; background-repeat: no-repeat; }
main { padding: 32px 0 72px; flex: 1; }
footer.foot { border-top: 1px solid var(--line); padding: 22px 0 28px; font-size: 12px; color: var(--ink-3); }
footer.foot .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 24px; }
.flash { padding: 11px 14px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--bg-2); margin-bottom: 16px;
  font-size: 13.5px; display: flex; gap: 10px; align-items: flex-start; overflow-wrap: anywhere; }
.flash::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); margin-top: 6px; flex: none; }
.flash.error::before { background: var(--bad); }

/* ---------- house components, used by the new pages */
.hero { display: flex; justify-content: space-between; align-items: flex-end; gap: 32px; padding-bottom: 24px;
  border-bottom: 1px solid var(--line); margin-bottom: 24px; }
.hero > div:first-child { min-width: 0; }
.hero h1 { font-size: clamp(26px, 3.4vw, 40px); line-height: 1.08; letter-spacing: -0.035em; max-width: 820px; }
.hero p { margin-top: 12px; color: var(--ink-3); max-width: 700px; font-size: 15px; }
.eyebrow { font: 500 11.5px var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 14px; }
.hero-side { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; flex: none; }
.crumbs { font-size: 12.5px; color: var(--ink-3); margin-bottom: 14px; display: flex; gap: 6px; flex-wrap: wrap; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 36px; padding: 0 14px; border-radius: 8px;
  border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); font: 500 13px var(--sans); white-space: nowrap; }
.btn:hover { border-color: var(--ink-3); }
.btn.primary { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn.primary:hover { opacity: .88; }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12px; border-radius: 6px; }
.btn.lg { height: 44px; padding: 0 20px; font-size: 14px; }
.section { margin-top: 36px; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; margin-bottom: 14px; flex-wrap: wrap; }
.section-head h2 { font-size: 17px; }
.section-head p { margin-top: 4px; color: var(--ink-3); font-size: 13px; max-width: 78ch; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 0; }
.card-pad { padding: 20px; }
.empty { padding: 28px 20px; text-align: center; color: var(--ink-3); font-size: 13.5px; }
.notice { display: flex; gap: 12px; padding: 14px 16px; border: 1px solid var(--line-2); border-radius: var(--radius); background: var(--bg-2);
  font-size: 13.5px; color: var(--ink-2); }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12px; font-weight: 500; margin-bottom: 6px; }
.field input, .field select { width: 100%; height: 38px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--line-2); font-size: 13.5px; }
.hint { font-size: 12px; color: var(--ink-3); margin-top: 4px; }

/* ---------- points: the only colour */
.pt { width: 10px; height: 10px; border-radius: 50%; flex: none; display: inline-block; background: var(--pt-gray); }
.pt-green { background: var(--pt-green); } .pt-yellow { background: var(--pt-yellow); }
.pt-orange { background: var(--pt-orange); } .pt-red { background: var(--pt-red); } .pt-amber { background: var(--warn); }
.pill { display: inline-flex; align-items: center; gap: 7px; height: 24px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--line-2);
  font-size: 12px; font-weight: 500; color: var(--ink-2); white-space: nowrap; background: var(--surface); }
/* health badges keep green / amber / red, as a point beside neutral words */
.badge { display: inline-flex; align-items: center; gap: 7px; min-height: 24px; padding: 2px 10px; border-radius: 999px;
  border: 1px solid var(--line-2); font-size: 12px; font-weight: 500; color: var(--ink-2); background: var(--surface); }
.badge::before { content: ""; width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--pt-gray); }
.badge-green::before { background: var(--ok); } .badge-amber::before { background: var(--warn); } .badge-red::before { background: var(--bad); }
.stat-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; min-width: 0; box-shadow: var(--shadow); }
.traffic-light label { cursor: pointer; }
.traffic-light span { background: var(--surface) !important; color: var(--ink) !important; border-color: var(--line-2) !important; }
.traffic-light input:checked + span { border-color: var(--ink) !important; background: var(--bg-2) !important; box-shadow: inset 0 0 0 1px var(--ink); }

/* ---------- the evidence chain */
.chain { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); box-shadow: var(--shadow); overflow: hidden; }
.chain-step { padding: 16px 16px 14px; border-left: 1px solid var(--line); min-width: 0; position: relative; }
.chain-step:first-child { border-left: 0; }
.chain-step .n { font: 600 28px/1.1 var(--mono); letter-spacing: -0.04em; }
.chain-step .l { font-size: 12px; color: var(--ink-3); margin-top: 6px; }
.chain-step .bar { height: 3px; background: var(--line); border-radius: 2px; margin-top: 12px; overflow: hidden; }
.chain-step .bar i { display: block; height: 100%; background: var(--ink); border-radius: 2px; }
.points { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.point-card { display: block; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); min-width: 0; }
.point-card:hover { border-color: var(--line-2); }
.point-card.on { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.point-card .top-line { display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 500; }
.point-card .n { font: 600 26px/1.1 var(--mono); letter-spacing: -0.04em; margin-top: 8px; }
.point-card .m { font-size: 12px; color: var(--ink-3); margin-top: 4px; }
.rows { padding: 0; overflow: hidden; }
.row { display: grid; grid-template-columns: 16px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 13px 18px; border-top: 1px solid var(--line); }
.row:first-child { border-top: 0; }
a.row:hover { background: var(--bg-2); }
.row .t { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .s { font-size: 12px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 2px; }
.row .r { text-align: right; font-size: 12px; color: var(--ink-3); white-space: nowrap; }
.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.facts > div { padding: 16px 18px; border-top: 1px solid var(--line); border-left: 1px solid var(--line); min-width: 0; }
.facts > div:nth-child(-n+2) { border-top: 0; } .facts > div:nth-child(odd) { border-left: 0; }
.facts dt { font: 500 10.5px var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 6px; }
.facts dd { font-size: 14px; overflow-wrap: anywhere; }
.timeline { padding: 6px 18px; }
.tl { display: grid; grid-template-columns: 92px 14px minmax(0, 1fr); gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); font-size: 13.5px; }
.tl:first-child { border-top: 0; }
.tl .d { font: 12px var(--mono); color: var(--ink-3); padding-top: 2px; }
.tl .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ink); margin-top: 6px; }
.tl .w { min-width: 0; overflow-wrap: anywhere; }
.tl .w small { display: block; color: var(--ink-3); font-size: 12px; margin-top: 2px; }
.src { font: 500 10.5px var(--mono); text-transform: uppercase; letter-spacing: .05em; padding: 2px 6px; border-radius: 4px;
  border: 1px solid var(--line-2); color: var(--ink-2); white-space: nowrap; }
.code { font: 12.5px/1.55 var(--mono); background: var(--bg-2); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px;
  overflow-x: auto; white-space: pre; max-width: 100%; }
.two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.land-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.land-media { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); max-width: 760px; }

/* ---------- Tailwind colour utilities, re-pointed at the house tokens (both themes).
   "html" in front makes these win over Tailwind's own single-class rules. */
html .bg-white { background-color: var(--surface); }
html .bg-gray-50, html .hover\:bg-gray-50:hover { background-color: var(--bg-2); }
html .bg-gray-100 { background-color: var(--bg-2); box-shadow: inset 0 0 0 1px var(--line-2); }
html .bg-gray-200, html .hover\:bg-gray-200:hover { background-color: var(--seq-1); }
html .text-gray-900, html .text-gray-800 { color: var(--ink); }
html .text-gray-700, html .text-gray-600 { color: var(--ink-2); }
html .text-gray-500, html .text-gray-400 { color: var(--ink-3); }
html .border-gray-100, html .border-gray-200 { border-color: var(--line); }
html .border-gray-300 { border-color: var(--line-2); }
html .divide-y > * + * { border-color: var(--line); }
html .rounded-xl { border-radius: var(--radius); }
html .shadow, html .shadow-sm, html .shadow-lg, html .hover\:shadow-md:hover { box-shadow: var(--shadow); }
html .bg-brand, html .hover\:bg-brand-dark:hover, html .bg-brand-dark { background-color: var(--ink); color: var(--bg); }
html .bg-brand.text-white, html .bg-brand .text-white { color: var(--bg); }
html .hover\:bg-brand-dark:hover { opacity: .88; }
html .text-brand, html .hover\:text-brand:hover { color: var(--ink); }
html a.text-brand, html a.hover\:text-brand:hover { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--ink-4); }
html .bg-brand-light { background-color: var(--bg-2); }
html .text-ok { color: var(--ok); } html .text-warn { color: var(--warn); } html .text-bad { color: var(--bad); }
/* coloured message boxes become neutral boxes with a coloured edge */
html .bg-red-50, html .bg-green-50, html .bg-amber-50, html .bg-blue-50 { background-color: var(--bg-2); }
html .hover\:bg-red-50:hover { background-color: var(--bg-2); }
html .border-red-200, html .border-green-200, html .border-blue-200, html .border-blue-100 { border-color: var(--line-2); }
html .text-red-700, html .text-red-600, html .text-green-700, html .text-amber-700, html .text-amber-900, html .text-blue-800, html .text-blue-900 { color: var(--ink); }
html div.bg-red-50 { border-left: 3px solid var(--bad); } html div.bg-green-50 { border-left: 3px solid var(--ok); }
html div.bg-amber-50 { border-left: 3px solid var(--warn); } html div.bg-blue-50 { border-left: 3px solid var(--ink); }
html .bg-amber-400 { background-color: var(--surface); box-shadow: inset 0 0 0 1px var(--line-2); }
html h2.text-bad { color: var(--ink); }

/* Signed in, the bar has two rows at every width: name and controls above, the full menu below.
   Eight menu items, an organisation switch and a name do not fit on one line, and a cut-off menu hides pages. */
.top.in .wrap { height: auto; flex-wrap: wrap; gap: 0 16px; padding-top: 12px; }
.top.in .brand { flex: 1; }
.top.in .nav { order: 3; flex: 0 0 100%; margin-top: 10px; gap: 4px; }
.top.in .nav a { padding: 8px 10px 10px; border-radius: 0; border-bottom: 2px solid transparent; }
.top.in .nav a:hover { background: transparent; border-bottom-color: var(--line-2); }
.top.in .nav a.on { border-bottom-color: var(--ink); }
@media (max-width: 900px) {
  .wrap { padding: 0 16px; }
  .top:not(.in) .wrap { height: 56px; }
  .brand small { display: none; }
  .top.in .wrap { gap: 0 10px; }
  /* on a phone the menu scrolls sideways: the fade on the right shows there is more, and links are finger-sized */
  .top.in .nav { margin: 8px -16px 0; padding: 0 36px 0 8px; flex: 0 0 calc(100% + 32px);
    -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 44px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 44px), transparent); }
  .top.in .nav a { padding: 12px 10px 12px; font-size: 14px; }
  .top-actions .btn.sm { height: 36px; padding: 0 12px; }
  .icon-btn { width: 36px; height: 36px; }
  .org-switch { height: 36px; min-height: 36px !important; background-position: calc(100% - 15px) 15px, calc(100% - 10px) 15px; }
  .btn { height: 42px; } .btn.sm { height: 36px; }
  main button, main a[class*="rounded-lg"] { min-height: 36px; }
  html input:not([type=checkbox]):not([type=radio]):not([type=color]):not([type=file]), html select, html textarea { font-size: 16px; min-height: 44px; }
  .top.in .brand { flex: 1 0 auto; }
  .top-actions { min-width: 0; }
  .org-switch { width: clamp(96px, 32vw, 150px); max-width: none; }
  .top-actions .who { display: none; }
  .hero { flex-direction: column; align-items: flex-start; gap: 16px; }
  .hero-side { justify-content: flex-start; }
  .chain { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .chain-step { border-top: 1px solid var(--line); }
  .chain-step:nth-child(-n+2) { border-top: 0; } .chain-step:nth-child(odd) { border-left: 0; }
  .chain-step:last-child { grid-column: 1 / -1; }
  .points, .land-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .two { grid-template-columns: 1fr; }
  .facts { grid-template-columns: 1fr; }
  .facts > div { border-left: 0; border-top: 1px solid var(--line) !important; } .facts > div:first-child { border-top: 0 !important; }
  .tl { grid-template-columns: 14px minmax(0, 1fr); } .tl .d { grid-column: 2; grid-row: 1; padding: 0; } .tl .dot { grid-row: 1; }
  .tl .w { grid-column: 2; }
  .row { padding: 12px 14px; } .row .r { display: none; }
  main { padding: 22px 0 56px; }
}

@media (max-width: 380px) { .org-switch { width: 90px; } .top.in .wrap { gap: 0 8px; } .top-actions { gap: 6px; } .top-actions .btn.sm { padding: 0 10px; } }
