:root {
  --bg: #fafafa;
  --surface: #ffffff;
  --surface-2: #f3f3f6;
  --text: #0b0b0f;
  --muted: #6b6b76;
  --border: #e5e5ea;
  --accent: #ff3d7f;
  --accent-ink: #ffffff;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 4px 12px rgba(0,0,0,.04);
  --radius: 12px;
  --radius-sm: 8px;
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0b0f;
    --surface: #15151c;
    --surface-2: #1d1d26;
    --text: #f5f5f7;
    --muted: #9a9aa6;
    --border: #2a2a35;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.3);
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); }
body { min-height: 100vh; -webkit-font-smoothing: antialiased; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

button {
  font: inherit; cursor: pointer; border: 1px solid var(--border);
  background: var(--surface); color: var(--text);
  padding: .55rem 1rem; border-radius: var(--radius-sm);
  transition: background .15s, border-color .15s, transform .05s;
}
button:hover { background: var(--surface-2); }
button:active { transform: translateY(1px); }
button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
button.primary:hover { filter: brightness(1.05); background: var(--accent); }
button.ghost { background: transparent; }
button.danger { color: #ef4444; border-color: rgba(239,68,68,.3); }
button.danger:hover { background: rgba(239,68,68,.08); }

input, select, textarea {
  font: inherit; color: var(--text);
  background: var(--surface); border: 1px solid var(--border);
  padding: .55rem .7rem; border-radius: var(--radius-sm); width: 100%;
}
input:focus, textarea:focus, select:focus {
  outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent;
}
textarea { resize: vertical; min-height: 6rem; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1.5rem; border-bottom: 1px solid var(--border);
  background: var(--surface); position: sticky; top: 0; z-index: 10;
}
.brand { display: flex; align-items: center; gap: .6rem; }
.brand h1 { margin: 0; font-size: 1.05rem; letter-spacing: -0.01em; }
.brand .dot {
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 0 3px rgba(255,61,127,.18);
}
.brand .tagline { color: var(--muted); font-size: .85rem; margin-left: .25rem; }
.topbar nav { display: flex; gap: .25rem; }
.topbar nav a {
  color: var(--text); padding: .45rem .8rem; border-radius: 999px; font-size: .9rem;
}
.topbar nav a:hover { background: var(--surface-2); text-decoration: none; }
.topbar nav a.active { background: var(--accent); color: var(--accent-ink); }
.topbar nav a.admin-link { color: var(--muted); }

main { max-width: 1200px; margin: 1.25rem auto; padding: 0 1.5rem 4rem; }

.board { display: grid; grid-template-columns: 240px 1fr; gap: 1.5rem; }
@media (max-width: 720px) { .board { grid-template-columns: 1fr; } }
.filters { display: flex; flex-direction: column; gap: 1.25rem; position: sticky; top: 5rem; align-self: start; }
.filter-group h3 {
  margin: 0 0 .5rem; font-size: .72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .08em; color: var(--muted);
}

.chips { display: flex; flex-wrap: wrap; gap: .35rem; }
.chip {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .25rem .6rem; font-size: .78rem;
  border: 1px solid var(--border); border-radius: 999px;
  background: var(--surface); color: var(--text); cursor: pointer;
  user-select: none;
  text-transform: capitalize;
}
.chip:hover { background: var(--surface-2); }
.chip.active { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.chip .swatch { width: .55rem; height: .55rem; border-radius: 50%; }
.chip .count { color: var(--muted); font-variant-numeric: tabular-nums; }
.chip.active .count { color: rgba(255,255,255,.85); }

.list-meta { color: var(--muted); font-size: .85rem; margin-bottom: .75rem; display: flex; justify-content: space-between; }
.cards { display: flex; flex-direction: column; gap: .6rem; }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1rem 1.1rem; box-shadow: var(--shadow);
  display: grid; grid-template-columns: 1fr auto; gap: .5rem 1rem;
  cursor: pointer; transition: border-color .15s, transform .05s;
}
.card:hover { border-color: var(--accent); }
.card h3 { margin: 0 0 .15rem; font-size: 1rem; }
.card .meta { color: var(--muted); font-size: .8rem; display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }
.card .tags { display: flex; gap: .3rem; flex-wrap: wrap; }
.card .desc { color: var(--muted); font-size: .9rem; margin: .35rem 0 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card .badges { display: flex; flex-direction: column; gap: .35rem; align-items: flex-end; }

.badge {
  display: inline-block; font-size: .72rem; font-weight: 600;
  padding: .2rem .55rem; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface-2);
  text-transform: capitalize;
}
.badge.status-new { background: #e0e7ff; color: #3730a3; border-color: transparent; }
.badge.status-triaged { background: #fef3c7; color: #92400e; border-color: transparent; }
.badge.status-planned { background: #dbeafe; color: #1e40af; border-color: transparent; }
.badge.status-in_progress { background: #fce7f3; color: #9d174d; border-color: transparent; }
.badge.status-shipped { background: #d1fae5; color: #065f46; border-color: transparent; }
.badge.status-declined { background: #f3f4f6; color: #6b7280; border-color: transparent; }
@media (prefers-color-scheme: dark) {
  .badge.status-new { background: rgba(99,102,241,.15); color: #a5b4fc; }
  .badge.status-triaged { background: rgba(245,158,11,.15); color: #fcd34d; }
  .badge.status-planned { background: rgba(59,130,246,.15); color: #93c5fd; }
  .badge.status-in_progress { background: rgba(236,72,153,.15); color: #f9a8d4; }
  .badge.status-shipped { background: rgba(16,185,129,.15); color: #6ee7b7; }
  .badge.status-declined { background: rgba(156,163,175,.15); color: #d1d5db; }
}
.badge.priority-critical { background: #fee2e2; color: #991b1b; border-color: transparent; }
.badge.priority-high { background: #ffedd5; color: #9a3412; border-color: transparent; }
.badge.priority-medium { background: #fef9c3; color: #854d0e; border-color: transparent; }
.badge.priority-low { background: #ecfccb; color: #3f6212; border-color: transparent; }
.badge.priority-unset { display: none; }
@media (prefers-color-scheme: dark) {
  .badge.priority-critical { background: rgba(239,68,68,.18); color: #fca5a5; }
  .badge.priority-high { background: rgba(249,115,22,.18); color: #fdba74; }
  .badge.priority-medium { background: rgba(234,179,8,.18); color: #fde68a; }
  .badge.priority-low { background: rgba(132,204,22,.18); color: #bef264; }
}

.tag {
  display: inline-flex; align-items: center; gap: .3rem;
  font-size: .72rem; padding: .15rem .5rem; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--border);
  text-transform: capitalize;
}
.tag .swatch { width: .5rem; height: .5rem; border-radius: 50%; }

.roadmap { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }
@media (max-width: 960px) { .roadmap { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .roadmap { grid-template-columns: 1fr; } }
.lane {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: .9rem; min-height: 200px;
}
.lane h3 {
  margin: 0 0 .75rem; font-size: .78rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .08em; color: var(--muted);
}
.lane-cards { display: flex; flex-direction: column; gap: .5rem; }
.lane .card { padding: .7rem .85rem; box-shadow: none; }

.form { display: flex; flex-direction: column; gap: 1rem; max-width: 700px; }
.form label { display: flex; flex-direction: column; gap: .35rem; font-size: .85rem; color: var(--muted); }
.form label input, .form label textarea, .form label select { color: var(--text); }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.row.inline { display: flex; align-items: flex-end; gap: .5rem; }
.row.inline input[type=color] { width: 3rem; padding: .25rem; }
@media (max-width: 540px) { .row { grid-template-columns: 1fr; } }

.chips.selectable .chip { cursor: pointer; }
.chips.selectable .chip.active { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

.msg { color: var(--muted); margin: 0; min-height: 1.2em; font-size: .85rem; }
.msg.ok { color: #16a34a; }
.msg.err { color: #dc2626; }

.detail .back { display: inline-block; margin-bottom: 1rem; color: var(--muted); }
.detail article {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.5rem; box-shadow: var(--shadow);
}
.detail h2 { margin: 0 0 .5rem; }
.detail .meta { color: var(--muted); font-size: .85rem; margin-bottom: 1rem; display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }
.detail .description { white-space: pre-wrap; line-height: 1.55; }

.admin-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; margin-top: 1.5rem; }
@media (max-width: 720px) { .admin-grid { grid-template-columns: 1fr; } }
.panel {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1rem;
}
.panel h4 {
  margin: 0 0 .75rem; font-size: .75rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .08em; color: var(--muted);
}

.comments { margin-top: 1.5rem; }
.comment-body { white-space: pre-wrap; line-height: 1.5; }
.description a, .comment-body a { word-break: break-all; }

.comment {
  border-top: 1px solid var(--border); padding: .8rem 0;
}
.comment .meta { font-size: .75rem; color: var(--muted); margin-bottom: .3rem; display: flex; gap: .5rem; align-items: center; }
.comment.internal { background: linear-gradient(to right, rgba(255,61,127,.06), transparent); padding-left: .75rem; border-left: 3px solid var(--accent); }
.comment .badge.internal { background: var(--accent); color: var(--accent-ink); border-color: transparent; }

.tags-admin .card { display: flex; align-items: center; justify-content: space-between; padding: .6rem .8rem; }
.tags-admin .card .left { display: flex; align-items: center; gap: .5rem; }
.swatch-lg { width: 1rem; height: 1rem; border-radius: 50%; border: 1px solid var(--border); }
