:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #1c1f24;
  --muted: #646b75;
  --border: #dde1e6;
  --accent: #5865f2;
  --accent-text: #ffffff;
  --open: #1a7f37;
  --closed: #8250df;
  --error: #c62828;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15171b;
    --surface: #1f2228;
    --text: #e8eaed;
    --muted: #9aa1ab;
    --border: #343841;
    --open: #3fb950;
    --closed: #a371f7;
    --error: #ff6b6b;
  }
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

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

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

.topbar h1 {
  margin: 0;
  font-size: 18px;
}

.user {
  display: flex;
  align-items: center;
  gap: 8px;
}

.user img {
  border-radius: 50%;
}

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

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button,
input,
select {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
}

button {
  cursor: pointer;
}

.button {
  display: inline-block;
  padding: 8px 14px;
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: var(--accent-text);
  text-decoration: none;
  font-weight: 600;
}

.button:disabled {
  opacity: 0.6;
}

.link {
  border: 0;
  background: none;
  color: var(--muted);
  text-decoration: underline;
}

.login {
  max-width: 420px;
  margin: 48px auto;
  padding: 24px;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.error {
  color: var(--error);
}

.status,
.hint,
.empty {
  color: var(--muted);
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filters input {
  flex: 1 1 220px;
}

.columns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

.column h2 {
  font-size: 15px;
  margin: 0 0 8px;
}

.count {
  color: var(--muted);
  font-weight: normal;
}

.cards {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
  padding: 10px 12px;
  text-align: left;
  border-radius: 8px;
}

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

.card .title {
  font-weight: 600;
  overflow-wrap: anywhere;
}

.meta {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.labels {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.label {
  padding: 0 8px;
  border-radius: 999px;
  font-size: 12px;
  border: 1px solid var(--label-color);
  background: color-mix(in srgb, var(--label-color) 22%, transparent);
}

dialog {
  width: min(860px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
}

dialog::backdrop {
  background: rgb(0 0 0 / 50%);
}

dialog article {
  padding: 16px 20px 20px;
}

.detail-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.detail-header h2 {
  margin: 4px 0 8px;
  overflow-wrap: anywhere;
}

.close {
  align-self: flex-start;
  font-size: 22px;
  line-height: 1;
}

.state {
  padding: 1px 8px;
  border-radius: 999px;
  color: #ffffff;
  font-weight: 600;
}

.state.open {
  background: var(--open);
}

.state.closed {
  background: var(--closed);
}

.markdown {
  overflow-wrap: anywhere;
}

.markdown img {
  max-width: 100%;
}

.markdown pre {
  overflow-x: auto;
  padding: 8px;
  background: var(--bg);
  border-radius: 6px;
}

.markdown table {
  display: block;
  overflow-x: auto;
  border-collapse: collapse;
}

.markdown td,
.markdown th {
  border: 1px solid var(--border);
  padding: 4px 8px;
}

.comments {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.comment {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
}

#comment-form {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

#comment-form textarea {
  width: 100%;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
}

#comment-form .button {
  align-self: flex-end;
}
