:root {
  --bg: #f6f7f9;
  --card: #ffffff;
  --text: #1c2026;
  --muted: #5d6673;
  --border: #dde1e6;
  --accent: #2557d6;
  --accent-text: #ffffff;
  --ok: #1d7a46;
  --warn: #9a6400;
  --error: #b42318;
  --code: #f0f2f5;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111418;
    --card: #1a1e24;
    --text: #e7eaee;
    --muted: #9aa3ae;
    --border: #2c323a;
    --accent: #6b93ff;
    --accent-text: #0d1117;
    --ok: #4cc283;
    --warn: #e0a84a;
    --error: #ff7b72;
    --code: #232830;
  }
}

* { 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;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--card);
}

@media (max-width: 720px) {
  .topbar { align-items: flex-start; flex-wrap: wrap; }
  .brand .muted { display: block; }
}

.brand { font-weight: 700; font-size: 18px; }
.mark { display: block; font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.muted { color: var(--muted); font-weight: 400; font-size: 14px; }
.error { color: var(--error); }
.ok { color: var(--ok); }

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

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 16px;
}

.card h2 { margin: 0 0 8px; font-size: 17px; }

.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.stack { display: flex; flex-direction: column; gap: 10px; }

input, select, textarea, button {
  font: inherit;
  color: inherit;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 7px 10px;
  max-width: 100%;
}

textarea { width: 100%; resize: vertical; }

button {
  background: var(--accent);
  color: var(--accent-text);
  border-color: var(--accent);
  cursor: pointer;
}

button.secondary { background: transparent; color: var(--accent); }
button:disabled { opacity: 0.55; cursor: wait; }

.options { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.options label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }

.list { display: flex; flex-direction: column; gap: 8px; }

.item {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.item-head { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; align-items: baseline; }
.item-title { font-weight: 600; overflow-wrap: anywhere; }
.badge { font-size: 12px; border: 1px solid var(--border); border-radius: 999px; padding: 1px 8px; color: var(--muted); }
.badge.deployed, .badge.published, .badge.generated { color: var(--ok); border-color: var(--ok); }
.badge.generating { color: var(--warn); border-color: var(--warn); }
.badge.generation_failed { color: var(--error); border-color: var(--error); }

pre {
  background: var(--code);
  border-radius: 6px;
  padding: 10px;
  overflow: auto;
  max-height: 420px;
  font-size: 12.5px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

code { background: var(--code); border-radius: 4px; padding: 0 4px; }
a { color: var(--accent); overflow-wrap: anywhere; }
.integrations { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.connection { display: flex; gap: 8px; align-items: center; }
.views { display: flex; gap: 6px; }
.views button.active { background: var(--accent); color: var(--accent-text); }
.loop { margin: 8px 0 12px; padding-left: 18px; }
.comment { white-space: pre-wrap; }

.dropzone {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  padding: 14px;
  cursor: pointer;
  background: var(--bg);
}
.dropzone.over { border-color: var(--accent); background: var(--code); }
.dropzone input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.evidence-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin: 10px 0; }
.evidence-grid h3 { margin: 0 0 4px; font-size: 12px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.evidence-grid ul { margin: 0; padding-left: 18px; }

.hints { margin: 0 0 10px; padding-left: 18px; color: var(--muted); }
.hints:empty { display: none; }
