/* ============================================================
   Relay — team task inbox
   Local fonts: Space Grotesk (display), Work Sans (text),
   IBM Plex Mono (labels & data). All assets are local.
   ============================================================ */

@font-face {
  font-family: 'Space Grotesk';
  src: url('assets/space-grotesk.ttf') format('truetype-variations'),
       url('assets/space-grotesk.ttf') format('truetype');
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
}

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

/* ---------------------------------- tokens */

:root {
  --paper: #f4f1eb;
  --surface: #fffdfa;
  --surface-2: #faf7f1;
  --line: #e4ddd2;
  --line-strong: #d2c7b8;
  /* boundary for real controls: ≥3:1 against both paper and surface */
  --field-line: #8d7f6b;
  --ink: #16181d;
  --ink-2: #4c525c;
  --ink-3: #6b7280;

  --brand: #7a1e3c;
  --brand-deep: #5d1530;
  --brand-soft: #f8e8ed;

  --rail-bg: #1e1a20;
  --rail-ink: #efe8e5;
  --rail-ink-2: #a79ea6;

  --ring: #9d2b4f;

  --todo-fg: #434b57;
  --todo-bg: #e9ebef;
  --todo-dot: #646f7e;
  --prog-fg: #845000;
  --prog-bg: #fbeed7;
  --prog-dot: #bb7a0c;
  --block-fg: #9e221a;
  --block-bg: #fbe2df;
  --block-dot: #c8382c;
  --done-fg: #146040;
  --done-bg: #ddefe3;
  --done-dot: #1d7a4e;

  --sans: 'Work Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  --display: 'Space Grotesk', 'Work Sans', Helvetica, Arial, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  --r-sm: 7px;
  --r-md: 11px;
  --r-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(30, 26, 32, 0.05), 0 1px 1px rgba(30, 26, 32, 0.04);
  --shadow-md: 0 10px 28px -14px rgba(30, 26, 32, 0.28), 0 2px 6px rgba(30, 26, 32, 0.06);
  --shadow-lg: -18px 0 48px -22px rgba(30, 26, 32, 0.38);

  --rail-w: 272px;
}

/* ---------------------------------- reset */

*,
*::before,
*::after {
  box-sizing: border-box;
}

/* author display rules must never defeat the hidden attribute */
[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
  /* keeps the page from shifting when the dialog locks body scrolling */
  scrollbar-gutter: stable;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1,
h2,
h3 {
  margin: 0;
  font-family: var(--display);
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.2;
}

p {
  margin: 0;
}

ul,
ol,
dl,
dd {
  margin: 0;
  padding: 0;
}

ul,
ol {
  list-style: none;
}

button {
  font: inherit;
  color: inherit;
}

svg {
  display: block;
  width: 100%;
  height: 100%;
}

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

.rail :focus-visible,
.detail-scrim:focus-visible {
  outline-color: #f0b7c8;
}

/* keep native focus for selects/inputs in every browser */
select:focus-visible,
input:focus-visible {
  outline: 3px solid var(--ring);
  outline-offset: 1px;
}

.skip-link {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 90;
  transform: translateY(-160%);
  background: var(--ink);
  color: #fff;
  padding: 10px 16px;
  border-radius: var(--r-sm);
  font-family: var(--mono);
  font-size: 12px;
  text-decoration: none;
  transition: transform 0.15s ease;
}

.skip-link:focus {
  transform: translateY(0);
}

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

.mono {
  font-family: var(--mono);
  font-variant-ligatures: none;
}

.noscript {
  margin: 24px;
  padding: 14px 18px;
  background: var(--block-bg);
  color: var(--block-fg);
  border-radius: var(--r-md);
  font-weight: 500;
}

/* ---------------------------------- shell */

.app {
  min-height: 100vh;
}

/* ---------------------------------- rail */

.rail {
  position: fixed;
  z-index: 60;
  inset: 0 auto 0 0;
  width: min(86vw, 320px);
  display: flex;
  flex-direction: column;
  gap: 26px;
  padding: 22px 18px 20px;
  background: var(--rail-bg);
  background-image: radial-gradient(120% 60% at 0% 0%, rgba(122, 30, 60, 0.42), transparent 62%);
  color: var(--rail-ink);
  overflow-y: auto;
  overscroll-behavior: contain;
  transform: translateX(-102%);
  /* hidden keeps the closed drawer out of the tab order and the a11y tree */
  visibility: hidden;
  transition: transform 0.26s cubic-bezier(0.2, 0.8, 0.2, 1), visibility 0s linear 0.26s;
}

.rail.is-open {
  transform: translateX(0);
  visibility: visible;
  transition: transform 0.26s cubic-bezier(0.2, 0.8, 0.2, 1), visibility 0s;
}

.rail-scrim {
  position: fixed;
  inset: 0;
  z-index: 55;
  background: rgba(22, 18, 24, 0.5);
  border: 0;
}

.rail-scrim[hidden] {
  display: none;
}

.rail-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
}

.brand-mark {
  flex: none;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 6px;
  border-radius: 10px;
  background: var(--brand);
  color: #ffeef3;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14);
}

.brand-text {
  display: grid;
}

.brand-name {
  font-family: var(--display);
  font-weight: 600;
  font-size: 19px;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.brand-sub {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--rail-ink-2);
  margin-top: 2px;
}

.icon-btn {
  flex: none;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 8px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 9px;
  cursor: pointer;
  color: inherit;
}

.rail-close {
  border-color: rgba(255, 255, 255, 0.18);
}

.rail-close:hover {
  background: rgba(255, 255, 255, 0.1);
}

.rail-heading {
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 400;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--rail-ink-2);
  margin: 0 0 9px 10px;
}

.nav-list {
  display: grid;
  gap: 2px;
}

.nav-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: transparent;
  border: 0;
  border-radius: 9px;
  cursor: pointer;
  text-align: left;
  font-size: 14.5px;
  color: var(--rail-ink);
}

.nav-btn:hover {
  background: rgba(255, 255, 255, 0.08);
}

.nav-btn[aria-current='true'] {
  background: var(--brand);
  color: #fff;
  font-weight: 500;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.nav-dot {
  flex: none;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.55;
}

.nav-btn[aria-current='true'] .nav-dot {
  opacity: 1;
}

.nav-label {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-count {
  flex: none;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--rail-ink-2);
  font-variant-numeric: tabular-nums;
}

.nav-btn[aria-current='true'] .nav-count {
  color: rgba(255, 255, 255, 0.82);
}

.rail-foot {
  margin-top: auto;
  display: grid;
  gap: 14px;
  padding-top: 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.rail-note {
  font-size: 13px;
  color: var(--rail-ink-2);
  line-height: 1.45;
}

.rail-reset {
  justify-self: start;
  padding: 7px 12px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--r-sm);
  color: var(--rail-ink);
  font-size: 13px;
  cursor: pointer;
}

.rail-reset:hover {
  background: rgba(255, 255, 255, 0.18);
}

.viewing-as {
  display: flex;
  align-items: center;
  gap: 10px;
}

.viewing-as > span:last-child {
  display: grid;
}

.viewing-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--rail-ink-2);
}

.viewing-name {
  font-size: 14px;
  font-weight: 500;
}

.avatar {
  flex: none;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.02em;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.16);
}

/* ---------------------------------- topbar */

.content {
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(244, 241, 235, 0.93);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}

.topbar-mobile {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
}

.menu-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 12px 7px 9px;
  background: var(--surface);
  border: 1px solid var(--field-line);
  border-radius: 999px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 500;
}

.menu-btn svg {
  width: 17px;
  height: 17px;
}

.menu-btn:hover {
  background: var(--surface-2);
}

.brand--compact .brand-mark {
  width: 28px;
  height: 28px;
  padding: 5px;
  border-radius: 8px;
}

.brand--compact .brand-name {
  font-size: 17px;
}

.topbar-head {
  padding: 16px 16px 14px;
}

.topbar-head h1 {
  font-size: clamp(1.45rem, 1.15rem + 1.1vw, 2.1rem);
}

.view-blurb {
  margin-top: 5px;
  color: var(--ink-2);
  font-size: 14px;
  max-width: 62ch;
}

/* ---------------------------------- toolbar */

.main {
  padding: 18px 16px 56px;
  display: grid;
  gap: 18px;
  align-content: start;
}

.toolbar {
  display: grid;
  gap: 12px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}

.field {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.field-label {
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 400;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.field-hint {
  font-size: 12px;
  color: var(--ink-3);
}

.search-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 12px;
  width: 17px;
  height: 17px;
  color: var(--ink-3);
  pointer-events: none;
}

input[type='search'] {
  width: 100%;
  padding: 11px 40px 11px 37px;
  font: inherit;
  font-size: 15px;
  color: var(--ink);
  background: var(--surface-2);
  border: 1px solid var(--field-line);
  border-radius: var(--r-md);
  -webkit-appearance: none;
  appearance: none;
}

input[type='search']::-webkit-search-cancel-button,
input[type='search']::-webkit-search-decoration {
  -webkit-appearance: none;
  appearance: none;
}

input[type='search']::placeholder {
  color: var(--ink-3);
}

input[type='search']:hover {
  background: #fff;
}

.clear-search {
  position: absolute;
  right: 7px;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  padding: 6px;
  background: transparent;
  border: 0;
  border-radius: 50%;
  color: var(--ink-2);
  cursor: pointer;
}

.clear-search:hover {
  background: var(--line);
}

.select-wrap {
  position: relative;
  display: flex;
}

.select-wrap select {
  width: 100%;
  padding: 11px 38px 11px 13px;
  font: inherit;
  font-size: 15px;
  color: var(--ink);
  background: var(--surface-2);
  border: 1px solid var(--field-line);
  border-radius: var(--r-md);
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}

.select-wrap select:hover {
  background: #fff;
}

.select-chevron {
  position: absolute;
  top: 50%;
  right: 11px;
  width: 17px;
  height: 17px;
  transform: translateY(-50%);
  color: var(--ink-2);
  pointer-events: none;
}

/* ---------------------------------- assignee strip */

.people {
  display: grid;
  gap: 8px;
}

.people-list {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: thin;
}

.person {
  flex: none;
}

.person-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 13px 5px 5px;
  background: var(--surface);
  border: 1px solid var(--field-line);
  border-radius: 999px;
  cursor: pointer;
  font-size: 13.5px;
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
}

.person-btn:hover {
  border-color: var(--line-strong);
  background: var(--surface-2);
}

.person-btn[aria-pressed='true'] {
  background: var(--brand);
  border-color: var(--brand-deep);
  color: #fff;
  font-weight: 500;
}

.person-btn[aria-pressed='true'] .person-count {
  color: rgba(255, 255, 255, 0.8);
}

.person-btn .avatar {
  width: 26px;
  height: 26px;
  font-size: 10px;
}

.person-count {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

/* ---------------------------------- list bar */

.list-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  padding-top: 2px;
}

.result-count {
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-2);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.chip-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px 4px 11px;
  background: var(--brand-soft);
  border: 1px solid #a86b80;
  border-radius: 999px;
  color: var(--brand-deep);
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 500;
}

.chip-btn:hover {
  background: #f3dae2;
}

.chip-btn svg {
  width: 13px;
  height: 13px;
  opacity: 0.75;
}

.chip-btn--reset {
  background: transparent;
  border-color: var(--field-line);
  color: var(--ink-2);
  padding-right: 11px;
}

.chip-btn--reset:hover {
  background: var(--surface);
}

/* ---------------------------------- task list */

.tasks {
  display: grid;
  gap: 10px;
}

.task {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.task::before {
  content: '';
  position: absolute;
  inset: 10px auto 10px 0;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--status-dot);
}

.task:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-md);
}

.task.is-open {
  border-color: var(--brand);
  box-shadow: 0 0 0 1px var(--brand), var(--shadow-md);
}

.task.is-flash {
  animation: flash 1.1s ease;
}

@keyframes flash {
  0% {
    background: var(--brand-soft);
  }
  100% {
    background: var(--surface);
  }
}

.task-inner {
  display: grid;
  gap: 10px;
  padding: 14px 16px 14px 18px;
  cursor: pointer;
}

.task-row-1 {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.open-item {
  flex: 1 1 auto;
  min-width: 0;
  padding: 0;
  margin: 0;
  background: none;
  border: 0;
  text-align: left;
  font-family: var(--display);
  font-size: 16.5px;
  font-weight: 600;
  letter-spacing: -0.012em;
  line-height: 1.3;
  color: var(--ink);
  cursor: pointer;
}

.open-item:hover {
  color: var(--brand);
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 2.5px;
}

.task-summary {
  color: var(--ink-2);
  font-size: 13.5px;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.task-row-1 > .pill {
  margin-top: 2px;
}

.task-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
}

.meta-bit {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--ink-2);
}

.meta-bit svg {
  width: 14px;
  height: 14px;
  color: var(--ink-3);
}

.meta-bit .avatar {
  width: 22px;
  height: 22px;
  font-size: 9px;
}

.meta-bit--date {
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.01em;
}

.tag {
  padding: 2px 8px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  font-size: 11.5px;
  color: var(--ink-2);
  background: var(--surface-2);
}

/* status pill */

.pill {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.01em;
  white-space: nowrap;
  background: var(--status-bg);
  color: var(--status-fg);
  border: 1px solid var(--status-ring);
}

.pill-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--status-dot);
}

[data-status='todo'] {
  --status-fg: var(--todo-fg);
  --status-bg: var(--todo-bg);
  --status-dot: var(--todo-dot);
  --status-ring: #ccd1d9;
}

[data-status='in-progress'] {
  --status-fg: var(--prog-fg);
  --status-bg: var(--prog-bg);
  --status-dot: var(--prog-dot);
  --status-ring: #ecd3a5;
}

[data-status='blocked'] {
  --status-fg: var(--block-fg);
  --status-bg: var(--block-bg);
  --status-dot: var(--block-dot);
  --status-ring: #f0c3bd;
}

[data-status='done'] {
  --status-fg: var(--done-fg);
  --status-bg: var(--done-bg);
  --status-dot: var(--done-dot);
  --status-ring: #bcdcc7;
}

.task[data-status='done'] .open-item {
  color: var(--ink-2);
}

/* priority */

.prio {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--ink-2);
}

.prio-bars {
  display: inline-flex;
  align-items: flex-end;
  gap: 2px;
  height: 12px;
}

.prio-bars i {
  width: 3px;
  background: var(--line-strong);
  border-radius: 1px;
}

.prio-bars i:nth-child(1) {
  height: 5px;
}

.prio-bars i:nth-child(2) {
  height: 8.5px;
}

.prio-bars i:nth-child(3) {
  height: 12px;
}

.prio-bars i.on {
  background: var(--ink-2);
}

.prio[data-priority='high'] .prio-bars i.on {
  background: var(--brand);
}

/* ---------------------------------- empty state */

.empty {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 44px 24px 48px;
  text-align: center;
  background: var(--surface);
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-lg);
}

.empty[hidden] {
  display: none;
}

.empty-mark {
  width: 42px;
  height: 42px;
  padding: 9px;
  border-radius: 12px;
  background: var(--brand-soft);
  color: var(--brand);
}

.empty h2 {
  font-size: 19px;
}

.empty p {
  max-width: 46ch;
  color: var(--ink-2);
  font-size: 14px;
}

.empty-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 6px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 16px;
  background: var(--surface);
  border: 1px solid var(--field-line);
  border-radius: var(--r-md);
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-sm);
}

.btn svg {
  width: 16px;
  height: 16px;
}

.btn:hover {
  background: var(--surface-2);
  border-color: var(--ink-3);
}

.btn--primary {
  background: var(--brand);
  border-color: var(--brand-deep);
  color: #fff;
}

.btn--primary:hover {
  background: var(--brand-deep);
  border-color: var(--brand-deep);
}

.btn--quiet {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  color: var(--ink-2);
  padding: 9px 12px;
}

.btn--quiet:hover {
  background: var(--surface-2);
  border-color: var(--line);
  color: var(--ink);
}

.btn[disabled] {
  opacity: 0.42;
  cursor: not-allowed;
  box-shadow: none;
}

.btn[disabled]:hover {
  background: transparent;
  border-color: transparent;
  color: var(--ink-2);
}

.fixture-note {
  margin-top: 6px;
  font-size: 12px;
  color: var(--ink-3);
  max-width: 68ch;
}

/* ---------------------------------- detail dialog */

.detail-layer {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: flex;
  justify-content: flex-end;
}

.detail-layer[hidden] {
  display: none;
}

.detail-scrim {
  position: absolute;
  inset: 0;
  background: rgba(22, 18, 24, 0.44);
  animation: fade 0.2s ease;
}

@keyframes fade {
  from {
    opacity: 0;
  }
}

.detail {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 100%;
  height: 100%;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  animation: slide-up 0.26s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes slide-up {
  from {
    transform: translateY(14px);
    opacity: 0.4;
  }
}

.detail-head {
  flex: none;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 16px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.detail-head-text {
  flex: 1 1 auto;
  min-width: 0;
}

.detail-head h2 {
  margin-top: 5px;
  font-size: clamp(1.2rem, 1.05rem + 0.7vw, 1.6rem);
  overflow-wrap: break-word;
}

.eyebrow {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.detail-head .icon-btn {
  border-color: var(--field-line);
  background: var(--surface-2);
  color: var(--ink-2);
}

.detail-head .icon-btn:hover {
  background: var(--line);
  color: var(--ink);
}

.detail-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 18px 16px 26px;
  display: grid;
  gap: 22px;
  align-content: start;
}

.status-box {
  display: grid;
  gap: 12px;
  padding: 14px 16px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-left: 3px solid var(--status-dot, var(--line-strong));
  border-radius: var(--r-md);
}

.status-box .select-wrap select {
  background: var(--surface);
  font-weight: 500;
}

.status-feedback {
  display: none;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
  font-size: 13.5px;
  line-height: 1.45;
  color: var(--done-fg);
  background: var(--done-bg);
  border: 1px solid #bcdcc7;
  border-radius: var(--r-sm);
  padding: 10px 12px;
}

.status-feedback.is-shown {
  display: flex;
}

.status-feedback-text {
  flex: 1 1 14ch;
  min-width: 0;
}

.status-feedback-text::before {
  content: '✓ ';
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
}

.status-feedback-actions {
  display: flex;
  flex: none;
  gap: 6px;
}

.feedback-btn {
  padding: 5px 11px;
  background: var(--surface);
  border: 1px solid #4f8a67;
  border-radius: var(--r-sm);
  color: var(--done-fg);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
}

.feedback-btn:hover {
  background: #eff8f2;
  border-color: var(--done-dot);
}

.meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(135px, 1fr));
  gap: 14px 18px;
  padding: 16px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.meta-grid dt {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 5px;
}

.meta-grid dd {
  font-size: 14px;
  color: var(--ink);
}

.meta-person {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.meta-person .avatar {
  width: 24px;
  height: 24px;
  font-size: 9.5px;
}

.meta-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.section-heading {
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 400;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 10px;
}

.brief {
  display: grid;
  gap: 14px;
  font-size: 15px;
  line-height: 1.65;
  color: var(--ink);
}

.brief p {
  overflow-wrap: break-word;
  white-space: pre-line;
}

.brief .outcome {
  padding: 13px 15px;
  background: var(--brand-soft);
  border-left: 3px solid var(--brand);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  color: var(--brand-deep);
  font-size: 14.5px;
}

.activity {
  display: grid;
  gap: 2px;
}

.activity li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px dashed var(--line);
  font-size: 13.5px;
  color: var(--ink-2);
}

.activity li:last-child {
  border-bottom: 0;
}

.activity .when {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-3);
  margin-left: auto;
}

.activity .is-empty {
  color: var(--ink-3);
  border-bottom: 0;
  font-style: italic;
}

.detail-foot {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
}

.detail-nav {
  display: flex;
  gap: 4px;
}

/* ---------------------------------- toasts */

.toasts {
  position: fixed;
  z-index: 80;
  bottom: 14px;
  left: 14px;
  right: 14px;
  display: grid;
  gap: 8px;
  justify-items: stretch;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 13px;
  background: var(--rail-bg);
  color: var(--rail-ink);
  border-radius: var(--r-md);
  box-shadow: 0 14px 34px -12px rgba(22, 18, 24, 0.55);
  font-size: 13.5px;
  line-height: 1.4;
  animation: toast-in 0.22s ease;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

.toast-text {
  flex: 1 1 auto;
}

.toast-text b {
  font-weight: 600;
}

/* Narrow screens keep the row to the facts a reader scans first;
   the rest stays one tap away in the detail view. */
@media (max-width: 639px) {
  .task-meta .meta-bit--comments,
  .task-meta .tag {
    display: none;
  }

  /* primary action first, then task-to-task navigation */
  .detail-foot {
    flex-direction: column-reverse;
    align-items: stretch;
    gap: 8px;
  }

  .detail-nav {
    justify-content: space-between;
  }
}

/* ============================================================
   ≥ 640px — roomier cards, side-by-side fields
   ============================================================ */

@media (min-width: 640px) {
  .main {
    padding: 22px 26px 64px;
  }

  .topbar-mobile {
    padding: 12px 26px;
  }

  .topbar-head {
    padding: 20px 26px 18px;
  }

  .toolbar {
    grid-template-columns: minmax(0, 1fr) 170px 170px;
    gap: 14px 16px;
    align-items: start;
    padding: 16px;
  }

  .task-inner {
    gap: 9px;
    padding: 16px 20px;
  }

  .task-summary {
    -webkit-line-clamp: 1;
    line-clamp: 1;
  }

  .toasts {
    left: 20px;
    right: auto;
    bottom: 20px;
    max-width: 440px;
  }
}

/* ============================================================
   ≥ 1024px — static rail, docked detail panel
   ============================================================ */

@media (min-width: 1024px) {
  .app {
    display: grid;
    grid-template-columns: var(--rail-w) minmax(0, 1fr);
  }

  .rail {
    position: sticky;
    inset: 0 auto auto 0;
    align-self: start;
    height: 100vh;
    width: auto;
    transform: none;
    visibility: visible;
    transition: none;
    padding: 26px 18px 22px;
    border-right: 1px solid #120f14;
  }

  .rail-close,
  .rail-scrim,
  .topbar-mobile {
    display: none !important;
  }

  .topbar {
    padding: 0;
  }

  .topbar-head {
    max-width: 1120px;
    margin: 0 auto;
    padding: 28px 40px 22px;
  }

  .main {
    max-width: 1120px;
    margin: 0 auto;
    padding: 24px 40px 72px;
    gap: 20px;
  }

  .task-inner {
    padding: 17px 22px;
  }

  .detail {
    width: min(560px, 46vw);
    border-left: 1px solid var(--line);
    animation: slide-in 0.26s cubic-bezier(0.2, 0.8, 0.2, 1);
  }

  @keyframes slide-in {
    from {
      transform: translateX(26px);
      opacity: 0.5;
    }
  }

  .detail-head,
  .detail-foot {
    padding-left: 28px;
    padding-right: 28px;
  }

  .detail-scroll {
    padding: 22px 28px 34px;
  }

  .detail-head {
    padding-top: 22px;
    padding-bottom: 18px;
  }
}

/* ============================================================
   Reduced motion
   ============================================================ */

@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;
  }
}

@media (forced-colors: active) {
  .task,
  .toolbar,
  .detail,
  .empty {
    border: 1px solid CanvasText;
  }

  .nav-btn[aria-current='true'],
  .person-btn[aria-pressed='true'] {
    outline: 2px solid CanvasText;
  }
}
