/* AFRIGRC — interface layer v1 (DEV).
   Loaded LAST on every page. Markup, element ids and JS hooks are unchanged: this file only restyles.
   Fonts are system fonts on purpose: no third-party request, no download, same result offline. */

:root {
  --cg-ink: #0b2f59;
  --cg-deep: #061a30;
  --cg-deep-2: #0a2b4e;
  --cg-canvas: #f1f4f7;
  --cg-surface: #ffffff;
  --cg-line: #d8e0e8;
  --cg-line-soft: #e8edf2;
  --cg-text: #16304a;
  --cg-muted: #58708a;
  --cg-action: #0b63ce;
  --cg-action-hover: #094fa6;
  --cg-ochre: #e39b00;
  --cg-ok: #1b7a5a;
  --cg-ok-bg: #e5f3ee;
  --cg-warn: #8a5300;
  --cg-warn-bg: #fff1d6;
  --cg-bad: #b3302c;
  --cg-bad-bg: #fbe9e8;
  --cg-info-bg: #e8f0fa;
  --cg-sans: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --cg-serif: "Iowan Old Style", "Charter", "Sitka Text", Cambria, "Noto Serif", Georgia, serif;
  --cg-side: 264px;
}

html { scroll-behavior: auto; }
body {
  font-family: var(--cg-sans);
  font-size: 15px;
  line-height: 1.55;
  color: var(--cg-text);
  background: var(--cg-canvas);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { color: var(--cg-ink); }
h1 {
  font-family: var(--cg-serif);
  font-weight: 600;
  font-size: clamp(27px, 2.4vw, 34px);
  line-height: 1.15;
  letter-spacing: -.012em;
  margin: 4px 0 8px;
}
h2 { font-size: 18px; line-height: 1.3; font-weight: 650; letter-spacing: -.005em; }
h3 { font-size: 15px; line-height: 1.35; font-weight: 650; }
p { max-width: 74ch; }
a { color: var(--cg-action); }
.muted, .lead, .help { color: var(--cg-muted); }

/* ---------- focus: always visible ---------- */
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible,
textarea:focus-visible, summary:focus-visible {
  outline: 3px solid rgba(11, 99, 206, .45);
  outline-offset: 2px;
}

/* ---------- app shell (added by cybergov-shell.js) ---------- */
body.cg { padding-left: var(--cg-side); }
.cg-side {
  position: fixed; inset: 0 auto 0 0; width: var(--cg-side); z-index: 60;
  display: flex; flex-direction: column; gap: 4px; padding: 22px 14px 20px;
  background: linear-gradient(180deg, var(--cg-deep) 0%, var(--cg-deep-2) 100%);
  color: #d5e2ef; overflow-y: auto; transition: transform .2s ease;
}
.cg-brand { display: flex; align-items: center; gap: 10px; padding: 0 10px 4px; font-size: 22px; font-weight: 800; letter-spacing: .03em; color: #fff; text-decoration: none; }
.cg-mark { width: 34px; height: 34px; flex: 0 0 auto; filter: drop-shadow(0 0 8px rgba(53, 208, 255, .35)); }
.cg-word b, .afri-word b { font-weight: 800; background: linear-gradient(90deg, #5fe0ff, #1797ff); -webkit-background-clip: text; background-clip: text; color: transparent; }
.cg-words { display: flex; flex-direction: column; line-height: 1.05; }
.cg-by { margin-top: 4px; font-size: 10.5px; font-weight: 600; letter-spacing: .06em; color: #8ea6bf; }
.afri-by { margin-left: 12px; font-size: 11px; font-weight: 600; letter-spacing: .06em; vertical-align: middle; opacity: .75; }
.auth-brand .afri-by { font-size: 12px; color: #34538b; opacity: 1; }
.cg-tagline { padding: 0 10px 16px; font-size: 12px; color: #8ea6bf; }
.cg-workspace { margin: 0 0 8px; padding: 11px 12px; border: 1px solid rgba(255, 255, 255, .12); border-radius: 8px; background: rgba(255, 255, 255, .05); }
.cg-workspace small { display: block; font-size: 12px; color: #8ea6bf; }
.cg-workspace strong { display: block; font-size: 13.5px; font-weight: 650; color: #fff; overflow-wrap: anywhere; }
.cg-group { margin: 14px 10px 4px; font-size: 12px; font-weight: 600; color: #8ea6bf; }
.cg-nav { display: grid; gap: 1px; }
.cg-nav a {
  display: block; padding: 8px 12px; border-radius: 6px; font-size: 14px; color: #cfdceb; text-decoration: none;
}
.cg-nav a:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.cg-nav a[aria-current="page"] { background: rgba(255, 255, 255, .1); color: #fff; font-weight: 650; box-shadow: inset 3px 0 0 var(--cg-ochre); }
.cg-env { margin: auto 10px 0; padding-top: 14px; font-size: 12px; color: #8ea6bf; }

.cg-top, body.cg > header {
  position: sticky; top: 0; z-index: 50; display: flex; align-items: center; gap: 14px;
  min-height: 60px; padding: 0 32px; margin: 0;
  background: var(--cg-surface); color: var(--cg-text); border-bottom: 1px solid var(--cg-line);
}
body.cg > header .brand { display: none; }
body.cg > header .badge, .cg-top .cg-envtag {
  padding: 3px 10px; border-radius: 999px; background: var(--cg-warn-bg); color: var(--cg-warn);
  font-size: 12px; font-weight: 600;
}
.cg-top .cg-spacer, body.cg > header #identity { margin-left: auto; }
.cg-top .cg-identity, body.cg > header #identity { font-size: 13.5px; color: var(--cg-muted); }
.cg-burger { display: none; }

body.cg main { max-width: 1240px; margin: 0 auto; padding: 32px 32px 72px; }
body.cg main > nav { display: none; }             /* the sidebar replaces the back-links */
body.cg .members { max-width: 1240px; padding: 32px 32px 72px; }
body.cg .intro { margin-bottom: 24px; }

/* dashboard: its own sidebar is gone, the shell provides it; keep its top bar and content layout */
body.cg .app { display: block; }
body.cg main.main { max-width: none; margin: 0; padding: 0; width: auto; }
body.cg .topbar { justify-content: flex-start; gap: 14px; padding: 0 32px; z-index: 50; }
body.cg .topbar .top-actions { margin-left: auto; }
body.cg .main > .content { max-width: 1240px; margin: 0 auto; }

/* ---------- page header bits ---------- */
.eyebrow, .members .eyebrow, main .eyebrow {
  display: flex; align-items: center; gap: 10px; margin: 0 0 6px;
  font-size: 13px; font-weight: 600; letter-spacing: 0; text-transform: none !important; color: var(--cg-muted);
}
.eyebrow::before { content: ""; width: 22px; height: 3px; border-radius: 2px; background: var(--cg-ochre); }
.dashboard-eyebrow, .content > .eyebrow, .members .eyebrow, main .eyebrow { color: var(--cg-muted); }

/* ---------- surfaces ---------- */
.card, .panel, .summary-card, .guide-card, .kpi {
  background: var(--cg-surface); border: 1px solid var(--cg-line); border-radius: 10px;
  box-shadow: 0 1px 2px rgba(6, 26, 48, .04); padding: 24px; margin: 18px 0;
}
.card-head, .dialog-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.card-head h2, .dialog-head h2 { margin: 0; }
.assistant-panel, .upload-panel, .import-panel, .ai-decision-box {
  margin: 22px 0; padding: 18px 20px; border: 1px solid var(--cg-line); border-radius: 8px;
  background: #f7f9fc; box-shadow: none;
}
.ai-result { background: #fff; border: 1px solid var(--cg-line); border-left: 3px solid var(--cg-action); border-radius: 6px; }
.ai-badge { background: var(--cg-info-bg); color: #1c4f93; font-weight: 600; }
.integrated-banner { padding: 10px 14px; border-radius: 6px; background: var(--cg-info-bg); color: #1c4f93; max-width: none; }

/* ---------- buttons ---------- */
button, .button, a.button, a.button.secondary {
  font-family: inherit; font-size: 14px; font-weight: 600; line-height: 1.2;
  padding: 10px 16px; border-radius: 6px; border: 1px solid var(--cg-action);
  background: var(--cg-action); color: #fff; cursor: pointer; text-decoration: none;
  transition: background-color .12s ease, border-color .12s ease, color .12s ease;
  transform: none; box-shadow: none;
}
button:hover:not(:disabled), .button:hover, a.button:hover { background: var(--cg-action-hover); border-color: var(--cg-action-hover); transform: none; box-shadow: none; }
button:disabled { opacity: .5; cursor: not-allowed; }
button.secondary, .button.secondary, .table-button, .actions button, .entry > button, .evidence-entry button, dialog #cancel {
  background: #fff; color: var(--cg-ink); border-color: #b4c2d1;
}
button.secondary:hover:not(:disabled), .button.secondary:hover, .table-button:hover, .actions button:hover:not(:disabled), .entry > button:hover, dialog #cancel:hover {
  background: #eef3f8; border-color: #8fa3b8; color: var(--cg-ink);
}
.actions button, .entry > button, .table-button { font-size: 13px; padding: 7px 12px; }
.actions { gap: 8px; margin-top: 10px; }
.table-button.danger, button.danger { color: var(--cg-bad); border-color: #d9a3a1; background: #fff; }
#logout, .cg-logout { background: transparent; color: var(--cg-ink); border-color: #b4c2d1; padding: 7px 14px; font-size: 13px; }
#logout:hover, .cg-logout:hover { background: #eef3f8; color: var(--cg-ink); border-color: #8fa3b8; }

/* ---------- forms ---------- */
label, .field { display: block; font-size: 13.5px; font-weight: 600; color: var(--cg-text); margin: 14px 0; }
input, select, textarea {
  display: block; width: 100%; margin-top: 6px; padding: 10px 12px; font: inherit; font-weight: 400;
  color: var(--cg-text); background: #fff; border: 1px solid #b4c2d1; border-radius: 6px;
}
input:hover, select:hover, textarea:hover { border-color: #8fa3b8; }
input:focus, select:focus, textarea:focus { border-color: var(--cg-action); }
input[type="file"] { padding: 9px 10px; background: #fff; }
input[type="file"]::file-selector-button { margin-right: 12px; padding: 6px 12px; border: 1px solid #b4c2d1; border-radius: 5px; background: #eef3f8; color: var(--cg-ink); font: inherit; font-weight: 600; cursor: pointer; }
input[type="checkbox"], input[type="radio"] { display: inline-block; width: auto; margin: 0 8px 0 0; }
textarea { min-height: 96px; }
form button[type="submit"], form > button:last-child { margin-top: 10px; }

/* ---------- tables ---------- */
.table-wrap, .table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th {
  text-align: left; padding: 10px 12px; font-size: 12.5px; font-weight: 650; letter-spacing: 0; text-transform: none;
  color: var(--cg-muted); border-bottom: 2px solid var(--cg-line); background: transparent; white-space: nowrap;
}
td { padding: 12px; border-bottom: 1px solid var(--cg-line-soft); vertical-align: top; }
tbody tr:hover td { background: #f7f9fc; }

/* ---------- lists of records ---------- */
.entry { padding: 16px 0; border-top: 1px solid var(--cg-line-soft); }
.entry:first-child { border-top: 0; }
.entry h3 { margin: 0 0 4px; }
.entry p { margin: 4px 0; }
.empty { padding: 20px 0; color: var(--cg-muted); }
details.entry > summary { cursor: pointer; font-weight: 600; color: var(--cg-ink); }

/* ---------- status marks ---------- */
.status, .pill, .tag, .badge {
  display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; line-height: 1.4;
  background: var(--cg-info-bg); color: #1c4f93; letter-spacing: 0;
}
.pill.pending { background: var(--cg-warn-bg); color: var(--cg-warn); }
.pill.expired, .status.danger { background: var(--cg-bad-bg); color: var(--cg-bad); }

/* ---------- notices ---------- */
#notice:not(:empty), .notice:not([hidden]):not(:empty) {
  padding: 11px 14px; border-radius: 6px; border-left: 4px solid #3b82c4; background: var(--cg-info-bg); color: #17406f; max-width: none;
}
#notice.error, .notice.error, .error:not(button) { border-left-color: var(--cg-bad); background: var(--cg-bad-bg); color: #8a2420; }
.notice.ok, .notice.success { border-left-color: var(--cg-ok); background: var(--cg-ok-bg); color: #145a42; }
#formError { color: var(--cg-bad); }

/* ---------- dialogs ---------- */
dialog { border: 0; border-radius: 10px; padding: 26px; width: min(640px, 94vw); box-shadow: 0 24px 60px rgba(6, 26, 48, .35); color: var(--cg-text); }
dialog::backdrop { background: rgba(6, 26, 48, .55); }

/* ---------- ISO pathway: the one memorable element ----------
   The five stages are a real sequence, so they are drawn as a rail:
   filled = done, ochre ring = next, dashed = locked until the stage before it is done. */
.workflow-grid {
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0; margin: 22px 0 10px;
}
.workflow-grid > .workflow-stage { position: relative; display: block; padding: 34px 18px 0 0; border: 0; }
.workflow-stage::before {
  content: ""; position: absolute; top: 6px; left: 0; width: 18px; height: 18px; box-sizing: border-box; border-radius: 50%;
  border: 2px solid #8fa3b8; background: #fff;
}
.workflow-stage::after { content: ""; position: absolute; top: 14px; left: 26px; right: 8px; height: 2px; background: var(--cg-line); }
.workflow-stage:last-child::after { display: none; }
.workflow-stage.done::before {
  border-color: var(--cg-ink); background: var(--cg-ink) center / 11px no-repeat
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.2 6.3l2.4 2.4 5.2-5.4' fill='none' stroke='white' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
.workflow-stage.done::after { background: var(--cg-ink); }
.workflow-stage:not(.done):not(.locked)::before { border-color: var(--cg-ochre); box-shadow: 0 0 0 4px rgba(227, 155, 0, .2); }
.workflow-stage.locked::before { border-style: dashed; border-color: #aebccb; background: transparent; }
.workflow-stage strong { display: block; font-size: 14px; line-height: 1.3; color: var(--cg-ink); }
.workflow-stage.locked strong { color: #6b7f94; }
.workflow-stage p { margin: 4px 0 6px; font-size: 13px; line-height: 1.45; }
.workflow-stage small { font-size: 12px; font-weight: 600; color: var(--cg-muted); }
.workflow-stage.done small { color: var(--cg-ok); }
.workflow-stage:not(.done):not(.locked) small { color: var(--cg-warn); }

/* ---------- dashboard (keeps its own frame; only typography and tone are aligned) ---------- */
.sidebar .brand { letter-spacing: .02em; }
.topbar { box-shadow: none; }
.kpi, .panel { box-shadow: 0 1px 2px rgba(6, 26, 48, .04); }

/* ---------- public / login ---------- */
.africa-stage {
  position: absolute; z-index: 1; top: 9%; right: 1%; bottom: 7%; width: 56%;
  pointer-events: none;
  -webkit-mask-image: linear-gradient(to right, transparent 0, #000 8%);
  mask-image: linear-gradient(to right, transparent 0, #000 8%);
}
.africa-stage img { width: 100%; height: 100%; object-fit: contain; object-position: center; }
.afri-word { letter-spacing: .04em; }
@media (min-width: 1001px) {
  .welcome-hero .hero-content { width: min(500px, 50%); }
  .welcome-hero .hero-content h1 { font-size: clamp(38px, 3.5vw, 56px); }
  .welcome-hero .hero-capabilities { flex-wrap: wrap; gap: 18px 34px; }
}
.hero-content h1, .hero-intro { text-shadow: 0 2px 18px rgba(4, 20, 36, .85); }
@media (max-width: 1000px) {
  .africa-stage { top: 6%; bottom: 6%; width: 70%; right: -10%; opacity: .45; }
}
.hero-pillars, .hero-intro, .hero-content h1 { position: relative; z-index: 3; }

/* ---------- responsive ---------- */
@media (max-width: 1000px) {
  .workflow-grid { grid-template-columns: 1fr; gap: 6px; }
  .workflow-grid > .workflow-stage { padding: 0 0 12px 32px; }
  .workflow-stage::before { top: 2px; }
  .workflow-stage::after { display: none; }
}
@media (max-width: 960px) {
  body.cg { padding-left: 0; }
  .cg-side { transform: translateX(-102%); box-shadow: 8px 0 30px rgba(6, 26, 48, .35); }
  body.cg.cg-open .cg-side { transform: none; }
  .cg-burger { display: inline-block; padding: 7px 12px; background: #fff; color: var(--cg-ink); border-color: #b4c2d1; }
  .cg-top, body.cg > header { padding: 0 16px; }
  body.cg main, body.cg .members { padding: 22px 16px 56px; }
  .card { padding: 18px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}

/* section rhythm inside long cards */
.card h2 { margin: 34px 0 8px; padding-top: 22px; border-top: 1px solid var(--cg-line-soft); }
.card h2:first-child, .card-head h2, .dialog-head h2, .card > .card-head + h2 { margin-top: 0; padding-top: 0; border-top: 0; }
.workflow-grid + h2, .workflow-grid + * { margin-top: 0; }
