:root {
  --bg: #07100f;
  --surface: #0c1715;
  --surface-2: #101e1b;
  --line: rgba(207, 231, 222, 0.11);
  --line-strong: rgba(207, 231, 222, 0.2);
  --text: #edf7f3;
  --muted: #86a09a;
  --mint: #8ef0c9;
  --mint-strong: #41dba0;
  --lime: #c9f56b;
  --amber: #ffbe62;
  --red: #ff7d77;
  --radius: 18px;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
  font-synthesis: none;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: var(--bg); color: var(--text); }
button, select { font: inherit; }
button { color: inherit; }
.skip-link { position: fixed; left: 1rem; top: -4rem; z-index: 50; padding: .75rem 1rem; background: var(--mint); color: #04100d; border-radius: 8px; }
.skip-link:focus { top: 1rem; }
.shell { min-height: 100vh; background-image: radial-gradient(circle at 75% 6%, rgba(65, 219, 160, .08), transparent 26%), linear-gradient(rgba(255,255,255,.018) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.018) 1px, transparent 1px); background-size: auto, 48px 48px, 48px 48px; }
.topbar { height: 78px; padding: 0 clamp(20px, 4vw, 64px); display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); background: rgba(7,16,15,.8); backdrop-filter: blur(18px); position: sticky; top: 0; z-index: 20; }
.brand-block, .topbar-actions, .live-state, .panel-heading, .legend, .result-controls { display: flex; align-items: center; }
.brand-block { gap: 13px; }
.brand-block h1 { margin: 2px 0 0; font-size: 17px; letter-spacing: -.02em; }
.brand-mark { width: 32px; height: 32px; position: relative; display: grid; place-items: center; border: 1px solid var(--line-strong); border-radius: 9px; }
.brand-mark span { position: absolute; width: 5px; border-radius: 999px; background: var(--mint); transform-origin: 50% 14px; }
.brand-mark span:nth-child(1) { height: 15px; transform: translateY(-4px); }
.brand-mark span:nth-child(2) { height: 11px; transform: rotate(120deg) translateY(-4px); }
.brand-mark span:nth-child(3) { height: 11px; transform: rotate(240deg) translateY(-4px); }
.eyebrow, .section-kicker { margin: 0; color: var(--muted); font-size: 10px; font-weight: 750; letter-spacing: .18em; }
.topbar-actions { gap: 10px; }
.review-center-link { padding: 8px 11px; border: 1px solid rgba(142,240,201,.3); border-radius: 999px; color: var(--mint); text-decoration: none; font-size: 10px; font-weight: 750; letter-spacing: .04em; }
.review-center-link:hover { background: rgba(142,240,201,.08); }
.live-state { gap: 8px; border: 1px solid var(--line); border-radius: 999px; padding: 8px 12px; color: var(--mint); font-size: 10px; font-weight: 800; letter-spacing: .13em; }
.live-state time { color: var(--muted); font-weight: 500; letter-spacing: 0; margin-left: 4px; }
.pulse { width: 6px; height: 6px; border-radius: 50%; background: var(--mint-strong); box-shadow: 0 0 0 5px rgba(65,219,160,.1); animation: pulse 2s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 9px rgba(65,219,160,0); } }
.icon-button { width: 36px; height: 36px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 50%; background: var(--surface); cursor: pointer; font-size: 20px; transition: .2s ease; }
.icon-button:hover { border-color: var(--mint); color: var(--mint); transform: rotate(30deg); }
.icon-button.loading { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
main { width: min(1600px, 100%); margin: 0 auto; padding: 0 clamp(20px, 4vw, 64px) 64px; }
.hero { min-height: 310px; padding: 60px 0 44px; display: flex; justify-content: space-between; align-items: flex-end; gap: 40px; border-bottom: 1px solid var(--line); }
.hero h2 { margin: 18px 0 16px; font-size: clamp(42px, 5vw, 72px); line-height: .96; letter-spacing: -.058em; font-weight: 620; }
.hero h2 span { color: var(--mint); }
.hero-copy { max-width: 640px; color: var(--muted); line-height: 1.75; font-size: 14px; margin: 0; }
.hero-status { flex: 0 0 290px; padding: 22px; border: 1px solid var(--line); border-radius: var(--radius); background: rgba(12,23,21,.68); display: grid; gap: 7px; }
.hero-status::before { content: ''; width: 100%; height: 3px; margin-bottom: 10px; background: linear-gradient(90deg, var(--mint), rgba(142,240,201,.05)); border-radius: 99px; }
.hero-status-label { font-size: 10px; color: var(--muted); letter-spacing: .16em; font-weight: 700; }
.hero-status strong { font-size: 20px; }
.hero-status span:last-child { color: var(--muted); font-size: 12px; }
.hero-status.warning::before { background: linear-gradient(90deg, var(--amber), rgba(255,190,98,.05)); }
.hero-status.warning strong { color: var(--amber); }
.metrics { display: grid; grid-template-columns: repeat(5, 1fr); margin: 30px 0; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.metric-card { min-height: 128px; padding: 21px 24px; display: flex; flex-direction: column; border-right: 1px solid var(--line); position: relative; }
.metric-card:last-child { border-right: 0; }
.metric-card.primary { background: linear-gradient(135deg, rgba(65,219,160,.12), transparent 70%); }
.metric-card.attention strong { color: var(--amber); }
.metric-label { color: var(--muted); font-size: 11px; font-weight: 650; }
.metric-card strong { font-size: 36px; letter-spacing: -.05em; margin: auto 0 4px; font-variant-numeric: tabular-nums; }
.metric-card > span:last-child { color: var(--muted); font-size: 10px; }
.panel { border: 1px solid var(--line); border-radius: var(--radius); background: rgba(12,23,21,.94); overflow: hidden; }
.panel-heading { justify-content: space-between; gap: 20px; padding: 25px 27px 22px; border-bottom: 1px solid var(--line); }
.panel-heading.compact { padding: 22px 24px 18px; }
.panel-heading h3 { margin: 7px 0 0; font-size: 19px; letter-spacing: -.025em; }
.legend { gap: 18px; color: var(--muted); font-size: 10px; }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.dot { width: 6px; height: 6px; display: inline-block; border-radius: 50%; background: var(--muted); }
.dot.active { background: var(--mint); box-shadow: 0 0 8px rgba(142,240,201,.6); }
.dot.idle { background: #526963; }
.dot.attention { background: var(--amber); }
.agent-pipeline { padding: 26px; display: grid; grid-template-columns: repeat(8, minmax(150px, 1fr)); gap: 12px; overflow-x: auto; }
.agent-card { min-width: 150px; min-height: 190px; padding: 18px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-2); text-align: left; position: relative; cursor: pointer; transition: transform .18s ease, border-color .18s ease, background .18s ease; }
.agent-card:not(:last-child)::after { content: '›'; position: absolute; right: -11px; top: 47%; z-index: 2; color: #516a63; font-size: 18px; }
.agent-card:hover, .agent-card.selected { transform: translateY(-3px); border-color: rgba(142,240,201,.5); background: #12231f; }
.agent-card.selected { box-shadow: inset 0 0 0 1px rgba(142,240,201,.18), 0 12px 30px rgba(0,0,0,.16); }
.agent-top { display: flex; align-items: center; justify-content: space-between; }
.agent-index { color: var(--muted); font-size: 10px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.agent-status-dot { width: 7px; height: 7px; border-radius: 50%; background: #526963; }
.agent-card[data-status="active"] .agent-status-dot { background: var(--mint); box-shadow: 0 0 10px rgba(142,240,201,.7); }
.agent-card[data-status="attention"] .agent-status-dot { background: var(--amber); }
.agent-card[data-status="not_started"] { opacity: .68; }
.agent-card h4 { margin: 24px 0 8px; font-size: 15px; letter-spacing: -.02em; }
.agent-card p { margin: 0; color: var(--muted); font-size: 10.5px; line-height: 1.55; min-height: 49px; }
.agent-stats { display: flex; align-items: flex-end; justify-content: space-between; margin-top: 17px; padding-top: 14px; border-top: 1px solid var(--line); }
.agent-stats strong { font-size: 24px; letter-spacing: -.05em; }
.agent-stats span { color: var(--muted); font-size: 9px; text-align: right; }
.pipeline-help { margin: 0; padding: 0 27px 22px; color: var(--muted); font-size: 10px; }
.rule-set-header { display: flex; align-items: end; justify-content: space-between; gap: 20px; padding: 24px 27px 18px; border-top: 1px solid var(--line); }
.rule-set-header h4 { margin: 7px 0 0; font-size: 15px; }
.rule-version { color: var(--mint); font: 9px ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .08em; }
.rule-set-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; padding: 0 26px 26px; }
.rule-set-card { min-width: 0; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); overflow: hidden; }
.rule-set-title { display: flex; justify-content: space-between; gap: 10px; padding: 13px 14px; border-bottom: 1px solid var(--line); }
.rule-set-title strong { font-size: 11px; }
.rule-set-title span { color: var(--mint); font-size: 8px; letter-spacing: .08em; white-space: nowrap; }
.rule-list { list-style: none; margin: 0; padding: 5px 14px 10px; }
.rule-list li { padding: 10px 0; border-bottom: 1px solid var(--line); }
.rule-list li:last-child { border-bottom: 0; }
.rule-label { display: flex; align-items: baseline; gap: 8px; }
.rule-label code { color: var(--mint); font-size: 8px; }
.rule-label strong { font-size: 10px; }
.rule-list p { margin: 5px 0 0; color: var(--muted); font-size: 9px; line-height: 1.5; }
.dashboard-grid { margin-top: 30px; display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(320px, .75fr); gap: 30px; }
.results-panel { grid-column: 1; }
.accounts-panel { grid-column: 2; }
.count-badge { display: inline-grid; min-width: 28px; height: 28px; padding: 0 8px; place-items: center; border: 1px solid var(--line); border-radius: 999px; color: var(--mint); font-size: 11px; font-weight: 750; }
.count-badge.warm { color: var(--amber); }
.timeline, .approval-list { min-height: 260px; max-height: 420px; overflow-y: auto; padding: 18px 24px 24px; }
.timeline-item { display: grid; grid-template-columns: 90px 24px 1fr auto; align-items: start; gap: 8px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.timeline-item:last-child { border-bottom: 0; }
.timeline-time { color: var(--muted); font-size: 10px; font-variant-numeric: tabular-nums; padding-top: 3px; }
.timeline-node { width: 8px; height: 8px; border-radius: 50%; background: var(--mint); margin-top: 3px; position: relative; }
.timeline-node::after { content: ''; position: absolute; width: 1px; height: 38px; background: var(--line-strong); left: 3.5px; top: 10px; }
.timeline-item:last-child .timeline-node::after { display: none; }
.timeline-main strong { display: block; font-size: 12px; margin-bottom: 5px; }
.timeline-main span { color: var(--muted); font-size: 10.5px; line-height: 1.5; }
.route-arrow { color: var(--mint); margin: 0 6px; }
.status-pill { display: inline-flex; align-items: center; padding: 5px 8px; border-radius: 999px; background: rgba(142,240,201,.08); color: var(--mint); font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; white-space: nowrap; }
.status-pill.failed, .status-pill.rejected, .status-pill.expired { color: var(--red); background: rgba(255,125,119,.09); }
.status-pill.pending, .status-pill.running, .status-pill.processing { color: var(--amber); background: rgba(255,190,98,.09); }
.approval-item { width: 100%; padding: 16px 0; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: inherit; text-align: left; cursor: pointer; }
.approval-item:hover h4 { color: var(--mint); }
.approval-item:last-child { border-bottom: 0; }
.approval-meta { display: flex; justify-content: space-between; color: var(--muted); font-size: 9px; letter-spacing: .05em; }
.approval-item h4 { margin: 10px 0 7px; font-size: 13px; line-height: 1.45; }
.approval-item p { margin: 0; color: var(--amber); font-size: 10px; }
.empty-state { color: var(--muted); display: grid; place-items: center; font-size: 12px; text-align: center; }
.results-heading { flex-wrap: wrap; }
.result-controls { gap: 8px; }
select, .filter-chip { border: 1px solid var(--line); background: var(--surface-2); color: var(--muted); border-radius: 8px; padding: 8px 10px; font-size: 10px; cursor: pointer; }
.filter-chip { color: var(--mint); }
.table-scroll { overflow: auto; max-height: 470px; }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th { position: sticky; top: 0; z-index: 2; background: #0c1715; color: var(--muted); font-size: 9px; letter-spacing: .08em; text-align: left; padding: 12px 18px; border-bottom: 1px solid var(--line); }
td { padding: 15px 18px; border-bottom: 1px solid var(--line); font-size: 11px; vertical-align: middle; }
tbody tr:hover { background: rgba(142,240,201,.025); }
.cell-primary { display: block; font-weight: 650; margin-bottom: 4px; }
.cell-secondary { display: block; color: var(--muted); font-size: 9px; }
.table-empty { height: 180px; text-align: center; color: var(--muted); }
.account-list { padding: 8px 24px 16px; }
.account-item { padding: 17px 0; border-bottom: 1px solid var(--line); }
.account-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.account-name { display: flex; align-items: center; gap: 10px; }
.account-indicator { width: 7px; height: 7px; border-radius: 50%; background: var(--red); }
.account-indicator.connected { background: var(--mint); }
.account-name strong { font-size: 12px; }
.account-code { color: var(--muted); font: 9px ui-monospace, SFMono-Regular, Menlo, monospace; }
.account-info { display: flex; justify-content: space-between; margin: 10px 0 0 17px; color: var(--muted); font-size: 9px; }
.integration-strip { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--line); }
.integration-strip > div { padding: 18px 22px; display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; }
.integration-strip > div:not(:last-child) { border-right: 1px solid var(--line); }
.integration-strip span { color: var(--muted); font-size: 8px; letter-spacing: .12em; }
.integration-strip strong { grid-row: 1 / span 2; grid-column: 2; font-size: 22px; }
.integration-strip small { color: var(--muted); font-size: 9px; }
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 30; max-width: 360px; padding: 16px 18px; border: 1px solid rgba(255,125,119,.3); border-radius: 12px; background: #251312; box-shadow: 0 20px 50px rgba(0,0,0,.3); }
.toast strong, .toast span { display: block; }
.toast strong { color: var(--red); margin-bottom: 5px; font-size: 12px; }
.toast span { color: #c7a6a3; font-size: 10px; }

@media (max-width: 1180px) {
  .metrics { grid-template-columns: repeat(3, 1fr); }
  .metric-card:nth-child(3) { border-right: 0; }
  .metric-card:nth-child(-n+3) { border-bottom: 1px solid var(--line); }
  .agent-pipeline { grid-template-columns: repeat(8, 175px); }
  .dashboard-grid { grid-template-columns: minmax(0, 1fr) 320px; }
  .rule-set-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 850px) {
  .topbar { padding: 0 20px; }
  .live-state time { display: none; }
  .hero { align-items: flex-start; flex-direction: column; min-height: auto; }
  .hero-status { width: 100%; flex-basis: auto; }
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .metric-card, .metric-card:nth-child(3) { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
  .metric-card:nth-child(even) { border-right: 0; }
  .metric-card:last-child { grid-column: 1 / -1; border-bottom: 0; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .activity-panel, .approval-panel, .results-panel, .accounts-panel { grid-column: 1; }
  .approval-panel { grid-row: 2; }
  .accounts-panel { grid-row: 4; }
  .legend { display: none; }
}
@media (max-width: 520px) {
  .brand-block .eyebrow { display: none; }
  .topbar { height: 66px; }
  main { padding-inline: 14px; }
  .hero { padding-top: 40px; }
  .hero h2 { font-size: 40px; }
  .metrics { grid-template-columns: 1fr 1fr; }
  .metric-card { min-height: 110px; padding: 17px; }
  .metric-card strong { font-size: 30px; }
  .panel-heading { padding-inline: 18px; }
  .agent-pipeline { padding: 18px; }
  .rule-set-header { padding-inline: 18px; }
  .rule-set-grid { grid-template-columns: 1fr; padding-inline: 18px; }
  .timeline-item { grid-template-columns: 64px 18px 1fr; }
  .timeline-item .status-pill { grid-column: 3; justify-self: start; }
}
