:root {
  --bg: #f6f7f3;
  --surface: #ffffff;
  --surface-raised: #f0f3ed;
  --line: #d7ddd5;
  --line-soft: #e8ece6;
  --text: #1d2720;
  --muted: #667168;
  --dim: #8a958d;
  --lime: #2f7d4b;
  --lime-soft: rgba(47, 125, 75, 0.1);
  --orange: #a45b18;
  --red: #c33f36;
  --blue: #346da6;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 320px; background: var(--bg); }
button, input { font: inherit; }
button { color: inherit; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.mono { font-family: "SFMono-Regular", Consolas, monospace; }
.eyebrow { margin: 0 0 5px; color: var(--dim); font-family: "SFMono-Regular", Consolas, monospace; font-size: 10px; font-weight: 700; letter-spacing: .16em; }

.shell { min-height: 100vh; }
.topbar { height: 76px; padding: 0 26px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); background: rgba(250, 251, 248, .92); position: sticky; top: 0; z-index: 10; backdrop-filter: blur(14px); }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { width: 28px; height: 28px; border: 1px solid var(--lime); border-radius: 50%; position: relative; box-shadow: inset 0 0 0 7px var(--lime-soft); }
.brand-mark::after { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--lime); position: absolute; top: 10px; left: 10px; box-shadow: 0 0 16px var(--lime); }
.brand h1 { margin: 0; font-size: 18px; letter-spacing: -.02em; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.live-pill { display: inline-flex; align-items: center; gap: 7px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: 12px; }
.live-pill span { width: 7px; height: 7px; border-radius: 50%; background: var(--lime); box-shadow: 0 0 10px var(--lime); }
.icon-button { border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 8px 12px; cursor: pointer; font-size: 12px; }
.icon-button:hover, .icon-button:focus-visible { border-color: var(--lime); outline: none; }
.nav-button { border: 0; border-bottom: 2px solid transparent; background: transparent; padding: 10px 4px; color: var(--muted); cursor: pointer; font-size: 12px; }
.nav-button:hover, .nav-button:focus-visible, .nav-button.active { color: var(--text); border-color: var(--lime); outline: none; }

.workspace { min-height: calc(100vh - 76px); display: grid; grid-template-columns: 320px minmax(0, 1fr); }
.sidebar { border-right: 1px solid var(--line); padding: 24px 16px; background: #f1f3ef; }
.sidebar-heading { padding: 0 8px 17px; display: flex; justify-content: space-between; align-items: flex-end; }
.sidebar h2 { margin: 0; font-size: 15px; }
.count { min-width: 26px; height: 26px; display: grid; place-items: center; border-radius: 7px; background: var(--surface-raised); color: var(--muted); font-size: 12px; }
.search input { width: 100%; margin-bottom: 14px; padding: 10px 11px; border: 1px solid var(--line-soft); border-radius: 8px; background: var(--surface); color: var(--text); outline: none; }
.search input:focus { border-color: #586359; }
.scope-switch { margin: -3px 0 16px; padding: 3px; display: grid; grid-template-columns: 1fr 1fr; gap: 3px; border: 1px solid var(--line); border-radius: 8px; background: #e9ede7; }
.scope-button { padding: 7px 8px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); cursor: pointer; font-size: 10px; }
.scope-button:hover, .scope-button:focus-visible { color: var(--text); outline: none; }
.scope-button.active { background: var(--surface); color: var(--lime); box-shadow: 0 1px 4px rgba(31, 54, 38, .08); font-weight: 650; }
.run-list { display: grid; gap: 15px; }
.workspace-group + .workspace-group { padding-top: 13px; border-top: 1px solid var(--line); }
.workspace-heading { width: 100%; padding: 7px 9px 10px; display: grid; grid-template-columns: 14px minmax(0, 1fr) auto; align-items: center; gap: 5px; border: 0; border-radius: 7px; background: transparent; color: var(--text); text-align: left; cursor: pointer; }
.workspace-heading:hover, .workspace-heading:focus-visible { background: rgba(47, 125, 75, .06); outline: none; }
.workspace-chevron { color: var(--lime); font-size: 16px; line-height: 1; transform: translateY(-1px); }
.workspace-name { min-width: 0; font-size: 11px; font-weight: 700; overflow-wrap: anywhere; }
.workspace-count { color: var(--dim); font: 8px "SFMono-Regular", Consolas, monospace; white-space: nowrap; }
.session-group { padding: 7px 0 4px; border-top: 1px solid var(--line); }
.session-group:first-child { padding-top: 0; border-top: 0; }
.session-heading { padding: 0 9px 7px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.session-name { color: #536058; font-size: 9px; font-weight: 700; letter-spacing: .08em; }
.session-count { color: var(--dim); font-size: 9px; }
.run-item { width: 100%; padding: 13px; border: 1px solid transparent; border-radius: 10px; background: transparent; text-align: left; cursor: pointer; }
.run-item:hover { background: var(--surface); }
.run-item.active { border-color: #bcc8be; background: var(--surface); box-shadow: inset 2px 0 var(--lime), 0 4px 16px rgba(31, 54, 38, .05); }
.run-item-top { display: flex; justify-content: space-between; gap: 10px; color: var(--dim); font-size: 10px; font-family: "SFMono-Regular", Consolas, monospace; }
.run-item-title { margin: 9px 0 11px; color: #303b33; font-size: 13px; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.run-item-stats { display: flex; gap: 11px; color: var(--dim); font-size: 10px; }
.status-dot { display: inline-block; width: 6px; height: 6px; margin-right: 5px; border-radius: 50%; background: var(--lime); }
.status-dot.completed { background: var(--blue); }
.status-dot.failed { background: var(--red); }
.status-dot.aborted { background: var(--orange); }

.main { min-width: 0; padding: 42px clamp(24px, 5vw, 72px) 80px; }
.empty-state { min-height: 55vh; display: grid; place-content: center; max-width: 460px; margin: auto; text-align: center; }
.empty-state h2 { margin: 5px 0 10px; font-size: 30px; }
.empty-state > p:last-child { color: var(--muted); line-height: 1.7; }
.run-detail { max-width: 1180px; margin: 0 auto; }
.insights-view { max-width: 1180px; margin: 0 auto; }
.insights-hero { display: flex; align-items: center; justify-content: space-between; gap: 40px; }
.insights-hero h2 { margin: 8px 0 10px; font-size: clamp(30px, 4vw, 50px); letter-spacing: -.045em; }
.insights-hero p:last-child { max-width: 720px; margin: 0; color: var(--muted); line-height: 1.7; }
.verification-ring { flex: 0 0 112px; aspect-ratio: 1; display: grid; place-content: center; border-radius: 50%; background: conic-gradient(var(--lime) var(--progress, 0%), var(--line-soft) 0); color: var(--text); font-size: 23px; font-weight: 700; position: relative; }
.verification-ring::before { content: ""; position: absolute; inset: 8px; border-radius: 50%; background: var(--bg); }
.verification-ring span { position: relative; z-index: 1; }
.verification-ring small { position: relative; z-index: 1; color: var(--dim); font: 8px "SFMono-Regular", Consolas, monospace; letter-spacing: .1em; }
.insight-metrics { margin-bottom: 20px; }
.insight-layout { display: grid; grid-template-columns: 1.1fr .9fr; gap: 18px; }
.skill-version-card { margin-top: 18px; }
.rank-row { display: grid; grid-template-columns: 28px minmax(120px, 1fr) 2fr 38px; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line-soft); }
.rank-row { width: 100%; border-top: 0; border-left: 0; border-right: 0; background: transparent; text-align: left; cursor: pointer; }
.rank-row:hover, .rank-row:focus-visible { background: #f7f9f5; outline: none; }
.rank-row:last-child { border-bottom: 0; }
.rank-number { color: var(--dim); font: 10px "SFMono-Regular", Consolas, monospace; }
.rank-name { color: #344138; font-size: 12px; }
.rank-track { height: 5px; border-radius: 999px; background: var(--line-soft); overflow: hidden; }
.rank-fill { height: 100%; border-radius: inherit; background: var(--orange); }
.rank-value { color: var(--dim); font: 10px "SFMono-Regular", Consolas, monospace; text-align: right; }
.category-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 9px; }
.category-item { padding: 12px; border: 1px solid var(--line-soft); border-radius: 8px; background: #fafbf9; text-align: left; cursor: pointer; color: inherit; }
.category-item:hover, .category-item:focus-visible { border-color: #aebdb1; outline: none; }
.category-name { color: var(--muted); font-size: 11px; }
.category-stats { margin-top: 8px; display: flex; align-items: baseline; gap: 7px; }
.category-count { font-size: 22px; }
.category-rate { color: var(--dim); font-size: 9px; }
.skill-table { width: 100%; border-collapse: collapse; }
.skill-table th, .skill-table td { padding: 12px 18px; border-bottom: 1px solid var(--line-soft); text-align: left; }
.skill-table th { color: var(--dim); font: 9px "SFMono-Regular", Consolas, monospace; letter-spacing: .1em; text-transform: uppercase; }
.skill-table tr:last-child td { border-bottom: 0; }
.skill-table tbody tr { cursor: pointer; }
.skill-table tbody tr:hover, .skill-table tbody tr:focus-visible { background: #f7f9f5; outline: none; }
.skill-name { font-size: 12px; font-weight: 650; }
.skill-hash { color: var(--dim); font: 9px "SFMono-Regular", Consolas, monospace; }
.hero { display: flex; justify-content: space-between; gap: 42px; align-items: flex-start; }
.hero-copy { max-width: 820px; }
.hero-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; color: var(--dim); font-size: 11px; }
.outcome { padding: 4px 8px; border-radius: 5px; background: var(--lime-soft); color: var(--lime); font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.outcome.completed { color: var(--blue); background: rgba(52, 109, 166, .1); }
.outcome.failed { color: var(--red); background: rgba(255, 120, 110, .1); }
.outcome.aborted { color: var(--orange); background: rgba(255, 184, 107, .1); }
.category-badge { padding: 4px 8px; border: 1px solid var(--line); border-radius: 5px; color: var(--muted); font: 9px "SFMono-Regular", Consolas, monospace; text-transform: uppercase; letter-spacing: .08em; }
.hero h2 { margin: 16px 0 12px; font-size: clamp(26px, 3.5vw, 44px); line-height: 1.12; letter-spacing: -.04em; }
.summary { margin: 0; color: var(--muted); line-height: 1.7; }
.health-score { flex: 0 0 108px; aspect-ratio: 1; display: grid; place-content: center; border: 1px solid var(--line); border-radius: 50%; background: radial-gradient(circle, var(--lime-soft), transparent 67%); color: var(--lime); font-size: 30px; font-weight: 650; position: relative; }
.health-score::after { content: "HEALTH"; position: absolute; bottom: 20px; left: 0; right: 0; text-align: center; color: var(--dim); font: 8px "SFMono-Regular", Consolas, monospace; letter-spacing: .15em; }

.metric-grid { margin: 34px 0; display: grid; grid-template-columns: repeat(5, 1fr); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.metric { min-height: 94px; padding: 17px; border-right: 1px solid var(--line); background: linear-gradient(145deg, #f7f9f5, var(--surface)); }
.metric:last-child { border-right: 0; }
.metric-label { color: var(--dim); font: 9px "SFMono-Regular", Consolas, monospace; letter-spacing: .12em; text-transform: uppercase; }
.metric-value { margin-top: 12px; font-size: 24px; letter-spacing: -.03em; }
.metric-detail { margin-top: 4px; color: var(--dim); font-size: 10px; }

.tabs { display: flex; gap: 3px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tab { padding: 13px 16px; border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--dim); cursor: pointer; white-space: nowrap; }
.tab:hover { color: var(--muted); }
.tab.active { color: var(--text); border-color: var(--lime); }
.panel { padding-top: 25px; }
.section-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(260px, .65fr); gap: 18px; }
.card { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); overflow: hidden; }
.card-heading { padding: 16px 18px; border-bottom: 1px solid var(--line-soft); display: flex; justify-content: space-between; align-items: center; }
.card-heading h3 { margin: 0; font-size: 13px; }
.card-body { padding: 18px; }
.finding { padding: 15px 0; border-bottom: 1px solid var(--line-soft); }
.finding:first-child { padding-top: 0; }
.finding:last-child { padding-bottom: 0; border-bottom: 0; }
.finding-title { display: flex; align-items: center; gap: 8px; margin-bottom: 7px; font-size: 13px; font-weight: 650; }
.warning-mark { width: 7px; height: 7px; border-radius: 50%; background: var(--orange); box-shadow: 0 0 9px rgba(255, 184, 107, .5); }
.finding p, .candidate p { margin: 5px 0; color: var(--muted); font-size: 12px; line-height: 1.65; }
.skill-action { margin-bottom: 11px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.evidence-level { padding: 4px 7px; border-radius: 5px; background: rgba(164, 91, 24, .1); color: var(--orange); font: 9px "SFMono-Regular", Consolas, monospace; text-transform: uppercase; }
.evidence-level.backed { background: var(--lime-soft); color: var(--lime); }
.skill-create-button { padding: 7px 10px; border: 1px solid var(--lime); border-radius: 7px; background: var(--lime); color: white; cursor: pointer; font-size: 11px; font-weight: 650; }
.skill-create-button:hover, .skill-create-button:focus-visible { background: #286b40; outline: 2px solid rgba(47, 125, 75, .18); outline-offset: 2px; }
.skill-create-button:disabled { border-color: var(--line); background: var(--surface-raised); color: var(--dim); cursor: default; }
.skill-result { margin-top: 10px !important; padding: 8px 10px; border-radius: 6px; background: var(--surface-raised); white-space: pre-line; overflow-wrap: anywhere; }
.skill-result.error { color: var(--red); background: rgba(195, 63, 54, .07); }
.failure-group { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.failure-heading { margin-bottom: 9px; color: var(--red); font: 9px "SFMono-Regular", Consolas, monospace; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.failure-item { display: grid; grid-template-columns: minmax(80px, 120px) minmax(0, 1fr); gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line-soft); }
.failure-item:last-child { border-bottom: 0; }
.failure-tool { color: var(--red); font-size: 10px; }
.failure-reason { color: #7c3e39; font: 10px/1.55 "SFMono-Regular", Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
.success-block { padding: 22px; text-align: center; color: var(--muted); }
.success-block strong { display: block; margin-bottom: 7px; color: var(--lime); }
.bar-row { margin-bottom: 16px; }
.bar-label { display: flex; justify-content: space-between; margin-bottom: 7px; color: var(--muted); font-size: 11px; }
.bar-track { height: 5px; border-radius: 999px; background: var(--line-soft); overflow: hidden; }
.bar-fill { height: 100%; border-radius: inherit; background: var(--lime); }

.timeline { position: relative; }
.timeline::before { content: ""; position: absolute; top: 8px; bottom: 8px; left: 13px; width: 1px; background: var(--line); }
.tool-row { position: relative; display: grid; grid-template-columns: 28px 130px minmax(0, 1fr) auto; gap: 13px; align-items: start; min-height: 48px; padding: 7px 0; }
.tool-node { z-index: 1; width: 27px; height: 27px; border: 1px solid #bdc9bf; border-radius: 7px; background: var(--surface); display: grid; place-items: center; color: var(--lime); font: 9px "SFMono-Regular", Consolas, monospace; }
.tool-node.error { color: var(--red); border-color: rgba(255, 120, 110, .45); }
.tool-name { padding-top: 5px; font: 11px "SFMono-Regular", Consolas, monospace; color: #344138; }
.tool-input { min-width: 0; padding-top: 5px; color: var(--dim); font: 10px "SFMono-Regular", Consolas, monospace; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tool-duration { padding-top: 5px; color: var(--dim); font: 10px "SFMono-Regular", Consolas, monospace; }
.tool-error-detail { grid-column: 2 / -1; margin: -3px 0 8px; padding: 9px 11px; border-left: 2px solid var(--red); border-radius: 0 6px 6px 0; background: rgba(195, 63, 54, .07); color: #7c3e39; font: 10px/1.55 "SFMono-Regular", Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }

.file-table { width: 100%; border-collapse: collapse; }
.file-table th, .file-table td { padding: 12px 14px; border-bottom: 1px solid var(--line-soft); text-align: left; }
.file-table th { color: var(--dim); font: 9px "SFMono-Regular", Consolas, monospace; letter-spacing: .11em; text-transform: uppercase; }
.file-table td { font-size: 12px; }
.file-table tr:last-child td { border-bottom: 0; }
.file-path { font-family: "SFMono-Regular", Consolas, monospace; color: #344138; overflow-wrap: anywhere; }
.file-reason { max-width: 360px; color: #7c3e39; font: 9px/1.5 "SFMono-Regular", Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
.op { color: var(--blue); }
.op.edit, .op.create-or-update, .op.unknown-mutation { color: var(--orange); }
.candidate { padding: 18px; border: 1px solid var(--line); border-radius: 10px; background: linear-gradient(130deg, var(--surface-raised), var(--surface)); }
.candidate + .candidate { margin-top: 12px; }
.candidate-index { color: var(--lime); font: 10px "SFMono-Regular", Consolas, monospace; }
.candidate h3 { margin: 8px 0 10px; font-size: 15px; }
.checkpoint { display: grid; grid-template-columns: 18px minmax(140px, 1fr) minmax(100px, auto); gap: 8px; align-items: center; padding: 9px 0; border-top: 1px solid var(--line-soft); color: var(--muted); font-size: 11px; }
.checkpoint-status { color: var(--orange); font-weight: 700; }
.checkpoint.followed .checkpoint-status { color: var(--lime); }
.checkpoint-evidence { color: var(--dim); font-size: 9px; text-align: right; }

.error-message { margin: 20px; padding: 14px; border: 1px solid rgba(255, 120, 110, .4); border-radius: 8px; color: var(--red); background: rgba(255, 120, 110, .08); }

@media (max-width: 900px) {
  .workspace { grid-template-columns: 1fr; }
  .sidebar { border-right: 0; border-bottom: 1px solid var(--line); }
  .run-list { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .metric { border-bottom: 1px solid var(--line); }
  .section-grid { grid-template-columns: 1fr; }
  .insight-layout { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  .topbar { height: auto; min-height: 72px; padding: 14px 16px; }
  .live-pill { display: none; }
  .main { padding: 28px 16px 60px; }
  .hero { gap: 18px; }
  .health-score { flex-basis: 78px; font-size: 23px; }
  .health-score::after { bottom: 11px; }
  .metric-grid { grid-template-columns: 1fr 1fr; }
  .metric:nth-child(2n) { border-right: 0; }
  .tool-row { grid-template-columns: 28px minmax(80px, 110px) minmax(0, 1fr); }
  .tool-duration { display: none; }
}
