/* Agent Runs index. Spacing, tokens, and breakpoints mirror tasks.css (.wrap / .ti-*). */
[data-pull-refresh-target="scroller"]:has(.runs-index) {
  background: #101722;
  > :has(> .runs-index) { max-width: none; padding: 0; }
  > :has(> .runs-index) > :is([role="status"], [role="alert"]) { max-width: 1252px; margin: 20px auto 0; width: calc(100% - 2 * clamp(20px, 3vw, 44px)); }
}

.runs-index {
  --panel: #192331; --panel-2: #18222f; --edge: #354151; --soft: #d0d8e4; --muted: #a9b5c6; --link: #a2c6ff;
  --green: #9cddbd; --green-wash: #203c34; --blue: #acd2ff; --blue-wash: #233e60;
  --amber: #f6d18f; --amber-wash: #403522; --red: #ffb6bd; --red-wash: #45242b;
  --mono: ui-monospace, Menlo, monospace;
  min-height: 100%; color: #f3f6fc; color-scheme: dark;
  font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; overflow-wrap: anywhere;

  :is(a, button):focus-visible { outline: 2px solid #93c5fd; outline-offset: 3px; }
  .wrap { max-width: 1340px; margin: 0 auto; padding: 28px clamp(20px, 3vw, 44px) 56px; }

  .pv { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--soft); white-space: nowrap; }
  .pv svg { width: 14px; height: 14px; flex: none; }
  .pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 20px; font-size: 11px; font-weight: 600; white-space: nowrap; background: #2c3544; color: var(--soft); }
  .pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
  .pill.live::before { box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 25%, transparent); }
  .t-green { background: var(--green-wash); color: var(--green); }
  .t-blue { background: var(--blue-wash); color: var(--blue); }
  .t-amber { background: var(--amber-wash); color: var(--amber); }
  .t-red { background: var(--red-wash); color: var(--red); }
  .t-gray { background: #2c3544; color: var(--soft); }
  .track { display: flex; gap: 3px; width: 84px; margin-top: 7px; }
  .track span { flex: 1; height: 4px; border-radius: 1px; background: #475566; }
  .track [data-segment="completed"] { background: #78d5aa; }
  .track :is([data-segment="running"], [data-segment="active"]) { background: #80acff; }
  .track :is([data-segment="error"], [data-segment="rejected"]) { background: #ff929c; }
  .track [data-segment="blocked"] { background: #f5c16b; }
  .track [data-segment="waiting"] { background: repeating-linear-gradient(90deg, #80acff 0 3px, #475566 3px 6px); }
  .track [data-segment="skipped"] { background: transparent; border: 1px dashed #748195; }

  .runs-totals { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 22px; background: var(--panel); border: 1px solid var(--edge); border-radius: 12px; overflow: hidden; }
  .runs-totals > div { padding: 14px 18px; }
  .runs-totals > div + div { border-left: 1px solid var(--edge); }
  .runs-totals dt { display: flex; align-items: center; gap: 8px; font-size: 12px; color: #c4cedb; }
  .runs-totals dt::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--tone, #80acff); flex: none; }
  .runs-totals dd { margin-top: 2px; font-size: 28px; letter-spacing: -1px; font-weight: 620; font-variant-numeric: tabular-nums; }

  .runs-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 14px; }
  .runs-filters { display: flex; flex-wrap: wrap; gap: 6px; }
  .runs-filters a { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; font-size: 12px; color: #b9c5d4; background: #17202c; border: 1px solid #394657; border-radius: 7px; white-space: nowrap; }
  .runs-filters a:hover { background: #243141; }
  .runs-filters a[aria-current] { background: #233953; border-color: #648dbb; color: #e7efff; }
  .runs-filters a span { font: 11px var(--mono); color: #a5b2c5; }
  .runs-filters a i { width: 7px; height: 7px; border-radius: 50%; background: var(--tone); }

  .runs-list { overflow: hidden; border: 1px solid #334051; border-radius: 12px; background: var(--panel-2); }
  .runs-columns { display: grid; grid-template-columns: minmax(280px, 1fr) 118px 168px 104px 82px; align-items: start; gap: 14px; padding-inline: 18px; }
  .runs-labels { align-items: center; height: 34px; font-size: 10px; text-transform: uppercase; letter-spacing: .105em; color: #acb9ca; background: #202c3a; font-weight: 650; }
  .runs-labels :last-child, .runs-timing { text-align: right; }
  .runs-row { position: relative; padding-block: 14px; border-top: 1px solid #303c4b; }
  .runs-labels + .runs-row { border-top: 0; }
  .runs-row:hover { background: #1f2b3a; }
  .runs-row.attn { box-shadow: inset 3px 0 0 #ff929c; }
  .runs-row.blocked { box-shadow: inset 3px 0 0 #f5c16b; }
  .runs-identity { display: flex; align-items: flex-start; gap: 12px; min-width: 0; }
  .runs-identity > img { margin-top: 2px; width: 32px; height: 32px; border-radius: 7px; }
  .runs-identity > div { min-width: 0; }
  .runs-title { display: block; font-size: 14.5px; font-weight: 600; line-height: 1.35; color: #eff3fa; }
  .runs-title::after { content: ""; position: absolute; inset: 0; }
  .runs-title:focus-visible { outline: none; }
  .runs-title:focus-visible::after { outline: 2px solid #93c5fd; outline-offset: -2px; }
  .runs-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 3px 8px; margin-top: 5px; font-size: 12px; color: #aebaca; min-width: 0; }
  .runs-tags code { font: 11px var(--mono); color: #8e9bae; }
  .runs-tags .dot { width: 3px; height: 3px; border-radius: 50%; background: #5d6a7c; }
  .runs-tags a { position: relative; z-index: 1; color: var(--link); font-size: 11.5px; font-weight: 550; }
  .runs-tags a:hover { text-decoration: underline; }
  .runs-tags .alt { display: none; gap: 5px; align-items: center; }

  .runs-status { padding-top: 1px; min-width: 0; }
  .runs-pipeline { min-width: 0; font-size: 12px; padding-top: 1px; color: #d5e2f5; font-weight: 550; }
  .runs-pipeline small { font-size: 11px; color: var(--muted); font-weight: 400; }
  .runs-pipeline .bad { color: var(--red); }
  .runs-provider { display: grid; gap: 4px; justify-items: start; padding-top: 1px; min-width: 0; }
  .runs-provider code { font: 10.5px var(--mono); color: #9daabc; }
  .runs-timing { font-size: 12px; color: #c4cedb; padding-top: 1px; }
  .runs-timing time { display: block; margin-top: 3px; font: 10.5px var(--mono); color: #9daabc; }

  .runs-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 18px; border-top: 1px solid #303c4b; font-size: 12px; color: var(--muted); }
  .runs-foot a { color: var(--link); font-weight: 600; }
  .runs-empty { padding: 48px 18px; text-align: center; color: var(--muted); }
  .runs-empty h2 { font-size: 16px; font-weight: 650; color: #f3f6fc; margin-bottom: 4px; }
  .runs-empty a { display: inline-block; margin-top: 8px; color: var(--link); font-weight: 600; }

  @media (max-width: 1179px) {
    .runs-columns { grid-template-columns: minmax(220px, 1fr) 112px 150px 74px; }
    .runs-columns > .runs-provider, .runs-labels > .l-agent { display: none; }
    .runs-tags .alt { display: inline-flex; }
  }
  @media (max-width: 959px) {
    .runs-labels { display: none; }
    .runs-columns { grid-template-columns: minmax(0, 1fr) auto; gap: 10px 12px; padding-inline: 14px; }
    .runs-row:first-of-type { border-top: 0; }
    .runs-identity { grid-column: 1 / -1; }
    .runs-status { grid-column: 1; padding-left: 44px; }
    .runs-pipeline { grid-column: 1 / -1; grid-row: 3; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding-left: 44px; }
    .runs-pipeline .track { margin-top: 0; }
    .runs-timing { grid-column: 2; grid-row: 2; }
    .runs-timing time { display: inline; margin-left: 4px; }
  }
  @media (max-width: 767px) {
    .wrap { padding: 18px 14px 40px; }
    .runs-totals { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .runs-totals > div:nth-child(3) { border-left: 0; }
    .runs-totals > div:nth-child(n+3) { border-top: 1px solid var(--edge); }
    .runs-totals dd { font-size: 22px; }
    .runs-filters { flex-wrap: nowrap; overflow-x: auto; width: 100%; padding-bottom: 2px; scrollbar-width: none; }
    .runs-foot { padding: 11px 14px; flex-wrap: wrap; }
  }
  @media (max-width: 420px) {
    .runs-filters a span { display: none; }
    .runs-filters a[aria-current] span { display: inline; }
  }
}
