/* Relay — dark dispatch desk */

@font-face {
  font-family: "Space Grotesk";
  src: url("assets/space-grotesk.ttf") format("truetype");
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("assets/ibm-plex-mono.ttf") format("truetype");
  font-display: swap;
}
@font-face {
  font-family: "Work Sans";
  src: url("assets/work-sans.ttf") format("truetype");
  font-display: swap;
}

:root {
  --bg: #0e1116;
  --bg-raise: #141922;
  --bg-raise-2: #1a2029;
  --line: #27303d;
  --line-soft: #1e2530;
  --text: #e9edf3;
  --muted: #97a1b0;
  --faint: #6b7482;
  --accent: #f2b63c;
  --accent-ink: #17120a;

  --todo: #6fa8f5;
  --in-progress: #f2b63c;
  --blocked: #f07a6e;
  --done: #52c98a;

  --radius: 8px;
  --focus: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent);
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  background:
    radial-gradient(1100px 500px at 85% -10%, rgba(242, 182, 60, 0.07), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(111, 168, 245, 0.06), transparent 60%),
    var(--bg);
  color: var(--text);
  font-family: "Work Sans", system-ui, -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
}

.mono { font-family: "IBM Plex Mono", ui-monospace, monospace; }

.skip-link {
  position: absolute;
  left: 12px;
  top: -48px;
  z-index: 60;
  background: var(--accent);
  color: var(--accent-ink);
  padding: 8px 14px;
  border-radius: 6px;
  font-weight: 600;
  text-decoration: none;
  transition: top 120ms ease;
}
.skip-link:focus { top: 12px; }

:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 4px; }

/* ---------- Top bar ---------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--line-soft);
  background: rgba(14, 17, 22, 0.9);
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(6px);
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.brand-mark {
  width: 22px;
  height: 22px;
  color: var(--accent);
  align-self: center;
}
.brand-name {
  font-family: "Space Grotesk", sans-serif;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.brand-sub {
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 9px;
}
.topbar-note {
  margin: 0;
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  color: var(--faint);
}

/* ---------- Shell ---------- */

.shell {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  gap: 28px;
  max-width: 1180px;
  margin: 0 auto;
  padding: 28px 24px 80px;
}

/* ---------- Rail ---------- */

.rail {
  position: sticky;
  top: 84px;
  align-self: start;
  background: var(--bg-raise);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px;
}
.rail-title {
  margin: 0 0 12px;
  font-family: "Space Grotesk", sans-serif;
  font-size: 13px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.counts { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.count-row { display: flex; }
.count-row + .count-row { border-top: 1px dashed var(--line-soft); }
.count-btn {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  background: none;
  border: 0;
  color: inherit;
  font: inherit;
  padding: 7px 6px;
  border-radius: 6px;
  cursor: pointer;
  text-align: left;
}
.count-btn:hover { background: var(--bg-raise-2); }
.count-btn[aria-pressed="true"] {
  background: var(--bg-raise-2);
  box-shadow: inset 2px 0 0 var(--accent);
}
.count-dot {
  width: 9px;
  height: 9px;
  border-radius: 3px;
  flex: none;
}
.count-label { flex: 1; font-size: 13.5px; color: var(--muted); }
.count-num {
  font-family: "IBM Plex Mono", monospace;
  font-size: 13px;
  color: var(--text);
}

.rail-progress { margin-top: 18px; }
.rail-progress-head {
  display: flex;
  justify-content: space-between;
  font-size: 12.5px;
  color: var(--muted);
  margin-bottom: 7px;
}
.rail-progress-head .mono { font-size: 12px; }
.bar {
  height: 6px;
  border-radius: 999px;
  background: var(--line-soft);
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--done), #7fe0ab);
  transition: width 240ms ease;
}
.rail-foot {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--line-soft);
  font-size: 11.5px;
  color: var(--faint);
  letter-spacing: 0.04em;
}

/* ---------- Main column ---------- */

.page-head { margin-bottom: 18px; }
.page-head h1 {
  margin: 0 0 4px;
  font-family: "Space Grotesk", sans-serif;
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.page-sub { margin: 0; color: var(--muted); font-size: 14px; }

/* Controls */

.controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 200px;
  gap: 14px;
  align-items: end;
  margin-bottom: 18px;
}
.field { display: grid; gap: 5px; }
.field-label {
  font-family: "IBM Plex Mono", monospace;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
}
.search-wrap { position: relative; }
.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 17px;
  height: 17px;
  color: var(--faint);
  pointer-events: none;
}
input[type="search"], select {
  width: 100%;
  background: var(--bg-raise);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  font: inherit;
  padding: 10px 12px;
}
input[type="search"] { padding-left: 38px; }
input[type="search"]::placeholder { color: var(--faint); }
input[type="search"]::-webkit-search-cancel-button { -webkit-appearance: none; }
select { cursor: pointer; appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 34px; }

/* ---------- Task rows ---------- */

.task-list { display: grid; gap: 8px; }

.row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  background: var(--bg-raise);
  border: 1px solid var(--line);
  border-left-width: 3px;
  border-radius: 10px;
  padding: 12px 16px 12px 12px;
  transition: background 120ms ease, transform 120ms ease;
}
.row:hover { background: var(--bg-raise-2); }
.row.is-flash { animation: rowflash 900ms ease; }
@keyframes rowflash {
  0% { background: rgba(242, 182, 60, 0.22); }
  100% { background: var(--bg-raise); }
}

.row-id {
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  color: var(--faint);
  letter-spacing: 0.05em;
  min-width: 64px;
}
.row-id .dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 3px;
  margin-right: 7px;
  vertical-align: baseline;
}

.row-main { min-width: 0; }
.row-title {
  background: none;
  border: 0;
  color: var(--text);
  font-family: "Space Grotesk", sans-serif;
  font-size: 15.5px;
  font-weight: 600;
  padding: 2px 4px;
  margin-left: -4px;
  border-radius: 5px;
  cursor: pointer;
  text-align: left;
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.row-title:hover { color: var(--accent); }
.row-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  margin-top: 4px;
  font-size: 12.5px;
  color: var(--muted);
}
.row-meta .meta {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}
.row-meta .meta svg { width: 13px; height: 13px; color: var(--faint); flex: none; }

.row-side { display: grid; justify-items: end; gap: 6px; }

.pill {
  font-family: "IBM Plex Mono", monospace;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  border-radius: 999px;
  padding: 3px 10px;
  border: 1px solid transparent;
  white-space: nowrap;
}
.pill-status-todo { color: var(--todo); border-color: rgba(111,168,245,0.4); background: rgba(111,168,245,0.08); }
.pill-status-in-progress { color: var(--in-progress); border-color: rgba(242,182,60,0.4); background: rgba(242,182,60,0.08); }
.pill-status-blocked { color: var(--blocked); border-color: rgba(240,122,110,0.4); background: rgba(240,122,110,0.08); }
.pill-status-done { color: var(--done); border-color: rgba(82,201,138,0.4); background: rgba(82,201,138,0.08); }
.pill-priority { color: var(--muted); border-color: var(--line); background: transparent; }
.pill-priority-high { color: var(--blocked); border-color: rgba(240,122,110,0.35); }

/* ---------- Empty state ---------- */

.empty {
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: 12px;
  padding: 44px 24px;
  color: var(--muted);
}
.empty-icon { width: 44px; height: 44px; color: var(--faint); margin-bottom: 10px; }
.empty-title {
  margin: 0 0 4px;
  font-family: "Space Grotesk", sans-serif;
  font-size: 18px;
  color: var(--text);
}
.empty-body { margin: 0 0 18px; }

.btn {
  font: inherit;
  font-weight: 600;
  background: var(--accent);
  color: var(--accent-ink);
  border: 0;
  border-radius: var(--radius);
  padding: 9px 16px;
  cursor: pointer;
}
.btn:hover { filter: brightness(1.06); }

/* ---------- Detail panel ---------- */

.detail {
  position: fixed;
  inset: 0 0 0 auto;
  width: min(520px, 100%);
  z-index: 40;
  background: var(--bg-raise);
  border-left: 1px solid var(--line);
  box-shadow: -24px 0 60px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  transform: translateX(24px);
  opacity: 0;
  pointer-events: none;
  transition: transform 180ms ease, opacity 180ms ease;
}
.detail.open { transform: none; opacity: 1; pointer-events: auto; }

.detail-inner {
  overflow-y: auto;
  padding: 22px 26px 32px;
  flex: 1;
}

.detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}
.detail-kicker {
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--faint);
}
.close-btn {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: none;
  border: 1px solid var(--line);
  color: var(--muted);
  border-radius: 7px;
  padding: 6px 10px;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.close-btn:hover { color: var(--text); border-color: var(--muted); }
.close-btn svg { width: 13px; height: 13px; }

.detail h2 {
  margin: 2px 0 14px;
  font-family: "Space Grotesk", sans-serif;
  font-size: 23px;
  line-height: 1.25;
  font-weight: 700;
}

.detail-body {
  border-top: 1px solid var(--line-soft);
  padding-top: 16px;
  color: #cfd6e0;
  font-size: 14.5px;
  white-space: pre-line;
}

.facts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 18px;
  margin: 18px 0;
  padding: 16px;
  background: var(--bg);
  border: 1px solid var(--line-soft);
  border-radius: 10px;
}
.fact-label {
  font-family: "IBM Plex Mono", monospace;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.13em;
  color: var(--faint);
  margin-bottom: 3px;
}
.fact-value { font-size: 13.5px; }
.fact-value .dot { display: inline-block; width: 8px; height: 8px; border-radius: 3px; margin-right: 6px; }

.status-field { display: grid; gap: 6px; margin: 18px 0 8px; }
.status-field select { max-width: 260px; }
.status-hint { font-size: 12.5px; color: var(--faint); }

/* ---------- Toast ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  z-index: 70;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
  font-size: 14px;
  border-radius: 8px;
  padding: 11px 18px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.45);
}

/* ---------- Responsive ---------- */

@media (max-width: 900px) {
  .shell {
    grid-template-columns: minmax(0, 1fr);
    gap: 18px;
    padding: 20px 16px 70px;
  }
  .rail { position: static; padding: 14px; }
  .counts { grid-template-columns: 1fr 1fr; }
  .count-row + .count-row { border-top: 0; }
  .rail-progress { display: none; }
  .rail-foot { display: none; }
  .page-head h1 { font-size: 25px; }
  .controls { grid-template-columns: minmax(0, 1fr); }
  .topbar { padding: 12px 16px; }
  .topbar-note { display: none; }
}

@media (max-width: 620px) {
  .row {
    grid-template-columns: minmax(0, 1fr) auto;
    padding: 12px 14px;
  }
  .row-id { display: none; }
  .row-side { justify-items: start; }
  .counts { grid-template-columns: 1fr; }
  .detail { inset: 0; width: 100%; border-left: 0; }
}

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