/* Quill design system: deep ink, teal signal, an orange nib. Dark by default, light on request. */
:root {
  --bg: #060908;
  --bg-2: #0a0f0e;
  --bg-3: #0f1615;
  --panel: rgba(255, 255, 255, 0.025);
  --panel-2: rgba(255, 255, 255, 0.045);
  --panel-solid: #0d1312;
  --line: rgba(255, 255, 255, 0.07);
  --line-2: rgba(255, 255, 255, 0.12);
  --text: #eaf2ef;
  --text-2: #b4c2be;
  --muted: #7d8c88;
  --faint: #4d5a57;
  --teal: #2dd4bf;
  --teal-2: #14b8a6;
  --teal-deep: #0f766e;
  --teal-glow: rgba(45, 212, 191, 0.16);
  --orange: #fb923c;
  --orange-2: #f97316;
  --up: #34d399;
  --down: #fb7185;
  --warn: #fbbf24;
  --info: #93c5fd;
  --pass-bg: rgba(52, 211, 153, 0.1);
  --warn-bg: rgba(251, 191, 36, 0.1);
  --fail-bg: rgba(251, 113, 133, 0.1);
  --info-bg: rgba(147, 197, 253, 0.1);
  --on-teal: #04201c;
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 20px 50px -24px rgba(0, 0, 0, 0.8);
  --radius: 16px;
  --radius-sm: 10px;
  --serif: "Instrument Serif", "Iowan Old Style", Georgia, serif;
  --sans: "Inter Tight", "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #f6f3ec; --bg-2: #efebe2; --bg-3: #e8e3d8;
  --panel: rgba(16, 48, 44, 0.025); --panel-2: rgba(16, 48, 44, 0.05); --panel-solid: #fbf9f4;
  --line: rgba(16, 48, 44, 0.1); --line-2: rgba(16, 48, 44, 0.18);
  --text: #0e2421; --text-2: #34504b; --muted: #6a7d79; --faint: #a3b0ac;
  --teal: #0f766e; --teal-2: #0d9488; --teal-deep: #0f766e; --teal-glow: rgba(15, 118, 110, 0.12);
  --orange: #ea580c; --orange-2: #ea580c;
  --up: #059669; --down: #e11d48; --warn: #b45309; --info: #2563eb;
  --pass-bg: rgba(5, 150, 105, 0.09); --warn-bg: rgba(180, 83, 9, 0.09); --fail-bg: rgba(225, 29, 72, 0.08); --info-bg: rgba(37, 99, 235, 0.08);
  --on-teal: #ffffff;
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.7) inset, 0 18px 40px -26px rgba(16, 48, 44, 0.35);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 var(--sans);
  font-feature-settings: "ss01", "cv11";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: inherit; text-decoration: none; }
::selection { background: var(--teal); color: var(--on-teal); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.mono, code, kbd, .num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
code { font-size: 0.86em; background: var(--panel-2); border: 1px solid var(--line); padding: 1px 6px; border-radius: 6px; word-break: break-all; }
kbd { font-size: 11px; border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 5px; padding: 0 5px; color: var(--muted); }
.up { color: var(--up); } .down { color: var(--down); }
.serif { font-family: var(--serif); font-weight: 400; letter-spacing: -0.01em; }
.eyebrow { font: 600 11px/1 var(--mono); letter-spacing: 0.16em; text-transform: uppercase; color: var(--teal); }
h1, h2, h3, h4 { margin: 0; line-height: 1.1; letter-spacing: -0.02em; font-weight: 600; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; white-space: nowrap; cursor: pointer;
  font: 500 14px/1 var(--sans); padding: 11px 16px; border-radius: 999px;
  color: var(--text); background: var(--panel-2); border: 1px solid var(--line-2);
  transition: background 0.15s, border-color 0.15s, transform 0.15s, box-shadow 0.15s;
}
.btn:hover { background: var(--panel); border-color: var(--teal); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--teal); color: var(--on-teal); border-color: transparent; font-weight: 600; box-shadow: 0 0 0 0 var(--teal-glow), 0 8px 24px -10px var(--teal); }
.btn.primary:hover { box-shadow: 0 0 0 6px var(--teal-glow), 0 10px 28px -10px var(--teal); }
.btn.ghost { background: transparent; }
.btn.sm { padding: 7px 12px; font-size: 13px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; box-shadow: none; }
.icon-btn { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); color: var(--text-2); cursor: pointer; font-size: 15px; }
.icon-btn:hover { border-color: var(--line-2); color: var(--text); }
:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }

/* panels */
.panel {
  position: relative; background: linear-gradient(180deg, var(--panel-2), var(--panel)); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); min-width: 0;
}
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.panel-title { font: 600 12px/1 var(--mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }

/* live dot */
.live-dot { position: relative; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--up); flex: none; }
.live-dot::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 1px solid var(--up); animation: ping 1.8s cubic-bezier(0, 0, 0.2, 1) infinite; }
@keyframes ping { 0% { transform: scale(0.6); opacity: 0.9; } 100% { transform: scale(1.8); opacity: 0; } }
.flash-up { animation: flashUp 0.9s ease; } .flash-down { animation: flashDown 0.9s ease; }
@keyframes flashUp { 0% { background: rgba(52, 211, 153, 0.22); } 100% { background: transparent; } }
@keyframes flashDown { 0% { background: rgba(251, 113, 133, 0.22); } 100% { background: transparent; } }

/* inputs */
input, select, textarea {
  font: inherit; color: var(--text); background: var(--bg-2); border: 1px solid var(--line-2); border-radius: var(--radius-sm); padding: 11px 13px; min-width: 0;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input::placeholder, textarea::placeholder { color: var(--faint); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 4px var(--teal-glow); }
select { appearance: none; padding-right: 34px; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 17px) 52%, calc(100% - 12px) 52%; background-size: 5px 5px; background-repeat: no-repeat; }

/* tags & chips */
.tag { display: inline-block; font: 700 10px/1 var(--mono); letter-spacing: 0.1em; text-transform: uppercase; padding: 4px 7px; border-radius: 6px; text-align: center; white-space: nowrap; }
.tag.pass { background: var(--pass-bg); color: var(--up); } .tag.warn { background: var(--warn-bg); color: var(--warn); }
.tag.fail { background: var(--fail-bg); color: var(--down); } .tag.info { background: var(--info-bg); color: var(--info); }
.tag.neutral { background: var(--panel-2); color: var(--text-2); border: 1px solid var(--line); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font: 500 12.5px var(--sans); border: 1px solid var(--line-2); background: var(--panel); color: var(--text-2); border-radius: 999px; padding: 6px 12px; cursor: pointer; transition: all 0.15s; }
.chip:hover { border-color: var(--teal); color: var(--text); }

/* tables */
.table-wrap { overflow-x: auto; margin: 0 -4px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font: 600 10.5px/1 var(--mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--faint); padding: 10px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 12px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr { transition: background 0.12s; }
tbody tr:hover { background: var(--panel-2); }
tbody tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
tr.clickable { cursor: pointer; }

.token-cell { display: flex; align-items: center; gap: 10px; min-width: 0; }
.avatar { position: relative; width: 30px; height: 30px; border-radius: 50%; flex: none; display: grid; place-items: center; font: 700 11px var(--mono); color: var(--on-teal); background: linear-gradient(135deg, var(--teal), var(--orange)); overflow: hidden; }
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: var(--bg-3); }
.token-cell b { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 180px; }
.token-cell small { display: block; color: var(--muted); font-size: 12px; white-space: nowrap; }

/* checkpoint */
.verdict { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: 12px; font-weight: 500; border: 1px solid transparent; }
.verdict .stamp { font: 700 12px/1 var(--mono); letter-spacing: 0.18em; padding: 7px 10px; border: 1.5px solid currentColor; border-radius: 7px; }
.verdict.pass { background: var(--pass-bg); color: var(--up); border-color: rgba(52, 211, 153, 0.2); }
.verdict.warn { background: var(--warn-bg); color: var(--warn); border-color: rgba(251, 191, 36, 0.2); }
.verdict.fail { background: var(--fail-bg); color: var(--down); border-color: rgba(251, 113, 133, 0.2); }
.checks { list-style: none; margin: 12px 0 0; padding: 0; }
.checks li { display: grid; grid-template-columns: 58px 190px 1fr; gap: 12px; padding: 11px 2px; border-bottom: 1px solid var(--line); font-size: 14px; align-items: baseline; }
.checks li:last-child { border-bottom: 0; }
.checks .lbl { font-weight: 500; }
.checks .det { color: var(--text-2); overflow-wrap: anywhere; }

/* misc */
.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 18px; font-size: 14px; margin: 0; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; font-family: var(--mono); text-align: right; font-variant-numeric: tabular-nums; }
.empty { color: var(--muted); padding: 28px 18px; text-align: center; border: 1px dashed var(--line-2); border-radius: 12px; }
.spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--line-2); border-top-color: var(--teal); border-radius: 50%; animation: spin 0.7s linear infinite; vertical-align: -2px; }
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton { height: 14px; border-radius: 6px; background: linear-gradient(90deg, var(--panel-2), var(--line-2), var(--panel-2)); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
pre.code { background: var(--bg-2); color: var(--text-2); border: 1px solid var(--line); padding: 14px 16px; border-radius: 12px; overflow-x: auto; font: 13px/1.6 var(--mono); margin: 10px 0 18px; }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 80; background: var(--panel-solid); color: var(--text); border: 1px solid var(--line-2); padding: 11px 16px; border-radius: 12px; font-size: 14px; max-width: calc(100vw - 32px); box-shadow: var(--shadow); }
.card li, .panel li, .panel td, .panel p { overflow-wrap: anywhere; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* live chip when the chain does not answer */
.offline .live-dot { background: var(--down); }
.offline .live-dot::after { border-color: var(--down); }
