:root {
  --bg: #f6f5f2;
  --card: #ffffff;
  --ink: #1f2328;
  --muted: #6a6f76;
  --line: #e3e1dc;
  --accent: #e8590c;
  --accent-soft: #fff1e6;
  --blue: #1c7ed6;
  --green: #2f9e44;
  --green-soft: #ebfbee;
  --red: #c92a2a;
  --red-soft: #fff0f0;
  --amber: #f08c00;
  --chip: #f1efea;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --radius: 12px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #15171a; --card: #1d2024; --ink: #e8e6e3; --muted: #9aa0a6; --line: #2e3237;
    --accent-soft: #3a2414; --green-soft: #15301c; --red-soft: #3a1a1a; --chip: #2a2e33; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #15171a; --card: #1d2024; --ink: #e8e6e3; --muted: #9aa0a6; --line: #2e3237;
  --accent-soft: #3a2414; --green-soft: #15301c; --red-soft: #3a1a1a; --chip: #2a2e33; color-scheme: dark;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
}
a { color: var(--blue); }
code, .mono { font-family: var(--mono); font-size: 0.92em; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
h1, h2, h3 { line-height: 1.2; margin: 0; }

.top {
  display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 12px 24px; border-bottom: 1px solid var(--line); background: var(--card);
  position: sticky; top: 0; z-index: 5;
}
.brand { display: flex; align-items: center; gap: 10px; font-size: 17px; }
.logo { position: relative; width: 26px; height: 22px; }
.logo i { position: absolute; border-radius: 50%; }
.logo i:nth-child(1) { width: 10px; height: 10px; left: 0; top: 6px; background: var(--accent); }
.logo i:nth-child(2) { width: 8px; height: 8px; right: 0; top: 0; background: var(--blue); }
.logo i:nth-child(3) { width: 8px; height: 8px; right: 0; bottom: 0; background: var(--blue); }
.status {
  font-size: 13px; color: var(--muted); background: var(--chip); padding: 4px 10px; border-radius: 99px;
}
.status.ok::before { content: "●"; color: var(--green); margin-right: 6px; }

.hero { max-width: 1280px; margin: 0 auto; padding: 28px 24px 8px; }
.hero h1 { font-size: clamp(26px, 4vw, 38px); letter-spacing: -0.02em; }
.lede { max-width: 860px; color: var(--muted); font-size: 16px; margin: 10px 0 18px; }
.lede b { color: var(--ink); font-weight: 600; }
.pick { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: end; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: 10px;
  padding: 8px 12px; cursor: pointer; text-align: left; font: inherit; font-size: 14px; max-width: 100%; white-space: normal;
}
.chip small { display: block; color: var(--muted); font-size: 12px; }
.chip.on { border-color: var(--accent); background: var(--accent-soft); }
.chip .tag { font-size: 11px; font-weight: 600; color: var(--accent); text-transform: uppercase; letter-spacing: .04em; }
.newform label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.row { display: flex; gap: 8px; align-items: center; margin: 8px 0; }
.row.wrap { flex-wrap: wrap; }
input, select, textarea {
  font: inherit; color: var(--ink); background: var(--card); border: 1px solid var(--line);
  border-radius: 10px; padding: 9px 12px; min-width: 0;
}
input { flex: 1; }
textarea { width: 100%; font-family: var(--mono); font-size: 13px; line-height: 1.45; resize: vertical; }
button {
  font: inherit; font-weight: 600; border: 0; border-radius: 10px; padding: 9px 16px; cursor: pointer;
  background: var(--accent); color: #fff; white-space: nowrap;
}
button:hover { filter: brightness(1.05); }
.examples { display: flex; gap: 6px; flex-wrap: wrap; }
.examples button {
  background: var(--chip); color: var(--muted); font-weight: 400; font-size: 12px; padding: 4px 10px; border-radius: 99px; white-space: normal; text-align: left;
}

.grid { max-width: 1280px; margin: 0 auto; padding: 16px 24px; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.col { display: grid; gap: 16px; min-width: 0; }
.sticky { position: sticky; top: 64px; }
.two { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; min-width: 0; }
.card:empty { display: none; }
.card h2 { font-size: 16px; margin-bottom: 10px; }
.card h3 { font-size: 14px; margin: 12px 0 4px; }
.cardhead { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.kicker { font-size: 12px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.casehead { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.key { font-family: var(--mono); font-weight: 700; }
.pill { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 99px; background: var(--chip); color: var(--muted); }
.pill.open { background: var(--accent-soft); color: var(--accent); }
.pill.closed { background: var(--green-soft); color: var(--green); }
.facets { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.facet { font-size: 12px; background: var(--chip); border-radius: 6px; padding: 2px 8px; }
.facet b { font-weight: 600; }

.alert { border-left: 4px solid var(--red); background: var(--red-soft); }
.alert.warn { border-left-color: var(--amber); }
.alert.ok { border-left-color: var(--green); background: var(--green-soft); }
.alert h2 { color: var(--red); }
.alert.ok h2 { color: var(--green); }
.alert.warn h2 { color: var(--amber); }
.timeline { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 10px 0; font-size: 14px; }
.timeline dt { color: var(--muted); }
.timeline dd { margin: 0; }
.bad { color: var(--red); font-weight: 600; }
.good { color: var(--green); font-weight: 600; }
ul.fix { margin: 6px 0; padding-left: 18px; }
ul.fix li { margin: 2px 0; }
.quote { font-style: italic; color: var(--muted); margin-top: 8px; }

.match { padding: 10px 0; border-top: 1px solid var(--line); }
.match:first-of-type { border-top: 0; }
.matchtop { display: flex; gap: 10px; align-items: baseline; }
.score { font-family: var(--mono); font-weight: 700; min-width: 34px; color: var(--accent); }
.bar { height: 4px; background: var(--chip); border-radius: 4px; margin: 6px 0 6px 44px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--accent); }
.reasons { margin-left: 44px; display: flex; flex-wrap: wrap; gap: 4px; }
.reason { font-size: 12px; border: 1px solid var(--line); border-radius: 6px; padding: 1px 7px; }
.reason b { font-weight: 600; }

.people { list-style: none; padding: 0; margin: 0; }
.people li { padding: 6px 0; border-top: 1px solid var(--line); }
.people li:first-child { border-top: 0; }
.findings { margin: 0 0 8px; padding-left: 18px; }
.findings li { margin: 3px 0; }
.mech { background: var(--chip); border-radius: 8px; padding: 8px 10px; margin: 8px 0; font-size: 14px; }

.graphcard svg { width: 100%; height: 520px; display: block; }
.legend { display: flex; flex-wrap: wrap; gap: 10px; font-size: 12px; color: var(--muted); margin-top: 6px; }
.legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--c); margin-right: 5px; vertical-align: -1px; }
svg text { font: 11px -apple-system, "Segoe UI", sans-serif; fill: var(--ink); paint-order: stroke; stroke: var(--card); stroke-width: 3px; }
svg .edge { stroke: var(--line); stroke-width: 1.4; }
svg .edge.hot { stroke: var(--red); stroke-width: 2.4; stroke-dasharray: 6 4; }
svg .edge.path { stroke: var(--accent); stroke-width: 2.2; }
svg .elabel { font-size: 9px; fill: var(--muted); }
svg .elabel.hot { fill: var(--red); font-weight: 700; }

.plant, .console { max-width: 1280px; margin: 0 auto; padding: 8px 24px; }
h2.sec { font-size: 20px; margin: 18px 0 12px; }
.two.wide { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th, td { text-align: left; padding: 6px 8px; border-top: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; border-top: 0; }
.result { overflow-x: auto; margin-top: 8px; max-height: 420px; }
.result pre { font-family: var(--mono); font-size: 12px; white-space: pre-wrap; }
#params { font-size: 13px; }
select { max-width: 100%; }

.foot { max-width: 1280px; margin: 16px auto 40px; padding: 0 24px; color: var(--ink); font-size: 14px; }

@media (max-width: 900px) {
  .pick, .grid, .two, .two.wide { grid-template-columns: minmax(0, 1fr); }
  .sticky { position: static; }
  .graphcard svg { height: 420px; }
  .top, .hero, .grid, .plant, .console, .foot { padding-left: 16px; padding-right: 16px; }
  .row { flex-wrap: wrap; }
}
