:root {
  --blue: #0078BF;
  --pink: #E44C9A;
  --amber: #D97706;
  --red: #B42318;
  --green: #10B981;
  --bg: #F9FAFB;
  --card: #FFFFFF;
  --border: #E5E7EB;
  --text: #111827;
  --muted: #6B7280;
  --code: #F3F4F6;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0B1220;
    --card: #111A2C;
    --border: #1F2937;
    --text: #E5E7EB;
    --muted: #9CA3AF;
    --code: #1F2937;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); font-family: 'Raleway', system-ui, sans-serif; font-size: 15px; line-height: 1.5; }
a { color: var(--blue); text-decoration: none; }
a:hover, a:focus { text-decoration: underline; outline: none; }
button { font-family: inherit; }
code, pre { font-family: 'JetBrains Mono', 'SF Mono', Menlo, Consolas, monospace; font-size: 13px; background: var(--code); padding: 1px 4px; border-radius: 3px; }
pre { padding: 12px; border-radius: 6px; overflow-x: auto; }

.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 24px; background: var(--card); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
}
.brand { font-weight: 700; color: var(--blue); }
.brand a { color: inherit; }
.who { color: var(--muted); font-size: 14px; }
.role { display: inline-block; padding: 2px 8px; border-radius: 12px; font-size: 11px; font-weight: 600; text-transform: uppercase; margin-right: 8px; }
.role-admin { background: var(--pink); color: #fff; }
.role-developer { background: var(--blue); color: #fff; }
button.link { background: none; border: none; color: var(--muted); cursor: pointer; padding: 0 0 0 8px; text-decoration: underline; font-size: 14px; }

main { padding: 24px; max-width: 1200px; margin: 0 auto; }
main.login { display: flex; justify-content: center; padding-top: 80px; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: 8px; padding: 32px; max-width: 480px; width: 100%; }
.lead { color: var(--muted); margin-top: -8px; }
.hint { color: var(--muted); font-size: 13px; margin-top: 20px; }
label { display: block; margin: 16px 0; font-weight: 600; }
label input { display: block; width: 100%; margin-top: 4px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 6px; font-family: 'JetBrains Mono', monospace; font-size: 13px; background: var(--card); color: var(--text); }
button[type=submit], button.primary { background: var(--blue); color: #fff; border: none; padding: 10px 20px; border-radius: 6px; font-weight: 600; cursor: pointer; font-size: 14px; }
button[type=submit]:hover, button.primary:hover { background: #005a92; }
button:focus-visible { outline: 2px solid var(--pink); outline-offset: 2px; }
.err { background: #FEE2E2; color: var(--red); border: 1px solid #FECACA; padding: 12px; border-radius: 6px; margin: 16px 0; }
@media (prefers-color-scheme: dark) { .err { background: #7F1D1D; color: #FECACA; border-color: #991B1B; } }

.status-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-bottom: 32px; }
.stat { background: var(--card); border: 1px solid var(--border); border-radius: 6px; padding: 16px; }
.stat .label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 6px; }
.stat .value { font-size: 22px; font-weight: 700; color: var(--text); }
.stat .value.ok { color: var(--green); }
.stat .value.warn { color: var(--amber); }
.stat .value.err { color: var(--red); }

section { margin-bottom: 32px; }
section h2 { color: var(--text); margin: 0 0 12px 0; font-size: 18px; }
section p { color: var(--muted); }

.actions { background: var(--card); border: 1px solid var(--border); border-radius: 6px; padding: 20px; }
.fire-row { display: flex; align-items: center; gap: 12px; margin-top: 12px; }
.fire-row select { padding: 8px 12px; border: 1px solid var(--border); border-radius: 6px; background: var(--card); color: var(--text); font-family: inherit; font-size: 14px; }
.fire-status { color: var(--muted); font-size: 13px; }
.fire-status.ok { color: var(--green); }
.fire-status.err { color: var(--red); }

.tx-table { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.tx-table th, .tx-table td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--border); font-size: 13px; }
.tx-table th { background: var(--code); font-weight: 600; color: var(--muted); text-transform: uppercase; font-size: 11px; letter-spacing: 0.5px; }
.tx-table tbody tr:hover { background: var(--code); cursor: pointer; }
.tx-table tbody tr:last-child td { border-bottom: none; }
.muted { color: var(--muted); }
.pill { display: inline-block; padding: 2px 6px; border-radius: 4px; font-size: 11px; font-weight: 600; text-transform: uppercase; }
.pill-ok { background: #D1FAE5; color: #065F46; }
.pill-pending { background: #FEF3C7; color: #92400E; }
.pill-err { background: #FEE2E2; color: #991B1B; }
.pill-transient { background: #FED7AA; color: #9A3412; }

.links { margin-top: 32px; }

.drawer { position: fixed; right: 0; top: 0; height: 100vh; width: 640px; background: var(--card); border-left: 1px solid var(--border); padding: 20px; overflow-y: auto; z-index: 100; box-shadow: -4px 0 16px rgba(0,0,0,0.1); }
.drawer.hidden { display: none; }
.drawer-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.drawer-head h3 { margin: 0; }
.drawer pre { max-height: calc(100vh - 100px); font-size: 12px; }

.doc { max-width: 800px; }
.doc h1 { color: var(--blue); }
.doc h2 { margin-top: 32px; }
.doc ul { padding-left: 24px; }
.doc li { margin: 6px 0; }
