/* Cards, tables, chips, figures, the journey ribbon and the score breakdown, shared by every screen that shows data. Tokens only. */

/* ── cards and figures ── */
.card { background: var(--card); border: 1px solid var(--rule); border-radius: 5px; }
.card--flush { overflow: hidden; }
.card-h { display: flex; align-items: center; gap: 10px; padding: 13px 16px; border-bottom: 1px solid var(--rule); }
.card-h h3, .card-h__title { font-size: 14px; }
.card-h__sub { font-size: 12px; color: var(--muted); }
.card-h__end { margin-left: auto; }

.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 11px; margin-bottom: 16px; }
.kpis--5 { grid-template-columns: repeat(5, 1fr); }
.kpi { position: relative; overflow: hidden; padding: 13px 15px; }
/* A card that is a button: `.mb3 button` clears every button's padding, border and background, so they are put back. */
.mb3 button.kpi { padding: 13px 15px; border: 1px solid var(--rule); background: var(--card); }
.kpi .v { margin: 7px 0 3px; font-family: var(--display); font-size: 26px; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; color: var(--navy); font-variant-numeric: tabular-nums; }
.kpi .d { font-size: 11px; line-height: 1.35; color: var(--muted); }
.kpi--alert, .mb3 button.kpi--alert { border-color: var(--amber-line); background: linear-gradient(178deg, var(--risk-m-b), var(--card) 60%); }
.kpi--alert .v { color: var(--risk-m); }
.kpi--good, .mb3 button.kpi--good { border-color: var(--good-line); background: linear-gradient(178deg, var(--hot-b), var(--card) 60%); }
.kpi--good .v { color: var(--hot); }
/* A card that opens or filters the list of what it counts. It grows a little under the mouse, keeping its own colours. */
.kpi--link { display: block; width: 100%; font: inherit; color: inherit; text-align: left; text-decoration: none; cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease; }
/* Under the mouse the card grows a touch; while its filter is on it stays grown a little more, mouse or not. */
.kpi--link:hover { transform: scale(1.015); box-shadow: var(--shadow-bar); }
.kpi--link[aria-pressed="true"] { transform: scale(1.03); box-shadow: var(--shadow-bar); }
@media (prefers-reduced-motion: reduce) { .kpi--link { transition: none; } .kpi--link:hover { transform: none; } }
.kpi--link:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

/* ── chips ── */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  height: 18px;
  padding: 0 6px;
  border-radius: 5px;
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
  background: var(--sunk);
  color: var(--body);
}
.chip--vhot { background: var(--vhot-b); color: var(--vhot); }
.chip--hot { background: var(--hot-b); color: var(--hot); }
.chip--warm { background: var(--warm-b); color: var(--warm); }
.chip--cold { background: var(--cold-b); color: var(--cold); }
.chip--rh { background: var(--risk-h-b); color: var(--risk-h); }
.chip--rm { background: var(--risk-m-b); color: var(--risk-m); }
.chip--rl { background: var(--risk-l-b); color: var(--risk-l); }
.chip--rs { background: var(--stable-b); color: var(--stable); }
.chip--dup { background: var(--dup-b); color: var(--dup); }
.chip .icon { width: 10px; height: 10px; flex-shrink: 0; }
.chip--small { height: 15px; font-size: 9px; padding: 0 5px; }
.chip--green { background: var(--green-w); color: var(--green-ink); }

/* ── table ── */
.tbl-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; }
.tbl caption { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.tbl th {
  padding: 9px 11px;
  text-align: left;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--faint);
  background: var(--card);
  border-bottom: 1px solid var(--rule);
  white-space: nowrap;
  user-select: none;
}
.mb3 .tbl th button { font-weight: inherit; letter-spacing: inherit; text-transform: inherit; color: inherit; }
.mb3 .tbl th button:hover, .mb3 .tbl th button[aria-pressed="true"] { color: var(--text); }
.tbl td { padding: 10px 11px; border-bottom: 1px solid var(--rule); font-size: 13px; vertical-align: middle; }
.tbl tbody tr { cursor: pointer; }
.tbl tbody tr:hover { background: var(--hover); }
.tbl tbody tr:last-child td { border-bottom: none; }
.tbl .r { text-align: right; }
.org { font-weight: 600; color: var(--text); text-decoration: none; }
/* An organisation's logo before its name (orgLogo in components/figures.js). A target without one shows no picture. */
.logo { display: inline-block; width: 20px; height: 20px; margin-right: 7px; vertical-align: -5px; border: 1px solid var(--rule); border-radius: 5px; background: var(--card); object-fit: contain; }
.logo--lg { width: 36px; height: 36px; margin-right: 10px; vertical-align: -9px; border-radius: 5px; }
/* No logo uploaded: the usual default profile picture, a grey circle with a white head and shoulders. */
.logo--none { display: inline-block; overflow: hidden; border-color: var(--faint); border-radius: 50%; background: var(--faint); }
.logo--none .logo__person { display: block; width: 100%; height: 100%; fill: var(--card); }
.logo-pick { display: flex; align-items: center; gap: 8px; }
.logo-pick__preview:empty { display: none; }
.logo-find { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; }
.logo-find__site { flex: 1 1 220px; min-width: 0; }
.logo-offer { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.logo-offer .logo { margin-right: 0; }
.logo-pick__preview .logo { margin-right: 0; vertical-align: middle; }
a.org:hover { text-decoration: underline; }
.org-s { margin-top: 1px; font-size: 11px; color: var(--muted); }
.cell-sub { display: block; margin-top: 1px; font-size: 10px; color: var(--muted); }
.cell-line { display: flex; align-items: center; gap: 6px; }

.dot { display: inline-block; width: 6px; height: 6px; border-radius: 2px; flex-shrink: 0; background: var(--faint); }

/* ── avatars ── */
.av {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--navy);
  color: var(--on-navy);
  font-family: var(--data);
  font-size: 9px;
  font-weight: 700;
}
.av--none { background: var(--faint); }
/* A profile photo in place of the initials (avatar in components/figures.js): the same circle, filled by the picture. */
.av--photo { padding: 0; object-fit: cover; background: var(--faint); }
.av--lg { width: 56px; height: 56px; font-size: 18px; }
.photo-pick { display: flex; align-items: center; gap: 12px; }
.photo-pick__actions { display: flex; flex-wrap: wrap; gap: 6px; }
.avs { display: flex; }
.avs .av { margin-left: -6px; border: 2px solid var(--card); }
.avs .av:first-child { margin-left: 0; }
.avs-none { font-size: 11px; color: var(--faint); }

/* ── the journey ribbon: one segment per interaction, coloured by its kind and sized by its weight ── */
.ribbon { display: flex; align-items: stretch; gap: 1px; height: 5px; min-width: 110px; border-radius: 3px; overflow: hidden; background: var(--sunk); }
.ribbon i { display: block; flex-shrink: 0; position: relative; background-color: var(--faint); }
.ribbon i.neg { background-image: repeating-linear-gradient(45deg, transparent, transparent 1.5px, color-mix(in srgb, var(--card) 45%, transparent) 1.5px, color-mix(in srgb, var(--card) 45%, transparent) 3px); }
.ribbon--lg { height: 8px; gap: 2px; border-radius: 4px; }
.ribbon-empty { display: flex; align-items: center; height: 16px; min-width: 110px; font-size: 10px; font-style: italic; color: var(--faint); }
.rlegend { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 9px; }
.rlegend span { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; color: var(--muted); }
.rlegend i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; background-color: var(--faint); }

/* ── how a score is made up ── */
.explain { overflow: hidden; border: 1px solid var(--rule); border-radius: 5px; background: var(--card); }
.ex-row { display: flex; align-items: center; gap: 10px; padding: 7px 12px; font-size: 12px; border-bottom: 1px solid var(--rule); }
.ex-row:last-child { border-bottom: none; }
.ex-row .lbl { flex: 1; margin: 0; font-size: 12px; font-weight: 400; color: var(--body); }
.ex-row .detail { display: block; margin-top: 2px; font-size: 10.5px; color: var(--muted); }
.ex-row .val { width: 44px; text-align: right; font-family: var(--data); font-weight: 600; }
.ex-row .val.pos { color: var(--hot); }
.ex-row .val.neg { color: var(--risk-h); }
.ex-row--total { background: var(--navy); color: var(--on-navy); font-weight: 700; }
.ex-row--total .lbl { color: var(--on-navy); font-weight: 700; }
.ex-bar { width: 62px; height: 5px; overflow: hidden; border-radius: 3px; background: var(--sunk); }
.ex-bar i { display: block; height: 100%; border-radius: 3px; background: var(--hot); }
.ex-bar i.neg { background: var(--risk-h); }
.ex-bar i.base { background: var(--muted); }
.stable-note { padding: 13px; border-radius: 5px; font-size: 12.5px; background: var(--stable-b); color: var(--stable); }

/* ── the journey timeline ── */
.tl { position: relative; padding-left: 26px; }
.tl::before { content: ""; position: absolute; left: 9px; top: 6px; bottom: 6px; width: 2px; background: var(--rule); }
.tl-i { position: relative; padding-bottom: 16px; }
/* The dot takes the colour of the kind of interaction, set from the data. */
.tl-dot { position: absolute; left: -22px; top: 3px; width: 12px; height: 12px; border-radius: 50%; background-color: var(--navy); border: 2px solid var(--card); box-shadow: 0 0 0 1px var(--rule); }
.tl-head { display: flex; align-items: center; gap: 7px; margin-bottom: 4px; flex-wrap: wrap; }
.tl-head strong { font-size: 13px; }
.tl-weight { font-size: 10.5px; font-weight: 600; color: var(--hot); }
.tl-weight.neg { color: var(--risk-h); }
.tl-text { font-size: 12.5px; line-height: 1.55; color: var(--body); overflow-wrap: anywhere; }
.tl-more { margin-top: 3px; font-size: 12px; }
.tl-more span { color: var(--muted); }
.tl-meta { display: flex; align-items: center; gap: 7px; margin-top: 6px; font-size: 11px; color: var(--muted); }

/* ── the ring chart: each tone is a heat level ── */
.donut { display: block; width: 130px; height: 130px; flex-shrink: 0; }
.donut__track { fill: none; stroke: var(--sunk); stroke-width: 22; }
.donut__seg { fill: none; stroke-width: 22; }
.donut__total { font: 800 22px var(--display); fill: var(--navy); }
.donut .tone--vhot { stroke: var(--vhot); }
.donut .tone--hot { stroke: var(--hot); }
.donut .tone--warm { stroke: var(--chart-warm); }
.donut .tone--cold { stroke: var(--chart-cold); }
i.tone--vhot { background: var(--vhot); }
i.tone--hot { background: var(--hot); }
i.tone--warm { background: var(--chart-warm); }
i.tone--cold { background: var(--chart-cold); }

/* ── the column chart: one series, its colour from the tone ── */
.cols { display: block; width: 100%; height: auto; overflow: visible; }
.cols__grid { stroke: var(--rule); stroke-dasharray: 2 4; }
.cols__base { stroke: var(--rule-strong); }
.cols__tick { font: 10px var(--data); fill: var(--faint); }
.cols__hit { fill: transparent; }
.cols__slot:hover .cols__hit { fill: var(--hover); }
.cols.tone--navy .cols__bar { fill: var(--navy); }
.cols.tone--blue .cols__bar { fill: var(--blue); }
/* The chart shrinks with the card, so its labels are drawn larger on a narrow screen to stay about 10px. */
@media (max-width: 700px) { .cols__tick { font-size: 16px; } }

/* ── empty states ── */
.empty { padding: 48px 20px; text-align: center; }
.empty > .icon { color: var(--faint); }
.empty h3 { margin: 12px 0 5px; font-size: 15px; }
.empty p { margin: 0 0 15px; font-size: 13px; line-height: 1.5; color: var(--muted); }

@media (max-width: 1000px) {
  .kpis { grid-template-columns: repeat(2, 1fr); }
}
