:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #1c2430;
  --muted: #5d6b7d;
  --border: #d9dee5;
  --accent: #1f6feb;
  --accent-text: #ffffff;
  --pass: #1a7f37;
  --pass-bg: #e6f4ea;
  --fail: #c62828;
  --fail-bg: #fdecea;
  --warn: #9a6700;
  --warn-bg: #fff4d6;
  --code-bg: #eef1f5;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1419;
    --surface: #171d24;
    --text: #e3e8ef;
    --muted: #93a1b3;
    --border: #2c3540;
    --accent: #4c8dff;
    --pass: #4ac26b;
    --pass-bg: #12301c;
    --fail: #ff7b72;
    --fail-bg: #3a1716;
    --warn: #e3b341;
    --warn-bg: #3a2e10;
    --code-bg: #0b0f14;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
}

header {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

header h1 { margin: 0; font-size: 18px; }
header h1 a { color: inherit; text-decoration: none; }

.redirect { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; min-width: 0; }
.redirect code { overflow-wrap: anywhere; }
.label { color: var(--muted); font-size: 13px; }

main { max-width: 1000px; margin: 0 auto; padding: 16px; }

h2 { margin: 0; font-size: 20px; }
h3 { margin: 0; font-size: 16px; }
h4 { margin: 12px 0 4px; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }

.toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.actions, .row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.hint { color: var(--muted); font-size: 13px; }
.empty { color: var(--muted); padding: 24px; text-align: center; border: 1px dashed var(--border); border-radius: 8px; }

button, .button {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  text-decoration: none;
  cursor: pointer;
}
button:hover, .button:hover { border-color: var(--accent); }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
button.danger { color: var(--fail); }
button.small, .button.small { padding: 2px 8px; font-size: 13px; }

code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
code { background: var(--code-bg); padding: 1px 4px; border-radius: 4px; }
code.wrap { overflow-wrap: anywhere; }
pre.json { margin: 0; padding: 12px; background: var(--code-bg); border-radius: 6px; overflow-x: auto; }

.client {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  margin-bottom: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.client-info { min-width: 0; }
.client-info .hint { overflow-wrap: anywhere; }
.meta { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 13px; color: var(--muted); }

.panel { margin-top: 12px; padding: 8px 16px 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; }
.panel summary { cursor: pointer; font-weight: 600; padding: 4px 0; }

.status { padding: 12px 16px; border-radius: 8px; font-weight: 600; margin: 0; }
.status.pass { background: var(--pass-bg); color: var(--pass); }
.status.fail { background: var(--fail-bg); color: var(--fail); }
.status.loading { background: var(--surface); border: 1px solid var(--border); }

.checks { list-style: none; margin: 0; padding: 0; }
.checks li { display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; padding: 6px 0; border-bottom: 1px solid var(--border); overflow-wrap: anywhere; }
.checks li:last-child { border-bottom: 0; }
.badge { flex: none; width: 44px; text-align: center; font-size: 11px; font-weight: 700; text-transform: uppercase; border-radius: 4px; padding: 1px 0; }
.checks .pass .badge { background: var(--pass-bg); color: var(--pass); }
.checks .fail .badge { background: var(--fail-bg); color: var(--fail); }
.checks .warn .badge { background: var(--warn-bg); color: var(--warn); }

table.claims { width: 100%; border-collapse: collapse; }
.claims th, .claims td { text-align: left; vertical-align: top; padding: 4px 8px 4px 0; border-bottom: 1px solid var(--border); }
.claims th { width: 1%; white-space: nowrap; font-weight: 600; }
.claims td { overflow-wrap: anywhere; }

dialog {
  width: min(560px, calc(100vw - 32px));
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
}
dialog::backdrop { background: rgb(0 0 0 / 0.4); }
dialog form { display: flex; flex-direction: column; gap: 10px; }
dialog label { display: flex; flex-direction: column; gap: 4px; font-size: 14px; font-weight: 600; }
dialog .field { display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
dialog .field-label { font-weight: 600; }
dialog label.check { flex-direction: row; align-items: center; gap: 8px; }
dialog label .hint { font-weight: 400; }
input, select, textarea {
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-weight: 400;
}
dialog .actions { justify-content: flex-end; margin-top: 8px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  max-width: calc(100vw - 32px);
  padding: 10px 16px;
  border-radius: 8px;
  background: var(--text);
  color: var(--bg);
  box-shadow: 0 4px 16px rgb(0 0 0 / 0.2);
}
.toast.error { background: var(--fail); color: #fff; }
