:root {
    --ink: #1d2733;
    --muted: #5f6b7a;
    --line: #d5dbe3;
    --accent: #1b5fa8;
    --ok: #1e7a3c;
    --bad: #b3261e;
    --warn: #8a5a00;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font: 14px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif;
    color: var(--ink);
    background: #f6f8fa;
}

code, pre { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 12.5px; }

.banner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 20px;
    background: #14212e;
    color: #fff;
}
.banner .environment {
    margin-left: 10px;
    padding: 2px 8px;
    border-radius: 10px;
    background: #f2b84b;
    color: #1d2733;
    font-weight: 600;
}
.banner code { color: #cfe3f7; }

.badge { padding: 1px 8px; border-radius: 10px; font-weight: 600; }
.badge.ok { background: #d8f0df; color: var(--ok); }
.badge.bad { background: #f8d9d6; color: var(--bad); }
.badge.unknown { background: #e6e9ee; color: var(--muted); }

.tabs { display: flex; gap: 4px; padding: 10px 20px 0; border-bottom: 1px solid var(--line); background: #fff; }
.tab {
    padding: 8px 18px;
    border: 1px solid transparent;
    border-bottom: 0;
    border-radius: 6px 6px 0 0;
    color: var(--muted);
    text-decoration: none;
    font-weight: 600;
}
.tab.active { background: #f6f8fa; border-color: var(--line); color: var(--accent); margin-bottom: -1px; }

.subnav { display: flex; align-items: center; gap: 6px; padding: 8px 20px; background: #f6f8fa; border-bottom: 1px solid var(--line); }
.subnav .subtitle { margin-right: 14px; color: var(--muted); }
.subtab { padding: 4px 12px; border-radius: 14px; color: var(--ink); text-decoration: none; }
.subtab.active { background: var(--accent); color: #fff; }

main { padding: 18px 20px 40px; max-width: 1280px; }
h2 { margin: 0 0 2px; }
h3 { margin: 22px 0 8px; }
h4 { margin: 0 0 6px; }

.request, .viewer, .history { background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 14px 16px; margin-bottom: 16px; }
.route { margin: 0 0 6px; color: var(--muted); }
.description { margin: 0 0 12px; }

.fields { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: flex-end; margin-bottom: 10px; }
fieldset { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: flex-end; border: 1px solid var(--line); border-radius: 6px; margin: 0 0 10px; width: 100%; }
legend { padding: 0 6px; color: var(--muted); font-weight: 600; }
label { display: flex; flex-direction: column; gap: 2px; font-size: 12.5px; color: var(--muted); }
label.check { flex-direction: row; align-items: center; gap: 6px; color: var(--ink); font-size: 14px; }
input[type=text], input[type=number], input[type=date], select { padding: 5px 7px; border: 1px solid var(--line); border-radius: 4px; font: inherit; color: var(--ink); min-width: 150px; }
input.short { min-width: 0; width: 90px; }
input.wide { width: 420px; max-width: 100%; }
.hint { color: var(--muted); font-size: 12.5px; }

textarea.raw { width: 100%; padding: 8px; border: 1px solid var(--line); border-radius: 4px; font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 12.5px; margin-bottom: 10px; }

button.send { padding: 7px 22px; border: 0; border-radius: 4px; background: var(--accent); color: #fff; font-weight: 600; cursor: pointer; }
button.send.danger { background: var(--bad); }
button.send:disabled { background: #9db3cc; cursor: default; }
button.link { border: 0; background: none; color: var(--accent); cursor: pointer; padding: 0 6px; font: inherit; }

.notice { padding: 8px 10px; background: #fff4d6; border-left: 3px solid var(--warn); color: var(--warn); }
.confirm { padding: 8px 10px; background: #fbe3e1; border-left: 3px solid var(--bad); }
.failure { padding: 8px 10px; background: #fbe3e1; border-left: 3px solid var(--bad); color: var(--bad); }

.viewer .meta { margin-left: 10px; font-weight: 400; color: var(--muted); font-size: 12.5px; }
.panes { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.pane { min-width: 0; }
.pane pre { margin: 8px 0 4px; padding: 10px; max-height: 480px; overflow: auto; background: #f1f4f8; border-radius: 4px; white-space: pre-wrap; word-break: break-word; }
.line { margin: 0 0 6px; word-break: break-all; }
table.headers { border-collapse: collapse; font-size: 12px; width: 100%; }
table.headers th { text-align: left; padding: 1px 10px 1px 0; color: var(--muted); white-space: nowrap; vertical-align: top; font-weight: 600; }
table.headers td { word-break: break-all; }

.status { padding: 1px 8px; border-radius: 4px; font-weight: 700; color: #fff; background: var(--muted); }
.status.s2 { background: var(--ok); }
.status.s4 { background: var(--warn); }
.status.s5 { background: var(--bad); }
.status.s0 { background: var(--bad); }

.history table { width: 100%; border-collapse: collapse; }
.history td { padding: 4px 8px; border-top: 1px solid var(--line); }
.history tr { cursor: pointer; }
.history tr:hover, .history tr.selected { background: #eaf2fb; }
