@font-face {
  font-family: "DM Sans";
  src: url("assets/dm-sans.ttf") format("truetype");
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
}

@font-face {
  font-family: "DM Serif Display";
  src: url("assets/dm-serif.ttf") format("truetype");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

:root {
  --paper: #f4f1e9;
  --paper-deep: #eae5d9;
  --sheet: #fbfaf6;
  --ink: #1d211e;
  --muted: #62685f;
  --line: #d4d0c6;
  --line-strong: #aaa79e;
  --signal: #2556d8;
  --signal-dark: #183a97;
  --todo: #596158;
  --progress: #2556d8;
  --blocked: #b33a2f;
  --done: #287256;
  --focus: #1748ce;
  --ease-out: cubic-bezier(.16, 1, .3, 1);
}

* { box-sizing: border-box; }

html { color-scheme: light; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: "DM Sans", sans-serif;
  -webkit-font-smoothing: antialiased;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  content: "";
  pointer-events: none;
  opacity: .24;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 160 160' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.055'/%3E%3C/svg%3E");
}

button, input, select { font: inherit; }
button, select { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--focus) 75%, white);
  outline-offset: 3px;
}

::selection { background: #bed0ff; color: #10265f; }
* { scrollbar-color: var(--line-strong) var(--paper); scrollbar-width: thin; }

.sr-only {
  position: absolute;
  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: 10px;
  left: 10px;
  z-index: 100;
  padding: 10px 14px;
  color: white;
  background: var(--signal-dark);
  transform: translateY(-150%);
  transition: transform .2s var(--ease-out);
}
.skip-link:focus { transform: translateY(0); }

.app-shell {
  display: grid;
  grid-template-columns: 228px minmax(0, 1fr);
  min-height: 100vh;
}

.app-shell.has-detail { grid-template-columns: 228px minmax(460px, 1fr) minmax(390px, 450px); }

.rail {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 28px 18px 20px;
  border-right: 1px solid var(--line);
  background: #e9e4d8;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 8px 26px;
  font-family: "DM Serif Display", serif;
  font-size: 25px;
  letter-spacing: -.02em;
}

.brand-mark { width: 30px; height: 30px; }
.brand-mark path:first-child { fill: var(--ink); stroke: none; }
.brand-mark path:last-child { fill: none; stroke: white; stroke-width: 1.6; }

.primary-nav { display: grid; gap: 4px; }
.nav-link {
  display: grid;
  grid-template-columns: 21px 1fr auto;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 11px;
  color: var(--ink);
  border-radius: 7px;
  text-decoration: none;
  font-size: 14px;
  font-weight: 650;
}
.nav-link svg { width: 19px; fill: none; stroke: currentColor; stroke-width: 1.7; }
.nav-link.is-active { background: var(--ink); color: white; }
.nav-link.is-muted { color: #686c65; }
.nav-count {
  min-width: 24px;
  padding: 2px 6px;
  border-radius: 20px;
  background: rgba(255,255,255,.14);
  text-align: center;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.rail-summary {
  padding: 26px 11px 18px;
  margin-top: 20px;
  border-top: 1px solid #cbc5b7;
}
.rail-summary > p {
  margin: 0 0 14px;
  color: #71746d;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .11em;
  text-transform: uppercase;
}
.pulse-row { display: flex; justify-content: space-between; align-items: center; margin: 10px 0; font-size: 12px; }
.pulse-row span { display: flex; align-items: center; gap: 8px; }
.pulse-row strong { font-size: 12px; font-variant-numeric: tabular-nums; }
.pulse-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--todo); }
.pulse-dot.progress { background: var(--progress); }
.pulse-dot.blocked { background: var(--blocked); }
.pulse-dot.done { background: var(--done); }

.workspace-switcher {
  display: grid;
  grid-template-columns: 34px 1fr 18px;
  align-items: center;
  gap: 9px;
  padding: 13px 8px 0;
  margin-top: auto;
  border-top: 1px solid #cbc5b7;
}
.workspace-switcher > span:nth-child(2) { display: grid; }
.workspace-switcher strong { font-size: 12px; }
.workspace-switcher small { color: var(--muted); font-size: 10px; }
.workspace-switcher svg { fill: none; stroke: currentColor; stroke-width: 1.8; }
.avatar, .presence-avatar, .presence-more, .mini-avatar {
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  font-weight: 800;
  letter-spacing: -.02em;
}
.avatar { width: 34px; height: 34px; color: #fff; background: #855637; font-size: 10px; }

.workspace { min-width: 0; padding: 42px clamp(28px, 4vw, 66px) 60px; }
.masthead {
  display: flex;
  justify-content: space-between;
  gap: 32px;
  max-width: 1100px;
  padding-bottom: 34px;
  border-bottom: 1px solid var(--ink);
}
.dateline {
  margin: 0 0 9px;
  color: var(--signal-dark);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .13em;
  text-transform: uppercase;
}
h1 {
  max-width: 700px;
  margin: 0;
  font-family: "DM Serif Display", serif;
  font-size: clamp(46px, 5vw, 72px);
  font-weight: 400;
  line-height: .98;
  letter-spacing: -.035em;
}
.lede { max-width: 620px; margin: 17px 0 0; color: var(--muted); font-size: 14px; line-height: 1.55; }
.presence { display: flex; align-self: flex-end; padding-bottom: 5px; }
.presence-avatar, .presence-more {
  width: 33px;
  height: 33px;
  margin-left: -7px;
  border: 2px solid var(--paper);
  color: #fff;
  background: var(--ink);
  font-size: 9px;
}
.presence-avatar:first-child { margin-left: 0; }
.presence-avatar.tone-1 { background: #5b3d96; }
.presence-avatar.tone-2 { background: #1f6f62; }
.presence-avatar.tone-3 { background: #a04b3e; }
.presence-more { color: var(--ink); background: #d9d3c6; }

.queue { max-width: 1100px; padding-top: 29px; }
.queue-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; }
.queue h2 { margin: 0; font-size: 16px; letter-spacing: -.01em; }
.queue-heading p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.mobile-menu { display: none; width: 40px; height: 40px; border: 1px solid var(--line); background: var(--sheet); }
.mobile-menu svg { width: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; }

.controls { display: grid; grid-template-columns: minmax(220px, 1fr) 178px; gap: 10px; margin-top: 20px; }
.search-field, .filter-field { position: relative; display: flex; align-items: center; }
.search-field svg { position: absolute; left: 14px; width: 19px; fill: none; stroke: var(--muted); stroke-width: 1.7; }
.search-field input, .filter-field select {
  width: 100%;
  height: 46px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: var(--sheet);
  color: var(--ink);
  font-size: 13px;
}
.search-field input { padding: 0 50px 0 43px; caret-color: var(--signal); }
.search-field input::placeholder { color: #73776f; opacity: 1; }
.search-field kbd {
  position: absolute;
  right: 11px;
  display: grid;
  place-items: center;
  width: 23px;
  height: 23px;
  border: 1px solid var(--line);
  border-radius: 3px;
  color: var(--muted);
  background: var(--paper);
  font-family: inherit;
  font-size: 11px;
  box-shadow: 0 1px 2px rgba(29,33,30,.08);
}
.filter-field select { appearance: none; padding: 0 38px 0 13px; }
.filter-field svg { position: absolute; right: 12px; width: 18px; fill: none; stroke: var(--ink); stroke-width: 1.6; pointer-events: none; }

.list-labels {
  display: grid;
  grid-template-columns: minmax(250px, 1fr) 155px 84px 107px;
  gap: 18px;
  padding: 23px 40px 8px;
  color: #747870;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.task-list { border-top: 1px solid var(--line-strong); }
.task-item { border-bottom: 1px solid var(--line); }
.task-open {
  position: relative;
  display: grid;
  grid-template-columns: 8px minmax(240px, 1fr) 155px 84px 107px 18px;
  align-items: center;
  gap: 18px;
  width: 100%;
  min-height: 78px;
  padding: 13px 14px 13px 8px;
  border: 0;
  color: inherit;
  background: transparent;
  text-align: left;
  transition: background-color .25s var(--ease-out), padding-left .25s var(--ease-out);
}
.task-open:hover { padding-left: 12px; background: rgba(255,255,255,.52); }
.task-item.is-selected .task-open { background: #e6e9dc; }
.status-pin { width: 7px; height: 7px; border-radius: 50%; background: var(--todo); }
.task-item[data-status="in-progress"] .status-pin { background: var(--progress); }
.task-item[data-status="blocked"] .status-pin { background: var(--blocked); }
.task-item[data-status="done"] .status-pin { background: var(--done); }
.task-primary { display: grid; gap: 6px; min-width: 0; }
.task-title { overflow: hidden; font-size: 14px; font-weight: 720; text-overflow: ellipsis; white-space: nowrap; }
.task-subline { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 11px; }
.project-name { color: var(--signal-dark); font-weight: 700; }
.priority-label::before { content: "·"; margin-right: 8px; color: var(--line-strong); }
.priority-label[data-priority="high"] { color: #92332b; font-weight: 700; }
.task-owner { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 11px; }
.owner-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-avatar { flex: 0 0 auto; width: 25px; height: 25px; color: #fff; background: #5c625b; font-size: 8px; }
.task-date { color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.status-badge {
  justify-self: start;
  padding: 5px 8px;
  border-radius: 3px;
  color: #474d47;
  background: #e0e0d9;
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
}
.task-item[data-status="in-progress"] .status-badge { color: #173d9d; background: #dbe4ff; }
.task-item[data-status="blocked"] .status-badge { color: #862d25; background: #f6ddd7; }
.task-item[data-status="done"] .status-badge { color: #205f48; background: #dcebe3; }
.row-arrow { width: 18px; fill: none; stroke: var(--muted); stroke-width: 1.7; transition: transform .2s var(--ease-out); }
.task-open:hover .row-arrow { transform: translateX(2px); }

.empty-state { padding: 66px 24px; border-bottom: 1px solid var(--line); text-align: center; }
.empty-state[hidden] { display: none; }
.empty-state svg { width: 52px; fill: none; stroke: var(--line-strong); stroke-width: 1.2; }
.empty-state h3 { margin: 16px 0 5px; font-family: "DM Serif Display", serif; font-size: 25px; font-weight: 400; }
.empty-state p { margin: 0; color: var(--muted); font-size: 13px; }
.empty-state button {
  padding: 10px 14px;
  margin-top: 19px;
  border: 0;
  border-radius: 3px;
  color: white;
  background: var(--ink);
  font-size: 12px;
  font-weight: 750;
}

.detail-panel {
  position: sticky;
  top: 0;
  z-index: 20;
  display: none;
  height: 100vh;
  overflow-y: auto;
  border-left: 1px solid var(--ink);
  background: var(--sheet);
  box-shadow: -16px 0 38px rgba(43, 39, 31, .06);
}
.detail-panel.is-open { display: block; animation: panel-in .38s var(--ease-out) both; }
@keyframes panel-in { from { transform: translateX(30px); opacity: .65; } to { transform: translateX(0); opacity: 1; } }
.detail-topbar {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 66px;
  padding: 0 26px;
  border-bottom: 1px solid var(--line);
  background: rgba(251,250,246,.96);
}
.close-detail {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 0;
  border: 0;
  color: var(--ink);
  background: transparent;
  font-size: 12px;
  font-weight: 750;
}
.close-detail svg { width: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.task-id { color: var(--muted); font-family: "DM Sans", sans-serif; font-size: 10px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.detail-content { padding: 34px 34px 50px; }
.detail-project { margin: 0 0 12px; color: var(--signal-dark); font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.detail-content h2 {
  margin: 0;
  font-family: "DM Serif Display", serif;
  font-size: clamp(32px, 3vw, 44px);
  font-weight: 400;
  line-height: 1.04;
  letter-spacing: -.028em;
  text-wrap: balance;
}
.detail-meta { display: flex; flex-wrap: wrap; gap: 8px; margin: 20px 0 28px; }
.detail-chip { padding: 6px 9px; border: 1px solid var(--line); border-radius: 3px; color: var(--muted); font-size: 10px; font-weight: 700; }
.detail-chip.priority-high { color: #8a3028; border-color: #d7a7a0; background: #fff5f1; }
.detail-section { padding: 25px 0; border-top: 1px solid var(--line); }
.detail-section h3 { margin: 0 0 13px; font-size: 11px; letter-spacing: .09em; text-transform: uppercase; }
.detail-body p { max-width: 68ch; margin: 0 0 14px; color: #484e48; font-size: 13px; line-height: 1.68; }
.detail-body p:last-child { margin-bottom: 0; color: var(--ink); font-weight: 650; }
.assignee-block { display: flex; align-items: center; gap: 12px; }
.assignee-block .mini-avatar { width: 36px; height: 36px; }
.assignee-block span:last-child { display: grid; gap: 2px; font-size: 12px; font-weight: 750; }
.assignee-block small { color: var(--muted); font-size: 10px; font-weight: 500; }
.status-section { padding: 22px; margin-top: 3px; border: 1px solid var(--line-strong); background: var(--paper); }
.status-section label { display: grid; gap: 8px; color: var(--muted); font-size: 11px; font-weight: 750; }
.status-section select {
  width: 100%;
  height: 45px;
  padding: 0 12px;
  border: 1px solid var(--ink);
  border-radius: 3px;
  color: var(--ink);
  background: var(--sheet);
  font-weight: 700;
}
.status-feedback { min-height: 18px; margin: 10px 0 0; color: var(--done); font-size: 11px; font-weight: 700; }
.tag-list { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { padding: 5px 8px; border-radius: 20px; color: #4e554f; background: #e5e2d9; font-size: 10px; font-weight: 700; }

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 60;
  padding: 12px 16px;
  color: white;
  background: var(--ink);
  border-radius: 4px;
  box-shadow: 0 9px 25px rgba(29,33,30,.22);
  font-size: 12px;
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition: opacity .2s var(--ease-out), transform .2s var(--ease-out);
}
.toast.is-visible { opacity: 1; transform: translateY(0); }

@media (min-width: 1121px) {
  .app-shell.has-detail .list-labels {
    grid-template-columns: minmax(210px, 1fr) 76px 96px;
  }
  .app-shell.has-detail .list-labels span:nth-child(2) { display: none; }
  .app-shell.has-detail .task-open {
    grid-template-columns: 8px minmax(210px, 1fr) 76px 96px 18px;
    gap: 12px;
  }
  .app-shell.has-detail .task-owner { display: none; }
}

@media (max-width: 1120px) {
  .app-shell.has-detail { grid-template-columns: 188px minmax(380px, 1fr) minmax(350px, 410px); }
  .app-shell, .app-shell.has-detail { grid-template-columns: 188px minmax(0, 1fr); }
  .app-shell.has-detail .detail-panel { position: fixed; right: 0; width: min(440px, calc(100vw - 188px)); }
  .rail { padding-inline: 13px; }
  .workspace { padding-inline: 30px; }
  .list-labels { grid-template-columns: minmax(210px, 1fr) 115px 72px 96px; }
  .task-open { grid-template-columns: 8px minmax(200px, 1fr) 115px 72px 96px 18px; gap: 12px; }
}

@media (max-width: 720px) {
  body.detail-open { overflow: hidden; }
  .app-shell, .app-shell.has-detail { display: block; }
  .rail { display: none; }
  .workspace { padding: 24px 18px 40px; }
  .masthead { align-items: end; padding-bottom: 24px; }
  .dateline { margin-bottom: 7px; }
  h1 { font-size: 46px; }
  .lede { max-width: 32ch; margin-top: 13px; font-size: 12px; }
  .presence { display: none; }
  .queue { padding-top: 24px; }
  .mobile-menu { display: inline-grid; place-items: center; }
  .controls { grid-template-columns: 1fr 136px; }
  .list-labels { display: none; }
  .task-list { margin-top: 17px; }
  .task-open {
    grid-template-columns: 8px minmax(0, 1fr) auto 18px;
    grid-template-areas: "pin primary badge arrow" "pin meta badge arrow";
    gap: 5px 10px;
    min-height: 86px;
    padding: 13px 4px;
  }
  .status-pin { grid-area: pin; align-self: start; margin-top: 6px; }
  .task-primary { grid-area: primary; }
  .task-title { font-size: 13px; }
  .task-owner { grid-area: meta; }
  .mini-avatar { width: 20px; height: 20px; font-size: 7px; }
  .task-date { grid-area: meta; align-self: center; margin-left: 29px; }
  .task-date::before { content: "Due "; }
  .task-owner .owner-name { display: none; }
  .status-badge { grid-area: badge; align-self: center; }
  .row-arrow { grid-area: arrow; }
  .app-shell.has-detail .detail-panel, .detail-panel {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100dvh;
    border-left: 0;
    box-shadow: none;
  }
  .detail-topbar { min-height: 58px; padding-inline: 18px; }
  .detail-content { padding: 27px 21px 44px; }
  .detail-content h2 { font-size: 36px; }
  .toast { right: 16px; bottom: 16px; left: 16px; text-align: center; }
}

@media (max-width: 440px) {
  .workspace { padding-inline: 14px; }
  .masthead { padding-inline: 3px; }
  h1 { font-size: 43px; }
  .controls { grid-template-columns: minmax(0, 1fr) 124px; gap: 7px; }
  .search-field input { padding-right: 14px; }
  .search-field kbd { display: none; }
  .filter-field select { padding-left: 10px; font-size: 12px; }
  .task-open { grid-template-columns: 7px minmax(0, 1fr) auto 14px; gap-inline: 8px; }
  .status-badge { padding-inline: 6px; font-size: 9px; }
}

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