/* =========================================================================
   BPWA We-Innovate — design system v2 (Modern Professional, data-dashboard)
   Poppins (display) + Open Sans (body). Light + dark. SVG icons only.
   Swap --brand-* for BPWA's official palette; drop a logo into the topbar.
   ========================================================================= */
@import url('https://fonts.googleapis.com/css2?family=Open+Sans:wght@400;500;600;700&family=Poppins:wght@500;600;700;800&display=swap');

:root {
  /* Brand (swap for BPWA's official palette) */
  --brand: #6d28d9;            /* violet-700 */
  --brand-dark: #5b21b6;
  --brand-darker: #4c1d95;
  --brand-soft: #f3effe;
  --brand-ring: rgba(109, 40, 217, .35);
  --secondary: #0d9488;        /* teal-600 */
  --accent: #f59e0b;           /* amber-500 */

  /* Maturity bands (workbook: Red/Orange/Yellow/Green/Purple) */
  --band-emerging: #e11d48;
  --band-developing: #ea580c;
  --band-established: #ca8a04;
  --band-advanced: #059669;
  --band-leader: #7c3aed;

  /* Priority */
  --pri-high: #e11d48;
  --pri-medium: #ea580c;
  --pri-low: #059669;
  --pri-best: #7c3aed;

  /* Neutrals — light */
  --bg: #f5f6f9;
  --bg-elev: #eef0f5;
  --card: #ffffff;
  --ink: #0f172a;
  --ink-soft: #334155;
  --muted: #64748b;
  --line: #e5e7eb;
  --line-strong: #d5d9e0;
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 8px 24px rgba(15, 23, 42, .06);
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06);

  --radius: 14px;
  --radius-sm: 10px;
  --radius-xs: 7px;
  --maxw: 1200px;
  --ring: 0 0 0 3px var(--brand-ring);
  color-scheme: light;
}

:root[data-theme="dark"] {
  --brand: #8b5cf6;
  --brand-dark: #7c3aed;
  --brand-darker: #6d28d9;
  --brand-soft: #211a3a;
  --brand-ring: rgba(139, 92, 246, .4);
  --secondary: #2dd4bf;
  --bg: #0a0f1e;
  --bg-elev: #111830;
  --card: #131a2e;
  --ink: #e8ecf6;
  --ink-soft: #b7c0d4;
  --muted: #7e8aa3;
  --line: #263149;
  --line-strong: #33405d;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 30px rgba(0, 0, 0, .35);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Open Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.55;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, h4 { font-family: "Poppins", system-ui, sans-serif; margin: 0 0 .4em; line-height: 1.22; font-weight: 700; letter-spacing: -.01em; color: var(--ink); }
a { color: var(--secondary); }
button { font: inherit; cursor: pointer; }
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.center { text-align: center; }
.hidden { display: none !important; }
.tnum { font-variant-numeric: tabular-nums; }

:where(button, a, input, select, textarea, [tabindex]):focus-visible {
  outline: none; box-shadow: var(--ring); border-radius: var(--radius-xs);
}

.skip-link {
  position: absolute; left: -9999px; top: 8px; z-index: 100;
  background: var(--brand); color: #fff; padding: 10px 16px; border-radius: var(--radius-sm); font-weight: 600;
}
.skip-link:focus { left: 12px; }

/* ---------- Top bar ---------- */
.topbar {
  background: var(--card); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 40;
}
.topbar-inner { max-width: var(--maxw); margin: 0 auto; padding: 12px 22px; display: flex; align-items: center; gap: 14px; }
.logo-mark {
  width: 40px; height: 40px; border-radius: 11px; flex: none; display: grid; place-items: center;
  background: linear-gradient(140deg, var(--brand), var(--brand-darker)); color: #fff;
  box-shadow: 0 4px 12px var(--brand-ring);
}
.logo-mark svg { width: 22px; height: 22px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text b { font-family: "Poppins", sans-serif; font-size: 1rem; letter-spacing: -.01em; color: var(--ink); }
.brand-text span { font-size: .72rem; color: var(--muted); }
.topbar-spacer { flex: 1; }
#topbarActions { display: flex; align-items: center; gap: 10px; }
.sme-chip {
  background: var(--brand-soft); color: var(--brand); border: 1px solid transparent;
  padding: 7px 14px; border-radius: 999px; font-size: .82rem; font-weight: 700;
  max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.user-name { font-size: .84rem; color: var(--ink-soft); font-weight: 600; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--line); background: var(--card);
  color: var(--ink-soft); display: grid; place-items: center; transition: background .18s, color .18s, border-color .18s;
}
.icon-btn:hover { background: var(--bg-elev); color: var(--ink); border-color: var(--line-strong); }
.icon-btn svg { width: 18px; height: 18px; }

/* ---------- Layout ---------- */
.layout { max-width: var(--maxw); margin: 0 auto; padding: 24px 22px 96px; display: grid; grid-template-columns: 258px 1fr; gap: 26px; align-items: start; }
@media (max-width: 900px) { .layout { grid-template-columns: 1fr; } }

/* ---------- Stepper ---------- */
.stepper { position: sticky; top: 82px; }
.stepper ol { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 3px; }
.step {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--radius-sm);
  color: var(--ink-soft); font-weight: 600; font-size: .89rem; background: transparent; border: 1px solid transparent;
  width: 100%; text-align: left; transition: background .18s, color .18s, border-color .18s;
}
.step:hover { background: var(--card); }
.step.active { background: var(--card); border-color: var(--line); box-shadow: var(--shadow-sm); color: var(--ink); }
.step .dot { width: 26px; height: 26px; border-radius: 8px; flex: none; display: grid; place-items: center;
  background: var(--bg-elev); color: var(--muted); font-size: .78rem; font-weight: 800; transition: background .18s, color .18s; }
.step.active .dot { background: var(--brand); color: #fff; }
.step .step-label { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.step .mini { font-size: .72rem; font-weight: 800; padding: 3px 9px; border-radius: 999px; background: var(--bg-elev); color: var(--muted); font-variant-numeric: tabular-nums; }
.step .mini.done { background: color-mix(in srgb, var(--band-advanced) 16%, transparent); color: var(--band-advanced); }

/* ---------- Cards ---------- */
.panel { display: flex; flex-direction: column; gap: 20px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px 24px; }
.card h2 { font-size: 1.24rem; }
.card .lead { color: var(--ink-soft); margin-top: -.2em; font-size: .95rem; }
.section-head { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.section-badge { font-size: .72rem; font-weight: 800; color: #fff; background: var(--secondary); padding: 4px 11px; border-radius: 999px; letter-spacing: .3px; text-transform: uppercase; }
.weight-pill { margin-left: auto; font-size: .74rem; font-weight: 700; color: var(--ink-soft); background: var(--bg-elev); border: 1px solid var(--line); padding: 4px 11px; border-radius: 999px; }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 15px; }
.field label { font-weight: 600; font-size: .88rem; color: var(--ink-soft); }
.field input, .field select, .field textarea {
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm); padding: 10px 13px; font: inherit;
  background: var(--card); color: var(--ink); width: 100%; transition: border-color .18s, box-shadow .18s;
}
.field textarea { min-height: 74px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--brand); box-shadow: var(--ring); }
.field input::placeholder, .field textarea::placeholder { color: var(--muted); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
@media (max-width: 640px) { .grid-2 { grid-template-columns: 1fr; } }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-toggle { border: 1px solid var(--line-strong); background: var(--card); border-radius: 999px; padding: 8px 15px; font-size: .85rem; font-weight: 600; color: var(--ink-soft); transition: all .18s; min-height: 40px; }
.chip-toggle:hover { border-color: var(--brand); color: var(--brand); }
.chip-toggle.on { background: var(--brand); color: #fff; border-color: var(--brand); }

/* ---------- Subsection assessment ---------- */
.subcard { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin-bottom: 16px; background: var(--card); }
.subcard > header { display: flex; align-items: center; gap: 12px; padding: 14px 18px; background: var(--bg-elev); border-bottom: 1px solid var(--line); }
.subcard > header .lbl { font-size: .74rem; font-weight: 800; color: var(--brand); background: var(--brand-soft); padding: 4px 9px; border-radius: 6px; font-variant-numeric: tabular-nums; }
.subcard > header h3 { margin: 0; font-size: 1rem; }
.subcard .live { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.score-pill { font-weight: 800; font-size: .82rem; padding: 4px 11px; border-radius: 999px; background: var(--bg-elev); border: 1px solid var(--line); color: var(--ink-soft); min-width: 50px; text-align: center; font-variant-numeric: tabular-nums; }
.pattern-badge { font-size: .72rem; font-weight: 700; padding: 4px 10px; border-radius: 999px; color: #fff; white-space: nowrap; }
.dim { padding: 15px 18px; border-bottom: 1px solid var(--line); }
.dim:last-child { border-bottom: none; }
.dim-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 9px; }
.dim-type { font-size: .7rem; font-weight: 800; text-transform: uppercase; letter-spacing: .5px; color: var(--secondary); flex: none; }
.dim-q { font-size: .92rem; font-weight: 600; color: var(--ink); }
.rating { display: inline-flex; gap: 0; margin: 8px 0; flex-wrap: wrap; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); overflow: hidden; }
.rbtn { width: 46px; height: 44px; border: none; border-right: 1px solid var(--line-strong); background: var(--card); font-weight: 800; color: var(--ink-soft); transition: background .15s, color .15s; }
.rbtn:last-child { border-right: none; }
.rbtn:hover { background: var(--brand-soft); color: var(--brand); }
.rbtn.on { background: var(--brand); color: #fff; }
.rbtn.na { width: auto; padding: 0 14px; font-size: .8rem; font-weight: 700; }
.crit { font-size: .85rem; color: var(--ink-soft); background: var(--brand-soft); border-left: 3px solid var(--brand); border-radius: 6px; padding: 9px 13px; margin: 8px 0; }
.crit.empty { background: var(--bg-elev); border-left-color: var(--line-strong); color: var(--muted); }
.evidence-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 10px; }
@media (max-width: 640px) { .evidence-row { grid-template-columns: 1fr; } }
.evidence-row .field { margin-bottom: 0; }
.evidence-row label { font-size: .76rem; color: var(--muted); }

/* ---------- Section summary ---------- */
.sec-summary { display: flex; align-items: center; gap: 18px; padding: 18px 22px; border-radius: var(--radius); color: #fff; margin-top: 6px; position: relative; overflow: hidden; }
.sec-summary::before { content: ""; position: absolute; inset: 0; background: rgba(0,0,0,.12); }
.sec-summary > * { position: relative; }
.sec-summary .big { font-size: 2rem; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.sec-summary .lvl { font-size: 1.05rem; font-weight: 800; }
.sec-summary .desc { font-size: .85rem; opacity: .96; }

/* ---------- Buttons ---------- */
.btn { border: 1px solid var(--line-strong); background: var(--card); color: var(--ink); border-radius: var(--radius-sm); padding: 11px 18px; font-weight: 700; font-size: .9rem; display: inline-flex; align-items: center; gap: 8px; transition: background .18s, border-color .18s, color .18s; min-height: 44px; }
.btn svg { width: 17px; height: 17px; }
.btn:hover { border-color: var(--muted); background: var(--bg-elev); }
.btn.primary { background: var(--brand); color: #fff; border-color: var(--brand); }
.btn.primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--bg-elev); }
.btn.small { padding: 7px 12px; min-height: 36px; font-size: .82rem; }
.btn.danger:hover { color: var(--pri-high); border-color: var(--pri-high); background: color-mix(in srgb, var(--pri-high) 8%, transparent); }
.stepnav { display: flex; justify-content: space-between; margin-top: 6px; gap: 10px; }
.saveflash { font-size: .8rem; color: var(--band-advanced); font-weight: 700; display: inline-flex; align-items: center; gap: 5px; }
.saveflash svg { width: 14px; height: 14px; }

/* ---------- Dashboard ---------- */
.page-head { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.page-head h1 { margin: 0; font-size: 1.5rem; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; display: flex; align-items: center; gap: 14px; }
.stat .stat-icon { width: 42px; height: 42px; border-radius: 11px; flex: none; display: grid; place-items: center; }
.stat .stat-icon svg { width: 21px; height: 21px; }
.stat .stat-num { font-family: "Poppins", sans-serif; font-size: 1.7rem; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.stat .stat-label { font-size: .8rem; color: var(--muted); margin-top: 3px; }

.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.search-wrap { position: relative; flex: 1; max-width: 340px; }
.search-wrap svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; color: var(--muted); }
.search-wrap input { width: 100%; padding: 10px 12px 10px 38px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--card); color: var(--ink); font: inherit; }
.search-wrap input:focus { outline: none; border-color: var(--brand); box-shadow: var(--ring); }

.tablelike { width: 100%; border-collapse: collapse; font-size: .88rem; }
.tablelike th, .tablelike td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.tablelike th { color: var(--muted); font-weight: 700; font-size: .74rem; text-transform: uppercase; letter-spacing: .4px; }
.tablelike tbody tr { transition: background .15s; }
.tablelike tbody tr:hover { background: var(--bg-elev); }
.tablelike td .row-actions { display: flex; gap: 4px; justify-content: flex-end; }

.status-pill { display: inline-flex; align-items: center; gap: 6px; font-size: .74rem; font-weight: 700; padding: 4px 10px; border-radius: 999px; }
.status-pill.draft { background: color-mix(in srgb, var(--band-developing) 14%, transparent); color: var(--band-developing); }
.status-pill.completed { background: color-mix(in srgb, var(--band-advanced) 14%, transparent); color: var(--band-advanced); }
.status-pill .dot-i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

.empty-state { text-align: center; padding: 44px 20px; }
.empty-state svg { width: 46px; height: 46px; color: var(--muted); margin-bottom: 10px; }

/* ---------- Login ---------- */
.auth-wrap { min-height: calc(100vh - 66px); display: grid; place-items: center; padding: 20px; }
.auth-card { width: 100%; max-width: 400px; }
.auth-logo { width: 56px; height: 56px; border-radius: 15px; margin: 0 auto 14px; display: grid; place-items: center; background: linear-gradient(140deg, var(--brand), var(--brand-darker)); color: #fff; box-shadow: 0 8px 20px var(--brand-ring); }
.auth-logo svg { width: 30px; height: 30px; }

/* ---------- Report ---------- */
.report { display: flex; flex-direction: column; gap: 20px; }
.report-cover { background: linear-gradient(135deg, var(--brand-darker), var(--brand)); color: #fff; border-radius: var(--radius); padding: 36px 36px 32px; position: relative; overflow: hidden; }
.report-cover::after { content: ""; position: absolute; right: -60px; top: -60px; width: 240px; height: 240px; border-radius: 50%; background: rgba(255,255,255,.07); }
.report-cover .eyebrow { font-size: .74rem; letter-spacing: .6px; text-transform: uppercase; opacity: .85; font-weight: 600; }
.report-cover h1 { font-size: 1.9rem; color: #fff; margin: 6px 0; }
.report-cover .org { font-size: 1.2rem; font-weight: 700; }
.report-cover .meta { display: flex; flex-wrap: wrap; gap: 10px 22px; margin-top: 18px; font-size: .86rem; opacity: .95; position: relative; }
.report-cover .meta span { display: inline-flex; align-items: center; gap: 7px; }
.report-cover .meta svg { width: 15px; height: 15px; opacity: .9; }
.overall-wrap { display: grid; grid-template-columns: 300px 1fr; gap: 28px; align-items: center; }
@media (max-width: 760px) { .overall-wrap { grid-template-columns: 1fr; } }
.donut { display: grid; place-items: center; }
.report-section-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.msc { border: 1px solid var(--line); border-radius: var(--radius); padding: 15px; border-top: 4px solid var(--line); background: var(--card); }
.msc .sc { font-family: "Poppins", sans-serif; font-size: 1.5rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.msc .lvl { font-weight: 700; font-size: .86rem; }
.diag { border: 1px solid var(--line); border-radius: var(--radius); padding: 15px 17px; margin-bottom: 10px; background: var(--card); }
.diag h4 { margin: 0 0 6px; font-size: .98rem; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.diag .row { font-size: .86rem; margin: 5px 0; color: var(--ink-soft); }
.diag .row b { color: var(--ink); }
.pri-tag { font-size: .7rem; font-weight: 800; color: #fff; padding: 3px 9px; border-radius: 999px; text-transform: uppercase; letter-spacing: .3px; }
.action-item { display: grid; grid-template-columns: 34px 1fr auto; gap: 13px; align-items: start; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 13px 15px; margin-bottom: 9px; background: var(--card); }
.action-item .n { width: 30px; height: 30px; border-radius: 9px; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 800; }
.needs-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 640px) { .needs-grid { grid-template-columns: 1fr; } }
.needs-block h4 { color: var(--secondary); text-transform: uppercase; letter-spacing: .4px; font-size: .72rem; margin-bottom: 4px; }
.needs-block ul { margin: 4px 0 0; padding-left: 18px; font-size: .9rem; }

/* ---------- Toast ---------- */
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--card); padding: 11px 20px; border-radius: 999px; font-size: .86rem; font-weight: 600; box-shadow: var(--shadow); opacity: 0; transition: opacity .2s; z-index: 60; pointer-events: none; }
.toast.show { opacity: 1; }

/* ---------- Motion ---------- */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

/* ---------- Print ---------- */
@media print {
  .topbar, .stepper, .stepnav, .no-print { display: none !important; }
  .layout { display: block; max-width: none; padding: 0; }
  body { background: #fff; font-size: 12px; }
  .card, .report, .msc, .diag, .action-item, .subcard { box-shadow: none; }
  .diag, .msc, .action-item, .subcard { break-inside: avoid; }
  .report-cover, .sec-summary, .pattern-badge, .pri-tag, .status-pill { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
