/* Analytics (the console's Analytics screen): the page's own layout. The components (KPI tiles, panels, select
   chips, codes, tables, avatars, logos, thumbnails) come from app.css; this file places them and draws the three
   charts the page has: the time-to-deliver histogram, the failure bars and the throughput columns. Everything is
   plain CSS on the tokens, so the light theme follows; nothing moves under the pointer. */

/* ── the top row: the range picker, the comparison note, the game and marketplace filters ── */
.an__bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.an__bar .selchips { flex: none; }
.an__note { font-size: 12px; color: var(--ink-3); }
.an__filters { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.an__bar .selchip .selchip__n { margin-left: -1px; }

/* ── two panels side by side ── */
.an__two { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: stretch; }
@media (max-width: 1050px) { .an__two { grid-template-columns: minmax(0, 1fr); } }
.an__two > .panel { display: flex; flex-direction: column; }
.an__two > .panel > .panel__body { flex: 1; }

/* ── time to deliver: eight columns with the count above each, the claim-window marker, the bucket labels ── */
.an__hist { padding: 22px 18px 12px; display: flex; flex-direction: column; gap: 8px; }
.an__histbars { position: relative; flex: 1; display: grid; grid-template-columns: repeat(var(--n, 8), minmax(0, 1fr)); gap: 6px; align-items: end; min-height: 170px; }
.an__hb { height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; min-width: 0; }
.an__hb-n { font: 11px/1 var(--mono); color: var(--ink-3); }
.an__hb-bar { display: block; width: 100%; min-height: 2px; border-radius: 5px 5px 2px 2px; background: var(--btn); }
.an__hb-bar--warn { background: var(--warn); }
.an__hb-bar--bad { background: var(--bad); }
.an__marker { position: absolute; top: 0; bottom: 0; border-left: 1.5px dashed var(--bad); pointer-events: none; }
.an__marker-label { position: absolute; top: -2px; transform: translateX(6px); font: 600 10.5px/1 var(--mono); color: var(--bad); white-space: nowrap; }
.an__marker-label--left { transform: translateX(calc(-100% - 6px)); }
.an__histlabels { display: grid; grid-template-columns: repeat(var(--n, 8), minmax(0, 1fr)); gap: 6px; font: 11px/1 var(--mono); color: var(--ink-3); text-align: center; }
.an__hint { font-size: 12px; color: var(--ink-3); }

/* ── failures by error code: icon tile · title and code · bar · count ── */
.an__fails { padding: 10px 18px 14px; display: flex; flex-direction: column; gap: 2px; }
.an__fail { display: grid; grid-template-columns: 28px minmax(120px, 150px) minmax(0, 1fr) 34px; gap: 10px; align-items: center; padding: 7px 0; }
.an__fail-icon { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: var(--attn-bg); color: var(--attn); }
.an__fail-icon--bad { background: var(--bad-bg); color: var(--bad); }
.an__fail-icon--warn { background: var(--warn-bg); color: var(--warn); }
.an__fail-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.an__fail-title { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.an__fail-text .code { align-self: flex-start; }
.an__fail-track { height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; }
.an__fail-fill { display: block; height: 100%; border-radius: 4px; background: var(--attn); }
.an__fail-fill--bad { background: var(--bad); }
.an__fail-fill--warn { background: var(--warn); }
.an__fail-n { font: 600 12.5px/1 var(--mono); text-align: right; }

/* ── throughput vs bots at work: the legend in the head, columns with the bots line, the axis ── */
.an__legend { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-3); }
.an__legend-bar { width: 10px; height: 10px; border-radius: 3px; background: var(--btn); }
.an__legend-line { width: 12px; height: 2px; background: var(--brand); }
.an__tp { padding: 16px 18px 10px; }
.an__tpbars { display: grid; grid-template-columns: repeat(var(--n, 24), minmax(0, 1fr)); gap: var(--gap, 4px); align-items: end; height: 150px; border-bottom: 1px solid var(--line); }
.an__tb { position: relative; height: 100%; display: flex; align-items: flex-end; min-width: 0; }
.an__tb-o { display: block; width: 100%; min-height: 2px; border-radius: 3px 3px 0 0; background: linear-gradient(180deg, var(--btn), color-mix(in oklab, var(--btn) 25%, transparent)); }
.an__tb-w { position: absolute; left: -2px; right: -2px; height: 2px; background: var(--brand); }
.an__axis { display: flex; justify-content: space-between; padding-top: 6px; font: 11px/1 var(--mono); color: var(--ink-3); }

/* ── breakdown: the name cell with its picture, the success bar ── */
.an__name { display: inline-flex; align-items: center; gap: 10px; font-weight: 500; white-space: nowrap; }
.an__name .glogo, .an__name .mlogo { width: 26px; height: 26px; border-radius: 7px; vertical-align: 0; }
.an__tile { width: 26px; height: 26px; border-radius: 7px; display: inline-grid; place-items: center; background: var(--panel-2); border: 1px solid var(--line-2); color: var(--ink-3); font: 600 10px/1 var(--mono); flex: none; }
.an__success { display: inline-flex; align-items: center; gap: 8px; font-family: var(--mono); }
.an__track { width: 60px; height: 5px; border-radius: 3px; background: var(--line); overflow: hidden; flex: none; }
.an__fill { display: block; height: 100%; }
.an__fill--ok { background: var(--ok); } .an__fill--warn { background: var(--warn); } .an__fill--bad { background: var(--bad); }
.an__fill--neutral { background: var(--ink-3); }
.an__bad { color: var(--bad); }
.an__breakdown { min-width: 680px; }
.an .table td.num, .an .table th.num { font-family: var(--mono); font-size: 12.5px; }
.an .table th.num { font-family: var(--sans); }
.an .table td { padding-top: 10px; padding-bottom: 10px; }
.an__item { display: inline-flex; align-items: center; gap: 10px; min-width: 0; }

/* ── the funnel ── */
.an__funnel { padding: 14px 18px; }
.an__funnel .bar { grid-template-columns: 130px 1fr 48px; }
.an__funnel .bar__fill { background: var(--btn); }

/* ── a phone: the pickers stack, the charts keep their height, the tables scroll inside their panel ── */
@media (max-width: 760px) {
  .an__filters { margin-left: 0; }
  .an .panel__head { flex-wrap: wrap; row-gap: 4px; }
  .an .panel__meta { white-space: normal; }
  .an__hist { padding: 22px 12px 10px; }
  .an__histbars, .an__histlabels { gap: 3px; }
  .an__hb-n, .an__histlabels { font-size: 10px; }
  .an__fail { grid-template-columns: 28px minmax(0, 1fr) 34px; }
  .an__fail-track { grid-column: 2 / 4; }
  .an__fail-n { grid-row: 1; grid-column: 3; }
  .an__tp { padding: 14px 12px 8px; }
  .an__tpbars { gap: 2px; }
}
