:root {
  color-scheme: dark;
  --bg: #12141c;
  --card: #1a1d29;
  --inset: #151823;
  --ink: #e6e8f0;
  --muted: #8b91a5;
  --line: #2a2f40;
  --accent: #8a8af2;
  --accent-soft: #2a2c4a;
  --good: #3ecf96;
  --good-soft: #143226;
  --bad: #f07575;
  --bad-soft: #3a1d1d;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.5;
}

.hidden { display: none !important; }

/* ---- gate ---- */
.gate {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg);
}
.gate-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 36px 40px; width: 360px; text-align: center;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
}
.gate-logo { font-size: 40px; }
.gate-card h1 { margin: 8px 0 4px; font-size: 22px; }
.gate-card p { color: var(--muted); margin: 0 0 20px; font-size: 13.5px; }
.gate-card input {
  width: 100%; margin-bottom: 10px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 8px; font-size: 14px;
}
.gate-card button { width: 100%; margin-top: 4px; }
.gate-error { color: var(--bad); font-size: 13px; min-height: 18px; margin-top: 8px; }

/* ---- chrome ---- */
header {
  display: flex; align-items: center; gap: 24px;
  padding: 14px 28px; background: var(--card);
  border-bottom: 1px solid var(--line);
}
.brand { font-size: 16px; white-space: nowrap; }
nav { display: flex; gap: 6px; flex: 1; }
nav button {
  border: none; background: transparent; padding: 8px 14px;
  border-radius: 8px; font-size: 14.5px; color: var(--muted); cursor: pointer;
}
nav button:hover { background: var(--accent-soft); color: var(--ink); }
nav button.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.user-chip {
  font-size: 13px; color: var(--muted); cursor: pointer;
  padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px;
}

main { max-width: 860px; margin: 26px auto 60px; padding: 0 20px; }
.tagline { color: var(--muted); margin: 0 0 14px 4px; }

footer {
  position: fixed; bottom: 0; left: 0; right: 0;
  padding: 8px 28px; font-size: 12.5px; color: var(--muted);
  background: linear-gradient(transparent, var(--bg) 40%);
  text-align: right; pointer-events: none;
}

/* ---- cards ---- */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 18px 20px; margin-bottom: 18px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
}
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px;
}
.card-head label { font-weight: 600; font-size: 14px; }

textarea {
  width: 100%; resize: vertical; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px; line-height: 1.55; color: var(--ink); background: var(--inset);
}
textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }

.run-row {
  display: flex; align-items: center; justify-content: flex-end;
  gap: 14px; margin-top: 12px;
}
.hint { color: var(--muted); font-size: 12.5px; }

button.primary {
  background: var(--accent); color: #14142a; border: none;
  padding: 10px 22px; border-radius: 9px; font-size: 14.5px; font-weight: 600;
  cursor: pointer;
}
button.primary:hover { filter: brightness(1.07); }
button.primary:disabled { opacity: 0.55; cursor: wait; }
button.secondary {
  background: var(--accent-soft); color: var(--accent); border: none;
  padding: 7px 14px; border-radius: 8px; font-size: 13.5px; font-weight: 600;
  cursor: pointer;
}
button.secondary:hover { filter: brightness(0.97); }

/* ---- output ---- */
.label-result { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 6px 0; }
.chip {
  padding: 6px 14px; border-radius: 999px; font-size: 14px; font-weight: 600;
  background: var(--accent-soft); color: var(--accent);
}
.chip.good { background: var(--good-soft); color: var(--good); }
.chip.bad { background: var(--bad-soft); color: var(--bad); }
.chip-label { font-size: 12px; color: var(--muted); display: block; margin-bottom: 3px; }
.verdict { font-size: 20px; }

.badges { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.badge {
  font-size: 12.5px; font-weight: 600; padding: 4px 10px; border-radius: 6px;
}
.badge.good { background: var(--good-soft); color: var(--good); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }

pre.yaml {
  background: var(--inset); border: 1px solid var(--line); border-radius: 10px;
  padding: 14px; overflow-x: auto; font-size: 12.5px; line-height: 1.5;
  margin: 0 0 12px;
}

table.fields { width: 100%; border-collapse: collapse; font-size: 13px; margin-bottom: 12px; }
table.fields th, table.fields td {
  text-align: left; padding: 6px 10px; border-bottom: 1px solid var(--line);
}
table.fields th { color: var(--muted); font-weight: 600; font-size: 12px; }
table.fields td.path { font-family: ui-monospace, Menlo, monospace; font-size: 12px; }
table.fields tr.miss td { background: var(--bad-soft); }

details.transcript { margin-bottom: 8px; }
details.transcript summary {
  cursor: pointer; color: var(--muted); font-size: 13px; user-select: none;
}
.tool-step {
  border-left: 3px solid var(--accent-soft); margin: 8px 0 8px 4px; padding: 4px 12px;
  font-size: 12.5px;
}
.tool-step .tool-name { font-weight: 600; color: var(--accent); font-family: ui-monospace, Menlo, monospace; }
.tool-step pre {
  margin: 6px 0 0; white-space: pre-wrap; word-break: break-word;
  color: var(--muted); max-height: 130px; overflow-y: auto; font-size: 11.5px;
}

.errors { color: var(--bad); font-size: 13px; margin: 0 0 12px; padding-left: 20px; }

.feedback {
  display: flex; align-items: center; gap: 10px;
  border-top: 1px dashed var(--line); margin-top: 14px; padding-top: 12px;
  font-size: 13.5px; color: var(--muted);
}
#note-text {
  flex: 1; min-width: 140px; padding: 7px 10px; font-size: 13px;
  border: 1px solid var(--line); border-radius: 8px;
  background: var(--inset); color: var(--ink);
}
button.thumb {
  background: transparent; border: 1px solid var(--line); border-radius: 8px;
  font-size: 17px; padding: 4px 12px; cursor: pointer;
}
button.thumb:hover { background: var(--accent-soft); }
button.thumb.chosen { background: var(--accent-soft); border-color: var(--accent); }

.error {
  background: var(--bad-soft); color: var(--bad); border-radius: 10px;
  padding: 12px 16px; font-size: 13.5px;
}

.spin { display: inline-block; animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
