/* ── Reset & base ─────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg:           #0d1117;
  --surface:      #161b22;
  --surface-2:    #21262d;
  --border:       #30363d;
  --text:         #e6edf3;
  --muted:        #8b949e;
  --accent:       #58a6ff;
  --green:        #3fb950;
  --yellow:       #d29922;
  --red:          #f85149;
  --orange:       #db6d28;
  --purple:       #bc8cff;
  --radius:       8px;
  --font-mono:    "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  --font-ui:      -apple-system, "Segoe UI", system-ui, sans-serif;
  --transition:   0.18s ease;
}

html { font-size: 15px; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Header ───────────────────────────────────────────────── */
header {
  border-bottom: 1px solid var(--border);
  padding: 2rem 1.5rem 1.5rem;
}

.header-inner {
  max-width: 800px;
  margin: 0 auto;
}

.logo {
  font-size: 1.9rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--text);
}

.logo span {
  color: var(--accent);
}

.tagline {
  color: var(--muted);
  font-size: 0.93rem;
  margin-top: 0.3rem;
}

/* ── Main & cards ─────────────────────────────────────────── */
main {
  flex: 1;
  max-width: 800px;
  width: 100%;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
}

/* ── Form ─────────────────────────────────────────────────── */
.form-card {
  background: var(--surface);
}

#report-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.optional {
  font-weight: 400;
  text-transform: none;
  color: var(--muted);
  opacity: 0.7;
  font-size: 0.8rem;
}

input[type="text"] {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.9rem;
  padding: 0.6rem 0.85rem;
  width: 100%;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}

input[type="text"]::placeholder {
  color: var(--muted);
  opacity: 0.55;
}

input[type="text"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.15);
}

button[type="submit"] {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: var(--accent);
  color: #0d1117;
  border: none;
  border-radius: var(--radius);
  font-size: 0.92rem;
  font-weight: 700;
  padding: 0.65rem 1.3rem;
  cursor: pointer;
  width: fit-content;
  transition: background var(--transition), transform var(--transition);
}

button[type="submit"]:hover {
  background: #79c0ff;
}

button[type="submit"]:active {
  transform: scale(0.97);
}

.btn-icon {
  width: 16px;
  height: 16px;
  fill: #0d1117;
  flex-shrink: 0;
}

/* ── Loading spinner ──────────────────────────────────────── */
#loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 2.5rem 0;
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-text {
  color: var(--muted);
  font-size: 0.9rem;
}

/* ── Section titles ───────────────────────────────────────── */
.section-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 1.2rem;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.section-icon {
  display: inline-block;
  width: 18px;
  height: 18px;
  background-color: currentColor;
  flex-shrink: 0;
}

/* tiny SVG masks for section icons */
.icon-changelog {
  color: var(--accent);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M5 3.25a.75.75 0 1 1-1.5 0 .75.75 0 0 1 1.5 0Zm0 2.122a2.25 2.25 0 1 0-1.5 0v.878A2.25 2.25 0 0 0 5.75 8.5h4.5a.75.75 0 0 1 .75.75v1.372a2.25 2.25 0 1 0 1.5 0V9.25A2.25 2.25 0 0 0 10.25 7h-4.5A.75.75 0 0 1 5 6.25V5.372Zm7.5 7.878a.75.75 0 1 1-1.5 0 .75.75 0 0 1 1.5 0Z'/%3E%3C/svg%3E") center/cover no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M5 3.25a.75.75 0 1 1-1.5 0 .75.75 0 0 1 1.5 0Zm0 2.122a2.25 2.25 0 1 0-1.5 0v.878A2.25 2.25 0 0 0 5.75 8.5h4.5a.75.75 0 0 1 .75.75v1.372a2.25 2.25 0 1 0 1.5 0V9.25A2.25 2.25 0 0 0 10.25 7h-4.5A.75.75 0 0 1 5 6.25V5.372Zm7.5 7.878a.75.75 0 1 1-1.5 0 .75.75 0 0 1 1.5 0Z'/%3E%3C/svg%3E") center/cover no-repeat;
}

.icon-risk {
  color: var(--red);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M6.457 1.047c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0 1 14.082 15H1.918a1.75 1.75 0 0 1-1.543-2.575Zm1.763.707a.25.25 0 0 0-.44 0L1.698 13.132a.25.25 0 0 0 .22.368h12.164a.25.25 0 0 0 .22-.368Zm.53 3.996v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z'/%3E%3C/svg%3E") center/cover no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M6.457 1.047c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0 1 14.082 15H1.918a1.75 1.75 0 0 1-1.543-2.575Zm1.763.707a.25.25 0 0 0-.44 0L1.698 13.132a.25.25 0 0 0 .22.368h12.164a.25.25 0 0 0 .22-.368Zm.53 3.996v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z'/%3E%3C/svg%3E") center/cover no-repeat;
}

.icon-check {
  color: var(--green);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M2.5 1.75v11.5c0 .138.112.25.25.25h3.17a.75.75 0 0 1 0 1.5H2.75A1.75 1.75 0 0 1 1 13.25V1.75C1 .784 1.784 0 2.75 0h8.5C12.216 0 13 .784 13 1.75v7.736a.75.75 0 0 1-1.5 0V1.75a.25.25 0 0 0-.25-.25h-8.5a.25.25 0 0 0-.25.25Zm11.03 9.53-3.75 3.75a.75.75 0 0 1-1.06 0l-1.5-1.5a.75.75 0 1 1 1.06-1.06l.97.97 3.22-3.22a.75.75 0 1 1 1.06 1.06Z'/%3E%3C/svg%3E") center/cover no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M2.5 1.75v11.5c0 .138.112.25.25.25h3.17a.75.75 0 0 1 0 1.5H2.75A1.75 1.75 0 0 1 1 13.25V1.75C1 .784 1.784 0 2.75 0h8.5C12.216 0 13 .784 13 1.75v7.736a.75.75 0 0 1-1.5 0V1.75a.25.25 0 0 0-.25-.25h-8.5a.25.25 0 0 0-.25.25Zm11.03 9.53-3.75 3.75a.75.75 0 0 1-1.06 0l-1.5-1.5a.75.75 0 1 1 1.06-1.06l.97.97 3.22-3.22a.75.75 0 1 1 1.06 1.06Z'/%3E%3C/svg%3E") center/cover no-repeat;
}

/* ── Changelog ────────────────────────────────────────────── */
.changelog-group {
  margin-bottom: 1.2rem;
}

.changelog-group:last-child {
  margin-bottom: 0;
}

.group-label {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  padding: 0.2rem 0.55rem;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 0.65rem;
}

.group-label::before {
  content: '';
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.group-label.breaking {
  color: var(--red);
  background: rgba(248, 81, 73, 0.1);
}

.group-label.features {
  color: var(--green);
  background: rgba(63, 185, 80, 0.1);
}

.group-label.fixes {
  color: var(--yellow);
  background: rgba(210, 153, 34, 0.1);
}

.commit-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.commit-list li {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  font-size: 0.88rem;
  color: var(--text);
  padding: 0.4rem 0.7rem;
  border-radius: 5px;
  background: var(--surface-2);
  border-left: 3px solid transparent;
  transition: border-color var(--transition);
}

.commit-list li:hover {
  border-left-color: var(--border);
}

.commit-hash {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--accent);
  background: rgba(88, 166, 255, 0.1);
  padding: 0.05rem 0.4rem;
  border-radius: 3px;
  flex-shrink: 0;
}

.commit-msg {
  flex: 1;
  line-height: 1.4;
}

.commit-author {
  color: var(--muted);
  font-size: 0.78rem;
  flex-shrink: 0;
}

/* ── Risks ────────────────────────────────────────────────── */
.risks-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.risk-item {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  gap: 0.25rem 0.75rem;
  padding: 0.85rem 1rem;
  border-radius: var(--radius);
  background: var(--surface-2);
  border: 1px solid var(--border);
  transition: border-color var(--transition);
}

.risk-item:hover {
  border-color: var(--muted);
}

.risk-badge {
  grid-row: 1 / 3;
  align-self: center;
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.25rem 0.55rem;
  border-radius: 4px;
  white-space: nowrap;
}

.risk-badge.critical {
  background: rgba(248, 81, 73, 0.18);
  color: var(--red);
  border: 1px solid rgba(248, 81, 73, 0.35);
}

.risk-badge.high {
  background: rgba(219, 109, 40, 0.18);
  color: var(--orange);
  border: 1px solid rgba(219, 109, 40, 0.35);
}

.risk-badge.medium {
  background: rgba(210, 153, 34, 0.18);
  color: var(--yellow);
  border: 1px solid rgba(210, 153, 34, 0.35);
}

.risk-badge.low {
  background: rgba(63, 185, 80, 0.12);
  color: var(--green);
  border: 1px solid rgba(63, 185, 80, 0.3);
}

.risk-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.risk-type {
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--text);
}

.risk-file {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--muted);
  background: var(--bg);
  padding: 0.05rem 0.45rem;
  border-radius: 3px;
  border: 1px solid var(--border);
}

.risk-desc {
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.5;
}

/* ── Checklist ────────────────────────────────────────────── */
.checklist {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.checklist li {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  padding: 0.75rem 0.9rem;
  border-radius: var(--radius);
  background: var(--surface-2);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
}

.checklist li:hover {
  border-color: var(--accent);
}

.checklist li.done {
  opacity: 0.55;
}

.checklist li.done .step-text {
  text-decoration: line-through;
  color: var(--muted);
}

.checklist input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin-top: 3px;
  flex-shrink: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

.step-content {
  flex: 1;
}

.step-text {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
}

.step-reason {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 0.2rem;
  line-height: 1.4;
}

/* ── Utility ──────────────────────────────────────────────── */
.hidden {
  display: none !important;
}

/* ── Footer ───────────────────────────────────────────────── */
footer {
  border-top: 1px solid var(--border);
  padding: 1rem 1.5rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.78rem;
}

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 560px) {
  .logo { font-size: 1.5rem; }
  .risk-item { grid-template-columns: 1fr; grid-template-rows: auto auto auto; }
  .risk-badge { justify-self: start; grid-row: auto; }
}
