/* =====================================================================
   Nigraan demo - chart and widget styles
   Purpose : SVG chart marks, the 12-district tile board, legends, feed,
             funnel, meters, heat table, segmented bar, district x domain
             matrix and sparklines.
   Related : js/core/charts.js, js/modules/dashboard.js
   Version : 0.2
   ===================================================================== */
.chart { width: 100%; display: block; overflow: visible; }
.chart text { font-family: var(--f-text); fill: var(--ink-2); font-size: 12px; }
.chart .tick { fill: var(--muted); font-size: 11.5px; font-variant-numeric: tabular-nums; }
.chart .lbl-strong { fill: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.chart .lbl-sel { fill: var(--brand-ink); font-weight: 700; }
.chart .grid line { stroke: var(--grid); stroke-width: 1; }
.chart .base { stroke: var(--axis); stroke-width: 1; }
.chart .hit { fill: transparent; }
.chart .mark { transition: opacity .15s; }
.chart.has-sel .mark.dim { opacity: .28; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 12.5px; color: var(--ink-2); margin-bottom: 8px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.legend i.line { height: 2px; border-radius: 1px; width: 16px; }
.legend i.dash { height: 0; border-top: 2px dashed; width: 16px; border-radius: 0; background: none !important; }

/* ---------- 12-district tile board ---------- */
.board-wrap { display: flex; gap: 16px; align-items: flex-start; }
.board { --t: 52px; display: grid; grid-template-columns: repeat(4, var(--t)); grid-template-rows: repeat(6, var(--t)); gap: 5px; flex: none; }
.board.lg { --t: 70px; gap: 6px; }
.board.xl { --t: 84px; gap: 7px; }
.board.sm { --t: 30px; gap: 3px; }
.tile {
  border-radius: 7px; border: 0; padding: 5px 6px; text-align: left; position: relative; display: flex; flex-direction: column; justify-content: space-between;
  background: var(--surface-2); color: var(--ink); font-size: 10.5px; line-height: 1.12; font-weight: 600; min-width: 0; cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease, opacity .15s;
}
.tile:hover { transform: translateY(-1px); box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--ink-2); }
.tile .tcode { font-weight: 700; opacity: .9; font-size: 10px; }
.tile .tv { font-family: var(--f-display); font-size: 13.5px; font-weight: 700; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile .tn { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board.lg .tile { padding: 7px 7px; font-size: 10.5px; letter-spacing: -0.01em; }
.board.lg .tile .tv { font-size: 17px; }
.board.xl .tile { padding: 8px 9px; font-size: 12px; }
.board.xl .tile .tv { font-size: 19px; }
.board.sm .tile { padding: 0; display: grid; place-items: center; font-size: 9.5px; }
.tile.lv0 { background: #dff0df; color: #0a4a0a; }
.tile.lv1 { background: #ffefc4; color: #5c3e00; }
.tile.lv2 { background: #fbd8c6; color: #7c2f0f; }
.tile.lv3 { background: var(--critical); color: #fff; }
.tile .ti { position: absolute; bottom: 6px; right: 6px; }
.board.sm .tile .ti { display: none; }
.tile.txt .tv { font-size: 10px; letter-spacing: 0; }
.board.has-sel .tile { opacity: .35; }
.board.has-sel .tile.sel { opacity: 1; box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--brand-ink); }
.board-legend { display: flex; flex-direction: column; gap: 8px; font-size: 12.5px; color: var(--ink-2); min-width: 0; }
.board-legend .row { display: flex; align-items: center; gap: 7px; }
.board-wrap.stack { flex-direction: column; gap: 12px; }
.board-wrap.stack .board-legend { flex-direction: row; flex-wrap: wrap; gap: 6px 14px; }
.vramp { display: flex; gap: 8px; align-items: stretch; }
.vr-sw { display: flex; flex-direction: column; gap: 2px; }
.vr-sw i { width: 16px; height: 13px; border-radius: 3px; display: block; }
.vr-lab { display: flex; flex-direction: column; justify-content: space-between; font-size: 11.5px; color: var(--muted); }
.sw { width: 14px; height: 14px; border-radius: 4px; flex: none; display: inline-block; }

/* ---------- feed ---------- */
.feed { list-style: none; margin: 0; padding: 0; }
.feed li { display: grid; grid-template-columns: 16px 1fr; gap: 9px; padding: 8px 0; border-top: 1px solid var(--line); }
.feed li:first-child { border-top: 0; padding-top: 0; }
.feed .t { font-size: 13px; font-weight: 600; line-height: 1.3; }
.feed .m { font-size: 12px; color: var(--muted); margin-top: 2px; }
.feed li.new .t::after { content: "New"; margin-left: 8px; font-size: 10.5px; font-weight: 700; color: var(--gold-ink); background: var(--gold-tint); border-radius: 99px; padding: 1px 7px; }

/* ---------- meters, funnel, segments ---------- */
.mrow { display: grid; grid-template-columns: minmax(0, 1fr) minmax(70px, 130px) 84px; gap: 10px; align-items: center; padding: 7px 0; border-top: 1px solid var(--line); font-size: 13px; }
.mrow:first-child { border-top: 0; }
.mrow .v { display: inline-flex; align-items: center; justify-content: flex-end; gap: 5px; font-variant-numeric: tabular-nums; color: var(--ink-2); white-space: nowrap; }
.pbar { height: 8px; border-radius: 999px; background: var(--q1); position: relative; overflow: hidden; }
.pbar i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 999px; background: var(--s1); }
.fstep { margin: 0 0 10px; }
.fstep .l { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; margin-bottom: 4px; }
.fstep .b { height: 14px; border-radius: 0 4px 4px 0; min-width: 3px; }
.segtall { display: flex; gap: 2px; height: 34px; border-radius: 4px; overflow: hidden; margin: 4px 0 12px; }
.segtall div { display: flex; align-items: center; padding-left: 8px; font-size: 12.5px; font-weight: 600; color: #fff; white-space: nowrap; min-width: 0; border-radius: 4px; }
.list-plain { list-style: none; padding: 0; margin: 0; }
.list-plain li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 13px; }
.list-plain li:first-child { border-top: 0; }
.list-plain .v { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---------- heat table ---------- */
.heat { table-layout: fixed; }
.heat th { font-size: 11.5px; padding: 0 2px 6px; white-space: normal; text-align: center; color: var(--muted); font-weight: 600; }
.heat th:first-child { width: 86px; text-align: left; }
.heat td { border-bottom: 0; padding: 0; }
.heat td.h { padding: 4px 2px; font-size: 11.5px; text-align: center; border: 2px solid var(--surface); border-radius: 5px; font-weight: 600; font-variant-numeric: tabular-nums; }
.heat td.dname { font-size: 12px; padding: 2px 4px 2px 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.heat tr.sel td.dname { color: var(--brand-ink); }
.heat.has-sel tr:not(.sel) td.h { opacity: .35; }

/* ---------- district x domain matrix (command centre) ---------- */
.matrix { table-layout: fixed; width: 100%; }
.matrix th { font-size: 10.5px; color: var(--muted); font-weight: 700; padding: 0 0 6px; text-align: center; white-space: nowrap; letter-spacing: -.01em; }
.matrix th.rowh { text-align: left; width: 158px; }
.matrix td { padding: 1px; }
.matrix td.rh { font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-right: 6px; }
.matrix td.rh a { color: var(--ink); text-decoration: none; }
.matrix td.rh a:hover { color: var(--brand-ink); text-decoration: underline; }
.mcell { display: grid; place-items: center; height: 22px; border-radius: 4px; border: 0; width: 100%; padding: 0; cursor: pointer; }
.mcell.lv0 { background: #e6f3e6; } .mcell.lv1 { background: #fff2cf; } .mcell.lv2 { background: #fcdccc; } .mcell.lv3 { background: #f4c4c4; }
.mcell.off { background: repeating-linear-gradient(45deg, var(--surface-2) 0 4px, var(--line) 4px 5px); cursor: default; }
.mcell:hover { box-shadow: 0 0 0 2px var(--ink-2); }

/* ---------- misc ---------- */
.spark { display: inline-block; vertical-align: middle; }
.bigstat { font-family: var(--f-display); font-size: 34px; font-weight: 750; letter-spacing: -0.015em; line-height: 1; }
.tview { max-height: 320px; overflow: auto; }
.tview table { font-size: 12.5px; }
.chartbox { min-height: 120px; }
