/* ==========================================================================
   Relay — team task inbox
   Direction: an operations dispatch register. Deep pine rail, cool bone
   paper, chartreuse signal accent, hairline rows, mono reference numbers.
   ========================================================================== */

@font-face {
  font-family: "Work Sans";
  src: url("assets/work-sans.ttf") format("truetype");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("assets/ibm-plex-mono.ttf") format("truetype");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

:root {
  /* Palette */
  --pine-900: #0b211a;
  --pine-800: #0f2a20;
  --pine-700: #16382b;
  --pine-600: #1e4a38;
  --bone: #f0efe6;
  --bone-2: #e7e5d9;
  --surface: #fbfaf4;
  --surface-2: #f5f3ea;
  --ink: #15231b;
  --ink-soft: #3a483e;
  --muted: #5c675d;
  --line: #d9d6c8;
  --line-strong: #c4c0ad;
  --lime: #cbf25a;
  --lime-deep: #a9d337;
  --lime-ink: #1b2a10;

  --st-todo-fg: #3d4e5a;
  --st-todo-bg: #e2e9ef;
  --st-prog-fg: #8a4c00;
  --st-prog-bg: #fbe9c6;
  --st-block-fg: #9c2117;
  --st-block-bg: #fadfdb;
  --st-done-fg: #1f5f3a;
  --st-done-bg: #dbeee1;

  --pri-high: #b3261e;
  --pri-med: #8a5a00;
  --pri-low: #6b756c;

  /* Type */
  --ui: "Work Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --fs-xs: 0.6875rem;
  --fs-sm: 0.8125rem;
  --fs-base: 0.9375rem;
  --fs-md: 1rem;
  --fs-lg: 1.125rem;
  --fs-xl: 1.375rem;
  --fs-2xl: 1.75rem;

  /* Space */
  --s1: 4px;
  --s2: 8px;
  --s3: 12px;
  --s4: 16px;
  --s5: 24px;
  --s6: 32px;
  --s7: 48px;

  --rail-w: 252px;
  --detail-w: 440px;
  --radius: 10px;
  --radius-sm: 7px;
  --shadow: 0 1px 1px rgba(11, 33, 26, 0.04), 0 6px 18px -8px rgba(11, 33, 26, 0.18);
  --shadow-lift: 0 2px 2px rgba(11, 33, 26, 0.05), 0 18px 40px -18px rgba(11, 33, 26, 0.32);
  --focus: #2f6f4d;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; overflow-x: clip; }

body {
  margin: 0;
  font-family: var(--ui);
  font-size: var(--fs-base);
  line-height: 1.5;
  color: var(--ink);
  background: var(--bone);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: var(--lime); color: var(--lime-ink); }

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: 3px;
}
.rail :focus-visible,
.detail :focus-visible,
.btn-primary:focus-visible { outline-color: var(--lime); }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

.skip-link {
  position: fixed;
  top: 8px; left: 8px;
  z-index: 100;
  transform: translateY(-160%);
  background: var(--pine-800);
  color: var(--lime);
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  text-decoration: none;
  transition: transform 0.18s ease;
}
.skip-link:focus { transform: translateY(0); }

/* ==========================================================================
   Shell
   ========================================================================== */
.app {
  display: grid;
  grid-template-columns: var(--rail-w) minmax(0, 1fr);
  min-height: 100dvh;
  transition: padding-right 0.28s cubic-bezier(0.22, 0.9, 0.24, 1);
}

/* ==========================================================================
   Rail
   ========================================================================== */
.rail {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  gap: var(--s5);
  padding: calc(var(--s5) + env(safe-area-inset-top)) var(--s4) var(--s5);
  background: var(--pine-800);
  color: #e7efe6;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--pine-600) transparent;
}
.rail::-webkit-scrollbar { width: 9px; }
.rail::-webkit-scrollbar-thumb {
  background: var(--pine-600);
  border-radius: 99px;
  border: 3px solid var(--pine-800);
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--s3);
  color: inherit;
  text-decoration: none;
  padding: var(--s2) var(--s2) var(--s2) 0;
}
.brand-mark { color: var(--lime); display: grid; flex: none; }
.brand-mark svg { display: block; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name {
  font-size: var(--fs-lg);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #fff;
}
.brand-tag {
  font-family: var(--mono);
  font-size: var(--fs-xs);
  letter-spacing: 0.06em;
  color: #9fb6a8;
  margin-top: 3px;
}

.rail-label {
  margin: 0 0 var(--s2);
  font-family: var(--mono);
  font-size: var(--fs-xs);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #8fa898;
}

.projects { min-height: 0; }
.project-list { display: flex; flex-direction: column; gap: 2px; }

.proj {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s2);
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #cfdccf;
  font: inherit;
  font-size: var(--fs-sm);
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease;
}
.proj:hover { background: rgba(203, 242, 90, 0.09); color: #fff; }
.proj .proj-count {
  font-family: var(--mono);
  font-size: var(--fs-xs);
  color: #8fa898;
}
.proj[aria-pressed="true"] {
  background: var(--lime);
  color: var(--lime-ink);
  font-weight: 600;
}
.proj[aria-pressed="true"] .proj-count { color: var(--lime-ink); opacity: 0.72; }

.rail-foot { margin-top: auto; }
.key { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 7px; }
.key li {
  display: flex;
  align-items: center;
  gap: var(--s2);
  font-size: var(--fs-sm);
  color: #b9cab9;
}
.key .key-count { margin-left: auto; font-family: var(--mono); font-size: var(--fs-xs); color: #8fa898; }

/* ==========================================================================
   Workspace / toolbar
   ========================================================================== */
.workspace {
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding: var(--s6) clamp(20px, 3.2vw, 48px) 96px;
}

.toolbar {
  display: flex;
  flex-direction: column;
  gap: var(--s2);
  padding-bottom: var(--s4);
  margin-bottom: var(--s4);
  border-bottom: 1px solid var(--line);
}
.toolbar-inner {
  display: flex;
  align-items: flex-end;
  gap: var(--s4);
  flex-wrap: wrap;
}

.field { display: flex; flex-direction: column; gap: 6px; }

.search-field {
  position: relative;
  flex: 1 1 260px;
  min-width: 0;
}
.search-field .field-icon {
  position: absolute;
  left: 12px;
  bottom: 11px;
  color: var(--muted);
  pointer-events: none;
}
.search-field input {
  width: 100%;
  height: 44px;
  padding: 0 16px 0 40px;
  font: inherit;
  font-size: var(--fs-base);
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  caret-color: var(--pine-700);
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}
.search-field input::placeholder { color: var(--muted); }
.search-field input:hover { border-color: var(--muted); }
.search-field input:focus {
  outline: none;
  border-color: var(--pine-700);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(30, 74, 56, 0.16);
}
.search-field input::-webkit-search-cancel-button { -webkit-appearance: none; }

.select-field { flex: 0 0 auto; }
.select-field > label,
.status-editor-head > label {
  font-family: var(--mono);
  font-size: var(--fs-xs);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.select-wrap { position: relative; display: inline-flex; }
.select-wrap select {
  appearance: none;
  -webkit-appearance: none;
  height: 44px;
  padding: 0 38px 0 14px;
  font: inherit;
  font-size: var(--fs-base);
  font-weight: 500;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}
.select-wrap select:hover { border-color: var(--muted); }
.select-wrap select:focus {
  outline: none;
  border-color: var(--pine-700);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(30, 74, 56, 0.16);
}
.select-caret {
  position: absolute;
  right: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--pine-700);
  pointer-events: none;
}
.select-wrap--field,
.select-wrap--field select { width: 100%; }

.result-count {
  margin: 0 0 11px;
  font-family: var(--mono);
  font-size: var(--fs-sm);
  color: var(--muted);
  white-space: nowrap;
}

.active-filter {
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  align-self: flex-start;
  font-size: var(--fs-sm);
  color: var(--ink-soft);
}
.active-filter::before {
  content: "";
  width: 7px; height: 7px;
  border-radius: 2px;
  background: var(--lime-deep);
}

/* ==========================================================================
   List
   ========================================================================== */
.list-region { container-type: inline-size; }

.list-head,
.row {
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr) 132px 84px 138px 84px;
  gap: var(--s3);
  align-items: center;
}

.list-head {
  padding: 0 14px 10px;
  font-family: var(--mono);
  font-size: var(--fs-xs);
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--line-strong);
}

.task-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.task-list > li { border-bottom: 1px solid var(--line); }

.row {
  width: 100%;
  margin: 0;
  padding: 15px 14px;
  border: 0;
  background: transparent;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease, box-shadow 0.15s ease;
}
@media (hover: hover) {
  .row:hover { background: var(--surface); }
  .row:hover .c-title-text { color: var(--pine-700); }
  .row:hover .row-cue { opacity: 1; transform: translateX(0); }
}
.row:active { background: var(--surface-2); }

.c-ref {
  font-family: var(--mono);
  font-size: var(--fs-xs);
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.c-ref .ref-prefix { color: var(--line-strong); }

.c-title {
  display: flex;
  align-items: baseline;
  gap: var(--s2);
  min-width: 0;
}
.c-title-text {
  font-size: var(--fs-md);
  font-weight: 550;
  letter-spacing: -0.01em;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color 0.15s ease;
}
.row-cue {
  margin-left: auto;
  color: var(--pine-700);
  opacity: 0;
  transform: translateX(-4px);
  transition: opacity 0.15s ease, transform 0.15s ease;
  flex: none;
  display: grid;
}

.c-status { min-width: 0; }
.c-pri {
  font-family: var(--mono);
  font-size: var(--fs-xs);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.pri-high { color: var(--pri-high); font-weight: 600; }
.pri-medium { color: var(--pri-med); }
.pri-low { color: var(--pri-low); }

.c-owner {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: var(--fs-sm);
  color: var(--ink-soft);
  min-width: 0;
}
.c-owner .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar {
  flex: none;
  width: 22px; height: 22px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: var(--pine-800);
  color: #dcefdc;
  font-family: var(--mono);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.c-due {
  font-family: var(--mono);
  font-size: var(--fs-xs);
  color: var(--muted);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* Stamps */
.stamp {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 4px 8px;
  border-radius: 5px;
  font-family: var(--mono);
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}
.stamp::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 1.5px;
  background: currentColor;
  flex: none;
}
.stamp--todo { color: var(--st-todo-fg); background: var(--st-todo-bg); }
.stamp--in-progress { color: var(--st-prog-fg); background: var(--st-prog-bg); }
.stamp--blocked { color: var(--st-block-fg); background: var(--st-block-bg); }
.stamp--done { color: var(--st-done-fg); background: var(--st-done-bg); }

.stamp.just-stamped { animation: stampIn 0.36s cubic-bezier(0.22, 0.9, 0.24, 1); }
@keyframes stampIn {
  0% { transform: translateY(-5px) scale(1.08); opacity: 0.35; }
  55% { transform: translateY(1px) scale(0.99); opacity: 1; }
  100% { transform: none; opacity: 1; }
}

/* Row entrance + status pulse */
.row { animation: rowIn 0.34s cubic-bezier(0.22, 0.9, 0.24, 1) both; }
.row.no-anim { animation: none; }
@keyframes rowIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}
.task-list > li.is-leaving {
  animation: rowOut 0.24s ease forwards;
  overflow: hidden;
}
@keyframes rowOut {
  to { opacity: 0; transform: translateX(14px); }
}
.row.just-changed { animation: pulse 0.7s ease; }
.row.no-anim.just-changed { animation: pulse 0.7s ease; }
@keyframes pulse {
  0% { background: rgba(203, 242, 90, 0.5); }
  100% { background: transparent; }
}

/* ==========================================================================
   Empty state
   ========================================================================== */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--s3);
  padding: var(--s7) var(--s5);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface-2);
}
.empty-state[hidden] { display: none !important; }
.empty-art { color: var(--pine-600); opacity: 0.85; }
.empty-title {
  margin: var(--s2) 0 0;
  font-size: var(--fs-xl);
  font-weight: 650;
  letter-spacing: -0.02em;
}
.empty-copy {
  margin: 0;
  max-width: 42ch;
  color: var(--muted);
  font-size: var(--fs-base);
}

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s2);
  min-height: 44px;
  padding: 0 18px;
  font: inherit;
  font-size: var(--fs-sm);
  font-weight: 600;
  letter-spacing: 0.01em;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease, transform 0.1s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--pine-800);
  color: #fff;
  border-color: var(--pine-800);
}
.btn-primary:hover { background: var(--pine-700); border-color: var(--pine-700); }
.btn-lime {
  background: var(--lime);
  color: var(--lime-ink);
  border-color: var(--lime);
}
.btn-lime:hover { background: var(--lime-deep); border-color: var(--lime-deep); }
.btn-ghost {
  background: transparent;
  color: var(--pine-700);
  border-color: var(--line-strong);
}
.btn-ghost:hover { background: var(--surface-2); border-color: var(--muted); }

.icon-btn {
  display: grid;
  place-items: center;
  width: 44px; height: 44px;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}
.icon-btn:hover { background: var(--pine-800); border-color: var(--pine-800); color: var(--lime); }

/* ==========================================================================
   Detail panel
   ========================================================================== */
.scrim {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(11, 33, 26, 0.42);
  opacity: 0;
  transition: opacity 0.24s ease;
}
.scrim.is-on { opacity: 1; }

.detail {
  position: fixed;
  top: 0; right: 0;
  z-index: 50;
  width: min(var(--detail-w), 100%);
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-left: 1px solid var(--line-strong);
  box-shadow: var(--shadow-lift);
  transform: translateX(102%);
  transition: transform 0.3s cubic-bezier(0.22, 0.9, 0.24, 1);
  visibility: hidden;
}
.detail.is-open { transform: translateX(0); visibility: visible; }

.detail-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s3);
  padding: calc(var(--s4) + env(safe-area-inset-top)) var(--s5) var(--s4);
  border-bottom: 1px solid var(--line);
  background: var(--pine-800);
  color: #e7efe6;
}
.detail-ref {
  margin: 0;
  font-family: var(--mono);
  font-size: var(--fs-xs);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #a8c0ae;
}
.detail-top .icon-btn {
  background: transparent;
  border-color: rgba(255, 255, 255, 0.28);
  color: #eaf1e8;
  flex: none;
}
.detail-top .icon-btn:hover { background: var(--lime); border-color: var(--lime); color: var(--lime-ink); }

.detail-scroll {
  flex: 1;
  overflow-y: auto;
  padding: var(--s5) var(--s5) calc(var(--s6) + env(safe-area-inset-bottom));
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}
.detail-scroll::-webkit-scrollbar { width: 10px; }
.detail-scroll::-webkit-scrollbar-thumb {
  background: var(--line-strong);
  border-radius: 99px;
  border: 3px solid var(--surface);
}

.detail-stamps { display: flex; flex-wrap: wrap; gap: var(--s2); margin-bottom: var(--s3); }

.detail-title {
  margin: 0 0 var(--s4);
  font-size: var(--fs-2xl);
  line-height: 1.18;
  font-weight: 650;
  letter-spacing: -0.028em;
  color: var(--ink);
  text-wrap: balance;
}

.meta {
  margin: 0 0 var(--s5);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.meta > div {
  background: var(--surface-2);
  padding: 11px 13px;
  min-width: 0;
}
.meta dt {
  font-family: var(--mono);
  font-size: var(--fs-xs);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 3px;
}
.meta dd {
  margin: 0;
  font-size: var(--fs-base);
  font-weight: 500;
  color: var(--ink);
  overflow-wrap: anywhere;
}
.meta .meta-wide { grid-column: 1 / -1; }
.meta .tag-row { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  font-size: var(--fs-xs);
  font-weight: 500;
  padding: 3px 8px;
  border-radius: 99px;
  background: var(--bone);
  border: 1px solid var(--line-strong);
  color: var(--ink-soft);
}

.section-label {
  margin: 0 0 var(--s3);
  font-family: var(--mono);
  font-size: var(--fs-xs);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: var(--s2);
}
.section-label::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.body-copy { margin-bottom: var(--s6); }
.body-copy p {
  margin: 0 0 var(--s4);
  max-width: 68ch;
  font-size: var(--fs-md);
  line-height: 1.62;
  color: var(--ink-soft);
  text-wrap: pretty;
}
.body-copy p:last-child { margin-bottom: 0; }

.status-editor {
  padding: var(--s4);
  border-radius: var(--radius);
  background: var(--surface-2);
}
.status-editor-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s3);
  margin-bottom: var(--s3);
  flex-wrap: wrap;
}
.status-hint { margin: 0; font-size: var(--fs-xs); color: var(--muted); }
.status-editor .select-wrap--field { margin-bottom: var(--s2); }
.status-feedback {
  margin: 0;
  min-height: 1.2em;
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--st-done-fg);
}
.status-feedback.is-error { color: var(--st-block-fg); }

/* ==========================================================================
   Toast
   ========================================================================== */
.toast-stack {
  position: fixed;
  left: 50%;
  bottom: calc(var(--s5) + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 70;
  display: flex;
  flex-direction: column;
  gap: var(--s2);
  align-items: center;
  width: min(440px, calc(100vw - 32px));
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: var(--s3);
  width: 100%;
  padding: 12px 12px 12px 16px;
  border-radius: var(--radius);
  background: var(--pine-900);
  color: #eef4ec;
  box-shadow: var(--shadow-lift);
  font-size: var(--fs-sm);
  animation: toastIn 0.28s cubic-bezier(0.22, 0.9, 0.24, 1) both;
}
.toast.is-out { animation: toastOut 0.22s ease forwards; }
@keyframes toastIn {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to { opacity: 1; transform: none; }
}
@keyframes toastOut {
  to { opacity: 0; transform: translateY(8px); }
}
.toast-msg { flex: 1; }
.toast-msg strong { color: var(--lime); font-weight: 600; }
.toast .btn-undo {
  flex: none;
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: transparent;
  color: #fff;
  font: inherit;
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 7px 12px;
  min-height: 36px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.toast .btn-undo:hover { background: var(--lime); border-color: var(--lime); color: var(--lime-ink); }

/* ==========================================================================
   Responsive — tablet & mobile
   ========================================================================== */
@media (min-width: 921px) {
  .app.has-detail { padding-right: var(--detail-w); }
}

@container (max-width: 860px) {
  .list-head,
  .row { grid-template-columns: 70px minmax(0, 1fr) 128px 118px 80px; }
  .c-pri, .list-head .c-pri { display: none; }
}
@container (max-width: 720px) {
  .list-head { display: none; }
  .list-head,
  .row { grid-template-columns: minmax(0, 1fr) auto; }
  .c-owner { display: none; }
  .c-ref { grid-column: 1; order: -2; }
  .c-status { grid-column: 2; order: -1; justify-self: end; }
  .c-title { grid-column: 1 / -1; }
  .c-title-text { white-space: normal; }
  .c-due { grid-column: 1 / -1; text-align: left; }
  .row { row-gap: 7px; padding: 14px; }
  .c-due::before {
    content: "Due ";
    color: var(--line-strong);
  }
}

@media (max-width: 920px) {
  .app {
    grid-template-columns: minmax(0, 1fr);
    min-height: 100dvh;
  }
  .rail {
    position: sticky;
    top: 0;
    z-index: 30;
    height: auto;
    flex-direction: row;
    align-items: center;
    gap: var(--s3);
    padding: calc(var(--s3) + env(safe-area-inset-top)) var(--s4) var(--s3);
    overflow: visible;
    border-bottom: 1px solid var(--pine-700);
  }
  .brand { flex: none; padding: 0; }
  .brand-tag { display: none; }
  .projects {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: var(--s2);
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .projects::-webkit-scrollbar { display: none; }
  .rail .rail-label { display: none; }
  .project-list {
    flex-direction: row;
    gap: 6px;
  }
  .proj {
    width: auto;
    white-space: nowrap;
    padding: 8px 12px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 99px;
  }
  .proj .proj-count { display: none; }
  .proj[aria-pressed="true"] { border-color: var(--lime); }
  .rail-foot { display: none; }

  .workspace { padding: var(--s5) var(--s4) 88px; }
  .detail {
    width: 100%;
    border-left: 0;
    box-shadow: none;
  }
  .detail-top { padding-top: calc(var(--s4) + env(safe-area-inset-top)); }
}

@media (max-width: 520px) {
  .toolbar-inner { gap: var(--s3); }
  .search-field { flex-basis: 100%; }
  .select-field { flex: 1 1 100%; }
  .select-field .select-wrap { width: 100%; }
  .select-field select { width: 100%; }
  .result-count { margin: 0; }
  .detail-title { font-size: var(--fs-xl); }
  .meta { grid-template-columns: 1fr; }
}

/* ==========================================================================
   Motion / contrast preferences
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .detail { transition: none; }
  .row-cue { opacity: 0; }
}

@media (forced-colors: active) {
  .stamp, .tag, .avatar { border: 1px solid currentColor; }
  .proj[aria-pressed="true"] { border: 2px solid currentColor; }
  .detail { border-left: 2px solid; }
}
