/* member-kit.css: the member dashboard's parts (spec 2026-11-17, section 2).
 *
 * One card, one tile, one pill, one switch, one table, one meter. Every part
 * is written in tokens.css's own values and carries the prefix `k-`.
 *
 * Not here on purpose: buttons (the family in components.css: .btn, .primary,
 * .ghost, .danger, .sm) and small print (components.css's .legal-note).
 *
 * Type is the scale's five steps and nothing under --fs-1. Two things that
 * must look different and share a step differ by weight or colour.
 */

/* ---- figures ----------------------------------------------------------
 * base.css asks for tabular figures on every page so columns line up. A
 * figure that stands alone at 24px or more is not in a column, and equal
 * digit widths make it read loose. It takes the face's own widths. Both
 * declarations are needed: the feature setting inherited from <body>
 * outranks font-variant-numeric. */
.k-fig, .k-hero-v, .k-tile-v {
  font-feature-settings: normal;
  font-variant-numeric: normal;
}

/* ---- layout ----------------------------------------------------------- */
.k-stack { display: grid; gap: var(--sp-4); align-content: start; min-width: 0; }
.k-grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--sp-4); }
.k-grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-4); align-items: start; }
.k-grid-21 { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: var(--sp-4); align-items: start; }
.k-grid-4 > *, .k-grid-2 > *, .k-grid-21 > * { min-width: 0; }
@media (max-width: 1023px) {
  .k-grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .k-grid-21 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 720px) {
  .k-grid-2 { grid-template-columns: minmax(0, 1fr); }
  .k-grid-4 { gap: var(--sp-3); }
}
/* A two-one row whose main cell is hidden gives the row to what is left. */
.k-grid-21:has(> [hidden]:first-child) > :not([hidden]) { grid-column: 1 / -1; }
/* Hidden means hidden: a class that sets display beats the UA's [hidden]. */
:is(.k-stack, .k-grid-4, .k-grid-2, .k-grid-21, .k-card, .k-tile, .k-hero, .k-pill, .k-seg, .k-chip, .k-alert, .k-list, .k-feed)[hidden] { display: none; }

/* ---- card: one card answers one question ------------------------------ */
.k-card { min-width: 0; background: var(--paper); border: 1px solid var(--hair); border-radius: var(--r-lg); }
.k-card-h { display: flex; align-items: center; flex-wrap: wrap; gap: var(--sp-2) var(--sp-3); padding: var(--sp-4) var(--sp-5) 0; }
.k-card-title { margin: 0; font-family: var(--display); font-size: var(--fs-2); font-weight: var(--w-mid); line-height: 1.3; letter-spacing: -0.01em; color: var(--ink); }
.k-card-meta { font-size: var(--fs-1); color: var(--dim); }
.k-card-act { margin-left: auto; font-size: var(--fs-1); font-weight: var(--w-mid); color: var(--ink); text-decoration: none; }
.k-card-act:hover { text-decoration: underline; }
.k-card-b { padding: var(--sp-3) var(--sp-5) var(--sp-5); }
@media (max-width: 720px) {
  .k-card-h { padding: var(--sp-4) var(--sp-4) 0; }
  .k-card-b { padding: var(--sp-3) var(--sp-4) var(--sp-4); }
}

/* ---- tile: label, figure, one line, one small visual ------------------ */
.k-tile { display: grid; gap: var(--sp-1); align-content: start; min-width: 0; padding: var(--sp-4) var(--sp-5); background: var(--paper); border: 1px solid var(--hair); border-radius: var(--r-lg); }
.k-tile-l { font-size: var(--fs-1); color: var(--dim); }
.k-tile-v { font-size: var(--fs-3); font-weight: var(--w-mid); line-height: 1.2; letter-spacing: -0.025em; overflow-wrap: anywhere; }
.k-tile-s { font-size: var(--fs-1); color: var(--dim); }
.k-tile-x { margin-top: var(--sp-2); }
@media (max-width: 720px) {
  .k-tile { padding: var(--sp-4); }
}

/* ---- hero: the one dark band a view leads with ------------------------ */
.k-hero { min-width: 0; padding: var(--sp-5) var(--sp-6); background: var(--term-2); color: var(--term-ink); border: 1px solid var(--term-edge); border-radius: var(--r-xl); }
.k-hero-l { display: block; font-size: var(--fs-1); color: var(--term-dim); }
.k-hero-v { display: block; font-size: var(--fs-5); font-weight: var(--w-mid); line-height: 1.08; letter-spacing: -0.04em; overflow-wrap: anywhere; }
.k-hero-v--2 { font-size: var(--fs-4); letter-spacing: -0.035em; }
.k-hero-cur { margin-right: 2px; font-size: var(--fs-3); font-weight: var(--w-body); letter-spacing: 0; color: var(--term-dim); vertical-align: 0.3em; }
.k-hero-v--2 .k-hero-cur { font-size: var(--fs-2); }
.k-hero-d { display: block; font-size: var(--fs-2); font-weight: var(--w-mid); }
.k-hero-stamp { font-size: var(--fs-1); color: var(--term-dim); }
.k-hero :is(.up) { color: var(--wr-up); }
.k-hero :is(.dn, .down) { color: var(--wr-down); }
@media (max-width: 720px) {
  .k-hero { padding: var(--sp-5) var(--sp-4); border-radius: var(--r-lg); }
  .k-hero-v { font-size: var(--fs-4); }
  .k-hero-v--2 { font-size: var(--fs-3); }
  .k-hero-cur { font-size: var(--fs-2); }
}

/* ---- pill: one shape; colour only for state --------------------------- */
.k-pill { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; min-height: 24px; padding: 0 var(--sp-2); border-radius: var(--r-pill); background: var(--soft); color: var(--ink); font-size: var(--fs-1); font-weight: var(--w-mid); line-height: 1.2; letter-spacing: 0; vertical-align: middle; }
.k-pill--run { background: var(--duck-bg); color: var(--duck-deep); }
.k-pill--warn { background: var(--bill-bg); color: var(--bill-ink); }
.k-pill--stop { background: var(--cuck-bg); color: var(--cuck-deep); }
.k-pill--idle { color: var(--dim); }
.k-pill--live { background: var(--ink); color: var(--paper); }
.k-pill--algo { background: var(--accent-lime); color: var(--brand-ink); }
.k-pill--line { background: transparent; box-shadow: inset 0 0 0 1px var(--hair); color: var(--dim); }
.k-dot { flex: none; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ---- switch (one of several) and chip (any of several) ---------------- */
.k-seg { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px; border-radius: var(--r-lg); background: var(--soft); }
.k-seg > button { min-height: 28px; padding: 0 var(--sp-3); border: 0; border-radius: var(--r-pill); background: transparent; color: var(--dim); font: var(--w-mid) var(--fs-1)/1 var(--body); cursor: pointer; }
.k-seg > button:hover { color: var(--ink); }
.k-seg > button[aria-pressed="true"] { background: var(--paper); color: var(--ink); box-shadow: var(--sh-1); }
.k-chip { display: inline-flex; align-items: center; min-height: 32px; padding: 0 var(--sp-3); border: 1px solid var(--hair); border-radius: var(--r-pill); background: var(--paper); color: var(--ink); font: var(--w-body) var(--fs-1)/1 var(--body); cursor: pointer; }
.k-chip:hover { border-color: var(--faint); }
.k-chip[aria-pressed="true"] { background: var(--duck-bg); border-color: var(--duck-deep); color: var(--duck-deep); font-weight: var(--w-mid); }
@media (max-width: 720px) {
  .k-seg > button { min-height: 36px; }
  .k-chip { min-height: 36px; }
}

/* ---- table ------------------------------------------------------------ */
.k-table { width: 100%; border-collapse: collapse; font-size: var(--fs-1); }
.k-table th { padding: var(--sp-2); border-bottom: 1px solid var(--hair); text-align: left; font-weight: var(--w-body); color: var(--dim); white-space: nowrap; }
.k-table td { padding: var(--sp-3) var(--sp-2); border-bottom: 1px solid var(--hair); vertical-align: middle; }
.k-table tr:last-child > td { border-bottom: 0; }
.k-table .k-num { text-align: right; }

/* ---- meter: a track, a fill, marks and a position --------------------- */
.k-meter { position: relative; height: 8px; border-radius: var(--r-pill); background: var(--soft); }
.k-meter-fill { position: absolute; inset: 0 auto 0 0; border-radius: var(--r-pill); background: var(--ink); }
.k-meter-mark { position: absolute; top: -3px; bottom: -3px; width: 2px; border-radius: var(--r-xs); background: var(--bill); }
/* The end mark is a limit (a cap, a sell-all rung), not money: ink. Red is
 * for money's direction only (spec section 2, rule 4). */
.k-meter-mark--end { background: var(--ink); }
.k-hero .k-meter-mark--end { background: var(--term-ink); }
.k-meter-dot { position: absolute; top: 50%; width: 12px; height: 12px; border-radius: 50%; background: var(--ink); box-shadow: 0 0 0 2px var(--paper); transform: translate(-50%, -50%); }
.k-meter-scale { display: flex; justify-content: space-between; gap: var(--sp-2); margin-top: 6px; font-size: var(--fs-1); color: var(--dim); }
/* A scale whose labels sit at their own points (with .k-meter-scale): each
 * child names its place inline, `style="--at:25%"`, and is centred there. A
 * child written at exactly `--at:0%` or `--at:100%` aligns its edge with the
 * track's instead, so the ends never hang outside it. One line high. */
.k-meter-scale--at { position: relative; display: block; height: 1.4em; line-height: 1.4; }
.k-meter-scale--at > * { position: absolute; top: 0; left: var(--at); transform: translateX(-50%); white-space: nowrap; }
.k-meter-scale--at > [style*="--at:0%"] { transform: none; }
.k-meter-scale--at > [style*="--at:100%"] { transform: translateX(-100%); }

/* ---- label and value rows --------------------------------------------- */
.k-list { display: grid; margin: 0; padding: 0; list-style: none; }
.k-list > li { display: flex; justify-content: space-between; gap: var(--sp-3); padding: var(--sp-2) 0; border-bottom: 1px solid var(--hair); font-size: var(--fs-1); }
.k-list > li:last-child { padding-bottom: 0; border-bottom: 0; }
.k-list-l { color: var(--dim); }
.k-list-v { font-weight: var(--w-mid); color: var(--ink); text-align: right; }

/* ---- attention row ---------------------------------------------------- */
.k-alert { display: flex; align-items: flex-start; flex-wrap: wrap; gap: var(--sp-2) var(--sp-3); padding: var(--sp-3) var(--sp-4); border-radius: var(--r-lg); background: var(--bill-bg); color: var(--ink); font-size: var(--fs-1); text-decoration: none; }
.k-alert-ic { flex: none; color: var(--bill-ink); }
.k-alert-t { flex: 1 1 240px; min-width: 0; }
.k-alert-go { margin-left: auto; font-weight: var(--w-mid); white-space: nowrap; }

/* ---- feed: a mark, a sentence, its reason, an amount, a time ---------- */
.k-feed { display: grid; margin: 0; padding: 0; list-style: none; }
.k-feed > li { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: var(--sp-3); align-items: start; padding: var(--sp-3) 0; border-bottom: 1px solid var(--hair); font-size: var(--fs-1); }
.k-feed > li:last-child { padding-bottom: 0; border-bottom: 0; }
.k-feed-ic { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--soft); color: var(--ink); }
.k-feed-ic--buy { background: var(--ink); color: var(--paper); }
.k-feed-ic--fail { background: var(--bill-bg); color: var(--bill-ink); }
.k-feed-t { display: block; font-weight: var(--w-mid); color: var(--ink); }
.k-feed-s { display: block; color: var(--dim); }
.k-feed-r { display: grid; gap: 1px; justify-items: end; text-align: right; white-space: nowrap; }
.k-feed-amt { font-weight: var(--w-mid); color: var(--ink); }
.k-feed-when { color: var(--dim); }
