:root {
  --bg: #0d1117;
  --panel: #161b22;
  --panel-2: #1c2230;
  --border: #30363d;
  --text: #e6edf3;
  --muted: #8b949e;
  --accent: #2f81f7;
  --accent-ink: #fff;
  --radius: 10px;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f6f8fa;
    --panel: #fff;
    --panel-2: #f0f3f6;
    --border: #d0d7de;
    --text: #1f2328;
    --muted: #656d76;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}
.wrap { max-width: 1200px; margin: 0 auto; padding: 0 20px; }

.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--panel);
  position: sticky;
  top: 0;
  z-index: 10;
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px;
}
.site-header h1 { font-size: 18px; margin: 0; }
.auth-nav { display: flex; align-items: center; gap: 8px; }

.btn {
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  padding: 7px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
}
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.ghost { background: transparent; }

.toolbar {
  display: flex; flex-wrap: wrap; gap: 12px; align-items: center;
  margin: 20px 0;
}
.search {
  flex: 1 1 240px;
  padding: 9px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
}
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  cursor: pointer;
}
.chip::before {
  content: ""; display: inline-block; width: 8px; height: 8px;
  border-radius: 50%; background: var(--chip, #888); margin-right: 6px;
  vertical-align: middle;
}
.chip.active { border-color: var(--accent); background: var(--panel-2); }
.closed-toggle { color: var(--muted); font-size: 13px; display: flex; gap: 6px; align-items: center; }

.board {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  align-items: start;
}
@media (max-width: 900px) { .board { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .board { grid-template-columns: 1fr; } }

.column {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
}
.column h2 {
  font-size: 13px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted); margin: 4px 4px 12px;
}
.cards { display: flex; flex-direction: column; gap: 10px; min-height: 20px; }

.card {
  display: flex; gap: 10px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  text-decoration: none;
  color: inherit;
}
.card:hover { border-color: var(--accent); }
.card-main h3 { font-size: 14px; margin: 0 0 6px; }
.tags { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 6px; }
.tag {
  font-size: 11px; padding: 1px 7px; border-radius: 999px;
  border: 1px solid var(--chip, #888);
  color: var(--text);
}
.card-meta { font-size: 12px; color: var(--muted); }

.load-state { text-align: center; color: var(--muted); margin: 40px 0; }

/* Dialogs */
.dialog {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel);
  color: var(--text);
  padding: 22px;
  width: min(460px, 92vw);
}
.dialog::backdrop { background: rgba(0,0,0,.5); }
.dialog h2 { margin: 0 0 14px; font-size: 18px; }
.dialog label { display: block; margin-bottom: 12px; font-size: 13px; color: var(--muted); }
.dialog input, .dialog textarea, .dialog select {
  width: 100%; margin-top: 5px;
  padding: 9px 10px;
  border-radius: 8px; border: 1px solid var(--border);
  background: var(--bg); color: var(--text);
  font: inherit;
}
.dialog small { color: var(--muted); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }

/* Post-submit confirmation */
.confirmation { text-align: center; padding: 8px 4px; }
.confirmation h2 { margin: 10px 0 8px; }
.confirmation p { color: var(--muted); line-height: 1.6; margin: 0 0 20px; }
.confirmation p strong { color: var(--text); }
.confirmation .dialog-actions { justify-content: center; }
.confirmation-check {
  width: 48px; height: 48px; margin: 0 auto; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; color: #fff; background: var(--accent);
}
.form-msg { color: var(--muted); font-size: 13px; margin: 10px 0 0; min-height: 18px; }
.badge {
  font-size: 11px; padding: 2px 8px; border-radius: 999px;
  border: 1px solid var(--border); color: var(--text); text-transform: capitalize;
}
.badge-triage { background: rgba(251,202,4,.15); }
.badge-planned { background: rgba(14,138,22,.18); }
.badge-in-progress { background: rgba(29,118,219,.18); }
.badge-done { background: rgba(111,66,193,.18); }

/* Visibility chooser in the submit form */
.visibility { border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; margin-bottom: 12px; }
.visibility legend { color: var(--muted); font-size: 13px; padding: 0 6px; }
.visibility .radio { display: flex; gap: 8px; align-items: flex-start; color: var(--text); margin-bottom: 8px; font-size: 13px; }
.visibility .radio:last-child { margin-bottom: 0; }
.visibility .radio input { width: auto; margin-top: 3px; }

/* Card is a <button> now — reset native button styling, keep card look */
.card {
  width: 100%;
  text-align: left;
  font: inherit;
  cursor: pointer;
  appearance: none;
}
.card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Wide dialog for the detail view */
.dialog-wide { width: min(680px, 94vw); max-height: 85vh; overflow-y: auto; }
.detail-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.detail-title { margin: 4px 0 10px; font-size: 20px; }
.detail-desc { margin: 12px 0 20px; line-height: 1.6; }
.detail-sub {
  font-size: 13px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted); margin: 0 0 12px; border-top: 1px solid var(--border); padding-top: 16px;
}
.muted { color: var(--muted); }

/* Comments / updates */
.comments { display: flex; flex-direction: column; gap: 14px; }
.comment { border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; background: var(--panel-2); }
.comment-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font-size: 13px; }
.comment-head .avatar { width: 20px; height: 20px; border-radius: 50%; }
.comment-date { color: var(--muted); font-size: 12px; }
.comment-body { line-height: 1.55; }
