@font-face { font-family: "Oswald"; src: url("assets/oswald.ttf") format("truetype"); font-weight: 200 700; font-display: swap; }
@font-face { font-family: "Space Grotesk"; src: url("assets/space-grotesk.ttf") format("truetype"); font-weight: 300 700; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url("assets/ibm-plex-mono.ttf") format("truetype"); font-weight: 400; font-display: swap; }

:root {
  --paper: oklch(0.962 0.008 248);
  --surface: oklch(0.992 0.003 248);
  --ink: oklch(0.2 0.035 264);
  --muted: oklch(0.43 0.03 262);
  --line: oklch(0.85 0.014 250);
  --line-strong: oklch(0.7 0.02 255);
  --rail: oklch(0.2 0.045 266);
  --rail-text: oklch(0.9 0.015 255);
  --rail-muted: oklch(0.74 0.025 258);
  --signal: oklch(0.87 0.17 98);
  --cobalt: oklch(0.48 0.21 264);
  --cobalt-tint: oklch(0.93 0.04 264);

  --todo: oklch(0.38 0.03 262);
  --todo-tint: oklch(0.925 0.01 255);
  --prog: oklch(0.46 0.2 264);
  --prog-tint: oklch(0.925 0.045 264);
  --block: oklch(0.5 0.2 28);
  --block-tint: oklch(0.93 0.045 28);
  --done: oklch(0.4 0.12 152);
  --done-tint: oklch(0.925 0.05 152);

  --display: "Oswald", "Arial Narrow", sans-serif;
  --body: "Space Grotesk", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --rail-w: 15rem;
  --panel-w: 29rem;
}

* { box-sizing: border-box; }
html { color-scheme: light; scrollbar-color: var(--line-strong) transparent; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 1rem/1.5 var(--body);
  -webkit-font-smoothing: antialiased;
  caret-color: var(--cobalt);
}
::selection { background: var(--signal); color: var(--ink); }
button, input, select { font: inherit; color: inherit; }
h1, h2, h3, p, ul, dl, dd { margin: 0; padding: 0; }
ul { list-style: none; }
svg { display: block; }
svg.i { width: 1.25rem; height: 1.25rem; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }

:focus-visible { outline: 3px solid var(--cobalt); outline-offset: 2px; }
.rail :focus-visible { outline-color: var(--signal); }

/* ---------- shell ---------- */
.app { display: grid; grid-template-columns: var(--rail-w) minmax(0, 1fr); min-height: 100vh; }
.rail {
  background: var(--rail);
  color: var(--rail-text);
  padding: 1.75rem 1.25rem;
  display: flex; flex-direction: column; gap: 2.25rem;
  position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: .65rem; color: #fff; text-decoration: none; border-radius: 4px; }
.brand-mark { width: 2.25rem; height: 2.25rem; fill: none; stroke: var(--signal); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.brand-mark circle { fill: var(--signal); }
.brand-name { font: 600 1.5rem/1 var(--display); letter-spacing: .06em; text-transform: uppercase; }

.rail-title { font: 500 .8125rem/1 var(--display); letter-spacing: .16em; text-transform: uppercase; color: var(--rail-muted); margin-bottom: .75rem; }
.track-list { display: grid; gap: 2px; }
.track-btn {
  width: 100%; display: grid; grid-template-columns: 1.25rem 1fr auto; align-items: center; gap: .75rem;
  padding: .65rem .75rem; border: 0; border-radius: 4px; background: transparent; color: var(--rail-text);
  text-align: left; cursor: pointer; transition: background-color .15s;
}
.track-btn:hover { background: oklch(0.3 0.05 266); }
.track-btn[aria-pressed="true"] { background: var(--signal); color: var(--ink); font-weight: 600; }
.track-btn .n { font: 400 .8125rem var(--mono); font-variant-numeric: tabular-nums; }
.rail-note { margin-top: auto; font-size: .8125rem; line-height: 1.5; color: var(--rail-muted); max-width: 22ch; }

.work { display: grid; grid-template-columns: minmax(0, 1fr); align-items: start; min-width: 0; }
.work.has-detail { grid-template-columns: minmax(0, 1fr) var(--panel-w); }
.inbox { padding: 2.5rem clamp(1.25rem, 3vw, 3rem) 4rem; min-width: 0; }

.inbox-head { margin-bottom: 1.5rem; }
h1 { font: 600 clamp(2.75rem, 4.5vw, 4rem)/.95 var(--display); letter-spacing: .01em; text-transform: uppercase; text-wrap: balance; }
.count { margin-top: .6rem; color: var(--muted); font-size: .9375rem; font-variant-numeric: tabular-nums; }

/* ---------- tools ---------- */
.tools { display: grid; grid-template-columns: minmax(14rem, 1.6fr) minmax(9rem, 1fr) minmax(9rem, 1fr); gap: 1rem; padding: 1.25rem 0; border-block: 2px solid var(--ink); margin-bottom: .25rem; }
.field { display: grid; gap: .4rem; min-width: 0; }
.field label { font: 500 .8125rem/1 var(--display); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.input-wrap { position: relative; }
.input-wrap svg { position: absolute; left: .8rem; top: 50%; translate: 0 -50%; width: 1.2rem; height: 1.2rem; fill: none; stroke: var(--muted); stroke-width: 1.9; stroke-linecap: round; pointer-events: none; }
input[type="search"], select {
  width: 100%; height: 2.875rem; border: 1.5px solid var(--line-strong); border-radius: 4px; background: var(--surface);
  padding: 0 .85rem; transition: border-color .15s, box-shadow .15s;
}
input[type="search"] { padding-left: 2.6rem; }
input[type="search"]::placeholder { color: oklch(0.5 0.025 262); }
input[type="search"]::-webkit-search-cancel-button { cursor: pointer; }
input:hover, select:hover { border-color: var(--ink); }
input:focus-visible, select:focus-visible { outline: none; border-color: var(--cobalt); box-shadow: 0 0 0 3px var(--cobalt-tint), 0 0 0 4px var(--cobalt); }
select {
  appearance: none; cursor: pointer; padding-right: 2.5rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='m5 8 5 5 5-5' fill='none' stroke='%23161c33' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right .7rem center; background-size: 1.1rem;
}

/* ---------- list ---------- */
.list { container-type: inline-size; container-name: list; }
.item { position: relative; border-bottom: 1px solid var(--line); }
.row {
  position: relative; display: grid; grid-template-columns: 4.5rem minmax(0, 1fr) 15.5rem; gap: 0 1.25rem; align-items: start;
  padding: 1.15rem .75rem; background: transparent; transition: background-color .15s;
}
.item:hover .row { background: var(--surface); }
.item.is-open .row { background: var(--surface); box-shadow: inset 0 0 0 2px var(--ink); }
.item.flash .row { animation: flash 1.4s var(--ease); }
@keyframes flash { 0% { background: var(--signal); } 100% { background: transparent; } }

.due { font-family: var(--display); text-transform: uppercase; line-height: 1; text-align: center; padding-top: .1rem; }
.due b { display: block; font-size: 2.25rem; font-weight: 600; letter-spacing: 0; font-variant-numeric: tabular-nums; }
.due span { display: block; font-size: .8125rem; letter-spacing: .14em; color: var(--muted); margin-top: .25rem; }

.main { min-width: 0; }
.title { font-size: 1.1875rem; font-weight: 600; line-height: 1.25; text-wrap: balance; }
.open-btn { all: unset; cursor: pointer; border-radius: 3px; }
.open-btn::after { content: ""; position: absolute; inset: 0; }
.open-btn:focus-visible { outline: none; }
.item:has(.open-btn:focus-visible) .row { outline: 3px solid var(--cobalt); outline-offset: -3px; }
.item:hover .open-btn { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; }
.summary { margin-top: .3rem; color: var(--muted); font-size: .9375rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; max-width: 68ch; }
.meta { margin-top: .6rem; display: flex; flex-wrap: wrap; gap: .35rem .5rem; align-items: center; font-size: .8125rem; color: var(--muted); }
.meta .proj { font: 400 .75rem var(--mono); letter-spacing: .02em; color: var(--ink); }
.tag { border: 1px solid var(--line-strong); border-radius: 3px; padding: .05rem .4rem; font-size: .75rem; }
.comments { display: inline-flex; align-items: center; gap: .25rem; font-variant-numeric: tabular-nums; }
.comments svg { width: .95rem; height: .95rem; }

.side { display: grid; gap: .6rem; justify-items: start; }
.person { display: flex; align-items: center; gap: .55rem; font-size: .9375rem; min-width: 0; }
.avatar { flex: none; width: 1.75rem; height: 1.75rem; display: grid; place-items: center; border-radius: 3px; background: var(--ink); color: #fff; font: 500 .75rem/1 var(--display); letter-spacing: .06em; }
.prio { display: inline-flex; align-items: center; gap: .45rem; font-size: .8125rem; color: var(--muted); }
.bars { display: inline-flex; align-items: flex-end; gap: 2px; height: .8rem; }
.bars i { width: 3px; background: var(--line-strong); }
.bars i:nth-child(1) { height: 35%; } .bars i:nth-child(2) { height: 65%; } .bars i:nth-child(3) { height: 100%; }
.bars i.on { background: var(--ink); }

.chip { display: inline-flex; align-items: center; gap: .4rem; padding: .22rem .6rem .22rem .45rem; border-radius: 3px; font: 500 .8125rem/1.2 var(--display); letter-spacing: .1em; text-transform: uppercase; white-space: nowrap; }
.chip svg { width: 1rem; height: 1rem; }
.s-todo { background: var(--todo-tint); color: var(--todo); }
.s-in-progress { background: var(--prog-tint); color: var(--prog); }
.s-blocked { background: var(--block-tint); color: var(--block); }
.s-done { background: var(--done-tint); color: var(--done); }
.sg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.sg .fill { fill: currentColor; stroke: none; }

@container list (max-width: 40rem) {
  .row { grid-template-columns: 3.25rem minmax(0, 1fr); gap: 0 .85rem; padding-inline: .25rem; }
  .due b { font-size: 1.75rem; }
  .side { grid-column: 2; grid-auto-flow: column; justify-content: start; align-items: center; margin-top: .75rem; gap: .5rem 1rem; }
  .side .person span:last-child { display: none; }
  .side .prio { display: none; }
}
@container list (min-width: 40.01rem) and (max-width: 52rem) {
  .row { grid-template-columns: 4rem minmax(0, 1fr) 11rem; }
  .side .prio { display: none; }
}

/* ---------- empty ---------- */
.empty { padding: 4rem 1rem; display: grid; justify-items: start; gap: .75rem; max-width: 34rem; }
.empty[hidden] { display: none; }
.empty svg { width: 5rem; fill: none; stroke: var(--line-strong); stroke-width: 2; }
.empty h2 { font: 600 2rem/1.05 var(--display); text-transform: uppercase; }
.empty p { color: var(--muted); }
.btn { height: 2.75rem; padding: 0 1.1rem; border: 0; border-radius: 4px; background: var(--ink); color: #fff; font-weight: 600; cursor: pointer; transition: background-color .15s; margin-top: .5rem; }
.btn:hover { background: var(--cobalt); }

/* ---------- detail ---------- */
.detail {
  position: sticky; top: 0; height: 100vh; overflow-y: auto; overscroll-behavior: contain;
  background: var(--surface); border-left: 2px solid var(--ink);
  padding: 1.5rem 1.75rem 3rem;
  animation: slide-in .45s var(--ease);
}
.detail[hidden] { display: none; }
@keyframes slide-in { from { opacity: 0; translate: 2.5rem 0; } to { opacity: 1; translate: 0 0; } }

.d-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.5rem; }
.d-id { font: 400 .8125rem var(--mono); letter-spacing: .04em; color: var(--muted); }
.icon-btn { display: inline-flex; align-items: center; gap: .5rem; height: 2.75rem; padding: 0 .9rem 0 .75rem; border: 1.5px solid var(--ink); border-radius: 4px; background: transparent; cursor: pointer; font-weight: 600; font-size: .9375rem; transition: background-color .15s, color .15s; }
.icon-btn:hover { background: var(--ink); color: #fff; }
.detail h2 { font: 500 clamp(1.875rem, 2.4vw, 2.25rem)/1.08 var(--display); letter-spacing: .005em; text-wrap: balance; outline: none; }

.status-box { margin-top: 1.5rem; padding: 1rem; background: var(--paper); border-radius: 4px; display: grid; gap: .5rem; }
.status-box label { font: 500 .8125rem/1 var(--display); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.status-box select { font-weight: 600; border-color: var(--ink); }
.status-note { min-height: 1.5rem; font-size: .875rem; color: var(--muted); display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.status-note .undo { all: unset; cursor: pointer; font-weight: 600; color: var(--cobalt); text-decoration: underline; text-underline-offset: 3px; border-radius: 2px; }
.status-note .undo:focus-visible { outline: 3px solid var(--cobalt); outline-offset: 2px; }
.status-note.just-changed { color: var(--ink); }

.facts { margin-top: 1.5rem; display: grid; grid-template-columns: 1fr 1fr; gap: 1.1rem 1.25rem; padding-bottom: 1.5rem; border-bottom: 1px solid var(--line); }
.facts dt { font: 500 .75rem/1 var(--display); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin-bottom: .4rem; }
.facts dd { font-size: .9375rem; display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; }
.facts .wide { grid-column: 1 / -1; }
.body { margin-top: 1.5rem; white-space: pre-line; max-width: 62ch; line-height: 1.6; }

/* ---------- toast ---------- */
.toast-zone { position: fixed; left: calc(var(--rail-w) + 1.5rem); bottom: 1.5rem; z-index: 60; display: grid; gap: .5rem; pointer-events: none; }
.toast { display: flex; align-items: center; gap: .65rem; max-width: 28rem; padding: .8rem 1.1rem; background: var(--ink); color: #fff; border-radius: 4px; box-shadow: 0 10px 28px oklch(0.2 0.04 264 / .28), 0 2px 6px oklch(0.2 0.04 264 / .2); animation: toast-in .4s var(--ease); font-size: .9375rem; }
.toast svg { flex: none; width: 1.25rem; height: 1.25rem; color: var(--signal); }
.toast.out { opacity: 0; translate: 0 .5rem; transition: opacity .3s, translate .3s; }
@keyframes toast-in { from { opacity: 0; translate: 0 1rem; } to { opacity: 1; translate: 0 0; } }

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ---------- narrow desktop ---------- */
@media (max-width: 1180px) {
  :root { --panel-w: 26rem; --rail-w: 13.5rem; }
}

/* ---------- mobile ---------- */
@media (max-width: 899px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .rail { position: static; height: auto; flex-direction: column; gap: 0; padding: 0; }
  .brand { padding: 1rem 1.25rem .5rem; }
  .brand-mark { width: 2rem; height: 2rem; }
  .brand-name { font-size: 1.375rem; }
  .tracks { padding: 0 0 .9rem; }
  .rail-title, .rail-note { display: none; }
  .track-list { display: flex; gap: .5rem; overflow-x: auto; padding: .25rem 1.25rem; scrollbar-width: none; }
  .track-btn { width: auto; flex: none; grid-template-columns: 1.1rem auto auto; gap: .5rem; padding: .55rem .8rem; border: 1px solid oklch(0.4 0.05 266); min-height: 2.75rem; }
  .track-btn[aria-pressed="true"] { border-color: var(--signal); }
  .work.has-detail { grid-template-columns: minmax(0, 1fr); }
  .inbox { padding: 1.5rem 1.25rem 3rem; }
  h1 { font-size: 2.75rem; }
  .tools { grid-template-columns: 1fr 1fr; gap: .85rem; }
  .field-search { grid-column: 1 / -1; }
  .detail { position: fixed; inset: 0; z-index: 50; height: 100dvh; border-left: 0; padding: 1rem 1.25rem 3rem; animation-name: sheet-in; }
  @keyframes sheet-in { from { opacity: 0; translate: 0 2rem; } to { opacity: 1; translate: 0 0; } }
  .toast-zone { left: 1rem; right: 1rem; bottom: 1rem; }
  .toast { max-width: none; }
}
@media (max-width: 420px) {
  .facts { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
