/* =====================================================================
 * ionik-dashboard.css — adaptive dashboard
 * ---------------------------------------------------------------------
 * Layout follows the reference: a stats column sitting beside the
 * history chart, a syllabus table with right-aligned topic names against
 * banded columns and a per-row evidence grid.
 *
 * Colour is DATA. The five-step ramp is the only place new colour
 * enters, and it is mixed from the existing --r-green / --r-amber /
 * --r-red into the cream ground so the page still reads as Ionik.
 *
 * Load order:
 *   ionik-cream.css -> ionik-motion.css -> ionik-mark-panel.css
 *   -> ionik-dashboard.css
 * ===================================================================== */

:root {
  --p1: color-mix(in srgb, var(--r-red)   74%, var(--bg-2));
  --p2: color-mix(in srgb, var(--r-amber) 64%, var(--bg-2));
  --p3: color-mix(in srgb, var(--r-green) 36%, var(--bg-2));
  --p4: color-mix(in srgb, var(--r-green) 64%, var(--bg-2));
  --p5: color-mix(in srgb, var(--r-green) 92%, var(--bg-2));
  --p-thin: color-mix(in srgb, var(--ink) 13%, var(--bg-2));
}

/* Demo marker: see the note in ionik-adaptive-dock.css. */
.db-demo {
  margin-bottom: 16px; padding: 10px 14px;
  border: 1px dashed color-mix(in srgb, var(--r-amber) 50%, var(--rule));
  border-radius: var(--r-sm);
  font-size: 11.5px; color: var(--r-amber); line-height: 1.5;
}

/* ── Chrome ──────────────────────────────────────────────────────── */

.db-tabs {
  display: flex; justify-content: center; gap: 30px;
  border-bottom: 1px solid var(--rule); margin-bottom: 18px;
}
.db-tab {
  appearance: none; border: 0; background: transparent;
  font-family: var(--sans); font-size: 13px; font-weight: 500;
  color: var(--ink-faint); padding: 11px 2px; cursor: pointer;
  border-bottom: 1px solid transparent; margin-bottom: -1px;
  display: inline-flex; align-items: center; gap: 7px;
}
.db-tab:hover { color: var(--ink-muted); }
.db-tab.on { color: var(--ink); border-bottom-color: var(--ink); }
.db-tab svg { opacity: 0.75; }

.db-select {
  appearance: none; font-family: var(--sans); font-size: 12.5px;
  color: var(--ink); background: var(--bg-2);
  border: 1px solid var(--rule); border-radius: var(--r-sm);
  padding: 9px 30px 9px 13px; cursor: pointer;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--ink-muted) 50%),
    linear-gradient(135deg, var(--ink-muted) 50%, transparent 50%);
  background-position: right 14px top 17px, right 9px top 17px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

/* Section title — a step up in size with a hairline under it, so the
   page reads as a document with sections rather than a stack of cards. */
.db-title {
  display: flex; align-items: baseline; gap: 12px;
  font-size: 17px; font-weight: 500; letter-spacing: -0.015em;
  color: var(--ink);
}
.db-title .div { color: var(--ink-faint); font-weight: 300; }
.db-title .sub { font-size: 12.5px; color: var(--ink-muted); font-weight: 400; }
.db-title-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; margin-bottom: 18px; flex-wrap: wrap;
}

.db-pane { display: none; }
.db-pane.on { display: block; }

/* ── Overview: stats column + chart ──────────────────────────────── */

.db-hero {
  display: grid;
  grid-template-columns: 268px minmax(0, 1fr);
  gap: 0;
}
.db-hero-l { padding: 4px 26px 4px 2px; border-right: 1px solid var(--rule-soft); }
.db-hero-r { padding: 4px 2px 4px 26px; min-width: 0; }

.db-band-lb {
  font-size: 15px; font-weight: 500; color: var(--ink);
  display: flex; align-items: center; gap: 8px;
}
.db-band-lb em { font-style: normal; font-size: 12px; color: var(--ink-faint); font-weight: 400; }
.db-info {
  width: 17px; height: 17px; border-radius: 50%;
  border: 1px solid var(--rule); background: transparent;
  color: var(--ink-faint); cursor: pointer; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
}
.db-info:hover { background: var(--panel); color: var(--ink); }

.db-big {
  font-size: 44px; font-weight: 500; letter-spacing: -0.035em;
  color: var(--ink); margin-top: 10px; line-height: 1;
  font-variant-numeric: tabular-nums;
}
.db-big small {
  font-size: 19px; font-weight: 400; color: var(--ink-faint);
  margin-left: 9px; letter-spacing: -0.02em;
}

.db-stat { padding: 15px 0 0; margin-top: 15px; border-top: 1px solid var(--rule-soft); }
.db-stat-top {
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
}
.db-stat-l { font-size: 12.5px; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.db-stat-r { font-size: 12.5px; color: var(--ink); font-weight: 600; white-space: nowrap; }
.db-stat-r span {
  font-size: 9.5px; font-weight: 500; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--ink-faint); margin-left: 6px;
}
.db-stat-sub {
  font-size: 11.5px; color: var(--ink-faint); margin-top: 9px;
  font-variant-numeric: tabular-nums;
}
.db-stat-sub .up   { color: var(--r-green); }
.db-stat-sub .down { color: var(--r-red); }

.db-meter { height: 4px; background: var(--panel-2); border-radius: var(--r-pill);
            margin-top: 9px; overflow: hidden; }
.db-meter i { display: block; height: 100%; background: var(--ink); border-radius: var(--r-pill); }
.db-meter.thin i { background: var(--ink-faint); }
.db-meter.p1 i { background: var(--p1); } .db-meter.p2 i { background: var(--p2); }
.db-meter.p3 i { background: var(--p3); } .db-meter.p4 i { background: var(--p4); }
.db-meter.p5 i { background: var(--p5); }

/* ── Chart ───────────────────────────────────────────────────────── */

/* An instrument plot: ruled grid, ticks on both axes, explicit whiskers.
   Everything is hairline weight so the data line stays the darkest mark. */
.db-chart-wrap { position: relative; }
.db-chart { width: 100%; height: auto; display: block; overflow: visible; }
.db-chart .ax   { stroke: var(--rule); stroke-width: 1; }
.db-chart .tk   { stroke: var(--rule); stroke-width: 1; }
.db-chart .gl   { stroke: var(--rule-faint); stroke-width: 1; }
.db-chart .cut  { stroke: var(--rule); stroke-width: 1; stroke-dasharray: 2 3; }
.db-chart .band { fill: color-mix(in srgb, var(--ink) 9%, transparent); }
.db-chart .line { fill: none; stroke: var(--ink); stroke-width: 1.7;
                  stroke-linejoin: round; stroke-linecap: round; }
.db-chart .wk   { stroke: var(--ink-muted); stroke-width: 1.2; }
.db-chart .pt   { fill: var(--bg-2); stroke: var(--ink); stroke-width: 1.4; }
.db-chart .lbl  { fill: var(--ink-faint); font-family: var(--sans); font-size: 9.5px;
                  font-variant-numeric: tabular-nums; }
.db-chart .cutl { fill: var(--ink-muted); }
.db-chart .ax-t { letter-spacing: 0.08em; }
.db-chart .hit  { cursor: crosshair; }
.db-chart .xh-l { stroke: var(--ink-muted); stroke-width: 1; stroke-dasharray: 2 2; }
.db-chart .xh-d { fill: var(--ink); }

/* Crosshair readout — pinned, so the eye does not chase a floating tip. */
.db-read {
  position: absolute; top: 0; right: 0;
  display: flex; align-items: baseline; gap: 10px;
  background: var(--bg-3); border: 1px solid var(--rule);
  border-radius: var(--r-sm); padding: 6px 11px;
  font-size: 11px; color: var(--ink-muted);
  font-variant-numeric: tabular-nums; pointer-events: none;
}
.db-read b { color: var(--ink); font-weight: 600; }
.db-read .m { font-size: 15px; color: var(--ink); font-weight: 500; }

.db-chart-empty {
  height: 176px; display: flex; align-items: center; justify-content: center;
  font-size: 12px; color: var(--ink-faint);
  border: 1px dashed var(--rule); border-radius: var(--r-sm);
}

/* ── Syllabus table ──────────────────────────────────────────────── */

.db-syl { position: relative; }
.db-syl-head, .db-syl-row {
  display: grid;
  grid-template-columns: 196px minmax(150px, 1fr) 198px;
  align-items: center; gap: 0;
}
.db-syl-head {
  font-size: 9.5px; letter-spacing: 0.13em; text-transform: uppercase;
  color: var(--ink-faint); padding-bottom: 12px;
}
.db-syl-head .lb { text-align: right; padding-right: 18px; }

/* Band columns are ruled, the way the reference separates E2/E3/E4. */
.db-scale { position: relative; height: 13px; }
.db-scale span { position: absolute; transform: translateX(-50%); white-space: nowrap; }

.db-syl-row { border-top: 1px solid var(--rule-faint); }
.db-syl-row:first-of-type { border-top: 1px solid var(--rule); }

.db-syl-name {
  text-align: right; padding: 14px 18px 14px 0; min-width: 0;
}
.db-syl-name b {
  display: block; font-size: 12.5px; font-weight: 500; color: var(--ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.db-syl-name i { font-style: normal; font-size: 10px; color: var(--ink-faint); }
.db-syl-row.dim .db-syl-name b { color: var(--ink-faint); font-weight: 400; }

.db-plot {
  position: relative; height: 100%; min-height: 52px;
  border-left: 1px solid var(--rule-soft);
  border-right: 1px solid var(--rule-soft);
}
.db-plot .gl { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--rule-faint); }
.db-bar-line { position: absolute; top: 50%; height: 1px; background: var(--ink-muted); }
.db-bar-cap  { position: absolute; top: 50%; width: 1px; height: 11px;
               margin-top: -5.5px; background: var(--ink-muted); }
.db-bar-mid  {
  position: absolute; top: 50%; width: 9px; height: 9px;
  margin: -4.5px 0 0 -4.5px; border-radius: 50%;
  background: var(--bg-2); border: 1.5px solid var(--ink); z-index: 2;
}
.db-bar-mid::before { content: ''; position: absolute; inset: -9px; border-radius: 50%; }
.db-bar-mid::after {
  content: attr(data-tip); position: absolute; left: 50%; bottom: 17px;
  transform: translateX(-50%); white-space: nowrap; pointer-events: none;
  padding: 5px 8px; border: 1px solid var(--rule); border-radius: 5px;
  background: var(--bg-2); color: var(--ink); font-size: 11px;
  box-shadow: 0 5px 16px rgba(0,0,0,.18); opacity: 0; visibility: hidden;
}
.db-bar-mid:hover::after { opacity: 1; visibility: visible; }
.db-plot .none {
  position: absolute; top: 50%; left: 10px; transform: translateY(-50%);
  font-size: 10.5px; color: var(--ink-faint);
}

/* Per-row evidence grid — the small squares on the right of each row. */
.db-mini {
  display: grid; grid-template-columns: repeat(10, 15px);
  gap: 3px; padding: 12px 0 12px 18px; justify-content: start;
}
.db-mini i {
  width: 15px; height: 15px; border-radius: 3px;
  border: 1px solid var(--rule-soft); background: transparent;
  display: block;
}
.db-mini i.s1 { background: var(--p1); border-color: var(--p1); }
.db-mini i.s2 { background: var(--p2); border-color: var(--p2); }
.db-mini i.s3 { background: var(--p3); border-color: var(--p3); }
.db-mini i.s4 { background: var(--p4); border-color: var(--p4); }
.db-mini i.s5 { background: var(--p5); border-color: var(--p5); }
.db-mini i.thin { background: var(--p-thin); border-color: var(--p-thin); }

/* ── Knowledge map ───────────────────────────────────────────────── */

.db-map-scroll { overflow-x: auto; padding-bottom: 10px; }
.db-map { display: grid; grid-template-columns: 210px repeat(10, 32px);
          gap: 6px; align-items: center; min-width: 590px; }
.db-map-vhd {
  font-size: 10px; letter-spacing: 0.05em; text-transform: uppercase;
  color: var(--ink-faint); writing-mode: vertical-rl; transform: rotate(180deg);
  height: 66px; justify-self: center;
}
.db-map-row-lb {
  font-size: 12.5px; color: var(--ink-soft); padding-right: 10px; text-align: right;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.db-map-grp {
  grid-column: 1 / -1; display: flex; align-items: center; gap: 10px;
  margin: 13px 0 4px;
}
.db-map-grp:first-of-type { margin-top: 0; }
.db-map-grp b {
  font-size: 9px; letter-spacing: 0.13em; text-transform: uppercase;
  font-weight: 600; color: var(--ink-muted); white-space: nowrap;
}
.db-map-grp i {
  font-style: normal; font-size: 10px; color: var(--ink-faint);
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.db-map-grp .ln { flex: 1; height: 1px; background: var(--rule); }

.db-cell { width: 32px; height: 32px; border-radius: 5px;
           border: 1px solid var(--rule-soft); background: transparent;
           cursor: pointer; }
/* Hover lifts the square out of the grid rather than recolouring it —
   the colour is data and must not change under the pointer. */
.db-cell:hover, .db-cell:focus-visible {
  outline: 2px solid var(--ink); outline-offset: 1px;
  transform: scale(1.08); position: relative; z-index: 2;
}
.db-map-info { margin-left: auto; width: 27px; height: 27px; border: 1px solid var(--rule); border-radius: 50%; background: var(--bg-2); color: var(--ink-soft); display: inline-grid; place-items: center; cursor: pointer; }
.db-map-info:hover { transform: scale(1.1); color: var(--ink); }
.db-map-info:active { transform: scale(.95); }
.db-map-help { margin: 12px 0 18px; padding: 11px 14px; border: 1px solid var(--rule-soft); border-radius: var(--r-sm); background: var(--bg-2); color: var(--ink-soft); font-size: 12px; line-height: 1.5; }
.db-map-help[hidden] { display: none; }
.db-mini i { cursor: pointer; }
.db-mini i:hover, .db-mini i:focus-visible {
  outline: 1.5px solid var(--ink); outline-offset: 1px;
  transform: scale(1.3); position: relative; z-index: 2;
}
.db-syl-row:hover { background: var(--panel); }
.db-table tbody tr:hover td { background: var(--panel); }
.db-cov-row:hover .lb { color: var(--ink); }
.db-cell.s1 { background: var(--p1); border-color: var(--p1); }
.db-cell.s2 { background: var(--p2); border-color: var(--p2); }
.db-cell.s3 { background: var(--p3); border-color: var(--p3); }
.db-cell.s4 { background: var(--p4); border-color: var(--p4); }
.db-cell.s5 { background: var(--p5); border-color: var(--p5); }
.db-cell.thin { background: var(--p-thin); border-color: var(--p-thin); }
.db-cell.na {
  background: repeating-linear-gradient(45deg, transparent 0 3px, var(--rule-soft) 3px 4px);
  border-color: var(--rule-faint);
}

.db-legend { display: flex; flex-wrap: wrap; gap: 13px; margin-top: 16px;
             font-size: 10px; color: var(--ink-faint); }
.db-legend span { display: inline-flex; align-items: center; gap: 5px; }
.db-legend i { width: 11px; height: 11px; border-radius: 2px;
               border: 1px solid var(--rule-soft); display: inline-block; }
.db-legend i.s1 { background: var(--p1); border-color: var(--p1); }
.db-legend i.s2 { background: var(--p2); border-color: var(--p2); }
.db-legend i.s3 { background: var(--p3); border-color: var(--p3); }
.db-legend i.s4 { background: var(--p4); border-color: var(--p4); }
.db-legend i.s5 { background: var(--p5); border-color: var(--p5); }
.db-legend i.thin { background: var(--p-thin); border-color: var(--p-thin); }

.db-prio-txt { font-size: 12px; color: var(--ink-soft); line-height: 1.55;
               margin-top: 7px; max-width: 62ch; }

.db-side-sec { padding: 16px 0; border-top: 1px solid var(--rule-soft); }
.db-side-sec:first-child { padding-top: 0; border-top: 0; }

.db-cov-row { display: flex; justify-content: space-between; align-items: baseline;
              gap: 10px; font-size: 11px; margin-top: 11px; }
.db-cov-row:first-child { margin-top: 0; }
.db-cov-row .lb { color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis;
                  white-space: nowrap; }

.db-sort { display: flex; gap: 12px; font-size: 10px; margin-bottom: 12px; }
.db-sort button { appearance: none; border: 0; background: transparent; padding: 0;
                  font-family: var(--sans); font-size: 10px; color: var(--ink-faint);
                  cursor: pointer; }
.db-sort button.on { color: var(--ink); font-weight: 600; }

/* ── Skill table (Overview, below the fold) ──────────────────────── */

.db-table { width: 100%; border-collapse: collapse; }
.db-table th {
  font-size: 9.5px; letter-spacing: 0.11em; text-transform: uppercase;
  color: var(--ink-faint); font-weight: 600; text-align: right;
  padding: 0 0 10px; border-bottom: 1px solid var(--rule); white-space: nowrap;
}
.db-table th:first-child { text-align: left; }
.db-table td { font-size: 12px; color: var(--ink-soft); text-align: right;
               padding: 10px 0; border-bottom: 1px solid var(--rule-faint);
               font-variant-numeric: tabular-nums; white-space: nowrap; }
.db-table td:first-child { text-align: left; color: var(--ink); font-weight: 500;
                           white-space: normal; }
.db-table tr:last-child td { border-bottom: 0; }
.db-table td.mute { color: var(--ink-faint); }
.db-table td .up { color: var(--r-green); } .db-table td .down { color: var(--r-red); }
.db-table .sub { display: block; font-size: 10px; color: var(--ink-faint); font-weight: 400; }
.db-table-scroll { overflow-x: auto; }

.db-inline { position: relative; height: 5px; width: 66px; display: inline-block;
             background: var(--panel-2); border-radius: var(--r-pill); vertical-align: middle; }
.db-inline i { position: absolute; left: 0; top: 0; bottom: 0;
               border-radius: var(--r-pill); background: var(--ink-muted); }

/* ── Narrow ──────────────────────────────────────────────────────── */

@media (max-width: 940px) {
  .db-hero { grid-template-columns: minmax(0, 1fr); }
  .db-hero-l { border-right: 0; border-bottom: 1px solid var(--rule-soft);
               padding: 0 0 18px; margin-bottom: 18px; }
  .db-hero-r { padding: 0; }
  .db-split { grid-template-columns: minmax(0, 1fr); }
  .db-syl-head, .db-syl-row { grid-template-columns: 120px minmax(110px, 1fr) 0; }
  .db-mini { display: none; }
}
