/* Load history and the Database section. Reference: frontend/DESIGN.md, "Load history" and
   "Database section". Loaded on every page after app.css; only tokens from app.css are used. */

/* --- Sparkline: one measure over scans, zero-based, neutral ink ------------------------------- */
.spark { display: block; width: 100%; height: 34px; overflow: visible; }
.spark-area { fill: var(--ink-3); opacity: .1; stroke: none; }
.spark-line { fill: none; stroke: var(--ink-2); stroke-width: 1.5; vector-effect: non-scaling-stroke; stroke-linejoin: round; stroke-linecap: round; }
/* The last point: a round-capped zero-length line, so it stays a dot when the box is stretched. */
.spark-dot { stroke: var(--ink); stroke-width: 6; stroke-linecap: round; vector-effect: non-scaling-stroke; }
/* The step the regression rule reported: the last segment, heavier and in the warning ink.
   The words beside the chart say the same ("+60%", "Got heavier"). */
.spark-step { stroke: var(--warn); stroke-width: 2.5; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.spark.is-fired .spark-dot { stroke: var(--warn); }
.spark-hit { fill: transparent; stroke: none; }
.spark-hit:hover { fill: var(--ink); opacity: .07; }

/* --- Small multiples: bytes, runs, p95 --------------------------------------------------------- */
.loadtrend { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-5) var(--sp-7); }
.panel > .loadtrend { padding: var(--sp-4) var(--sp-5); }
.spark-cell { display: grid; gap: var(--sp-2); min-width: 0; }
.spark-head { display: flex; align-items: baseline; gap: var(--sp-3); min-width: 0; }
.spark-head > .label { margin: 0; }
.spark-foot { display: flex; justify-content: space-between; gap: var(--sp-3); font: 500 var(--fs-2)/1.2 var(--font-mono); color: var(--ink-2); white-space: nowrap; }
.spark-foot > b { font-weight: 600; color: var(--ink); }
.delta { margin-left: auto; font: 600 var(--fs-2)/1.2 var(--font-mono); color: var(--ink-2); white-space: nowrap; }
.delta.is-fired { color: var(--warn); }
.delta-mark { font-size: 9px; margin-right: 2px; }
.loadtrend-head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2) var(--sp-4); margin-bottom: var(--sp-3); }
.loadtrend-head > .label { margin: 0; }
.panel-head > .loadtrend-head { margin: 0; }
@media (max-width: 639.98px) { .loadtrend { grid-template-columns: minmax(0, 1fr); } }

/* --- What got heavier (Overview) ------------------------------------------------------------- */
.heavier .tbl.is-list { min-width: 46rem; }
.heavier td > .spark { height: 30px; margin-top: 2px; }
.heavier-move { font: 500 var(--fs-2)/1.2 var(--font-mono); white-space: nowrap; }
.heavier-move > b { font-weight: 600; }
.heavier-arrow { color: var(--ink-3); margin: 0 5px; }
.heavier-pct { font: 600 var(--fs-2)/1.2 var(--font-mono); color: var(--warn); }

/* --- Queries: a regressed row's second line ------------------------------------------------------ */
.load-up { font: 600 var(--fs-2)/1.2 var(--font-mono); color: var(--warn); }
.load-up-from { color: var(--ink-3); font-family: var(--font-mono); }
.tbl th > a.sort.is-sub { margin-left: var(--sp-4); font-weight: 400; }

/* --- Database section (Settings) ------------------------------------------------------------- */
.dbconn { display: grid; grid-template-columns: minmax(13rem, 17rem) minmax(0, 1fr); gap: var(--sp-4) var(--sp-7); padding: var(--sp-4) var(--sp-5); border-top: 1px solid var(--line); }
.dbconn-id { display: grid; gap: var(--sp-2); align-content: start; min-width: 0; }
.dbconn-engine { font-weight: 600; font-size: var(--fs-4); }
.dbconn-engine > .mono { font-weight: 400; font-size: var(--fs-2); color: var(--ink-2); margin-left: var(--sp-3); }
.dbconn-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(13.5rem, 1fr)); gap: var(--sp-4) var(--sp-6); min-width: 0; }
.dbfact { display: grid; gap: var(--sp-2); align-content: start; min-width: 0; }
.dbfact > .label { margin: 0; }
.dbfact.is-wide { grid-column: 1 / -1; }
.tiers { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
/* A tier box: letter, name, state. Available is solid, unavailable is outlined, not reported is dashed. */
.tier { display: inline-flex; align-items: center; gap: var(--sp-3); height: var(--ctl-sm); padding: 0 var(--sp-4) 0 0; border: 1px solid var(--line-strong); border-radius: var(--r-1); font-size: var(--fs-2); white-space: nowrap; }
.tier > b { display: grid; place-items: center; align-self: stretch; width: 20px; font: 600 var(--fs-1)/1 var(--font-mono); background: var(--surface-3); border-radius: 2px 0 0 2px; }
.tier.is-available { border-color: var(--win); }
.tier.is-available > b { background: var(--win); color: var(--surface); }
.tier.is-unavailable { color: var(--ink-3); }
.tier.is-not_reported { border-style: dashed; color: var(--ink-3); }
.tier-state { color: var(--ink-3); font-size: var(--fs-1); }
.tier.is-available > .tier-state { color: var(--win); }
.dbmatch-num { font: 500 var(--fs-6)/1 var(--font-mono); letter-spacing: -.02em; }
.dbmatch-of { color: var(--ink-2); font-size: var(--fs-2); }
.dbmatch-of > b { font: 600 var(--fs-2)/1 var(--font-mono); color: var(--ink); }
.dbsteps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-4) var(--sp-5); padding: var(--sp-4) var(--sp-5); border-top: 1px solid var(--line); }
.dbstep { display: grid; gap: var(--sp-2); align-content: start; min-width: 0; }
.dbstep-head { display: flex; align-items: center; gap: var(--sp-3); font-weight: 600; }
.dbstep-n { display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: var(--surface-3); font: 600 var(--fs-1)/1 var(--font-mono); }
.dbstep-note { color: var(--ink-3); font-size: var(--fs-2); }
.dbline { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2) var(--sp-4); padding: var(--sp-3) var(--sp-5); border-top: 1px solid var(--line); min-height: 32px; }
.thresholds { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--sp-4) var(--sp-5); }
@media (max-width: 767.98px) { .thresholds { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.thresholds .field > label { display: flex; align-items: baseline; gap: var(--sp-3); }
.thresholds .unit { color: var(--ink-3); font: 400 var(--fs-1)/1 var(--font-mono); margin-left: auto; }
.thresholds .field-note { color: var(--ink-3); font-size: var(--fs-1); min-height: 14px; }
.thresholds .input.is-changed { border-color: var(--accent); }
.rule-line { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2) var(--sp-3); margin-bottom: var(--sp-4); }
.checklist .dbsteps { border-top: 0; padding: 0; }
@media (max-width: 1039.98px) { .dbconn { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 767.98px) { .dbsteps { grid-template-columns: minmax(0, 1fr); } }

/* Getting started, full list: the database step shows its three commands in order, one per row,
   so the single command and the link of the compact list are not repeated. */
.checklist:not(.is-compact) .step[data-step="database"] .step-row > .cli,
.checklist:not(.is-compact) .step[data-step="database"] .step-row > .btn { display: none; }
.checklist .dbsteps { grid-template-columns: minmax(0, 1fr); gap: var(--sp-3); }
.checklist .dbstep { grid-template-columns: 4.5rem minmax(0, 1fr); align-items: center; gap: var(--sp-2) var(--sp-4); }
.checklist .dbstep > .cli { max-width: 34rem; }
.checklist .dbstep > .dbstep-note { grid-column: 2; }
