/* AiB Platform — cards and their inhabitants: the white card itself, KPI
   tiles, the activity feed and the facts list (detail rails). */

.card {
  background: var(--white);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
}
.card-pad { padding: clamp(18px, 2vw, 26px); }
.card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 22px 0;
}
.card-title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 640;
  font-size: 17px;
  letter-spacing: -0.01em;
}
.card-sub { margin: 4px 0 0; color: var(--grey); font-size: 13px; }

/* padding-less head row for card-pad bodies: title left, quiet aside right.
   Its padded cousin is .card-head, which supplies an unpadded card's own
   top/side padding — the two are different boxes, not duplicates. */
.spread { display: flex; justify-content: space-between; align-items: baseline; gap: 14px; }

/* ---------- collapsible card head (the detail-rail cards) ---------- */
/* Rides inside .card-title: <h2 class="card-title"><button class="card-toggle">.
   The .meta aside carries the collapsed summary (count, n/m) in the quiet
   mono voice; the chevron turns, nothing else moves. */
.card-toggle {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: inherit;
}
.card-toggle .meta { display: inline-flex; align-items: center; gap: 10px; }
.card-toggle .chev { flex: 0 0 auto; color: var(--grey-dark); transition: transform 0.25s var(--ease-out); }
.card-toggle[aria-expanded="true"] .chev { transform: rotate(180deg); }

/* ---------- KPI cards ---------- */
/* min() keeps the min column narrower than any phone: the row folds to one
   column instead of pushing the page sideways */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(215px, 100%), 1fr));
  gap: 16px;
  margin-bottom: 20px;
}
.kpi { padding: 18px 20px 14px; }
.kpi-label {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--grey);
}
.kpi-line {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-top: 8px;
}
.kpi-value {
  font-family: var(--font-display);
  font-weight: 720;
  font-size: 34px;
  line-height: 1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.kpi-spark { flex: 0 0 auto; color: var(--grey-dark); }
.kpi-delta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.05em;
  color: var(--grey);
}
.delta-chip { padding: 2px 8px; border-radius: 999px; }
.delta-chip--good { color: var(--ok); background: var(--ok-face); }
.delta-chip--bad { color: var(--danger); background: var(--danger-face); }
.delta-chip--flat { color: var(--grey); background: var(--paper); }

/* ---------- feed / activity ---------- */
.feed { padding: 6px 22px 14px; }
/* The dashboard's activity list shows ~seven of its fifteen rows and
   scrolls for the rest — the page must not stretch with the history. The
   partly visible next row is the scroll affordance. */
.feed--capped { max-height: 322px; overflow-y: auto; overscroll-behavior: contain; }
.feed-item {
  display: flex;
  gap: 14px;
  align-items: baseline;
  padding: 11px 0;
  border-bottom: 1px solid var(--hairline);
  font-size: 13.5px;
}
.feed-item:last-child { border-bottom: 0; }
.feed-item .t {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.05em;
  color: var(--grey-dark);
  white-space: nowrap;
  min-width: 64px;
  font-variant-numeric: tabular-nums;
}
.feed-item .ok-mark { margin-left: auto; font-family: var(--font-mono); font-size: 11px; color: var(--ok); }
.feed-item .fail-mark { margin-left: auto; font-family: var(--font-mono); font-size: 11px; color: var(--danger); }

/* ---------- ask facts (approval cards) ---------- */
/* The asking payload as words — inline label·value pairs that wrap, so an
   accountant reads "Amount €640.00 · Supplier Bulmetal", never raw JSON. */
.ask-facts { margin: 0 0 10px; display: flex; flex-wrap: wrap; gap: 4px 20px; }
.ask-fact { display: flex; align-items: baseline; gap: 7px; font-size: 13px; min-width: 0; }
/* the label reads as a small-caps header in ink — an accountant must find
   "СУМА" at a glance; the value still leads through its larger size */
.ask-fact dt {
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  white-space: nowrap;
}
.ask-fact dd { margin: 0; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; min-width: 0; }

/* ---------- facts list (detail rails) ---------- */
.facts { margin: 0; padding: 6px 22px 14px; }
.fact {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 11px 0;
  border-bottom: 1px solid var(--hairline);
  font-size: 13.5px;
}
.fact:last-child { border-bottom: 0; }
.fact dt { color: var(--grey); font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.07em; text-transform: uppercase; }
/* values carry emails, IBANs, URLs — break rather than push the page wide */
.fact dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; min-width: 0; overflow-wrap: anywhere; }
