/* E2E Process Control Tower. Uses the tokens from site.css; amber (--signal) still means live. */

/* The grid needs room: this page runs wider than the rest of the site. */
.ct-page .wrap { max-width: 1440px; }

.site-nav a[aria-current="page"] { color: var(--ink); }

.ct-hero { box-shadow: inset 0 4px 0 var(--signal); }

/* ---------- KPI strip ---------- */
.ct-kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 0; margin-top: 24px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); overflow: hidden; }
.ct-kpi { display: grid; gap: 2px; padding: 14px 16px; border-left: 1px solid var(--line); min-width: 0; }
.ct-kpi:first-child { border-left: 0; background: var(--signal-soft); }
.ct-kpi-n { font: 700 1.7rem/1.1 var(--font-display); font-variant-numeric: tabular-nums; }
.ct-kpi-n small { font: 500 0.9rem var(--font-mono); color: var(--muted); }
.ct-kpi-l { font-size: 0.78rem; color: var(--muted); font-weight: 500; }

/* ---------- Toolbar ---------- */
.ct-section { padding-top: 28px; }
.ct-tools { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 18px; }
.ct-tools select { font: inherit; font-size: var(--step--1); padding: 8px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); max-width: 100%; }
.ct-tools .search input { background: var(--surface); }
.ct-tools-end { display: flex; gap: 8px; align-items: center; margin-left: auto; flex-wrap: wrap; }
.ct-check { display: inline-flex; gap: 6px; align-items: center; font-size: var(--step--1); color: var(--muted); cursor: pointer; }

/* ---------- Tally (counts + stacked bar) ---------- */
.ct-tally { display: inline-flex; align-items: center; gap: 10px; min-width: 0; }
.ct-tally-txt { font: 500 0.78rem var(--font-mono); color: var(--muted); white-space: nowrap; }
.ct-tally-txt b { color: var(--ink); }
.ct-dim { color: var(--muted); opacity: .8; }
.ct-bar { display: inline-flex; width: 72px; height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; flex: none; }
.ct-bar i { display: block; height: 100%; }
.ct-bar .is-live { background: var(--signal); }
.ct-bar .is-review { background: var(--accent); }
.ct-bar .is-planned { background: color-mix(in srgb, var(--muted) 45%, var(--surface-2)); }
.ct-bar.is-empty { background: transparent; box-shadow: inset 0 0 0 1px var(--line); }

/* ---------- Hierarchy ---------- */
.ct-tree { display: grid; gap: 10px; }
.ct-node > summary { list-style: none; cursor: pointer; }
.ct-node > summary::-webkit-details-marker { display: none; }
.ct-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 14px; }
.ct-name { display: inline-flex; align-items: center; gap: 10px; flex: 1 1 260px; min-width: 0; flex-wrap: wrap; }
.ct-code { font-size: 0.75rem; color: var(--muted); }
.ct-lvl { font-size: 0.68rem; text-transform: uppercase; letter-spacing: .08em; font-weight: 600; color: var(--muted); }
.ct-caret { width: 18px; height: 18px; flex: none; display: grid; place-items: center; border-radius: 5px; color: var(--muted); }
.ct-caret::before { content: ""; width: 6px; height: 6px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-45deg); transition: transform .15s ease; }
details[open] > summary .ct-caret::before { transform: rotate(45deg); }
.ct-caret.is-none::before { content: none; }
.ct-node > summary:hover .ct-caret { background: var(--surface-2); color: var(--ink); }

.ct-vs { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: inset 4px 0 0 var(--vs, var(--accent)); overflow: hidden; }
.ct-vs > summary { padding-left: 16px; }
.ct-vs > summary b { font-family: var(--font-display); font-size: 1.12rem; font-weight: 700; }
.ct-vs > .ct-kids { border-top: 1px solid var(--line); padding: 6px 12px 12px 30px; }
.ct-open { font-size: var(--step--1); font-weight: 600; text-decoration: none; padding: 4px 10px; border-radius: 99px; border: 1px solid var(--line); color: var(--accent); }
.ct-open:hover { border-color: var(--accent); }

.ct-ws { border-bottom: 1px dashed var(--line); }
.ct-ws:last-child { border-bottom: 0; }
.ct-ws > summary, .ct-ws > .ct-row { padding-inline: 4px; }
.ct-ws .ct-name { font-weight: 600; }
.ct-ws > .ct-kids { padding: 0 0 12px 30px; display: grid; gap: 8px; }
.ct-ws.is-gap .ct-name { font-weight: 500; color: var(--muted); }
.ct-gap-txt { font: 500 0.78rem var(--font-mono); color: var(--muted); }

.ct-dil { border: 1px solid var(--line); border-radius: 10px; background: var(--paper); }
.ct-dil > summary { padding-block: 9px; }
.ct-dil .ct-name { font-weight: 600; font-size: 0.95rem; }
.ct-dil > .ct-kids { padding: 0 10px 10px 40px; display: grid; gap: 8px; }

.ct-mod { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 14px; align-items: center; padding: 10px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.ct-mod.is-live { border-color: color-mix(in srgb, var(--signal) 55%, var(--line)); }
.ct-mod.is-live:hover { border-color: var(--signal); }
.ct-mod-main { display: grid; gap: 2px; min-width: 0; color: inherit; text-decoration: none; }
a.ct-mod-main b { color: var(--ink); }
a.ct-mod-main:hover b { color: var(--accent); }
.ct-mod-main b { font-size: 0.95rem; }
.ct-mod-main > span { font-size: 0.82rem; color: var(--muted); }
.ct-mod-where { font-size: 0.8rem; color: var(--muted); text-align: right; }
.ct-mod-where a { text-decoration: none; }

/* Status pills beyond site.css */
.ct-pill--live { background: var(--signal-soft); color: var(--ink); border: 1px solid var(--signal); }
.ct-pill--review { background: color-mix(in srgb, var(--accent) 14%, var(--surface)); color: var(--accent); }
.ct-pill--planned { background: var(--surface-2); color: var(--muted); }

/* ---------- Grid ---------- */
.ct-count { font: 500 var(--step--1) var(--font-mono); color: var(--muted); margin-bottom: 8px; }
.ct-table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.ct-table { width: 100%; border-collapse: collapse; font-size: 0.86rem; min-width: 1240px; }
.ct-table th { position: sticky; top: 0; background: var(--surface-2); text-align: left; padding: 0; border-bottom: 1px solid var(--line); white-space: nowrap; }
.ct-table th button { all: unset; box-sizing: border-box; display: flex; gap: 6px; align-items: center; width: 100%; padding: 10px 12px; cursor: pointer; font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.ct-table th button:hover, .ct-table th[aria-sort="ascending"] button, .ct-table th[aria-sort="descending"] button { color: var(--ink); }
.ct-table th button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.ct-sort { font-size: 0.6rem; color: var(--signal); }
.ct-table td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.ct-table tr:last-child td { border-bottom: 0; }
.ct-table tbody tr:hover td { background: var(--paper); }
.ct-table tr.is-live td:first-child { box-shadow: inset 3px 0 0 var(--signal); }
.ct-table td small { display: block; color: var(--muted); font-size: 0.78rem; margin-top: 2px; }
.ct-table td[data-col="title"] { min-width: 240px; font-weight: 600; }
.ct-table td[data-col="title"] a { color: var(--ink); text-decoration: none; }
.ct-table td[data-col="title"] a:hover { color: var(--accent); text-decoration: underline; }
.ct-table td[data-col="title"] small { font-weight: 400; }
.ct-table td[data-col="appId"] { white-space: nowrap; }
.ct-table td[data-col="ext"] { min-width: 180px; }
.ct-crafted { display: inline-flex; gap: 2px; }
.ct-crafted i { font: 600 0.68rem/1 var(--font-mono); font-style: normal; width: 17px; height: 19px; display: grid; place-items: center; border-radius: 4px; background: var(--surface-2); color: var(--muted); opacity: .55; }
.ct-crafted i.is-on { background: var(--ok-soft); color: var(--ok); opacity: 1; }
.ct-ext { display: block; font-size: 0.8rem; }
.ct-ext b { font-family: var(--font-mono); color: var(--accent); }

@media (max-width: 960px) {
  .ct-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .ct-kpi:nth-child(4) { border-left: 0; }
  .ct-kpi:nth-child(n+4) { border-top: 1px solid var(--line); }
}
@media (max-width: 720px) {
  .ct-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ct-kpi:nth-child(odd) { border-left: 0; }
  .ct-kpi:nth-child(4) { border-left: 1px solid var(--line); }
  .ct-kpi:nth-child(n+3) { border-top: 1px solid var(--line); }
  .ct-tools-end { margin-left: 0; }
  .ct-tools select { flex: 1 1 100%; }
  .ct-vs > .ct-kids { padding-left: 12px; }
  .ct-ws > .ct-kids { padding-left: 10px; }
  .ct-dil > .ct-kids { padding-left: 10px; }
  .ct-tally-txt { white-space: normal; }
  .ct-mod { grid-template-columns: minmax(0, 1fr) auto; }
  .ct-mod-where { grid-column: 1 / -1; grid-row: 2; text-align: left; }
}
