/* Call patterns: how queries are called (frontend/DESIGN.md, "Call patterns"). Tokens only: both themes work. */

/* The pattern that is most of production's reads: one band above everything else on Overview and on the list. */
.hero { display: grid; grid-template-columns: max-content minmax(0, 1fr) max-content; gap: var(--sp-3) var(--sp-7); align-items: center; padding: var(--sp-5) var(--sp-6); border: 1px solid var(--accent); border-left-width: 4px; border-radius: var(--r-3); background: var(--surface); min-width: 0; }
.hero-num { font: 500 40px/1 var(--font-mono); letter-spacing: -.03em; color: var(--ink); }
.hero-of { color: var(--ink-2); font-size: var(--fs-2); margin-top: var(--sp-2); white-space: nowrap; }
.hero-main { min-width: 0; display: flex; flex-direction: column; gap: var(--sp-3); }
.hero-title { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2) var(--sp-4); font-size: var(--fs-4); font-weight: 600; min-width: 0; }
.hero-facts { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2) var(--sp-5); color: var(--ink-2); font-size: var(--fs-2); min-width: 0; }
.hero-facts b { font: 600 var(--fs-2)/1 var(--font-mono); color: var(--ink); }
.hero-bar { grid-column: 1 / -1; }
.hero-bar > .bar { height: 10px; }
@media (max-width: 760px) { .hero { grid-template-columns: minmax(0, 1fr); } }

/* The loop in one line: nested brackets, outermost first. Used in list rows and the hero. */
.nest { display: inline-flex; align-items: center; gap: 0; min-width: 0; font-size: var(--fs-2); color: var(--ink-2); white-space: nowrap; overflow: hidden; }
.nest > span { display: inline-flex; align-items: center; height: 18px; padding: 0 var(--sp-3); border: 1px solid var(--line-strong); border-right: 0; border-radius: var(--r-1) 0 0 var(--r-1); margin-right: -1px; background: var(--surface); }
.nest > span + span { border-radius: 0; background: var(--surface-2); }
.nest > span:last-child { border-right: 1px solid var(--line-strong); border-radius: 0 var(--r-1) var(--r-1) 0; background: var(--accent-bg); color: var(--ink); font-family: var(--font-mono); }
.nest > span:only-child { border-radius: var(--r-1); }
.nest > .is-guess { border-style: dashed; }

/* Each measured byte counted once, by the first kind it fits. One accent for the kind in focus; the rest are
   neutral steps with a label in the table beside the bar (colour is not a state here). */
.acct { display: flex; gap: 2px; height: 14px; min-width: 0; }
.acct > span { flex-basis: 0; min-width: 3px; border-radius: 2px; background: var(--ink-3); }
.acct > .is-top { background: var(--accent); }
.acct > .is-measured { background: color-mix(in srgb, var(--ink-3) 55%, var(--surface)); }
.acct > .is-none { background: var(--surface-3); box-shadow: inset 0 0 0 1px var(--line-strong); }
.acct-tbl td, .acct-tbl th { padding-top: var(--sp-2); padding-bottom: var(--sp-2); }
.acct-tbl .bar { width: 100%; }
.acct-tbl tr.is-top .bar > span { background: var(--accent); }
.acct-tbl .bar > span { background: var(--ink-3); }
.acct-tbl tr.is-none td { color: var(--ink-3); }

/* Proof of a possible change: what qopt could ever show about it. Solid: the data side can be measured.
   Dashed: evidence only. Dashed amber: a trade-off, never a win. No green anywhere. */
.chip.is-proof-data_side_verifiable { --c: var(--ink); --cb: transparent; border-color: var(--ink-2); }
.chip.is-proof-evidence_only { --c: var(--ink-2); --cb: transparent; border: 1px dashed var(--line-strong); }
.chip.is-proof-trade_off { --c: var(--warn); --cb: transparent; border: 1px dashed var(--warn); }
.tch { display: inline-flex; align-items: center; height: 18px; padding: 0 var(--sp-3); border: 1px solid var(--ink-2); border-radius: var(--r-1); font-size: var(--fs-1); font-weight: 500; color: var(--ink); white-space: nowrap; }
.tch.is-evidence_only { border: 1px dashed var(--line-strong); color: var(--ink-2); }
.tch.is-trade_off { border: 1px dashed var(--warn); color: var(--warn); }
.chg td:first-child { box-shadow: inset 3px 0 0 var(--ink-2); }
.chg tr.is-evidence_only td:first-child { box-shadow: none; border-left: 3px dashed var(--line-strong); }
.chg tr.is-trade_off td:first-child { box-shadow: none; border-left: 3px dashed var(--warn); }

/* The members of a loop: code facts on the left, the query log on the right, one rule between them. */
.lp-tbl { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: var(--fs-2); }
.lp-tbl th { padding: var(--sp-2) var(--sp-4); text-align: left; font-weight: 500; color: var(--ink-3); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--surface-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lp-tbl td { padding: var(--sp-3) var(--sp-4); border-bottom: 1px solid var(--line); vertical-align: middle; overflow: hidden; }
.lp-tbl tr:last-child > td { border-bottom: 0; }
.lp-tbl .num { text-align: right; font-family: var(--font-mono); white-space: nowrap; }
.lp-tbl .is-log { border-left: 2px solid var(--accent); }
.lp-tbl th.is-group { color: var(--ink-2); font-weight: 600; background: var(--surface); border-top: 0; }
.lp-tbl .bar { width: 100%; }
.lp-tbl .l1, .lp-tbl .l2 { display: flex; align-items: center; gap: var(--sp-3); min-width: 0; white-space: nowrap; }
.lp-tbl .l2 { color: var(--ink-3); font-size: var(--fs-1); margin-top: 2px; }
.lp-tbl .clip { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.lp-tbl td.is-empty-heavy { color: var(--warn); font-weight: 600; }
.lp-nest { margin: 0 var(--sp-4) var(--sp-4) var(--sp-6); }
.lp-nest > .lp-box { background: var(--surface); }
.lp-box .lp-box { margin: 0 var(--sp-4) var(--sp-4) var(--sp-6); }
.lp-box.is-step { border-color: var(--line-strong); box-shadow: inset 3px 0 0 var(--ink-3); }
.lp-foot { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2) var(--sp-4); }

/* The hand-off text: the CLI's own words, to copy. */
pre.handoff { margin: 0; padding: var(--sp-5); border: 0; border-radius: 0; background: var(--surface-2); font: 400 var(--fs-1)/1.55 var(--font-mono); color: var(--ink); white-space: pre-wrap; overflow-wrap: anywhere; max-height: 30rem; overflow-y: auto; }

/* Dismiss: fixed reasons as a list of radio rows. */
.reasons { display: flex; flex-direction: column; gap: var(--sp-3); }
.reason { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 0 var(--sp-4); padding: var(--sp-3) var(--sp-4); border: 1px solid var(--line-strong); border-radius: var(--r-2); }
.reason > i { grid-row: span 2; width: 12px; height: 12px; margin-top: 3px; border: 1.5px solid var(--ink-3); border-radius: 50%; }
.reason > b { font-weight: 600; }
.reason > span { color: var(--ink-3); font-size: var(--fs-1); }
.reason.is-error { border-style: dashed; }

/* Held back by default: a quiet line above the list, each part a toggle. */
.held { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2) var(--sp-4); padding: var(--sp-3) var(--sp-5); border-bottom: 1px solid var(--line); background: var(--surface-2); font-size: var(--fs-2); color: var(--ink-2); }
.held .check { height: var(--ctl-sm); }

.stat-bar { margin-top: var(--sp-3); }
.stat-bar > .bar { width: 100%; height: 6px; }

/* A label line with a note at its other end. */
.row.is-spread { justify-content: space-between; }
.acct-head { margin-bottom: var(--sp-3); }
.acct-head > .label { margin: 0; }
.acct-tbl { margin-top: var(--sp-3); }
/* Seen in production with no query log: the tab is there, greyed. */
.seg > .seg-off { color: var(--ink-3); padding: 0 var(--sp-4); display: inline-flex; align-items: center; cursor: not-allowed; }
.alert .chips.is-under { margin-top: var(--sp-2); }
.l1 > .strong.is-fixed { flex: none; }
.foot-label { margin: 0; }

/* The pattern page. */
.panel.is-measured-edge { box-shadow: inset 3px 0 0 var(--accent); }
.panel.is-raised { box-shadow: var(--shadow-pop); }
.mt-label { margin-top: var(--sp-5); }
.lp-row.is-driver { border: 1px solid var(--line); border-radius: var(--r-2); background: var(--surface-2); }
.lp-bytes > .lp-bytes-bar { flex: 1 1 auto; min-width: 2rem; }
.lp-bytes > .lp-bytes-num { flex: none; width: 4.25rem; text-align: right; }
.reason > input[type=radio] { grid-row: span 2; margin: 3px 0 0; accent-color: var(--accent); }
.reason:has(input:checked) { border-color: var(--accent); background: var(--accent-bg); }
.reason { cursor: pointer; }

.acct-chips { margin-top: var(--sp-3); }

/* The loop benchmark on a pattern page: N statements -> the batched one, bytes before and after on one scale (the
   typical and the heavy run), each item's rows against its own statement's. Green only on a fixed member. */
.lb-n { font: 400 var(--fs-2)/1.3 var(--font-mono); color: var(--ink-2); white-space: nowrap; }
.lb-n > b { font-size: var(--fs-4); font-weight: 600; color: var(--ink); }
.lb-reads { display: grid; grid-template-columns: 3.75rem minmax(3rem, 1fr) max-content; gap: var(--sp-3); align-items: center; min-width: 0; }
.lb-reads + .lb-reads { margin-top: var(--sp-2); }
.lb-label { color: var(--ink-3); font-size: var(--fs-2); }
.lb-bars { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.lb-bars > .bar { height: 6px; }
.lb-sql > summary { cursor: pointer; font-size: var(--fs-2); }
.lb-sql > pre.sql { margin-top: var(--sp-3); white-space: pre-wrap; overflow-wrap: anywhere; max-height: 18em; overflow: auto; }
