:root {
  color-scheme: dark;
  --bg: #0b111b; --surface: #151e2b; --surface2: #1c2938;
  --line: #2c3b4c; --fg: #e7edf4; --muted: #9baabd;
  --success: #42bd93; --failure: #f08080; --running: #75b8fa;
  --warning: #e8b86b; --neutral: #a3aec0;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 15px/1.5 system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif; }
a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; }
.shell { margin: 0 auto; max-width: 1300px; padding: 38px 24px 48px; }
.top { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-bottom: 28px; }
.eyebrow { color: var(--running); font-size: 11px; letter-spacing: .18em; font-weight: 750; }
h1 { font-size: clamp(27px,3vw,40px); letter-spacing: -.04em; font-weight: 680; margin: 5px 0; }
.muted, .freshness, .placeholder { color: var(--muted); }
p { margin: 0; }
.header-actions { display: flex; align-items: center; gap: 14px; }
.freshness { font-size: 12px; max-width: 270px; text-align: right; }
button, select, input[type="search"] { font: inherit; color: var(--fg); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
button { padding: 9px 16px; cursor: pointer; }
button:hover { border-color: var(--running); }
button:disabled { opacity: .5; cursor: wait; }
.summary { display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); gap: 10px; margin-bottom: 24px; }
.metric { border: 1px solid var(--line); background: var(--surface); border-radius: 12px; padding: 16px; }
.metric .value { font-size: 30px; font-weight: 720; line-height: 1.2; font-variant-numeric: tabular-nums; }
.metric .label { color: var(--muted); font-size: 12px; margin-top: 7px; }
.metric.failure .value { color: var(--failure); }
.metric.running .value { color: var(--running); }
.metric.success .value { color: var(--success); }
.controls { display: flex; align-items: end; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.controls label:not(.toggle) { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--muted); }
.controls input[type="search"] { min-width: 295px; padding: 9px 12px; }
.controls select { padding: 9px 12px; min-width: 180px; }
.toggle { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 8px; padding-bottom: 9px; }
input[type="checkbox"] { accent-color: var(--running); }
.repo { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); margin: 0 0 12px; overflow: hidden; }
.repo > summary { cursor: pointer; padding: 15px 18px; display: flex; align-items: center; justify-content: space-between; gap: 12px; list-style: none; }
.repo > summary::-webkit-details-marker { display: none; }
.repo > summary:hover { background: var(--surface2); }
.repo-title { font-size: 17px; font-weight: 660; }
.repo-title:before { content: "▾"; margin-right: 12px; display: inline-block; color: var(--muted); font-size: 13px; }
.repo:not([open]) .repo-title:before { transform: rotate(-90deg); }
.repo-totals { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: end; }
.pill { border-radius: 100px; padding: 2px 9px; border: 1px solid var(--line); font-size: 11px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pill.failure { color: var(--failure); border-color: #6a4047; }
.pill.running { color: var(--running); border-color: #365879; }
.pill.success { color: var(--success); border-color: #356251; }
.pill.warning { color: var(--warning); }
.pill.neutral { color: var(--neutral); }
.workflow {
  display: grid;
  grid-template-columns: minmax(180px,1.6fr) 125px minmax(130px,1fr) 105px 56px;
  align-items: center;
  gap: 14px;
  padding: 11px 18px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  color: var(--row-text);
  --row-text: #f6f9fc;
  --row-muted: #d9e3ee;
}
/* Entire row follows the latest COMPLETED run; unfinished runs use a separate blue notice. */
.workflow.success { --row-bg: #20563c; --row-hover: #2a684a; }
.workflow.failure { --row-bg: #713437; --row-hover: #844044; }
.workflow.warning, .workflow.neutral, .workflow.never {
  --row-bg: #68521d; --row-hover: #806528;
}
.workflow { background: var(--row-bg); }
.workflow:hover { background: var(--row-hover); }
.workflow-name { min-width: 0; font-weight: 550; overflow-wrap: anywhere; }
.workflow a:hover { color: inherit; text-decoration: underline; }
.workflow .dim { color: var(--row-muted); }
.status-cell { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; min-width: 0; }
.badge { font-size: 12px; font-weight: 650; white-space: nowrap; }
.active-indicator {
  display: inline-block; max-width: 100%; overflow-wrap: anywhere;
  color: #fff; font-size: 11px; font-weight: 600;
  padding: 2px 6px; border: 1px solid #93c5fd; border-radius: 5px;
  background: #1c598b; text-decoration: none;
}
.workflow .active-indicator:hover { color: #fff; background: #1674b2; }
.meta { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--row-muted); }
.run-link { justify-self: end; color: inherit; text-decoration: underline; text-underline-offset: 2px; font-variant-numeric: tabular-nums; }
.empty, .placeholder { padding: 20px; font-size: 13px; }
.error { color: var(--failure); }
.stale { color: var(--warning); }
footer { margin-top: 25px; font-size: 12px; color: var(--muted); }
footer a { text-decoration: underline; text-underline-offset: 3px; }
@media (max-width: 850px) {
  .summary { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .workflow { grid-template-columns: minmax(170px,1fr) 120px 82px; }
  .workflow .branch, .workflow .event { display: none; }
}
@media (max-width: 550px) {
  .shell { padding: 20px 12px; }
  .top { align-items: start; flex-direction: column; }
  .header-actions { width: 100%; justify-content: space-between; }
  .freshness { text-align: left; }
  .summary { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .controls { display: grid; grid-template-columns: 1fr; gap: 8px; }
  .controls input[type="search"], .controls select { min-width: 0; width: 100%; }
  .repo > summary { align-items: start; flex-direction: column; }
  .repo-totals { justify-content: start; }
  .workflow { grid-template-columns: minmax(130px,1fr) 110px; gap: 8px; }
  .workflow .age, .workflow .run-link { display: none; }
}
@media (prefers-color-scheme: light) {
  :root { color-scheme: light; --bg:#f4f7fa; --surface:#fff; --surface2:#f0f5fa;
    --line:#d6e0e8; --fg:#162331; --muted:#536576; --success:#117850;
    --failure:#b62e36; --running:#155eb3; --warning:#94600c; --neutral:#627084; }
  .workflow {
    --row-text: #172434;
    --row-muted: #334a5a;
  }
  .workflow.success { --row-bg: #c0e7cb; --row-hover: #aadbb9; }
  .workflow.failure { --row-bg: #f3c2c4; --row-hover: #e9adaf; }
  .workflow.warning, .workflow.neutral, .workflow.never {
    --row-bg: #ffe5a0; --row-hover: #f5d77e;
  }
}


/* Per-repository workflow trigger graph */
.repo-heading-content { display:flex; align-items:center; flex-wrap:wrap; gap:12px; }
.graph-link { color:var(--running); font-size:12px; font-weight:600; padding:3px 9px;
  border-radius:6px; border:1px solid var(--line); text-decoration:none; white-space:nowrap; }
.graph-link:hover { text-decoration:underline; background:var(--surface2); }
.graph-back { margin:9px 0 0; color:var(--running); font-size:13px; }
.graph-back a { text-decoration:underline; text-underline-offset:3px; }
.graph-top { margin-bottom:16px; }
.graph-summary { color:var(--muted); margin:12px 0 18px; font-size:13px; }
.graph-legend { display:flex; flex-wrap:wrap; align-items:center; gap:18px; font-size:12px;
  color:var(--muted); margin-bottom:14px; }
.graph-legend span { display:inline-flex; align-items:center; gap:7px; }
.legend-stroke { display:inline-block; width:26px; height:0; border-top:3px solid #8291a3; }
.legend-stroke.chain { border-color:#54b89a; }
.legend-stroke.reuse { border-color:#aa8ff0; border-top-style:dashed; }
.legend-stroke.dispatch { border-color:#e4b466; border-top-style:dashed; }
.graph-area { border-radius:12px; border:1px solid var(--line); background:var(--surface);
  overflow:auto; min-height:160px; padding:4px; }
.graph-area svg { display:block; max-width:none; }
.graph-edge { fill:none; stroke:#8291a3; stroke-width:1.8; opacity:.8; }
.graph-edge.chain { stroke:#54b89a; stroke-width:2.8; }
.graph-edge.reuse { stroke:#aa8ff0; stroke-dasharray:7 5; stroke-width:2.3; }
.graph-edge.dispatch { stroke:#e4b466; stroke-dasharray:4 4; }
.graph-edge.unresolved { stroke-dasharray:3 6; }
.graph-node rect { stroke-width:1.4; fill:var(--surface2); stroke:var(--line); }
.graph-node.source rect { fill:#2b3645; stroke:#78889a; }
.graph-node.success rect { fill:#20563c; stroke:#42bd93; }
.graph-node.failure rect { fill:#713437; stroke:#f08080; }
.graph-node.warning rect, .graph-node.neutral rect,
.graph-node.never rect { fill:#68521d; stroke:#e8b86b; }
.graph-node text { pointer-events:none; fill:#f6f9fc; }
.graph-node .graph-label { font-size:13px; font-weight:650; }
.graph-node .graph-subtitle { font-size:10px; opacity:.82; }
.graph-node a { cursor:pointer; }
.graph-node a:hover rect { stroke-width:3; }
.graph-note { padding:12px 0; color:var(--muted); font-size:12px; }
.graph-section-title { font-size:17px; font-weight:650; margin:22px 0 12px; }
.graph-details { display:grid; gap:8px; }
.graph-detail { border:1px solid var(--line); border-radius:8px; background:var(--surface);
  overflow:hidden; font-size:13px; }
.graph-detail > summary { display:flex; align-items:center; justify-content:space-between;
  gap:12px; cursor:pointer; padding:10px 14px; }
.graph-detail > summary:hover { background:var(--surface2); }
.graph-detail > summary a { color:var(--running); text-decoration:underline; }
.graph-detail ul { color:var(--muted); padding:0 20px 12px 36px; margin:0; }
.graph-detail li { margin:5px 0; overflow-wrap:anywhere; }
.graph-state { color:var(--muted); font-size:11px; }
.graph-unknown { font-style:italic; }
@media (prefers-color-scheme: light) {
  .graph-node.source rect { fill:#dfe8f2; stroke:#667a92; }
  .graph-node.source text { fill:#203247; }
  .graph-node.success rect { fill:#c0e7cb; stroke:#27865d; }
  .graph-node.failure rect { fill:#f3c2c4; stroke:#b62e36; }
  .graph-node.warning rect, .graph-node.neutral rect,
  .graph-node.never rect { fill:#ffe5a0; stroke:#ad7923; }
  .graph-node:not(.source) text { fill:#203247; }
}
