:root {
    --text: #24292f;
    --muted: #57606a;
    --line: #d0d7de;
    --faint: #f6f8fa;
    --blue: #0969da;
    --purple: #8250df;
    --green: #116329;
    --red: #a40e26;
    --amber: #9a6700;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
    color: var(--text);
    line-height: 1.45;
}

.boot {
    padding: 3rem;
    color: var(--muted);
}

/* ---------- shell ---------- */

header {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    padding: .5rem .9rem 0;
    border-bottom: 1px solid var(--line);
    background: var(--faint);
}

.lang {
    display: flex;
    gap: .15rem;
    padding-bottom: .5rem;
}

.lang-btn {
    padding: .2rem .45rem;
    border: 1px solid var(--line);
    border-radius: .3rem;
    background: #fff;
    color: var(--muted);
    font-size: .72rem;
    font-weight: 600;
    letter-spacing: .04em;
    cursor: pointer;
}

.lang-btn:hover {
    color: var(--text);
}

.lang-btn.on {
    background: var(--blue);
    border-color: var(--blue);
    color: #fff;
}

.brand {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
    padding-bottom: .5rem;
}

nav.tabs {
    display: flex;
    gap: .25rem;
    margin-left: auto;
    align-self: flex-end;
}

.tab {
    padding: .4rem .85rem;
    border: 1px solid var(--line);
    border-bottom: none;
    border-radius: .4rem .4rem 0 0;
    background: #eaeef2;
    color: var(--muted);
    text-decoration: none;
    font-size: .88rem;
}

.tab:hover {
    color: var(--text);
}

.tab.active {
    background: #fff;
    color: var(--text);
    font-weight: 600;
    margin-bottom: -1px;
    border-bottom: 1px solid #fff;
}

.pills {
    display: flex;
    gap: .3rem;
    padding-bottom: .5rem;
}

main {
    padding: 1rem 1.1rem 3rem;
}

h1 {
    font-size: 1.3rem;
    margin: .2rem 0 .1rem;
}

h2 {
    font-size: 1rem;
    margin: 1.2rem 0 .3rem;
}

h3 {
    font-size: .92rem;
    margin: .9rem 0 .25rem;
}

a {
    color: var(--blue);
}

code {
    background: var(--faint);
    padding: .05rem .3rem;
    border-radius: .25rem;
    font-size: .85em;
}

.muted {
    color: var(--muted);
    font-size: .82rem;
}

/* ---------- controls ---------- */

button {
    cursor: pointer;
    border: 1px solid var(--line);
    background: #fff;
    border-radius: .35rem;
    padding: .22rem .6rem;
    font: inherit;
    font-size: .84rem;
}

button:hover:not(:disabled) {
    background: var(--faint);
}

button:disabled {
    opacity: .5;
    cursor: default;
}

button.primary {
    color: var(--blue);
    border-color: #adcdf5;
}

button.ghost {
    border: none;
    color: var(--muted);
    padding: .1rem .3rem;
}

input, select, textarea {
    font: inherit;
    font-size: .84rem;
    padding: .2rem .4rem;
    border: 1px solid var(--line);
    border-radius: .3rem;
    background: #fff;
    color: var(--text);
}

textarea {
    width: 100%;
    font-family: ui-monospace, SFMono-Regular, monospace;
    font-size: .8rem;
}

.bar {
    display: flex;
    gap: .4rem;
    align-items: center;
    flex-wrap: wrap;
    padding: .35rem 0;
}

.bar + .bar {
    border-top: 1px solid var(--faint);
}

/* ---------- primitives ---------- */

.pill {
    border-radius: 1rem;
    padding: .05rem .55rem;
    font-size: .74rem;
    border: 1px solid transparent;
}

.pill.on {
    background: #dafbe1;
    color: var(--green);
}

.pill.off {
    background: #ffebe9;
    color: var(--red);
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: .25rem;
    background: #eef1f4;
    border-radius: 1rem;
    padding: .1rem .55rem;
    font-size: .78rem;
    margin: .12rem .12rem .12rem 0;
}

.chip.event {
    background: #fff3e0;
}

.chip button {
    border: none;
    background: none;
    color: var(--red);
    padding: 0 .1rem;
}

.hb {
    display: inline-block;
    width: .55rem;
    height: .55rem;
    border-radius: 50%;
}

.hb.live {
    background: #1a7f37;
}

.hb.stale {
    background: #bf8700;
}

.hb.manual {
    background: #8c959f;
}

.banner {
    border-radius: .4rem;
    padding: .5rem .8rem;
    margin: .4rem 0;
    font-size: .85rem;
}

.banner.error {
    background: #fdecef;
    border: 1px solid #e5989f;
    border-left: 4px solid var(--red);
    color: #7a0f22;
}

.banner.warn {
    background: #fff8e6;
    border: 1px solid #f0d488;
    color: #7a5c00;
}

.card {
    border: 1px solid var(--line);
    border-radius: .5rem;
    padding: .6rem .85rem;
    margin: .5rem 0;
}

.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(19rem, 1fr));
    gap: .6rem;
}

.big {
    font-size: 1.2rem;
    font-weight: 600;
}

table {
    border-collapse: collapse;
    width: 100%;
    margin: .3rem 0;
}

th, td {
    border-bottom: 1px solid #eaeef2;
    text-align: left;
    padding: .3rem .5rem;
    font-size: .84rem;
    vertical-align: top;
}

th {
    color: var(--muted);
    font-weight: 600;
}

.on-text {
    color: var(--green);
    font-weight: 600;
}

.off-text {
    color: var(--red);
    font-weight: 600;
}

/* ---------- operations ---------- */

fieldset {
    border: 1px solid var(--line);
    border-radius: .45rem;
    margin: .5rem 0;
    padding: .3rem .7rem .6rem;
}

legend {
    font-size: .84rem;
    font-weight: 600;
    color: var(--blue);
}

.op {
    border-top: 1px solid #f0f2f4;
    padding: .45rem 0;
}

.op:first-of-type {
    border-top: none;
}

.op .verb {
    background: #eaeaea;
    border-radius: 1rem;
    padding: .02rem .45rem;
    font-size: .7rem;
    margin-left: .35rem;
}

.op .wire {
    color: var(--muted);
    font-size: .72rem;
    font-family: ui-monospace, monospace;
}

.op .io {
    font-size: .74rem;
    font-family: ui-monospace, monospace;
}

.op .io .req {
    color: var(--blue);
}

.op .io .resp {
    color: var(--purple);
}

.type-link {
    cursor: pointer;
    text-decoration: underline dotted;
    font-weight: 600;
    background: none;
    border: none;
    font-size: inherit;
    color: inherit;
    padding: 0;
}

.deprecated {
    color: var(--red);
    font-size: .72rem;
    font-weight: 600;
}

.idrow {
    display: flex;
    gap: .3rem;
    align-items: center;
    margin: .25rem 0;
    flex-wrap: wrap;
}

.idrow input {
    min-width: 6rem;
}

.btns {
    display: flex;
    gap: .3rem;
    flex-wrap: wrap;
}

/* ---------- console ---------- */

.split {
    display: grid;
    grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
    gap: 1rem;
    align-items: start;
}

@media (max-width: 70rem) {
    .split {
        grid-template-columns: 1fr;
    }
}

.log {
    background: #0d1117;
    color: #c9d1d9;
    font-family: ui-monospace, SFMono-Regular, monospace;
    font-size: .76rem;
    padding: .4rem;
    border-radius: 0 0 .4rem .4rem;
    height: 46vh;
    overflow: auto;
}

.log.tall {
    height: 74vh;
    border-radius: .4rem;
    position: sticky;
    top: .5rem;
}

.log .line {
    white-space: pre-wrap;
    border-bottom: 1px solid #161b22;
    padding: .12rem 0;
    word-break: break-word;
}

.log .muted {
    color: #6e7681;
}

.line.send {
    color: #7ee787;
}

.line.recv {
    color: #79c0ff;
}

.line.evt {
    color: #ffa657;
}

.line.err {
    color: #ff7b72;
}

.tag {
    background: #21262d;
    border-radius: .25rem;
    padding: 0 .3rem;
    font-size: .72rem;
    color: #8b949e;
}

/* ---------- transport lanes ---------- */

.lanes {
    display: flex;
    gap: .4rem;
    overflow-x: auto;
    padding-bottom: .4rem;
}

.lane {
    flex: 1 1 15rem;
    min-width: 15rem;
    display: flex;
    flex-direction: column;
}

.lane-head {
    border: 1px solid var(--line);
    border-bottom: none;
    border-radius: .4rem .4rem 0 0;
    padding: .3rem .5rem;
    background: var(--faint);
}

.lane-head > div:first-child {
    display: flex;
    align-items: center;
    gap: .3rem;
    font-size: .85rem;
}

/* ---------- scenarios ---------- */

.card.scenario {
    display: flex;
    flex-direction: column;
    gap: .1rem;
}

.card.scenario.active {
    border-color: #adcdf5;
    background: #f6faff;
}

.card.scenario .claim {
    font-size: .84rem;
}

.card.scenario p {
    margin: .35rem 0;
}

.card.scenario ul.watch {
    margin: 0 0 .5rem;
    padding-left: 1.1rem;
}

.card.scenario button {
    align-self: flex-start;
    margin-top: auto;
}

ol.steps {
    list-style: none;
    margin: .3rem 0;
    padding: 0;
}

.step {
    border-left: 3px solid var(--line);
    padding: .3rem .6rem;
    margin: .3rem 0;
    background: var(--faint);
    border-radius: 0 .35rem .35rem 0;
}

.step.running {
    border-left-color: var(--blue);
}

.step.done {
    border-left-color: #1a7f37;
}

.step.failed {
    border-left-color: var(--red);
}

.step.skipped {
    border-left-color: #8c959f;
    opacity: .75;
}

.step .glyph {
    font-weight: 700;
    margin-right: .2rem;
}

.step .observed {
    font-family: ui-monospace, monospace;
    font-size: .76rem;
    margin-top: .15rem;
}

.step.failed .observed {
    color: var(--red);
}

.step .tag {
    background: #e4e8ec;
    color: var(--muted);
    margin-right: .25rem;
}

.step .wires {
    margin-top: .35rem;
    border-top: 1px solid #e4e8ec;
    padding-top: .25rem;
}

.exchange {
    font-size: .78rem;
    font-family: ui-monospace, monospace;
    margin: .25rem 0;
}

.exchange.send {
    color: var(--green);
}

.exchange.recv {
    color: var(--blue);
}

.exchange.evt {
    color: var(--amber);
}

.exchange.err {
    color: var(--red);
}

pre.wire-body {
    background: #0d1117;
    color: #c9d1d9;
    font-size: .72rem;
    padding: .3rem .45rem;
    border-radius: .3rem;
    margin: .15rem 0 .35rem;
    max-height: 12rem;
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-word;
}

.wire-row {
    border: 1px solid #eaeef2;
    border-radius: .4rem;
    padding: .3rem .55rem;
    margin: .25rem 0;
    font-size: .82rem;
}

.wire-row.dangling {
    border-color: #ff7b72;
    background: #fff5f5;
}

.flow {
    font-family: ui-monospace, monospace;
    font-size: .78rem;
}

.flow .producer {
    color: var(--blue);
}

.flow .consumer {
    color: var(--purple);
}

/* ---------- modal ---------- */

.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20;
}

.modal-box {
    background: #fff;
    border-radius: .5rem;
    padding: .9rem 1.1rem;
    max-width: 36rem;
    width: 90%;
    max-height: 80vh;
    overflow: auto;
    position: relative;
}

.modal-box .close {
    position: absolute;
    top: .5rem;
    right: .5rem;
}

/* ---------- embedded documents ---------- */

.embed {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 8.5rem);
}

.embed iframe {
    flex: 1;
    width: 100%;
    border: 1px solid var(--line);
    border-radius: .4rem;
    background: #fff;
}

#blazor-error-ui {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #fff8e6;
    border-top: 1px solid #f0d488;
    padding: .6rem 1.2rem;
    font-size: .85rem;
    z-index: 30;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    float: right;
}
