/* ==========================================================================
   AKIJ Resource — Brand Maturity Dashboard
   International corporate design system. No runtime libraries.
   ========================================================================== */

/* ---------------------------------------------------------------- tokens */
:root {
  --ink: #0B1F3A;
  --ink-soft: #3D4C63;
  --surface: #F7F8FA;
  --card: #FFFFFF;
  --border: #E3E7ED;
  --border-strong: #C9D2DE;
  --accent: #C8102E;
  --accent-soft: #FBE9EC;
  --muted: #6B7686;
  --link: #0B4EA2;

  --l1: #B42318;
  --l2: #E07B00;
  --l3: #C9A400;
  --l4: #3A8F5B;
  --l5: #0E5E4E;

  --ok: #1F7A4D;
  --ok-bg: #E8F4ED;
  --warn: #B45309;
  --warn-bg: #FBF1E3;
  --bad: #B42318;
  --bad-bg: #FBEAE8;
  --na: #6B7686;
  --na-bg: #EEF1F5;

  --shadow: 0 1px 2px rgba(11, 31, 58, .06), 0 2px 8px rgba(11, 31, 58, .05);
  --shadow-lg: 0 4px 24px rgba(11, 31, 58, .12);
  --radius: 10px;
  --radius-sm: 7px;
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --sans: Inter, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

[data-theme="dark"] {
  --ink: #E8EDF4;
  --ink-soft: #AEB9C8;
  --surface: #0E1622;
  --card: #16202E;
  --border: #263444;
  --border-strong: #3A4A5E;
  --accent: #E23A52;
  --accent-soft: #3A1B22;
  --muted: #8593A6;
  --link: #6FA9F5;

  --ok: #4CAF7D;
  --ok-bg: #16301F;
  --warn: #E39A3B;
  --warn-bg: #332514;
  --bad: #E06A5C;
  --bad-bg: #341A17;
  --na: #8593A6;
  --na-bg: #1F2937;

  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 2px 8px rgba(0, 0, 0, .35);
  --shadow-lg: 0 4px 24px rgba(0, 0, 0, .5);
}

/* ---------------------------------------------------------------- reset */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--surface);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 { margin: 0; font-weight: 600; line-height: 1.25; }

a { color: var(--link); }

button { font-family: inherit; }

.num { font-variant-numeric: tabular-nums; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------------------------------------------------------------- topbar */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px 24px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
}
.topbar__brand { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.wordmark {
  font-family: var(--serif); font-weight: 700; font-size: 17px;
  letter-spacing: .01em; color: var(--ink); white-space: nowrap;
}
.title-sep { color: var(--muted); }
.title { font-size: 15px; font-weight: 600; color: var(--ink-soft); white-space: nowrap; }

.topbar__right { display: flex; align-items: center; gap: 12px; }
.audit-date { font-size: 13px; color: var(--muted); white-space: nowrap; }

.sbu-select select {
  font-family: inherit; font-size: 14px; font-weight: 600;
  color: var(--ink); background: var(--card);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  padding: 7px 32px 7px 12px; max-width: 340px; cursor: pointer;
}
.sbu-select select:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.theme-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 50%;
  border: 1px solid var(--border); background: var(--card); color: var(--ink);
  cursor: pointer;
}
.theme-toggle:hover { background: var(--surface); }
.icon { width: 18px; height: 18px; fill: currentColor; }

/* ---------------------------------------------------------------- tabs */
.tabs {
  position: sticky; top: 61px; z-index: 40;
  display: flex; gap: 2px; overflow-x: auto;
  padding: 0 24px; background: var(--card);
  border-bottom: 1px solid var(--border);
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: 0 0 auto; padding: 11px 14px; font-size: 13.5px; font-weight: 500;
  color: var(--muted); background: none; border: none; border-bottom: 2px solid transparent;
  cursor: pointer; white-space: nowrap;
}
.tab:hover { color: var(--ink); }
.tab[aria-selected="true"] { color: var(--ink); font-weight: 600; border-bottom-color: var(--accent); }
.tab:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

/* ---------------------------------------------------------------- layout */
.main { padding: 28px 24px 56px; max-width: 1440px; margin: 0 auto; }

.section { margin-bottom: 28px; }
.section__head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.section__title { font-family: var(--serif); font-size: 19px; font-weight: 700; color: var(--ink); }
.section__sub { font-size: 13px; color: var(--muted); }
.section__actions { display: flex; gap: 8px; flex-wrap: wrap; }

.grid { display: grid; gap: 16px; }
.grid--2 { grid-template-columns: repeat(2, 1fr); }
.grid--3 { grid-template-columns: repeat(3, 1fr); }
.grid--4 { grid-template-columns: repeat(4, 1fr); }
.grid--kpis { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }

.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow);
}
.card--flush { padding: 0; overflow: hidden; }
.card__title { font-size: 13px; font-weight: 600; letter-spacing: .02em; text-transform: uppercase; color: var(--muted); margin-bottom: 12px; }

/* KPI cards */
.kpi { display: flex; flex-direction: column; gap: 6px; }
.kpi__label { font-size: 12.5px; font-weight: 600; letter-spacing: .03em; text-transform: uppercase; color: var(--muted); }
.kpi__value { font-family: var(--serif); font-size: 30px; font-weight: 700; line-height: 1; color: var(--ink); }
.kpi__value small { font-size: 15px; font-weight: 600; color: var(--muted); }
.kpi__note { font-size: 12.5px; color: var(--muted); }

/* level badge */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600;
}
.badge--big { font-family: var(--serif); font-size: 22px; font-weight: 700; padding: 8px 18px; }
.lv-1 { background: var(--l1); color: #fff; }
.lv-2 { background: var(--l2); color: #fff; }
.lv-3 { background: var(--l3); color: #1a1a1a; }
.lv-4 { background: var(--l4); color: #fff; }
.lv-5 { background: var(--l5); color: #fff; }
.lv-chip { background: transparent; color: var(--ink); border: 1.5px solid currentColor; }
.lv-chip.lv-1 { color: var(--l1); } .lv-chip.lv-2 { color: var(--l2); }
.lv-chip.lv-3 { color: var(--l3); } .lv-chip.lv-4 { color: var(--l4); }
.lv-chip.lv-5 { color: var(--l5); }

/* status */
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
.status svg { width: 16px; height: 16px; flex: 0 0 auto; }
.st-achieved { color: var(--ok); }
.st-partial { color: var(--warn); }
.st-not-achieved { color: var(--bad); }
.st-not-assessed { color: var(--na); }

/* chips */
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600;
  border: 1px solid var(--border); color: var(--ink-soft); background: var(--surface);
}
.chip--framework { border-color: var(--border-strong); color: var(--muted); font-style: italic; }
.chip--audit { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.effort-S { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.effort-M { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.effort-L { background: var(--bad-bg); color: var(--bad); border-color: transparent; }

/* tables */
.table-scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 13.5px; }
th, td { text-align: left; padding: 9px 11px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: 12px; font-weight: 600; letter-spacing: .03em; text-transform: uppercase; color: var(--muted); white-space: nowrap; }
tbody tr:hover { background: var(--surface); }
tr.sortable th { cursor: pointer; user-select: none; }
tr.sortable th:hover { color: var(--ink); }
.sort-indicator { font-size: 11px; color: var(--accent); }

/* heatmap */
.heatmap { display: grid; gap: 2px; }
.heatmap__cell {
  display: flex; align-items: center; justify-content: center;
  padding: 7px 4px; font-size: 12.5px; font-weight: 600; color: #fff;
  border-radius: 3px; min-height: 34px; text-align: center;
}
.heatmap__cell--na { color: var(--muted); background: var(--na-bg); }
.heatmap__hcell {
  display: flex; align-items: center; justify-content: center;
  padding: 8px 6px; font-size: 11px; font-weight: 600; letter-spacing: .03em;
  text-transform: uppercase; color: var(--muted); min-height: 30px;
}
.heatmap__row-label {
  display: flex; align-items: center; padding: 7px 8px; font-size: 13px;
  font-weight: 500; color: var(--ink); text-decoration: none; min-height: 34px;
}
.heatmap__row-label:hover { color: var(--link); background: var(--surface); }

/* checklist matrix cells */
.matrix-cell {
  display: flex; flex-direction: column; justify-content: center; gap: 4px;
  padding: 8px 10px; border-radius: 6px; text-decoration: none;
  border: 1px solid var(--border); min-height: 60px;
}
.matrix-cell:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }
.matrix-cell.unlocked { background: var(--ok-bg); }
.matrix-cell.inprogress { background: var(--warn-bg); }
.matrix-cell.locked { background: var(--na-bg); }
.matrix-cell__pct { font-size: 15px; font-weight: 700; color: var(--ink); }
.matrix-cell__counts { font-size: 11px; color: var(--muted); }

.mini-bar { display: inline-flex; width: 100%; height: 7px; border-radius: 999px; overflow: hidden; background: var(--na-bg); }
.mini-bar > span { display: inline-block; height: 100%; }

/* milestone highlight */
.flash { animation: flash 1.6s ease-out; }
@keyframes flash {
  0% { box-shadow: 0 0 0 3px var(--accent); background: var(--accent-soft); }
  100% { box-shadow: none; }
}

/* ---------------------------------------------------- SVG chart colours
   Neutral chart colours live in CSS (so CSS custom properties + dark mode apply).
   SVG presentation attributes cannot resolve var(), hence classes. */
.chart-svg text { fill: var(--ink); }
.chart-svg .muted { fill: var(--muted); }
.chart-svg .soft { fill: var(--ink-soft); }
.chart-svg .gridline { stroke: var(--border); }
.chart-svg .gridline-strong { stroke: var(--border-strong); }
.chart-svg .track { stroke: var(--na-bg); }
.chart-svg .accent { stroke: var(--accent); fill: var(--accent); }
.chart-svg .series-current { fill: var(--accent); stroke: var(--accent); }
.chart-svg .series-target { fill: var(--border-strong); stroke: var(--border-strong); }
.chart-svg .bar, .chart-svg .dot { cursor: pointer; }
.chart-svg .bar:hover, .chart-svg .dot:hover { opacity: .85; }

/* ---------------------------------------------------- utility classes */
.flex { display: flex; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.flex-center { display: flex; align-items: center; }
.wrap { flex-wrap: wrap; }
.gap-12 { gap: 12px; }
.gap-20 { gap: 20px; }
.mt-4 { margin-top: 4px; } .mt-6 { margin-top: 6px; } .mt-8 { margin-top: 8px; }
.mt-10 { margin-top: 10px; } .mt-12 { margin-top: 12px; } .mt-14 { margin-top: 14px; }
.mt-16 { margin-top: 16px; } .mt-20 { margin-top: 20px; }
.mb-8 { margin-bottom: 8px; } .mb-10 { margin-bottom: 10px; }
.mb-12 { margin-bottom: 12px; } .mb-14 { margin-bottom: 14px; }
.ml-6 { margin-left: 6px; }
.big-number { font-family: var(--serif); font-size: 40px; font-weight: 700; line-height: 1; }
.kpi__value--sm { font-size: 18px; }
.kpi__value--md { font-size: 20px; }
.kpi__value--lg { font-size: 24px; }
.mw-280 { max-width: 280px; }
.w-120 { width: 120px; }
.checklist-dim-label { margin: 6px 0 4px; }
.checklist-dim-block { padding: 4px 12px 8px; }
.mini-bar__seg { display: inline-block; height: 7px; vertical-align: top; }
.hc-row { display: contents; }
.quarter-row { display: flex; justify-content: space-between; padding: 7px 0; border-bottom: 1px solid var(--border); }
.group-pct { color: var(--muted); font-size: 12.5px; }
.score-num { font-family: var(--serif); font-size: 20px; font-weight: 700; }



/* progress ring / bars */
.progress { height: 8px; border-radius: 999px; background: var(--na-bg); overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: 999px; }

/* checklist */
.checklist-levels { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin-bottom: 20px; }
.level-card {
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 10px; text-align: center; cursor: pointer; background: var(--card);
  position: relative; transition: transform .15s ease, box-shadow .15s ease;
}
.level-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.level-card__ring { margin: 0 auto 8px; }
.level-card__name { font-size: 12.5px; font-weight: 700; }
.level-card__counts { font-size: 11.5px; color: var(--muted); margin-top: 3px; }
.level-card__state { font-size: 11px; font-weight: 600; margin-top: 6px; padding: 2px 8px; border-radius: 999px; display: inline-block; }
.state-unlocked { background: var(--ok-bg); color: var(--ok); }
.state-inprogress { background: var(--warn-bg); color: var(--warn); }
.state-locked { background: var(--na-bg); color: var(--na); }
.level-card.locked { opacity: .68; }

.checklist-group { margin-bottom: 22px; }
.checklist-group__head { display: flex; align-items: center; gap: 10px; cursor: pointer; padding: 8px 0; }
.checklist-group__head h3 { font-size: 16px; }
.checklist-group__head .chevron { transition: transform .15s ease; }
.checklist-group.collapsed .checklist-items { display: none; }
.checklist-group.collapsed .chevron { transform: rotate(-90deg); }
.checklist-items { border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.checklist-item { display: flex; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--border); align-items: flex-start; }
.checklist-item:last-child { border-bottom: none; }
.checklist-item__body { flex: 1; min-width: 0; }
.checklist-item__text { font-size: 13.5px; }
.checklist-item__meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 5px; align-items: center; }
.checklist-item__closed { font-size: 12px; color: var(--link); cursor: pointer; }
.checklist-item__evidence { font-size: 12.5px; color: var(--muted); margin-top: 4px; }

/* filters */
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.filters select, .filters input[type="search"] {
  font-family: inherit; font-size: 13px; color: var(--ink); background: var(--card);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 6px 10px;
}
.toggle { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink); cursor: pointer; }

/* roadmap milestones */
.milestone {
  border: 1px solid var(--border); border-left: 4px solid var(--accent);
  border-radius: var(--radius-sm); padding: 12px 14px; margin-bottom: 10px; background: var(--card);
}
.milestone__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.milestone__title { font-size: 14px; font-weight: 600; }
.milestone__id { font-size: 11.5px; color: var(--muted); font-family: monospace; }
.milestone__success { font-size: 13px; color: var(--ink-soft); margin-top: 4px; }
.milestone__meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 9px; align-items: center; }
.milestone__deps { margin-top: 6px; font-size: 12px; color: var(--muted); }

.transition-band { margin-bottom: 20px; }
.transition-band__head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.transition-band__head h3 { font-size: 15px; }
.transition-band__head .quarter { font-size: 13px; color: var(--muted); }

/* stepper */
.stepper { display: flex; align-items: center; gap: 6px; margin-bottom: 18px; flex-wrap: wrap; }
.stepper__step { display: flex; align-items: center; gap: 8px; }
.stepper__node {
  width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px; color: #fff;
}
.stepper__line { width: 26px; height: 2px; background: var(--border-strong); }
.stepper__label { font-size: 12px; color: var(--muted); }

/* charts */
.chart { width: 100%; }
.chart svg { display: block; width: 100%; height: auto; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12.5px; color: var(--ink-soft); margin-top: 8px; }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.swatch { width: 11px; height: 11px; border-radius: 2px; display: inline-block; }
.chart-scroll { overflow-x: auto; }

/* matrix (2x2) */
.matrix { position: relative; }
.matrix__axis-label { font-size: 12px; color: var(--muted); }
.dot { cursor: pointer; }
.dot:hover { opacity: .8; }

/* footer */
.footer {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 18px 24px; border-top: 1px solid var(--border); background: var(--card);
  font-size: 12.5px; color: var(--muted);
}
.link-btn { background: none; border: none; color: var(--link); font-size: 12.5px; cursor: pointer; padding: 0; text-decoration: underline; }

/* callouts */
.note { font-size: 13px; color: var(--ink-soft); }
.note--gate { padding: 9px 12px; border-left: 3px solid var(--warn); background: var(--warn-bg); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }

/* search / audit detail */
.search-input { width: 100%; max-width: 420px; padding: 8px 12px; font-family: inherit; font-size: 13.5px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); color: var(--ink); background: var(--card); }

/* buttons */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: inherit; font-size: 13px; font-weight: 600; color: var(--ink);
  background: var(--card); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  padding: 7px 12px; cursor: pointer;
}
.btn:hover { background: var(--surface); }
.btn--primary { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn--primary:hover { background: var(--ink-soft); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* tooltip */
.tooltip {
  position: absolute; z-index: 60; pointer-events: none;
  background: var(--ink); color: #fff; font-size: 12px; line-height: 1.4;
  padding: 7px 10px; border-radius: 6px; max-width: 300px; box-shadow: var(--shadow-lg);
}
.tooltip--light { background: var(--card); color: var(--ink); border: 1px solid var(--border); }

/* responsive */
@media (max-width: 1024px) {
  .grid--4 { grid-template-columns: repeat(2, 1fr); }
  .checklist-levels { grid-template-columns: repeat(5, 1fr); }
}
@media (max-width: 768px) {
  .topbar { padding: 10px 14px; flex-wrap: wrap; }
  .topbar__right { width: 100%; justify-content: space-between; }
  .title { font-size: 13.5px; }
  .tabs { top: 105px; padding: 0 14px; }
  .main { padding: 20px 14px 44px; }
  .grid--2, .grid--3, .grid--4 { grid-template-columns: 1fr; }
  .checklist-levels { grid-template-columns: repeat(5, 1fr); gap: 6px; }
  .level-card { padding: 10px 4px; }
}
@media (max-width: 640px) {
  .checklist-levels { grid-template-columns: repeat(2, 1fr); }
  .kpi__value { font-size: 24px; }
  .sbu-select select { max-width: 200px; }
}

/* reduced motion */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* focus visibility */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* ---------------------------------------------------------------- print */
@media print {
  @page { size: A4 landscape; margin: 12mm; }
  .topbar, .tabs, .footer, .section__actions, .filters, .theme-toggle, .sbu-select, .btn {
    display: none !important;
  }
  body { background: #fff; color: #000; }
  .main { padding: 0; max-width: none; }
  .card { box-shadow: none; border: 1px solid #ccc; break-inside: avoid; }
  .section { break-after: page; }
  .checklist-group { break-inside: auto; }
  .checklist-items { display: block !important; }
  .checklist-group .checklist-items { display: block !important; }
  a { color: #000; text-decoration: none; }
}
