:root {
  --bg: #f7f7f5;
  --card: #ffffff;
  --ink: #1a1a1a;
  --muted: #6b7280;
  --accent: #4f46e5;
  --accent-ink: #ffffff;
  --border: #e5e7eb;
  --ok: #16a34a;
  --warn: #d97706;
  --bad: #dc2626;
  --s1: #fee2e2;
  --s2: #fef3c7;
  --s3: #ecfccb;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

/* submit / thanks */
main.card {
  max-width: 640px;
  margin: 48px auto;
  padding: 32px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
h1 { margin: 0 0 8px; font-size: 28px; }
.lede { color: var(--muted); margin: 0 0 24px; }
form.stacked { display: flex; flex-direction: column; gap: 18px; }
label { display: block; }
.lbl { display: block; font-weight: 600; font-size: 14px; margin-bottom: 6px; }
input[type=text], input[type=url], select, textarea {
  width: 100%; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: 8px;
  font-family: inherit; font-size: 14px; background: #fff;
}
textarea { resize: vertical; }
fieldset {
  border: 1px solid var(--border); border-radius: 8px; padding: 12px 16px;
}
fieldset legend { font-weight: 600; padding: 0 6px; font-size: 14px; }
label.inline { display: block; padding: 4px 0; font-size: 14px; }
.hint { display: block; font-size: 12px; color: var(--muted); margin-top: 4px; }
button {
  padding: 10px 18px; border: 0; border-radius: 8px;
  background: var(--accent); color: var(--accent-ink);
  font-weight: 600; cursor: pointer; font-size: 14px;
}
button:hover { filter: brightness(0.95); }

/* admin */
body.admin { background: var(--bg); }
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 24px; background: #fff; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
}
.topbar h1 { font-size: 18px; }
.stats { display: flex; gap: 18px; font-size: 14px; }
.stats b { font-size: 16px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }

.admin-main { max-width: 980px; margin: 24px auto; padding: 0 16px; }
.card.empty { text-align: center; padding: 48px; }

.tool-header {
  font-size: 18px; margin: 32px 0 12px; padding-bottom: 6px;
  border-bottom: 2px solid var(--border);
}
.tool-section { display: flex; flex-direction: column; gap: 16px; }

.cluster {
  background: #fff; border: 1px solid var(--border); border-left: 4px solid var(--border);
  border-radius: 10px; padding: 16px; box-shadow: 0 1px 2px rgba(0,0,0,.03);
}
.cluster.sev-S1 { border-left-color: var(--bad); }
.cluster.sev-S2 { border-left-color: var(--warn); }
.cluster.sev-S3 { border-left-color: var(--ok); }

.cluster-head {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-bottom: 10px;
}
.cluster-summary { flex: 1; font-weight: 500; }
.badge {
  font-size: 11px; padding: 3px 8px; border-radius: 999px;
  border: 1px solid var(--border); background: #fafafa; text-transform: uppercase;
  letter-spacing: 0.04em; font-weight: 700;
}
.badge.sev { background: #fff; }
.cluster.sev-S1 .badge.sev { background: var(--s1); }
.cluster.sev-S2 .badge.sev { background: var(--s2); }
.cluster.sev-S3 .badge.sev { background: var(--s3); }
.badge.cat-bug { background: #fde2e2; }
.badge.cat-feature { background: #dbeafe; }
.badge.cat-question { background: #ede9fe; }
.badge.cat-duplicate { background: #e5e7eb; }

details { margin: 8px 0; }
details summary { cursor: pointer; font-size: 13px; color: var(--muted); padding: 6px 0; }
.items { list-style: none; padding: 0; margin: 0; }
.items li {
  padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px;
  margin-bottom: 8px; background: #fafafa;
}
.item-title { font-weight: 600; margin: 4px 0; }
.item-body { font-size: 14px; white-space: pre-wrap; }
.thumb { max-width: 240px; max-height: 160px; border: 1px solid var(--border); border-radius: 6px; margin-top: 6px; }

.prompt-form { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
textarea.prompt {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px; line-height: 1.5;
}
.row { display: flex; gap: 8px; }
.approve { background: var(--ok); }
.save { background: #6b7280; }
.reject { background: var(--bad); }

dialog {
  border: 1px solid var(--border); border-radius: 10px; padding: 16px;
  width: min(420px, 92vw);
}
dialog::backdrop { background: rgba(0,0,0,.35); }
