:root {
  --bg: #f3f5f7;
  --surface: #ffffff;
  --ink: #1b2028;
  --ink-muted: #64707d;
  --border: #e1e5ea;
  --accent: #2451b0;
  --accent-ink: #ffffff;
  --radius: 8px;
  --shadow-card: 0 1px 2px rgba(16, 24, 40, 0.06);
  --shadow-card-hover: 0 6px 16px rgba(16, 24, 40, 0.12);

  --cat-new: #64748b;
  --cat-indeterminate: #2451b0;
  --cat-done: #2f855a;

  --pr-highest: #c0392b;
  --pr-high: #b9770e;
  --pr-medium: #2451b0;
  --pr-low: #2f855a;
  --pr-lowest: #8a94a6;
  --pr-none: #a6acb5;

  --epic: #6554c0;
  --epic-bg: rgba(101, 84, 192, 0.1);

  --blocked-text: #b3423d;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: 'IBM Plex Sans', system-ui, -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

.mono-key {
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 12.5px;
  color: var(--ink-muted);
  letter-spacing: 0.01em;
}

.muted {
  color: var(--ink-muted);
}

.small {
  font-size: 13px;
}

button {
  font-family: inherit;
}

button:focus-visible,
input:focus-visible,
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    animation: none !important;
  }
}

/* ---------- App header ---------- */

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.app-header-left {
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.app-header-left h1 {
  font-size: 18px;
  font-weight: 600;
  margin: 0;
}

.project-badge {
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--accent);
  background: rgba(36, 81, 176, 0.08);
  border-radius: 5px;
  padding: 3px 8px;
  letter-spacing: 0.02em;
}

.epic-select {
  font-family: inherit;
  font-size: 13.5px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 10px;
  max-width: 280px;
}

.app-header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-secondary,
.btn-ghost {
  border-radius: 6px;
  padding: 7px 14px;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease;
}

.btn-secondary {
  background: var(--accent);
  color: var(--accent-ink);
  border: 1px solid var(--accent);
}

.btn-secondary:hover {
  background: #1d4590;
}

.btn-ghost {
  background: transparent;
  color: var(--ink-muted);
  border: 1px solid var(--border);
}

.btn-ghost:hover {
  border-color: var(--ink-muted);
  color: var(--ink);
}

/* ---------- Board ---------- */

main {
  padding: 20px 24px 40px;
}

.board-status {
  margin-bottom: 16px;
  font-size: 14px;
}

.board {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  overflow-x: auto;
  padding-bottom: 8px;
}

.column {
  flex: 0 0 268px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.column-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-top: 3px solid var(--cat-new);
  border-bottom: 1px solid var(--border);
}

.column-new .column-header {
  border-top-color: var(--cat-new);
}

.column-indeterminate .column-header {
  border-top-color: var(--cat-indeterminate);
}

.column-done .column-header {
  border-top-color: var(--cat-done);
}

.column-label {
  font-weight: 600;
  font-size: 13.5px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.column-count {
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 12px;
  color: var(--ink-muted);
  background: var(--bg);
  border-radius: 10px;
  padding: 1px 8px;
}

.column-cards {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  min-height: 40px;
}

.column-empty {
  padding: 8px 4px;
  text-align: center;
}

.card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  width: 100%;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
  cursor: pointer;
  box-shadow: var(--shadow-card);
  transition: box-shadow 120ms ease, transform 120ms ease, border-color 120ms ease;
}

.card:hover {
  box-shadow: var(--shadow-card-hover);
  border-color: #c9ced6;
  transform: translateY(-1px);
}

.card-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
}

.card-summary {
  font-size: 14px;
  color: var(--ink);
  line-height: 1.4;
}

/* ---------- Epic tag ---------- */

.epic-tag {
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--epic);
  background: var(--epic-bg);
  border: 1px solid rgba(101, 84, 192, 0.3);
  border-radius: 4px;
  padding: 2px 6px;
  align-self: flex-start;
}

/* ---------- Priority pill ---------- */

.priority-pill {
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 2px 8px;
  border-radius: 999px;
  color: #fff;
  align-self: flex-start;
}

.priority-highest {
  background: var(--pr-highest);
}

.priority-high {
  background: var(--pr-high);
}

.priority-medium {
  background: var(--pr-medium);
}

.priority-low {
  background: var(--pr-low);
}

.priority-lowest {
  background: var(--pr-lowest);
}

.priority-none {
  background: var(--pr-none);
}

/* ---------- Modal ---------- */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 24, 30, 0.45);
  align-items: flex-start;
  justify-content: center;
  padding: 8vh 20px 20px;
  z-index: 100;
}

.modal-overlay:not([hidden]) {
  display: flex;
}

.modal {
  position: relative;
  background: var(--surface);
  border-radius: 10px;
  max-width: 640px;
  width: 100%;
  max-height: 78vh;
  overflow-y: auto;
  padding: 28px 32px 32px;
  box-shadow: 0 20px 50px rgba(16, 24, 40, 0.25);
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 16px;
  background: none;
  border: none;
  font-size: 22px;
  line-height: 1;
  color: var(--ink-muted);
  cursor: pointer;
  padding: 4px;
}

.modal-close:hover {
  color: var(--ink);
}

.modal-meta-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.modal h2 {
  font-size: 20px;
  font-weight: 600;
  margin: 0 0 16px;
}

.modal-facts {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 4px 12px;
  font-size: 13.5px;
  margin: 0 0 16px;
}

.modal-facts dt {
  color: var(--ink-muted);
}

.modal-facts dd {
  margin: 0;
}

.modal hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 0 0 16px;
}

.prose p {
  margin: 0 0 12px;
}

.prose ul,
.prose ol {
  margin: 0 0 12px;
  padding-left: 22px;
}

.prose pre {
  background: var(--bg);
  border-radius: 6px;
  padding: 12px;
  overflow-x: auto;
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 13px;
}

.prose code {
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 0.92em;
  background: var(--bg);
  padding: 1px 4px;
  border-radius: 4px;
}

.prose blockquote {
  border-left: 3px solid var(--border);
  margin: 0 0 12px;
  padding-left: 12px;
  color: var(--ink-muted);
}

.prose table {
  border-collapse: collapse;
  margin-bottom: 12px;
  width: 100%;
}

.prose th,
.prose td {
  border: 1px solid var(--border);
  padding: 6px 8px;
  font-size: 13.5px;
  text-align: left;
}

.mention {
  color: var(--accent);
  font-weight: 500;
}

/* ---------- Modal children section ---------- */

.modal-children {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.modal-children h3 {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-muted);
  margin: 0 0 10px;
}

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

.child-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  cursor: pointer;
  font-family: inherit;
  font-size: 13.5px;
  color: var(--ink);
  transition: border-color 120ms ease, background 120ms ease;
}

.child-item:hover {
  border-color: #c9ced6;
  background: var(--bg);
}

.child-summary {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.child-status {
  flex-shrink: 0;
  color: var(--ink-muted);
}

.child-blocked,
.child-blocked .mono-key,
.child-blocked .child-status {
  color: var(--blocked-text);
}

/* ---------- Login ---------- */

.login-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-card {
  width: 100%;
  max-width: 340px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 32px 28px;
  box-shadow: var(--shadow-card);
}

.eyebrow {
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 12px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 0 0 8px;
}

.login-card h1 {
  font-size: 22px;
  margin: 0 0 6px;
}

.login-card p.muted {
  margin: 0 0 20px;
  font-size: 13.5px;
}

.login-card form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.login-card label {
  font-size: 13px;
  font-weight: 500;
}

.login-card input {
  font-size: 14px;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  margin-bottom: 6px;
}

.login-card button {
  background: var(--accent);
  color: var(--accent-ink);
  border: none;
  border-radius: 6px;
  padding: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 4px;
}

.login-card button:hover {
  background: #1d4590;
}

.error {
  color: var(--pr-highest);
  font-size: 13px;
  margin: 8px 0 0;
}
