/* =====================================================================
   mobile-list.css — AG "Strata List" kit (portable).
   The list/hero layer of the Strata mobile standard: a KPI + distribution
   hero, quick-filter chips, a sort row, and rich verdict cards.

   🟡 The :root block maps Strata token NAMES onto the host app's palette
      (alias + semantic/tier colours). This is the ONLY app-specific part.
   🟢 Everything below it is generic — it references token names only, no
      raw hex. Copy verbatim into any app; pair with mobile-list.js.
   ===================================================================== */

/* 🟡 THEME — Strata token names → AGI-DEMO's --c-* vocabulary + tiers */
:root {
    --card: var(--c-surface-0);
    --surface: #F8F9FB;
    --surface-2: var(--c-surface-2);
    --chip: #EEF1F3;
    --ink: var(--c-text-primary);
    --muted: var(--c-text-secondary);
    --muted-2: var(--c-text-muted);
    --faint: #A0AAB4;
    --line: var(--c-separator);
    --blue: var(--c-brand-dark);
    --blue-2: var(--c-brand);
    --green: #1E8449; --green-bg: #E8F6EE;
    --amber: #B7770A; --amber-bg: #FBF1E0;
    --red:   #C0392B; --red-bg:   #FBE9E7;
    /* tier accents — DMI: Leader / Mature / Developing / Nascent (match CONFIG.DMI_COLOURS) */
    --tier-1: #1E8449; --tier-1-bg: #E8F6EE;
    --tier-2: #2E5BA8; --tier-2-bg: #E9F0FA;
    --tier-3: #B7770A; --tier-3-bg: #FBF1E0;
    --tier-4: #85929E; --tier-4-bg: #EEF1F3;
    --r-ctl: 8px;
}

/* 🟢 GENERIC KIT --------------------------------------------------------- */

/* tone system — a toned element gets a class that sets --tone / --tone-bg,
   and the element paints itself from those vars. Keeps the kit data-agnostic. */
.agl-tone-t1 { --tone: var(--tier-1); --tone-bg: var(--tier-1-bg); }
.agl-tone-t2 { --tone: var(--tier-2); --tone-bg: var(--tier-2-bg); }
.agl-tone-t3 { --tone: var(--tier-3); --tone-bg: var(--tier-3-bg); }
.agl-tone-t4 { --tone: var(--tier-4); --tone-bg: var(--tier-4-bg); }
.agl-tone-good    { --tone: var(--green);   --tone-bg: var(--green-bg); }
.agl-tone-info    { --tone: var(--blue-2);  --tone-bg: #E9F0FA; }
.agl-tone-bad     { --tone: var(--red);     --tone-bg: var(--red-bg); }
.agl-tone-at      { --tone: var(--amber);   --tone-bg: var(--amber-bg); }
.agl-tone-neutral { --tone: var(--muted-2); --tone-bg: var(--chip); }

/* hero — KPI tiles + distribution bar */
.agl-hero { margin: 12px 12px 0; }
.agl-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; }
.agl-stat { background: var(--card); border-radius: var(--r-ctl); padding: 9px 6px 8px;
    text-align: center; box-shadow: 0 1px 3px rgba(28,40,51,.06); }
.agl-stat-n { font-family: 'Instrument Serif', serif; font-size: 1.5rem; line-height: 1; color: var(--ink); }
.agl-stat-l { font-size: .55rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em;
    color: var(--muted); margin-top: 5px; line-height: 1.2; }

.agl-dist { margin-top: 9px; background: var(--card); border-radius: var(--r-ctl); padding: 11px 12px;
    box-shadow: 0 1px 3px rgba(28,40,51,.06); }
.agl-dist-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.agl-dist-title { font-size: .64rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.agl-dist-sub { font-size: .64rem; color: var(--muted-2); }
.agl-dist-bar { display: flex; gap: 2px; height: 8px; border-radius: var(--r-pill); overflow: hidden; background: var(--surface-2); }
.agl-dist-bar > span { background: var(--tone); }
.agl-dist-legend { display: flex; flex-wrap: wrap; gap: 4px 11px; margin-top: 9px; }
.agl-dist-legend span { display: inline-flex; align-items: center; gap: 5px; font-size: .65rem; color: var(--muted); }
.agl-dist-legend i { width: 8px; height: 8px; border-radius: 2px; background: var(--tone); }
.agl-dist-legend b { color: var(--ink); font-weight: 600; }

/* controls — quick-filter chips + sort row (sticky to the viewport top) */
.agl-controls { position: sticky; top: 0; z-index: 5; background: var(--c-surface-1); padding: 11px 0 3px; margin-top: 11px; }
.agl-chips { display: flex; gap: 7px; overflow-x: auto; padding: 0 12px 3px; scrollbar-width: none; }
.agl-chips::-webkit-scrollbar { display: none; }
.agl-chip { flex-shrink: 0; display: inline-flex; align-items: center; gap: 6px; font-family: inherit;
    font-size: .76rem; font-weight: 600; color: var(--muted); background: var(--card);
    border: 1px solid var(--line); border-radius: var(--r-pill); padding: 6px 12px; cursor: pointer; transition: all .14s; }
.agl-chip i { width: 7px; height: 7px; border-radius: 50%; background: var(--tone); }
.agl-chip b { color: var(--muted-2); font-weight: 700; }
.agl-chip.is-active { background: var(--ink); border-color: var(--ink); color: #fff; }
.agl-chip.is-active b { color: rgba(255,255,255,.72); }
.agl-chip.is-active i { box-shadow: 0 0 0 2px rgba(255,255,255,.3); }

.agl-sortrow { display: flex; align-items: center; justify-content: space-between; padding: 8px 12px 0; position: relative; }
.agl-count { font-size: .72rem; color: var(--muted-2); }
.agl-sort { display: inline-flex; align-items: center; gap: 5px; font-family: inherit; font-size: .74rem;
    font-weight: 500; color: var(--muted); background: none; border: none; cursor: pointer; }
.agl-sort b { color: var(--ink); font-weight: 600; }
.agl-sort svg { width: 11px; height: 11px; }
.agl-sort-menu { position: absolute; right: 12px; top: calc(100% + 4px); background: var(--card);
    border: 1px solid var(--line); border-radius: var(--r-ctl); box-shadow: 0 8px 28px rgba(8,6,30,.18);
    padding: 5px; z-index: 8; min-width: 184px; }
.agl-sort-menu[hidden] { display: none; }
.agl-sort-opt { display: block; width: 100%; text-align: left; font-family: inherit; font-size: .8rem;
    color: var(--ink); background: none; border: none; border-radius: 6px; padding: 9px 11px; cursor: pointer; }
.agl-sort-opt:hover { background: var(--surface-2); }
.agl-sort-opt.is-active { background: var(--surface-2); color: var(--blue); font-weight: 600; }

/* cards — single-column verdict feed */
.agl-list { padding: 8px 12px 100px; display: flex; flex-direction: column; gap: 9px; }
.agl-card { position: relative; display: block; width: 100%; text-align: left; font-family: inherit;
    background: var(--card); border: 1px solid var(--line); border-radius: var(--r-card);
    padding: 13px 14px 13px 17px; cursor: pointer; overflow: hidden;
    box-shadow: 0 1px 2px rgba(28,40,51,.05); transition: transform .12s, box-shadow .16s; }
.agl-card:active { transform: scale(.985); }
.agl-card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--tone); }
.agl-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.agl-card-id { min-width: 0; }
.agl-eyebrow { font-size: .58rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted-2); }
.agl-title { font-size: .95rem; font-weight: 600; color: var(--ink); line-height: 1.25; margin-top: 2px; }
.agl-body { font-size: .86rem; line-height: 1.45; color: var(--ink); margin-top: 8px;
    display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.agl-val { text-align: right; flex: 0 0 auto; }
.agl-val-l { font-size: .52rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); }
.agl-val-n { font-family: 'Instrument Serif', serif; font-size: 1.7rem; line-height: .95; color: var(--ink); }
.agl-foot { display: flex; align-items: center; gap: 9px; margin-top: 11px; flex-wrap: wrap; }
.agl-status { display: inline-flex; align-items: center; gap: 5px; font-size: .67rem; font-weight: 600;
    padding: 3px 9px; border-radius: var(--r-pill); color: var(--tone); background: var(--tone-bg); }
.agl-status i { width: 6px; height: 6px; border-radius: 50%; background: var(--tone); }
.agl-meta { font-size: .68rem; color: var(--muted-2); }

.agl-empty { padding: 44px 16px; text-align: center; color: var(--muted-2); font-size: .85rem; }

/* ranked-bar panels — distribution cards (e.g. a Landscape view). Fill colour is
   passed inline by the adapter so panels can carry their own semantic palette. */
.agl-panels { display: flex; flex-direction: column; gap: 11px; padding: 12px 12px 100px; }
.agl-panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-card);
    padding: 14px; box-shadow: 0 1px 2px rgba(28,40,51,.05); }
.agl-panel-title { font-size: .64rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em;
    color: var(--muted); margin-bottom: 12px; }
.agl-rank-row { margin-bottom: 11px; }
.agl-rank-row:last-child { margin-bottom: 0; }
.agl-rank-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 5px; }
.agl-rank-label { font-size: .8rem; color: var(--ink); font-weight: 500; min-width: 0;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.agl-rank-val { font-size: .7rem; color: var(--muted-2); white-space: nowrap; flex: 0 0 auto; }
.agl-rank-val b { color: var(--ink); font-weight: 600; font-size: .82rem; }
.agl-rank-track { height: 7px; background: var(--surface-2); border-radius: var(--r-pill); overflow: hidden; }
.agl-rank-fill { height: 100%; border-radius: var(--r-pill); }
