:root {
  --bg: #0b0f14;
  --panel: #121820;
  --panel-2: #18202b;
  --line: #243041;
  --ink: #e8eef5;
  --muted: #8d9bab;
  --accent: #00ec97;
  --ok: #34d399; --ok-bg: rgba(52, 211, 153, .12);
  --warn: #fbbf24; --warn-bg: rgba(251, 191, 36, .12);
  --bad: #f87171; --bad-bg: rgba(248, 113, 113, .12);
  --info: #60a5fa; --info-bg: rgba(96, 165, 250, .12);
  --neutral: #a3b1c2; --neutral-bg: rgba(163, 177, 194, .1);
  --radius: 14px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: radial-gradient(1200px 500px at 15% -10%, rgba(0, 236, 151, .07), transparent 60%), var(--bg);
  color: var(--ink); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--info); text-decoration: none; } a:hover { text-decoration: underline; }
code, .mono { font-family: var(--mono); font-size: .86em; word-break: break-all; }
code { background: var(--panel-2); border: 1px solid var(--line); border-radius: 6px; padding: .05em .35em; }
.small { font-size: .78em; }

.top {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 1rem 2rem; border-bottom: 1px solid var(--line); background: rgba(11, 15, 20, .85);
  position: sticky; top: 0; z-index: 2; backdrop-filter: blur(8px);
}
.brand { display: flex; align-items: center; gap: .8rem; }
.brand h1 { margin: 0; font-size: 1.25rem; letter-spacing: -.01em; }
.brand p { margin: 0; color: var(--muted); font-size: .88rem; }
.logo { width: 36px; height: 36px; }
.logo path { fill: rgba(0, 236, 151, .14); stroke: var(--accent); stroke-width: 1.8; stroke-linejoin: round; }
.logo .tick { fill: none; stroke-width: 2.4; stroke-linecap: round; }
.top-right { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; }
.live { display: inline-flex; align-items: center; gap: .4rem; color: var(--muted); font-size: .85rem; }
.live i { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 0 rgba(0, 236, 151, .6); animation: pulse 2s infinite; }
.is-loading .live i { background: var(--warn); }
@keyframes pulse { 70% { box-shadow: 0 0 0 8px rgba(0, 236, 151, 0); } 100% { box-shadow: 0 0 0 0 rgba(0, 236, 151, 0); } }
@media (prefers-reduced-motion: reduce) { .live i { animation: none; } }
.auto { color: var(--muted); font-size: .85rem; display: inline-flex; gap: .3rem; align-items: center; }

.btn {
  font: inherit; font-size: .9rem; color: #04130d; background: var(--accent); border: 0; border-radius: 9px;
  padding: .42rem .95rem; cursor: pointer; font-weight: 600;
}
.btn:hover { filter: brightness(1.08); }
.btn:focus-visible, button:focus-visible, input:focus-visible, summary:focus-visible { outline: 2px solid var(--info); outline-offset: 2px; }
.link-btn { background: none; border: 0; color: var(--info); cursor: pointer; padding: .4rem 0; font: inherit; font-size: .88rem; }

main { max-width: 1280px; margin: 0 auto; padding: 1.4rem 2rem 2rem; display: grid; gap: 1.1rem; }

.config { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: .6rem 1rem; }
.config summary { cursor: pointer; color: var(--muted); font-size: .9rem; }
.config summary span { color: var(--ink); font-weight: 600; margin-right: .3rem; }
.config form { display: grid; grid-template-columns: repeat(3, 1fr) auto; gap: .8rem; align-items: end; margin-top: .8rem; }
.config label { display: grid; gap: .25rem; font-size: .8rem; color: var(--muted); }
input {
  font: inherit; font-size: .9rem; color: var(--ink); background: var(--bg); border: 1px solid var(--line);
  border-radius: 8px; padding: .45rem .6rem; min-width: 0;
}
.alert { background: var(--bad-bg); border: 1px solid rgba(248, 113, 113, .4); color: #fecaca; padding: .7rem 1rem; border-radius: 10px; }

.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; display: grid; gap: .45rem; align-content: start; }
.kpi-label { color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; }
.kpi-value { font-size: 1.6rem; font-weight: 650; display: flex; align-items: baseline; flex-wrap: wrap; gap: .5rem; }
.kpi-value small { font-size: .95rem; color: var(--muted); font-weight: 500; }
.kpi-value .badge { font-size: .85rem; }
.kpi-foot { color: var(--muted); font-size: .82rem; }
.meter { height: 8px; background: var(--panel-2); border-radius: 99px; overflow: hidden; }
.meter span { display: block; height: 100%; border-radius: 99px; background: var(--ok); transition: width .5s ease; }
.meter-warn span { background: var(--warn); } .meter-bad span { background: var(--bad); }

.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.1rem; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.25rem; min-width: 0; }
.card h2 { margin: 0 0 .9rem; font-size: 1.02rem; display: flex; flex-wrap: wrap; align-items: baseline; gap: .5rem; }
.card h2 small { color: var(--muted); font-weight: 400; font-size: .82rem; }

.badge {
  display: inline-flex; align-items: center; gap: .3rem; padding: .14rem .55rem; border-radius: 99px;
  font-size: .76rem; font-weight: 600; letter-spacing: .01em; white-space: nowrap; border: 1px solid transparent;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-ok { color: var(--ok); background: var(--ok-bg); border-color: rgba(52, 211, 153, .3); }
.badge-warn { color: var(--warn); background: var(--warn-bg); border-color: rgba(251, 191, 36, .3); }
.badge-bad { color: var(--bad); background: var(--bad-bg); border-color: rgba(248, 113, 113, .3); }
.badge-info { color: var(--info); background: var(--info-bg); border-color: rgba(96, 165, 250, .3); }
.badge-neutral { color: var(--neutral); background: var(--neutral-bg); border-color: rgba(163, 177, 194, .25); }

.kv { display: grid; grid-template-columns: 170px 1fr; gap: .1rem 1rem; padding: .5rem 0; border-bottom: 1px solid var(--line); align-items: baseline; }
.kv:last-child { border-bottom: 0; }
.kv > span { color: var(--muted); font-size: .88rem; }
.kv > strong { font-weight: 600; }
.kv > em { grid-column: 2; color: var(--muted); font-style: normal; font-size: .8rem; }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.chip { background: var(--ok-bg); color: var(--ok); border: 1px solid rgba(52, 211, 153, .3); border-radius: 8px; padding: .12rem .5rem; }
.keycard { background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; padding: .7rem .9rem; margin-bottom: .7rem; }
.keycard .kv { grid-template-columns: 150px 1fr; padding: .35rem 0; }
.note { color: var(--muted); font-size: .84rem; margin: .7rem 0 0; }
.empty { color: var(--muted); margin: 0; }

.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: .9rem; }
th { text-align: left; color: var(--muted); font-weight: 500; font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; padding: .4rem .6rem; border-bottom: 1px solid var(--line); }
td { padding: .6rem; overflow-wrap: anywhere; border-bottom: 1px solid var(--line); vertical-align: top; }
.cmds { display: grid; gap: .35rem; }
.cmd { display: flex; gap: .4rem; align-items: center; }
.cmd code { font-size: .78rem; word-break: normal; overflow-wrap: anywhere; }
.copy { flex: none; white-space: nowrap; font: inherit; font-size: .75rem; background: var(--panel-2); color: var(--ink); border: 1px solid var(--line); border-radius: 6px; padding: .15rem .5rem; cursor: pointer; }

.feed { list-style: none; margin: 0; padding: 0; display: grid; gap: .1rem; }
.feed li { display: grid; grid-template-columns: 172px 1fr auto; gap: .8rem; align-items: center; padding: .45rem 0; border-bottom: 1px solid var(--line); }
.feed li:last-child { border-bottom: 0; }
.feed .badge { justify-self: start; }
.feed-summary { font-size: .88rem; overflow-wrap: anywhere; }
.feed time { color: var(--muted); font-size: .8rem; white-space: nowrap; }

.tx-form { display: flex; gap: .5rem; }
.tx-form input { flex: 1; font-family: var(--mono); font-size: .82rem; }
.examples { color: var(--muted); font-size: .82rem; margin: .7rem 0; display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; }
.examples button { font: inherit; font-size: .78rem; color: var(--ink); background: var(--panel-2); border: 1px solid var(--line); border-radius: 99px; padding: .12rem .6rem; cursor: pointer; }
.examples button:hover { border-color: var(--accent); }
.tx-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .6rem; }
.tx { background: var(--panel-2); border: 1px solid var(--line); border-left: 3px solid var(--neutral); border-radius: 10px; padding: .6rem .8rem; font-size: .88rem; }
.tx-ok { border-left-color: var(--ok); } .tx-warn { border-left-color: var(--warn); } .tx-bad { border-left-color: var(--bad); } .tx-info { border-left-color: var(--info); }
.tx-head { display: flex; flex-wrap: wrap; gap: .45rem; align-items: center; }
.tx-head .code { color: var(--bad); font-weight: 700; }
.tx-link { margin-left: auto; font-size: .78rem; }
.tx-what { margin-top: .35rem; font-weight: 600; overflow-wrap: anywhere; }
.tx-meta { color: var(--muted); font-size: .78rem; margin-top: .2rem; overflow-wrap: anywhere; }

.diagram { width: 100%; height: auto; display: block; margin: .2rem 0 1rem; }
.diagram .node rect { fill: var(--panel-2); stroke: var(--line); stroke-width: 1.5; }
.diagram .node-guard rect { fill: rgba(0, 236, 151, .06); stroke: var(--accent); }
.diagram text { fill: var(--ink); font-family: system-ui, sans-serif; }
.diagram .t-title { font-size: 19px; font-weight: 700; text-anchor: middle; }
.diagram .t-sub { font-size: 13px; fill: var(--muted); text-anchor: middle; }
.diagram .t-mono { font-family: var(--mono); font-size: 13px; fill: var(--info); text-anchor: middle; }
.diagram .t-edge { font-family: var(--mono); font-size: 13px; fill: var(--muted); text-anchor: middle; }
.diagram .checks text { font-size: 15px; }
.diagram .edge { fill: none; stroke: var(--muted); stroke-width: 2; }
.diagram .edge-ok { stroke: var(--ok); } .diagram .edge-warn { stroke: var(--warn); } .diagram .edge-bad { stroke: var(--bad); }
.diagram .arrowhead { fill: var(--muted); }
.diagram .out rect { stroke-width: 1.5; }
.diagram .out-ok rect { fill: var(--ok-bg); stroke: var(--ok); }
.diagram .out-warn rect { fill: var(--warn-bg); stroke: var(--warn); }
.diagram .out-bad rect { fill: var(--bad-bg); stroke: var(--bad); }
.diagram .t-out { font-size: 15px; font-weight: 650; }
.diagram .t-sub-l { font-size: 12.5px; fill: var(--muted); }
.how-steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin: 0; padding: 0; list-style: none; counter-reset: s; }
.how-steps li { background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; padding: .8rem 1rem; font-size: .9rem; color: var(--muted); counter-increment: s; }
.how-steps li::before { content: counter(s); display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: #04130d; font-weight: 700; font-size: .8rem; margin-right: .5rem; }
.how-steps strong { color: var(--ink); }

footer { max-width: 1280px; margin: 0 auto; padding: 0 2rem 2rem; color: var(--muted); font-size: .82rem; }

@media (max-width: 960px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid, .how-steps { grid-template-columns: 1fr; }
  .config form { grid-template-columns: 1fr; }
  .top, main, footer { padding-left: 1rem; padding-right: 1rem; }
}
@media (max-width: 560px) {
  .kpis { grid-template-columns: 1fr; }
  .kv, .keycard .kv { grid-template-columns: 1fr; }
  .kv > em { grid-column: 1; }
  .feed li { grid-template-columns: 1fr auto; }
  .feed-summary { grid-column: 1 / -1; grid-row: 2; }
}
#tx-hint:empty { display: none; }
td strong { white-space: nowrap; }
