@font-face {
  font-family: "Oswald";
  src: url("assets/oswald.ttf") format("truetype");
  font-display: swap;
}
@font-face {
  font-family: "Work Sans";
  src: url("assets/work-sans.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;
}

:root {
  color-scheme: dark;
  --ink: #0b0f16;
  --panel: #121826;
  --panel-2: #171f30;
  --line: #26304a;
  --paper: #eef2e6;
  --muted: #9aa5bd;
  --lime: #cdf14d;
  --lime-ink: #101408;
  --amber: #ffb224;
  --sky: #6fc3ff;
  --rose: #ff7a90;
  --mint: #4de3a3;
  --radius: 14px;
  --focus: #ffffff;
}

* { box-sizing: border-box; }
html { background: var(--ink); scroll-behavior: smooth; }
body {
  margin: 0;
  background:
    radial-gradient(1100px 380px at 85% -80px, rgba(205, 241, 77, 0.14), transparent 60%),
    radial-gradient(900px 500px at -10% 10%, rgba(111, 195, 255, 0.1), transparent 55%),
    var(--ink);
  color: var(--paper);
  font-family: "Work Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.55;
  min-height: 100vh;
  -webkit-tap-highlight-color: rgba(205, 241, 77, 0.25);
}

.skip {
  position: absolute; left: 12px; top: -48px; z-index: 60;
  background: var(--lime); color: var(--lime-ink);
  padding: 10px 14px; border-radius: 999px; font-weight: 700; text-decoration: none;
  transition: top 0.18s ease;
}
.skip:focus-visible { top: 12px; outline: 3px solid #fff; outline-offset: 2px; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }

.eyebrow {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--muted); margin: 0 0 10px;
}
.eyebrow-live { display: flex; align-items: center; gap: 8px; color: var(--lime); }
.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--lime); box-shadow: 0 0 0 5px rgba(205,241,77,.18); }

/* Top bar */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 12px 22px;
  background: rgba(11, 15, 22, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: baseline; gap: 10px; }
.brand-mark { display: inline-flex; transform: translateY(6px); }
.brand-name {
  font-family: "Oswald", sans-serif; font-weight: 600;
  letter-spacing: 0.12em; font-size: 24px; color: #fff;
}
.brand-sub { font-family: "IBM Plex Mono", monospace; font-size: 12px; color: var(--muted); letter-spacing: 0.08em; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.shift-label { font-family: "IBM Plex Mono", monospace; font-size: 12px; color: var(--muted); letter-spacing: 0.06em; }
.shift-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--mint); box-shadow: 0 0 10px var(--mint); }
.avatar-stack { display: flex; }
.avatar-stack span {
  width: 30px; height: 30px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: "IBM Plex Mono", monospace; font-size: 10px; font-weight: 700;
  background: var(--panel-2); border: 1px solid var(--line); color: var(--paper);
  margin-left: -8px;
}
.avatar-stack span:first-child { margin-left: 0; background: var(--lime); color: var(--lime-ink); border-color: var(--lime); }

/* Shell */
.shell {
  display: grid; grid-template-columns: 288px minmax(0, 1fr);
  gap: 26px; max-width: 1240px; margin: 0 auto; padding: 30px 26px 60px;
  align-items: start;
}
.rail {
  position: sticky; top: 76px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px 18px;
}
.rail-total { font-size: 14px; color: var(--muted); margin: 0 0 10px; }
.rail-total strong { color: #fff; font-size: 22px; font-variant-numeric: tabular-nums; }
.meter { height: 8px; border-radius: 999px; background: #0a0e15; border: 1px solid var(--line); overflow: hidden; margin-bottom: 16px; }
.meter-fill { display: block; height: 100%; background: linear-gradient(90deg, var(--mint), var(--lime)); transition: width 0.35s ease; }
.rail-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.rail-list button {
  width: 100%; display: flex; align-items: center; gap: 10px;
  background: transparent; color: var(--paper);
  border: 1px solid transparent; border-radius: 10px;
  padding: 9px 10px; font: inherit; font-size: 14px; cursor: pointer;
  touch-action: manipulation;
  transition: background-color 0.16s ease, border-color 0.16s ease;
}
.rail-list button:hover { background: var(--panel-2); border-color: var(--line); }
.rail-list button[aria-current="true"] { background: #1c2539; border-color: var(--lime); }
.rail-key { flex: 1; text-align: left; }
.rail-n { font-family: "IBM Plex Mono", monospace; font-size: 12px; background: #0a0e15; border: 1px solid var(--line); border-radius: 999px; padding: 1px 9px; font-variant-numeric: tabular-nums; }
.dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.dot-todo { background: var(--sky); box-shadow: 0 0 8px rgba(111,195,255,.7); }
.dot-prog { background: var(--amber); box-shadow: 0 0 8px rgba(255,178,36,.7); }
.dot-block { background: var(--rose); box-shadow: 0 0 8px rgba(255,122,144,.7); }
.dot-done { background: var(--mint); box-shadow: 0 0 8px rgba(77,227,163,.7); }
.rail-note { margin-top: 18px; border-top: 1px dashed var(--line); padding-top: 14px; font-size: 13.5px; color: var(--muted); }
.rail-note p:last-child { margin: 0; }

.main { min-width: 0; }
.hero h1 {
  font-family: "Oswald", sans-serif;
  font-size: clamp(52px, 7vw, 92px);
  line-height: 0.95; letter-spacing: -0.01em; text-transform: uppercase;
  margin: 0 0 12px; color: #fff;
  text-wrap: balance;
}
.hero h1 .lime-word { color: var(--lime); }
.lede { max-width: 62ch; color: var(--muted); font-size: 17px; margin: 0 0 22px; }

/* Toolbar */
.toolbar {
  display: grid; grid-template-columns: minmax(0, 1fr) 220px auto;
  gap: 12px; align-items: end;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px;
  position: sticky; top: 70px; z-index: 20;
}
.field { display: grid; gap: 6px; min-width: 0; }
.field label { font-family: "IBM Plex Mono", monospace; font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.search-wrap {
  display: flex; align-items: center; gap: 8px;
  background: #0a0e15; border: 1px solid var(--line); border-radius: 999px;
  padding: 0 14px; color: var(--muted);
}
.search-wrap:focus-within { border-color: var(--lime); color: var(--lime); }
.search-wrap input {
  flex: 1; min-width: 0; background: transparent; border: 0; color: var(--paper);
  font: inherit; font-size: 15px; padding: 11px 0; outline: none;
}
.select-wrap { display: block; }
.select-wrap select {
  width: 100%; appearance: none;
  background-color: #0a0e15; color: var(--paper);
  border: 1px solid var(--line); border-radius: 999px;
  font: inherit; font-size: 14px; padding: 11px 36px 11px 14px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23cdf14d' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center;
}
.select-wrap select:hover { border-color: var(--lime); }
.result-count { font-family: "IBM Plex Mono", monospace; font-size: 12px; color: var(--muted); margin: 0; padding-bottom: 12px; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* Ledger rows — single column, tabular */
.ledger { list-style: none; margin: 18px 0 0; padding: 0; display: grid; gap: 10px; }
.item {
  display: grid;
  grid-template-columns: 118px minmax(0, 1fr) auto;
  gap: 16px; align-items: center;
  background: var(--panel);
  border: 1px solid var(--line); border-left: 4px solid var(--sky);
  border-radius: 12px; padding: 14px 14px 14px 16px;
  transition: border-color 0.16s ease, background-color 0.16s ease, transform 0.16s ease;
}
.item:hover { background: var(--panel-2); border-color: #3a4767; }
.item[data-status="todo"] { border-left-color: var(--sky); }
.item[data-status="in-progress"] { border-left-color: var(--amber); }
.item[data-status="blocked"] { border-left-color: var(--rose); }
.item[data-status="done"] { border-left-color: var(--mint); }
.item.is-done .item-title { text-decoration: line-through; text-decoration-thickness: 2px; text-decoration-color: rgba(77,227,163,.8); color: var(--muted); }
.item-id {
  font-family: "IBM Plex Mono", monospace; font-size: 12px; color: var(--muted);
  display: flex; align-items: center; gap: 8px; font-variant-numeric: tabular-nums;
}
.item-main { min-width: 0; }
.item-title { margin: 0 0 4px; font-size: 17px; font-weight: 650; color: #fff; line-height: 1.3; overflow-wrap: break-word; }
.item-sum { margin: 0 0 8px; font-size: 14px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.item-meta { display: flex; flex-wrap: wrap; gap: 6px; font-family: "IBM Plex Mono", monospace; font-size: 11.5px; }
.chip { border: 1px solid var(--line); border-radius: 999px; padding: 2px 9px; color: var(--muted); background: #0a0e15; white-space: nowrap; }
.chip.pri-high { color: #ffd4a8; border-color: #6b4a1f; }
.chip.st-todo { color: var(--sky); }
.chip.st-in-progress { color: var(--amber); }
.chip.st-blocked { color: var(--rose); }
.chip.st-done { color: var(--mint); }
.item-side { display: grid; gap: 8px; justify-items: end; }
.open-btn {
  background: var(--lime); color: var(--lime-ink);
  border: 1px solid var(--lime); border-radius: 999px;
  font: inherit; font-weight: 700; font-size: 14px;
  padding: 9px 18px; cursor: pointer; white-space: nowrap;
  touch-action: manipulation;
  transition: background-color 0.15s ease, transform 0.15s ease;
}
.open-btn:hover { background: #dcff62; transform: translateY(-1px); }
.open-btn:active { transform: translateY(0); }
.due-flag { font-family: "IBM Plex Mono", monospace; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.due-flag.urgent { color: var(--rose); }

/* Empty */
.empty {
  margin-top: 18px; text-align: left;
  border: 1px dashed #3a4767; border-radius: var(--radius);
  padding: 34px 28px; background: rgba(18, 24, 38, 0.7);
}
.empty-code { font-family: "IBM Plex Mono", monospace; color: var(--lime); letter-spacing: 0.1em; margin: 0 0 8px; }
.empty h2 { font-family: "Oswald", sans-serif; text-transform: uppercase; font-size: 32px; margin: 0 0 8px; color: #fff; text-wrap: pretty; }
.empty p { color: var(--muted); margin: 0 0 16px; max-width: 52ch; }

/* Buttons */
.btn { font: inherit; font-weight: 700; border-radius: 999px; padding: 11px 20px; cursor: pointer; touch-action: manipulation; transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.15s ease; }
.btn:hover { transform: translateY(-1px); }
.btn-lime { background: var(--lime); color: var(--lime-ink); border: 1px solid var(--lime); }
.btn-lime:hover { background: #dcff62; }
.btn-ghost { background: transparent; color: var(--paper); border: 1px solid var(--line); font-size: 14px; padding: 9px 16px; }
.btn-ghost:hover { border-color: var(--lime); color: var(--lime); }
.icon-btn {
  background: #0a0e15; color: var(--paper); border: 1px solid var(--line);
  width: 38px; height: 38px; border-radius: 50%; font-size: 15px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  touch-action: manipulation;
}
.icon-btn:hover { border-color: var(--lime); color: var(--lime); }

/* Drawer (detail) — right side panel on desktop, bottom sheet on mobile */
.scrim { position: fixed; inset: 0; background: rgba(4, 6, 10, 0.62); z-index: 40; }
.scrim[hidden] { display: none; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 50;
  width: min(480px, 100vw);
  background: #0e1420; border-left: 1px solid var(--line);
  display: flex; flex-direction: column;
  box-shadow: -30px 0 80px rgba(0,0,0,.5);
  overscroll-behavior: contain;
  animation: slide-in 0.24s ease;
}
.drawer[hidden] { display: none; }
@keyframes slide-in { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px 12px; border-bottom: 1px solid var(--line); }
.drawer-head .eyebrow { margin: 0; }
.drawer-body { padding: 18px 20px; overflow-y: auto; flex: 1; }
.detail-statusline { display: flex; align-items: center; gap: 8px; font-family: "IBM Plex Mono", monospace; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.1em; margin: 0 0 10px; }
.drawer-body h2 { font-family: "Oswald", sans-serif; font-size: 34px; line-height: 1.05; text-transform: uppercase; margin: 0 0 14px; color: #fff; text-wrap: pretty; }
.meta-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 0 0 16px; }
.meta-grid > div { background: #0a0e15; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; min-width: 0; }
.meta-grid dt { font-family: "IBM Plex Mono", monospace; font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted); }
.meta-grid dd { margin: 2px 0 0; font-size: 14px; color: var(--paper); overflow-wrap: break-word; }
.body-copy { font-size: 15.5px; color: #d6dcea; white-space: pre-line; overflow-wrap: break-word; border-left: 3px solid var(--lime); padding-left: 14px; margin-bottom: 16px; }
.tag-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 18px; }
.status-form { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px; display: grid; gap: 8px; }
.status-form label { font-family: "IBM Plex Mono", monospace; font-size: 11px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--lime); }
.saved-note { margin: 0; font-size: 13.5px; color: var(--mint); font-family: "IBM Plex Mono", monospace; }
.drawer-foot { display: flex; justify-content: space-between; gap: 10px; padding: 14px 20px calc(16px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); }

.toast {
  position: fixed; left: 50%; bottom: calc(22px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  z-index: 70; background: var(--lime); color: var(--lime-ink);
  font-weight: 700; font-size: 14px; padding: 12px 20px; border-radius: 999px;
  box-shadow: 0 12px 40px rgba(0,0,0,.45); max-width: min(92vw, 520px);
}
.toast[hidden] { display: none; }

.colophon { margin-top: 26px; color: #6b7690; font-size: 13px; font-family: "IBM Plex Mono", monospace; max-width: 70ch; }

/* Responsive */
@media (max-width: 980px) {
  .shell { grid-template-columns: 1fr; padding: 20px 16px 60px; }
  .rail { position: static; order: 2; }
  .rail-list { grid-template-columns: repeat(5, minmax(max-content, 1fr)); overflow-x: auto; gap: 8px; }
  .rail-list button { white-space: nowrap; }
  .rail-note { display: none; }
  .toolbar { grid-template-columns: 1fr; position: static; }
  .result-count { padding-bottom: 0; }
  .item { grid-template-columns: 1fr; gap: 10px; }
  .item-side { justify-items: start; grid-template-columns: 1fr auto; align-items: center; width: 100%; }
  .topbar { padding: 10px 14px; }
  .shift-label { display: none; }
  .avatar-stack span:nth-child(n+4) { display: none; }
}
@media (max-width: 560px) {
  .drawer { top: auto; left: 0; right: 0; bottom: 0; width: auto; max-height: 92dvh; border-left: 0; border-top: 1px solid var(--line); border-radius: 18px 18px 0 0; }
  .drawer-body h2 { font-size: 27px; }
  .meta-grid { grid-template-columns: 1fr 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
  .pulse { box-shadow: none; }
}
