:root {
  --bg: #f5f6f8; --card: #ffffff; --ink: #1d2433; --muted: #6b7385; --line: #e3e6ec;
  --accent: #2f6fde; --accent-2: #e5862a; --good: #1f9d6b; --bad: #d1435b; --window: rgba(47,111,222,.12);
  --radius: 12px; --shadow: 0 1px 2px rgba(20,30,50,.06), 0 4px 16px rgba(20,30,50,.05);
  font-size: 15px;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: "Segoe UI", system-ui, -apple-system, sans-serif; background: var(--bg); color: var(--ink); }
header { position: sticky; top: 0; z-index: 10; display: flex; gap: 24px; align-items: center; flex-wrap: wrap;
  padding: 12px 22px; background: #fff; border-bottom: 1px solid var(--line); }
.brand { display: flex; gap: 12px; align-items: center; }
.logo { width: 38px; height: 38px; border-radius: 10px; background: linear-gradient(135deg, #2f6fde, #7b4fd6); color: #fff;
  display: grid; place-items: center; font-size: 22px; }
.title { font-weight: 700; font-size: 18px; }
.subtitle { color: var(--muted); font-size: 12.5px; }
nav { display: flex; gap: 4px; }
nav button { border: 0; background: none; padding: 8px 14px; border-radius: 8px; color: var(--muted); font-size: 14px; cursor: pointer; }
nav button.active { background: #eaf0fc; color: var(--accent); font-weight: 600; }
nav button:hover { color: var(--ink); }
.rig { margin-left: auto; display: flex; gap: 10px; align-items: center; font-size: 13px; color: var(--muted); }
main { padding: 18px 22px 40px; }
.tab { display: none; }
.tab.active { display: block; }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; margin-bottom: 16px; }
.card-h { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
h2 { font-size: 15px; margin: 0 0 10px; }
.muted { color: var(--muted); font-size: 13px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid2.wide-left { grid-template-columns: 1.6fr 1fr; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.span2 { grid-column: span 2; } .span3 { grid-column: span 3; }
.col { display: flex; flex-direction: column; }
@media (max-width: 1100px) { .grid2, .grid2.wide-left, .grid3 { grid-template-columns: 1fr; } .span2, .span3 { grid-column: auto; } }
svg { width: 100%; height: auto; display: block; }
.row { display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--muted); }
.rig label, .controls label { flex-direction: row; align-items: center; gap: 6px; }
select, input { font: inherit; font-size: 14px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); }
button.primary { background: var(--accent); color: #fff; border: 0; padding: 9px 16px; border-radius: 8px; font-weight: 600; cursor: pointer; }
button.primary:disabled { opacity: .5; cursor: default; }
button.ghost { background: #fff; border: 1px solid var(--line); padding: 7px 12px; border-radius: 8px; cursor: pointer; color: var(--ink); }
.controls { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; }
.controls .desc { flex-basis: 100%; }
.pill { padding: 4px 10px; border-radius: 99px; background: #eef0f4; font-size: 12.5px; font-weight: 600; }
.pill.running { background: #fff1e0; color: #b2600f; } .pill.done { background: #e3f6ee; color: var(--good); }
.pill.error, .pill.stopped { background: #fde8ec; color: var(--bad); }
.result { margin-top: 14px; }
.result.empty { color: var(--muted); font-size: 13.5px; }
.droplets { display: flex; gap: 10px; margin: 8px 0; }
.droplet { flex: 1; text-align: center; background: #f8f9fb; border-radius: 10px; padding: 6px; }
.droplet .a { font-weight: 700; font-size: 16px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; font-size: 13.5px; }
.kv b { font-weight: 600; }
.big { font-size: 28px; font-weight: 700; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 12px; font-weight: 600; }
.badge.in { background: #e3f6ee; color: var(--good); } .badge.out { background: #fde8ec; color: var(--bad); }
.steps { max-height: 300px; overflow: auto; font-family: Consolas, monospace; font-size: 12px; }
.steps div { padding: 3px 0; border-bottom: 1px dashed var(--line); display: grid; grid-template-columns: 62px 86px 1fr; gap: 8px; }
.steps .t { color: var(--muted); } .steps .d { color: var(--accent); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-top: 6px; align-items: center; }
.swatch { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 4px; vertical-align: -2px; }
.explain { margin: 0; padding-left: 18px; font-size: 13.5px; line-height: 1.55; }
.thoughts { max-height: 340px; overflow: auto; font-size: 13px; line-height: 1.45; }
.thoughts .t { padding: 8px 10px; border-left: 3px solid var(--accent); background: #f7f9fd; border-radius: 6px; margin-bottom: 8px; white-space: pre-wrap; }
.tablewrap { overflow: auto; max-height: 420px; }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th, td { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
th { position: sticky; top: 0; background: #fff; color: var(--muted); font-weight: 600; }
tr.init td { color: var(--muted); }
tr.best td { background: #fff8ec; }
.pipeline { display: flex; flex-direction: column; align-items: stretch; gap: 4px; }
.layer { display: grid; grid-template-columns: 190px 1fr; gap: 14px; padding: 12px 16px; border-radius: 10px; background: #f3f6fc; border: 1px solid #dfe6f5; }
.layer span { color: var(--muted); }
.hidden-layer { background: #fbf4ea; border-color: #f0dfc6; }
.arrow { text-align: center; color: var(--muted); }
.switch { flex-direction: row; align-items: center; gap: 6px; cursor: pointer; }
#tooltip { position: fixed; pointer-events: none; background: #1d2433; color: #fff; font-size: 12px; padding: 6px 8px; border-radius: 6px; display: none; z-index: 50; white-space: pre; }
.dev { border-top: 1px solid var(--line); padding: 10px 0; font-size: 13px; }
.dev code { background: #f1f3f7; padding: 1px 5px; border-radius: 4px; font-size: 12px; }
.outcome-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat { background: #f8f9fb; border-radius: 10px; padding: 10px; }
.stat .l { color: var(--muted); font-size: 12px; } .stat .v { font-size: 20px; font-weight: 700; }
.droplet svg { height: 64px; width: 100%; }
