/* ===========================================================
   AIB Homes Tracking Dashboard — shared styles
   Designed by deciZr (an Opinions company) for AIB
   =========================================================== */

:root {
  /* AIB brand palette (purple) */
  --aib-purple:        #7E2881;
  --aib-purple-dark:   #4D1750;
  --aib-purple-mid:    #A85BAA;
  --aib-purple-light:  #D2A8D5;
  --aib-lavender:      #E8D4EA;
  --aib-lavender-soft: #F5EEF6;
  --aib-gold:          #C69431;   /* accent for partner/secondary bars */
  --aib-gold-soft:     #EFD99C;

  --ink:        #1C1420;
  --ink-soft:   #3A2E3D;
  --muted:      #716774;
  --muted-soft: #A299A5;
  --panel:      #ffffff;
  --bg:         #F7F4F8;
  --border:     #E4DBE6;
  --border-soft: #F0EAF1;
  --alert:      #B12A2A;

  /* Chart palette (AIB-led, with partner colours for multi-brand) */
  --chart-1: #7E2881;   /* AIB primary */
  --chart-2: #A85BAA;   /* secondary purple */
  --chart-3: #D2A8D5;   /* tertiary */
  --chart-4: #E8D4EA;   /* softest */
  --chart-5: #C69431;   /* gold accent */
  --chart-6: #8A7D8D;   /* neutral */

  /* Brand-specific colours — sampled from each brand's logo (Colour Guidance.docx) */
  --brand-aib:     #7E2881;   /* AIB mulberry */
  --brand-boi:     #0033A0;   /* BOI blue */
  --brand-ptsb:    #E94E1B;   /* PTSB orange */
  --brand-ebs:     #C41E1E;   /* EBS red */
  --brand-haven:   #7CB82E;   /* Haven green */
  --brand-revolut: #1A1A1A;   /* Revolut black */
  --brand-cu:      #6B8E6B;   /* Credit Union (neutral sage - no single brand) */
  --brand-anyaib:  #4D1750;   /* AIB dark for NET/ANY AIB */

  /* Brand gradient pairs (light -> dark) for funnel fills */
  --brand-aib-light:     #A85BAA; --brand-aib-dark:     #4D1750;
  --brand-boi-light:     #4D6FCC; --brand-boi-dark:     #001F66;
  --brand-ptsb-light:    #FF8052; --brand-ptsb-dark:    #B53700;
  --brand-ebs-light:     #E85050; --brand-ebs-dark:     #8C1313;
  --brand-haven-light:   #A8D457; --brand-haven-dark:   #547D20;
  --brand-revolut-light: #4A4A4A; --brand-revolut-dark: #0F0F0F;

  /* Heatmap scale (light -> dark AIB purple) */
  --heat-0:   #F5EEF6;
  --heat-25:  #D2A8D5;
  --heat-50:  #A85BAA;
  --heat-75:  #7E2881;
  --heat-100: #4D1750;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.4;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---------- Header ---------- */
header.app-header {
  background: #fff;
  border-bottom: 3px solid var(--aib-purple);
  padding: 12px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex: none;
}
header.app-header .left { display: flex; align-items: center; gap: 20px; }
header.app-header img.aib { height: 38px; }
header.app-header .home-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 4px;
  background: var(--aib-lavender-soft);
  color: var(--aib-purple-dark);
  text-decoration: none;
  border: 1px solid transparent;
  transition: background .12s, border-color .12s;
}
header.app-header .home-link:hover { background: var(--aib-lavender); border-color: var(--aib-purple); }
header.app-header .home-link svg { width: 18px; height: 18px; }
header.app-header .titles h1 {
  font-size: 20px;
  font-weight: 700;
  color: var(--aib-purple-dark);
  margin: 0;
  letter-spacing: 0.2px;
}
header.app-header .titles .sub { font-size: 12px; color: var(--muted); margin-top: 3px; }
header.app-header img.opinions { height: 30px; opacity: 0.85; }

/* ---------- Rolling note ---------- */
.rolling-note {
  background: var(--aib-lavender);
  color: var(--aib-purple-dark);
  padding: 6px 28px;
  font-size: 12px;
  font-weight: 500;
  border-bottom: 1px solid var(--border);
  flex: none;
}

/* ---------- Main ---------- */
main {
  padding: 18px 28px 60px;
  flex: 1;
}

/* ---------- Filters bar ---------- */
.filters {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 14px 18px;
  margin-bottom: 18px;
  box-shadow: 0 1px 2px rgba(77,23,80,0.04);
}
.filters h2 {
  font-size: 11px;
  font-weight: 600;
  color: var(--aib-purple-dark);
  margin: 0 0 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
/* 9 filter dropdowns: 5 across on row 1, 4 across on row 2.
   Uses a 20-column micro-grid; items 1–5 span 4 cols each (5×4 = 20),
   items 6–9 span 5 cols each (4×5 = 20). */
.filter-grid {
  display: grid;
  grid-template-columns: repeat(20, 1fr);
  gap: 10px 14px;
}
.filter-grid > .ms { grid-column: span 4; }
.filter-grid > .ms:nth-child(n+6) { grid-column: span 5; }
@media (max-width: 1100px) {
  .filter-grid { grid-template-columns: repeat(3, 1fr); }
  .filter-grid > .ms,
  .filter-grid > .ms:nth-child(n+6) { grid-column: span 1; }
}
@media (max-width: 700px) {
  .filter-grid { grid-template-columns: repeat(2, 1fr); }
}

/* multi-select dropdown */
.ms { position: relative; }
.ms-label {
  display: block;
  font-size: 10px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 4px;
}
.ms-button {
  width: 100%;
  padding: 6px 28px 6px 10px;
  font-size: 12px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
  position: relative;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: inherit;
}
.ms-button:hover { border-color: var(--aib-purple); }
.ms-button:focus { outline: none; border-color: var(--aib-purple); box-shadow: 0 0 0 2px rgba(126,40,129,0.18); }
.ms-button::after {
  content: "";
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-25%) rotate(45deg);
  width: 5px;
  height: 5px;
  border-right: 1.5px solid var(--muted);
  border-bottom: 1.5px solid var(--muted);
  pointer-events: none;
}
.ms-popup {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  min-width: 220px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 4px;
  box-shadow: 0 4px 16px rgba(77,23,80,0.14);
  z-index: 100;
  display: none;
  max-height: 280px;
  overflow-y: auto;
  padding: 4px 0;
}
.ms.open .ms-popup { display: block; }
.ms-actions {
  display: flex;
  gap: 8px;
  padding: 4px 10px 6px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}
.ms-actions button {
  background: none; border: none;
  color: var(--aib-purple-dark);
  font-size: 10px; font-weight: 600;
  cursor: pointer; padding: 2px 4px;
  text-transform: uppercase; letter-spacing: 0.4px;
}
.ms-actions button:hover { text-decoration: underline; }
.ms-option {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 12px; cursor: pointer;
  font-size: 12px; user-select: none;
}
.ms-option:hover { background: var(--aib-lavender-soft); }
.ms-option input[type="checkbox"] {
  margin: 0; accent-color: var(--aib-purple); cursor: pointer;
  width: 14px; height: 14px; flex: none;
}
.ms-option .opt-label { flex: 1; }

.filter-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 10px;
}
.btn-reset {
  background: #fff;
  border: 1px solid var(--aib-purple);
  color: var(--aib-purple-dark);
  padding: 5px 12px;
  font-size: 11px; font-weight: 600;
  border-radius: 4px; cursor: pointer;
  text-transform: uppercase; letter-spacing: 0.4px;
}
.btn-reset:hover { background: var(--aib-lavender); }

/* ---------- Panel grid ---------- */
.panel-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.panel-grid .span-2 { grid-column: 1 / -1; }

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 16px 18px 14px;
  box-shadow: 0 1px 2px rgba(77,23,80,0.04);
  display: flex;
  flex-direction: column;
}
.panel h3 {
  font-size: 17px;
  font-weight: 700;
  color: var(--aib-purple-dark);
  margin: 0 0 12px;
  letter-spacing: 0.2px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}
.panel h3 .panel-tag {
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.panel .body { flex: 1; display: flex; flex-direction: column; }
.panel .base {
  font-size: 10px;
  color: var(--muted);
  margin-top: 10px;
  border-top: 1px solid var(--border-soft);
  padding-top: 6px;
}
.panel .base.low { color: var(--alert); font-weight: 600; }

/* Inline delta (Δ vs Total) indicator — reusable across legends, bars, pies */
.v-delta {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  font-size: 11px;
  margin-left: 4px;
}
.v-delta.up   { color: var(--aib-purple-dark); }
.v-delta.down { color: var(--alert); }
.v-delta.flat { color: var(--muted); }
.v-delta.big { font-size: 13px; }

/* vbar (Property Types etc.) — delta below the big % number */
.vbar-col .vbar-delta {
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  margin-bottom: 4px;
}
.vbar-col .vbar-delta.up { color: var(--aib-purple-dark); }
.vbar-col .vbar-delta.down { color: var(--alert); }
.vbar-col .vbar-delta.flat { color: var(--muted); }

/* Pie delta under the big % */
.pie-cell .pie-delta {
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  margin-top: 2px;
}
.pie-cell .pie-delta.up { color: var(--aib-purple-dark); }
.pie-cell .pie-delta.down { color: var(--alert); }
.pie-cell .pie-delta.flat { color: var(--muted); }

/* Insufficient data placeholder */
.no-data-note {
  flex: 1;
  min-height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
  margin: 10px 0;
  background: var(--aib-lavender-soft);
  border: 1.5px dashed var(--muted-soft);
  border-radius: 6px;
  color: var(--muted);
  font-size: 13px;
  font-style: italic;
  line-height: 1.5;
  letter-spacing: 0.1px;
}

/* ---------- Stacked bar (100%) ---------- */
.stacked-bar {
  display: flex;
  width: 100%;
  height: 64px;
  border-radius: 5px;
  overflow: hidden;
  background: var(--border-soft);
  margin: 16px 0 10px;
  box-shadow: 0 1px 3px rgba(77,23,80,0.08);
}
.stacked-bar .seg {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px; font-weight: 700;
  color: #fff;
  overflow: hidden;
  white-space: nowrap;
}
.stacked-bar .seg.txt-dark { color: var(--ink); }
.stacked-legend {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px 14px;
  margin-top: 10px;
  font-size: 12px;
}
.stacked-legend .item {
  display: flex; align-items: center; gap: 7px;
  padding: 4px 8px;
  background: var(--aib-lavender-soft);
  border-radius: 3px;
}
.stacked-legend .swatch {
  width: 12px; height: 12px; border-radius: 2px; flex: none;
}
.stacked-legend .label { color: var(--ink); font-weight: 500; }
.stacked-legend .pct {
  color: var(--muted); margin-left: auto;
  font-variant-numeric: tabular-nums; font-weight: 600;
}

/* ---------- Grouped horizontal bars ---------- */
.grouped {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 8px;
}
.grouped-row {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 12px;
  align-items: center;
}
.grouped-row .row-label {
  font-size: 13px; font-weight: 600;
  color: var(--ink); text-align: right;
}
.grouped-row .pair { display: flex; flex-direction: column; gap: 4px; }
.grouped-row .bar-wrap {
  position: relative; display: flex; align-items: center; gap: 8px;
}
.grouped-row .bar-wrap .legend-dot {
  width: 8px; height: 8px; border-radius: 50%; flex: none;
}
.grouped-row .bar-bg {
  flex: 1; height: 18px;
  background: var(--border-soft);
  border-radius: 3px;
  position: relative; overflow: hidden;
}
.grouped-row .bar-fill {
  height: 100%; border-radius: 3px;
}
.grouped-row .pct-label {
  font-size: 12px; font-variant-numeric: tabular-nums;
  font-weight: 700; color: var(--ink);
  min-width: 36px; text-align: right;
}
.grouped-legend {
  display: flex; gap: 16px; justify-content: flex-end;
  margin-bottom: 12px; font-size: 12px;
}
.grouped-legend .item { display: flex; align-items: center; gap: 6px; font-weight: 500; }
.grouped-legend .swatch { width: 12px; height: 12px; border-radius: 50%; }

/* ---------- Ranked horizontal bars ---------- */
.ranked {
  display: flex; flex-direction: column; gap: 6px; margin-top: 4px;
}
.ranked-row {
  display: grid;
  grid-template-columns: 1fr 88px;
  gap: 10px;
  align-items: center;
}
.ranked-row .label-bar {
  display: grid;
  grid-template-columns: 1fr 36px;
  gap: 8px;
  align-items: center;
}
.ranked-row .stmt { font-size: 12px; color: var(--ink); line-height: 1.25; }
.ranked-row .ranked-bar-wrap {
  height: 14px; background: var(--border-soft);
  border-radius: 3px; position: relative; overflow: hidden;
  margin-top: 4px; grid-column: 1 / -1;
}
.ranked-row .ranked-bar-fill {
  height: 100%; background: var(--aib-purple); border-radius: 3px;
}
.ranked-row .pct {
  font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums;
  color: var(--aib-purple-dark); text-align: right;
}
.ranked-row .delta {
  font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums;
  text-align: right; white-space: nowrap;
}
.ranked-row .delta.up   { color: var(--aib-purple-dark); }
.ranked-row .delta.down { color: var(--alert); }
.ranked-row .delta.flat { color: var(--muted); }

/* ---------- Line chart (SVG) ---------- */
.line-chart-wrap {
  position: relative;
  width: 100%;
  margin-top: 4px;
}
.line-chart-wrap svg { display: block; width: 100%; height: auto; }
.line-chart-legend {
  display: flex; flex-wrap: wrap; gap: 10px 14px;
  margin-top: 8px; font-size: 11px;
}
.line-chart-legend .item { display: flex; align-items: center; gap: 6px; }
.line-chart-legend .swatch-line {
  display: inline-block;
  width: 18px; height: 3px; border-radius: 2px;
}
.line-chart-legend .label { color: var(--ink); }

/* Small side table inside line-chart panel ("AIB v BOI") */
.inline-table {
  margin-top: 10px;
  background: var(--aib-lavender-soft);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 8px 10px;
}
.inline-table h4 {
  font-size: 11px;
  font-weight: 700;
  color: var(--aib-purple-dark);
  margin: 0 0 6px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.inline-table table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}
.inline-table th, .inline-table td {
  padding: 3px 4px;
  border-bottom: 1px solid var(--border-soft);
  font-variant-numeric: tabular-nums;
  text-align: center;
}
.inline-table th:first-child, .inline-table td:first-child { text-align: left; font-weight: 600; }
.inline-table th {
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.3px;
}
.inline-table tr:last-child td { border-bottom: 0; }
.inline-table .gap.pos { color: var(--aib-purple-dark); font-weight: 700; }
.inline-table .gap.neg { color: var(--alert);           font-weight: 700; }

/* ---------- Heatmap (brand x attribute) ---------- */
.heatmap-wrap {
  overflow-x: auto;
  margin-top: 4px;
}
table.heatmap {
  border-collapse: collapse;
  width: 100%;
  font-size: 11px;
}
table.heatmap th, table.heatmap td {
  padding: 5px 6px;
  border: 1px solid #fff;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
table.heatmap th {
  background: var(--aib-lavender-soft);
  color: var(--aib-purple-dark);
  font-weight: 600;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
table.heatmap th.stmt-col,
table.heatmap td.stmt-col {
  text-align: right;
  min-width: 0;
  max-width: 260px;
  width: 1%;
  white-space: normal;
  font-size: 12px;
  font-weight: 500;
  text-transform: none;
  color: var(--ink);
  background: #fff;
  letter-spacing: 0;
  padding-right: 10px;
}
table.heatmap td.heat-cell {
  min-width: 54px;
  color: #fff;
  font-weight: 600;
}
table.heatmap td.heat-cell.dark-text { color: var(--ink); }
table.heatmap tr:hover td.stmt-col { background: var(--aib-lavender-soft); }

/* ---------- Correspondence map (2D scatter of brands + attributes) ---------- */
.ca-wrap {
  display: flex;
  flex-direction: column;
  flex: 1;
  margin-top: 4px;
}
.ca-wrap svg {
  width: 100%;
  height: auto;
  max-height: 480px;
  display: block;
  background: var(--aib-lavender-soft);
  border: 1px solid var(--border);
  border-radius: 6px;
}
.ca-legend {
  display: flex;
  gap: 18px;
  margin-top: 10px;
  font-size: 12px;
  justify-content: center;
}
.ca-legend .item {
  display: flex;
  align-items: center;
  gap: 8px;
}
.ca-legend .dot-brand {
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--aib-purple);
  border: 2px solid var(--aib-purple-dark);
}
.ca-legend .dot-attr {
  width: 10px; height: 10px;
  background: var(--aib-gold);
  transform: rotate(45deg);
}
.ca-footnote {
  margin-top: 10px;
  padding: 8px 12px;
  background: var(--aib-lavender-soft);
  border-left: 3px solid var(--aib-purple);
  font-size: 11px;
  color: var(--muted);
  line-height: 1.5;
  font-style: italic;
  border-radius: 0 4px 4px 0;
}

/* ---------- Per-brand equity bar grids ---------- */
.brand-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 10px;
  margin-top: 4px;
}
.brand-col {
  background: var(--aib-lavender-soft);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 10px;
}
.brand-col h4 {
  font-size: 12px;
  font-weight: 700;
  margin: 0 0 8px;
  color: var(--aib-purple-dark);
  text-align: center;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--aib-purple);
}
.brand-col .brand-row {
  display: grid;
  grid-template-columns: 1fr 28px;
  gap: 6px;
  align-items: center;
  font-size: 10px;
  margin-bottom: 3px;
}
.brand-col .brand-row .stmt {
  color: var(--ink); line-height: 1.2;
}
.brand-col .brand-row .pct {
  font-variant-numeric: tabular-nums; text-align: right; font-weight: 600;
  color: var(--aib-purple-dark);
}
.brand-col .brand-row .bar {
  grid-column: 1 / -1; height: 6px;
  background: var(--border-soft); border-radius: 2px; overflow: hidden;
  margin-bottom: 4px;
}
.brand-col .brand-row .bar-fill { height: 100%; background: var(--aib-purple); }

/* AIB v BOI gap side-table */
.gap-table-side {
  background: var(--aib-lavender-soft);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 10px 12px;
  min-width: 190px;
}
.gap-table-side h4 {
  font-size: 11px; font-weight: 700; margin: 0 0 8px;
  color: var(--aib-purple-dark);
  text-transform: uppercase; letter-spacing: 0.3px;
  border-bottom: 1px solid var(--border); padding-bottom: 5px;
}
.gap-table-side table { width: 100%; border-collapse: collapse; font-size: 11px; }
.gap-table-side th, .gap-table-side td { padding: 3px 2px; font-variant-numeric: tabular-nums; }
.gap-table-side th { font-size: 10px; color: var(--muted); text-align: right; text-transform: uppercase; font-weight: 600; }
.gap-table-side th:first-child, .gap-table-side td:first-child { text-align: left; font-weight: 500; }
.gap-table-side td { text-align: right; }
.gap-table-side td.gap.pos { color: var(--aib-purple-dark); font-weight: 700; }
.gap-table-side td.gap.neg { color: var(--alert); font-weight: 700; }

/* ---------- NLG insights box ---------- */
.nlg-box {
  background: linear-gradient(135deg, var(--aib-purple-dark), var(--aib-purple));
  color: #fff;
  border-radius: 8px;
  padding: 24px 28px;
  flex: 1;                /* fill panel body height */
  display: flex;
  flex-direction: column;
  box-shadow: 0 3px 10px rgba(77,23,80,0.18);
}
.nlg-box h4 {
  margin: 0 0 14px;
  font-size: 14px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  opacity: 0.92;
  border-bottom: 1px solid rgba(255,255,255,0.25);
  padding-bottom: 10px;
}
.nlg-box ul {
  margin: 0;
  padding-left: 22px;
  font-size: 17px;
  line-height: 1.55;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-around;
}
.nlg-box ul li { margin-bottom: 10px; }
.nlg-box ul li:last-child { margin-bottom: 0; }
.nlg-box ul li strong { font-weight: 800; opacity: 1; }
.nlg-box .nlg-empty { font-size: 13px; opacity: 0.75; font-style: italic; }

/* ---------- Funnel chart (SVG, hero) ---------- */
.funnel-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  align-items: stretch;
  margin-top: 6px;
}
.funnel-svg-col {
  background: var(--aib-lavender-soft);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 14px 10px;
  display: flex;
  flex-direction: column;
}
.funnel-svg-col h4 {
  font-size: 19px;
  font-weight: 800;
  color: var(--aib-purple-dark);
  margin: 0 0 8px;
  text-align: center;
  padding-bottom: 8px;
  border-bottom: 3px solid var(--aib-purple);
  letter-spacing: 0.3px;
}
.funnel-svg-col .funnel-svg-wrap {
  flex: 1;
  display: flex;
  align-items: stretch;
  justify-content: center;
}
.funnel-svg-col svg {
  width: 100%;
  height: auto;
  display: block;
  max-height: 360px;
}
.funnel-svg-col .funnel-base {
  font-size: 10px;
  color: var(--muted);
  text-align: center;
  margin-top: 6px;
  border-top: 1px solid var(--border-soft);
  padding-top: 5px;
}
.funnel-svg-col .funnel-base.low { color: var(--alert); font-weight: 600; }

/* ---------- Pie / donut chart ---------- */
.pie-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin-top: 6px;
}
.pie-cell {
  background: var(--aib-lavender-soft);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 14px 8px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.pie-cell .pie-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--aib-purple-dark);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 8px;
  text-align: center;
}
.pie-cell svg { width: 100%; max-width: 130px; height: auto; display: block; }
.pie-cell .pie-pct {
  font-size: 26px;
  font-weight: 800;
  color: var(--aib-purple-dark);
  margin-top: 8px;
  font-variant-numeric: tabular-nums;
}
.pie-cell .pie-sub { font-size: 10px; color: var(--muted); margin-top: 2px; }

/* ---------- Vertical column chart (Property Types etc.) ---------- */
.vbar-chart {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
  gap: 14px;
  align-items: end;
  height: 180px;
  padding: 18px 8px 6px;
  border-bottom: 1px solid var(--border-soft);
}
.vbar-col {
  display: flex; flex-direction: column;
  justify-content: flex-end; align-items: center;
  height: 100%; gap: 6px;
}
.vbar-pct {
  font-size: 24px;
  font-weight: 700;
  color: var(--aib-purple-dark);
  font-variant-numeric: tabular-nums;
  margin-bottom: 4px;
}
.vbar-bar {
  width: 80%;
  background: linear-gradient(180deg, var(--aib-purple-mid), var(--aib-purple));
  border-radius: 4px 4px 0 0;
  min-height: 4px;
  box-shadow: 0 1px 3px rgba(77,23,80,0.2);
}
.vbar-labels {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
  gap: 14px;
  padding: 6px 8px 0;
}
.vbar-label {
  font-size: 12px;
  color: var(--ink);
  font-weight: 500;
  text-align: center;
  line-height: 1.25;
}
.vbar-n {
  font-size: 10px;
  color: var(--muted);
  text-align: center;
  margin-top: 2px;
}

.callout-box {
  margin-top: 14px;
  background: linear-gradient(120deg, var(--aib-purple-dark), var(--aib-purple));
  color: #fff;
  border-radius: 6px;
  padding: 14px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  box-shadow: 0 2px 6px rgba(77,23,80,0.18);
}
.callout-box .label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  opacity: 0.95;
  line-height: 1.3;
}
.callout-box .value {
  font-size: 36px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

/* ---------- NPS bar (Promoters/Passives/Detractors) ---------- */
.nps-grid {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 4px;
}
.nps-row {
  display: grid;
  grid-template-columns: 110px 1fr 70px;
  gap: 12px;
  align-items: center;
}
.nps-row .brand-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
}
.nps-row .nps-bar {
  display: flex;
  height: 24px;
  background: var(--border-soft);
  border-radius: 4px;
  overflow: hidden;
}
.nps-row .nps-bar .seg {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
}
.nps-row .nps-bar .seg.detr { background: var(--alert); }
.nps-row .nps-bar .seg.pass { background: var(--muted); }
.nps-row .nps-bar .seg.prom { background: var(--aib-purple); }
.nps-row .nps-score {
  text-align: right;
  font-size: 18px;
  font-weight: 700;
  color: var(--aib-purple-dark);
  font-variant-numeric: tabular-nums;
}
.nps-row .nps-score.neg { color: var(--alert); }
.nps-row .nps-score.empty { color: var(--muted); font-size: 14px; font-weight: 500; }

/* ---------- Ranked simple table ---------- */
table.ranked-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  margin-top: 4px;
}
table.ranked-table th, table.ranked-table td {
  padding: 5px 8px;
  border-bottom: 1px solid var(--border-soft);
  text-align: left;
  font-variant-numeric: tabular-nums;
}
table.ranked-table th {
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.4px;
}
table.ranked-table td.pct { text-align: right; font-weight: 600; min-width: 50px; }
table.ranked-table td.bar-cell { width: 40%; }
table.ranked-table td.bar-cell .bar { height: 12px; background: var(--border-soft); border-radius: 2px; overflow: hidden; }
table.ranked-table td.bar-cell .bar-fill { height: 100%; background: var(--aib-purple); }
table.ranked-table tr.highlight td { background: var(--aib-lavender-soft); font-weight: 600; }
/* Stretch ranked-table to fill the panel height with evenly-spaced rows */
table.ranked-table.fill-h { height: 100%; }
table.ranked-table.fill-h tbody tr { height: 1px; }
table.ranked-table.fill-h tbody td {
  vertical-align: middle;
  padding-top: 8px;
  padding-bottom: 8px;
}
table.ranked-table.fill-h td.bar-cell .bar { height: 16px; }

/* ---------- Bar chart (horizontal for short lists) ---------- */
.simple-bars {
  display: flex; flex-direction: column; gap: 9px; margin-top: 6px;
}

/* Delta variant (adds a "Δ vs Total" column beside the % value) */
.simple-bars.with-delta .row {
  grid-template-columns: 190px 1fr 56px 72px;
}
.simple-bars.with-delta .row .delta {
  text-align: right;
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.simple-bars.with-delta .row .delta.up   { color: var(--aib-purple-dark); }
.simple-bars.with-delta .row .delta.down { color: var(--alert); }
.simple-bars.with-delta .row .delta.flat { color: var(--muted); }
.simple-bars-header {
  display: grid;
  grid-template-columns: 190px 1fr 56px 72px;
  gap: 12px;
  padding: 0 0 6px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--border);
  font-size: 10px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.simple-bars-header span:nth-child(3),
.simple-bars-header span:nth-child(4) { text-align: right; }
/* When applied: rows distribute to fill the panel height with even spacing */
.simple-bars.fill-h {
  height: 100%;
  gap: 0;
  justify-content: space-around;
}
.simple-bars .row {
  display: grid; grid-template-columns: 160px 1fr 56px;
  gap: 12px; align-items: center; font-size: 13px;
}
.simple-bars .row .lbl { color: var(--ink); font-weight: 500; }
.simple-bars .row .bar-bg { height: 22px; background: var(--border-soft); border-radius: 3px; overflow: hidden; }
.simple-bars .row .bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--aib-purple-mid), var(--aib-purple));
  border-radius: 3px;
}
.simple-bars .row .val { text-align: right; font-weight: 700; font-size: 14px; font-variant-numeric: tabular-nums; color: var(--aib-purple-dark); }

/* ---------- Footer ---------- */
footer.app-footer {
  background: #fff;
  border-top: 1px solid var(--border);
  padding: 8px 28px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 10px;
  color: var(--muted);
  flex: none;
}
footer.app-footer img { height: 18px; opacity: 0.7; }

/* ---------- Static info banner (opportunity sizing pages) ---------- */
.static-note {
  background: linear-gradient(135deg, var(--aib-purple-dark), var(--aib-purple));
  color: #fff;
  border-radius: 6px;
  padding: 14px 20px;
  margin-bottom: 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  box-shadow: 0 2px 6px rgba(77,23,80,0.18);
}
.static-note .title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  opacity: 0.92;
}
.static-note .body {
  font-size: 14px;
  line-height: 1.5;
  font-weight: 500;
}
.static-note .body strong { font-weight: 800; }

/* ---------- Slim horizontal stacked bars (Profiler Demographics) ---------- */
.slim-stacked {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 6px;
}
.slim-stacked .row-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--aib-purple-dark);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 4px;
}
.slim-stacked .bar {
  display: flex;
  width: 100%;
  height: 26px;
  border-radius: 4px;
  overflow: hidden;
  background: var(--border-soft);
  box-shadow: 0 1px 2px rgba(77,23,80,0.08);
}
.slim-stacked .bar .seg {
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-size: 11px; font-weight: 700;
  overflow: hidden; white-space: nowrap;
}
.slim-stacked .bar .seg.txt-dark { color: var(--ink); }
.slim-stacked .leg {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  margin-top: 6px;
  font-size: 11px;
}
.slim-stacked .leg .item {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 2px 8px;
  background: var(--aib-lavender-soft);
  border-radius: 3px;
}
.slim-stacked .leg .swatch { width: 10px; height: 10px; border-radius: 2px; }
.slim-stacked .leg .name { color: var(--ink); font-weight: 500; }
.slim-stacked .leg .pct { font-weight: 700; color: var(--aib-purple-dark); font-variant-numeric: tabular-nums; }

/* ---------- Stacked column (vertical) for Profiler ---------- */
.stacked-col-wrap {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: 6px;
  align-items: end;
}
.stacked-col {
  display: flex;
  flex-direction: column-reverse;
  height: 220px;
  border-radius: 5px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--border-soft);
  box-shadow: 0 1px 3px rgba(77,23,80,0.08);
}
.stacked-col .seg {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  min-height: 18px;
  white-space: nowrap;
}
.stacked-col .seg.txt-dark { color: var(--ink); }
.stacked-col-label {
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--aib-purple-dark);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-top: 8px;
}
.stacked-col-legend {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 12px;
  font-size: 12px;
}
.stacked-col-legend .item {
  display: grid;
  grid-template-columns: 14px 1fr 48px 48px;
  gap: 8px;
  align-items: center;
  padding: 4px 8px;
  background: var(--aib-lavender-soft);
  border-radius: 3px;
}
.stacked-col-legend .swatch { width: 14px; height: 14px; border-radius: 2px; }
.stacked-col-legend .name { color: var(--ink); font-weight: 500; }
.stacked-col-legend .pct { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--aib-purple-dark); }
.stacked-col-legend .delta { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; font-size: 11px; }
.stacked-col-legend .delta.up { color: var(--aib-purple-dark); }
.stacked-col-legend .delta.down { color: var(--alert); }
.stacked-col-legend .delta.flat { color: var(--muted); }

/* ---------- Profiler pie/donut ---------- */
.donut-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px;
}
.donut-cell svg { width: 180px; height: 180px; display: block; }
.donut-legend {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 12px;
  width: 100%;
  max-width: 300px;
}
.donut-legend .item {
  display: grid;
  grid-template-columns: 14px 1fr 48px 48px;
  gap: 8px;
  align-items: center;
  padding: 4px 8px;
  background: var(--aib-lavender-soft);
  border-radius: 3px;
  font-size: 12px;
}
.donut-legend .swatch { width: 14px; height: 14px; border-radius: 2px; }
.donut-legend .name { color: var(--ink); font-weight: 500; }
.donut-legend .pct { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--aib-purple-dark); }
.donut-legend .delta { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; font-size: 11px; }
.donut-legend .delta.up { color: var(--aib-purple-dark); }
.donut-legend .delta.down { color: var(--alert); }
.donut-legend .delta.flat { color: var(--muted); }

/* ---------- Contents (index) page ---------- */
.contents-hero {
  background: linear-gradient(120deg, var(--aib-purple) 0%, var(--aib-purple-dark) 100%);
  color: #fff;
  padding: 36px 28px 28px;
  border-radius: 6px;
  margin-bottom: 24px;
  border: 1px solid var(--aib-purple-dark);
}
.contents-hero h2 {
  font-size: 22px; font-weight: 600; margin: 0 0 6px;
}
.contents-hero p {
  font-size: 13px; margin: 0; opacity: 0.92;
}
.page-list {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
@media (max-width: 900px) {
  .page-list { grid-template-columns: 1fr; }
}
.page-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-left: 4px solid var(--aib-purple);
  border-radius: 6px;
  padding: 18px 20px;
  text-decoration: none;
  color: var(--ink);
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: transform .12s, box-shadow .12s;
}
.page-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(77,23,80,0.12);
  border-left-color: var(--aib-purple-dark);
}
.page-card.disabled {
  opacity: 0.5; pointer-events: none;
  border-left-color: var(--muted-soft);
}
.page-card .num {
  font-size: 10px; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.6px;
}
.page-card .title {
  font-size: 16px; font-weight: 600; color: var(--aib-purple-dark);
}
.page-card .desc { font-size: 12px; color: var(--muted); }
.page-card .arrow {
  font-size: 14px; color: var(--aib-purple);
  align-self: flex-end; margin-top: 4px;
}
