:root {
  --bg: #0f1115;
  --panel: #171a21;
  --panel-2: #1e222b;
  --border: #2a2f3a;
  --text: #e6e8ec;
  --muted: #9aa2b1;
  --accent: #6366f1;
  --error: #f87171;
  --warn: #f59e0b;
  --ok: #10b981;
}

* { box-sizing: border-box; }

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

h1, h2, h3 { margin: 0 0 .5rem; }
h2 { font-size: 1rem; margin-top: 1.25rem; }
h3 { font-size: .9rem; color: var(--muted); margin-top: 1.25rem; }

.muted { color: var(--muted); }
.tiny { font-size: .8rem; }
.error { color: var(--error); }
code { background: var(--panel-2); padding: 1px 5px; border-radius: 4px; }

button {
  background: var(--accent);
  color: #fff;
  border: 0;
  border-radius: 6px;
  padding: .5rem .85rem;
  cursor: pointer;
  font: inherit;
}
button:disabled { opacity: .4; cursor: default; }
button.ghost { background: var(--panel-2); color: var(--text); border: 1px solid var(--border); }
button.link {
  background: none;
  color: var(--text);
  border: 0;
  padding: .3rem .5rem;
  text-align: left;
  width: 100%;
  border-radius: 6px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .5rem;
}
button.link:hover { background: var(--panel-2); }
button.link.active { background: var(--panel-2); color: #fff; }
button.link .count {
  font-size: .75rem;
  color: var(--muted);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0 .45rem;
  min-width: 1.6rem;
  text-align: center;
}
button.link .count.hot { background: var(--accent); border-color: var(--accent); color: #fff; }
button.back, button.inline-link {
  background: none;
  border: 0;
  color: var(--muted);
  padding: 0;
  font-size: .85rem;
}
button.back:hover, button.inline-link:hover { color: var(--text); text-decoration: underline; }
button.back { margin-bottom: .75rem; }
button.inline-link { color: var(--accent); }

input[type="text"], input[type="password"], textarea, select {
  width: 100%;
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  padding: .5rem;
  font: inherit;
}
textarea { resize: vertical; line-height: 1.45; }
select { appearance: auto; }

/* Login */
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.5rem;
}
.centered {
  max-width: 380px;
  margin: 8vh auto;
}
#login-form { display: flex; flex-direction: column; gap: .75rem; margin-top: 1rem; }
#login-form label { display: flex; flex-direction: column; gap: .25rem; }
#login-form label.row { flex-direction: row; align-items: center; gap: .5rem; }

/* App layout */
.topbar {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .75rem 1rem;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}
.topbar .spacer { flex: 1; }
.badge {
  font-size: .65rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 1px 6px;
  border-radius: 999px;
  vertical-align: middle;
  font-weight: normal;
}

.layout { display: flex; align-items: flex-start; }
.sidebar {
  width: 260px;
  flex: none;
  padding: 1rem;
  border-right: 1px solid var(--border);
  height: calc(100vh - 53px);
  overflow-y: auto;
}
.sidebar h2:first-child { margin-top: 0; }
.sidebar form { display: flex; gap: .5rem; margin-top: .5rem; }
.nav-list { list-style: none; padding: 0; margin: .5rem 0 0; }
.content { flex: 1; padding: 1rem 1.25rem; min-width: 0; max-width: 1100px; }

.view-head { display: flex; align-items: baseline; gap: .75rem; }
.pager { display: flex; gap: .5rem; margin: .75rem 0; }

.scroll { overflow: auto; max-height: calc(100vh - 200px); border: 1px solid var(--border); border-radius: 8px; }
table { border-collapse: collapse; width: 100%; }
th, td {
  border-bottom: 1px solid var(--border);
  padding: .4rem .6rem;
  text-align: left;
  white-space: nowrap;
  vertical-align: top;
  max-width: 420px;
  overflow: hidden;
  text-overflow: ellipsis;
}
thead th { position: sticky; top: 0; background: var(--panel-2); z-index: 1; }
tbody tr:hover { background: var(--panel); }

pre.json, pre.body {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  overflow: auto;
}
pre.body { white-space: pre-wrap; font: inherit; line-height: 1.55; }

/* Feedback inbox */
.chips { display: flex; gap: .4rem; margin: .5rem 0 .75rem; }
.chip {
  background: var(--panel-2);
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: .25rem .7rem;
  font-size: .8rem;
}
.chip.active { color: #fff; border-color: var(--accent); background: rgba(99, 102, 241, .18); }
.empty { color: var(--muted); padding: 2rem 0; text-align: center; }

.feedback-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .5rem; }
.feedback-row {
  display: block;
  width: 100%;
  text-align: left;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: .75rem .9rem;
  color: var(--text);
}
.feedback-row:hover { border-color: #3a4050; background: var(--panel-2); }
.feedback-row-top { display: flex; align-items: center; gap: .5rem; }
.feedback-title { flex: 1; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feedback-row-meta { margin-top: .15rem; }
.feedback-row-body { margin-top: .4rem; color: var(--muted); font-size: .85rem; white-space: pre-wrap; }

.pill {
  font-size: .7rem;
  font-weight: 600;
  padding: 1px 8px;
  border-radius: 999px;
  white-space: nowrap;
  border: 1px solid transparent;
}
.pill.kind-bug { color: #fca5a5; background: rgba(239, 68, 68, .14); }
.pill.kind-feature { color: #c7d2fe; background: rgba(99, 102, 241, .18); }
.pill.status-new { color: var(--text); background: var(--panel-2); border-color: var(--border); }
.pill.status-planned { color: #c7d2fe; background: rgba(99, 102, 241, .18); }
.pill.status-in_progress { color: #fcd34d; background: rgba(245, 158, 11, .16); }
.pill.status-done { color: #6ee7b7; background: rgba(16, 185, 129, .16); }
.pill.status-declined { color: var(--muted); background: var(--panel-2); text-decoration: line-through; }

.detail-head .pills { display: flex; gap: .4rem; margin-bottom: .4rem; }
.detail-head h2 { font-size: 1.25rem; margin: 0; }
dl.meta {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: .2rem 1rem;
  margin: .75rem 0 0;
  font-size: .85rem;
}
dl.meta dt { color: var(--muted); }
dl.meta dd { margin: 0; overflow-wrap: anywhere; }

form.triage { display: flex; flex-direction: column; gap: .75rem; max-width: 640px; }
form.triage label { display: flex; flex-direction: column; gap: .3rem; font-size: .85rem; color: var(--muted); }
form.triage .row { display: flex; align-items: center; gap: .75rem; }

/* Match button-level loading feedback in the main clients. */
.button-spinner {
  display: inline-block;
  width: .85em;
  height: .85em;
  margin-right: .5em;
  vertical-align: -.1em;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: button-spin .7s linear infinite;
}
@keyframes button-spin { to { transform: rotate(360deg); } }
button[aria-busy="true"] { cursor: progress; }
