/* Relay — a calm team task inbox */

@font-face {
  font-family: "DM Sans";
  src: url("./assets/dm-sans.ttf") format("truetype");
  font-weight: 100 1000;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "DM Serif Display";
  src: url("./assets/dm-serif.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Literata";
  src: url("./assets/literata.ttf") format("truetype");
  font-weight: 200 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;
}

:root {
  color-scheme: light;
  --paper: #f3eee3;
  --paper-deep: #eae2d3;
  --surface: #fffdf8;
  --surface-soft: #faf6ed;
  --ink: #1c2b24;
  --ink-soft: #35463d;
  --muted: #5d675f;
  --muted-light: #6b736b;
  --line: #ded6c7;
  --line-strong: #cfc5b3;
  --forest: #183127;
  --forest-soft: #234336;
  --forest-line: #365849;
  --cream: #f4eedf;
  --cream-soft: #d7d1c3;
  --lime: #d9e8ac;
  --lime-deep: #b3cf6d;
  --focus: #1b7358;
  --focus-dark: #d9e8ac;
  --rust: #a84527;
  --shadow-sm: 0 1px 1px rgba(33, 40, 30, 0.03), 0 8px 20px rgba(33, 40, 30, 0.04);
  --shadow-md: 0 2px 3px rgba(33, 40, 30, 0.04), 0 18px 42px rgba(33, 40, 30, 0.08);
  --serif: "DM Serif Display", "Iowan Old Style", Georgia, serif;
  --sans: "DM Sans", "Avenir Next", "Segoe UI", system-ui, sans-serif;
  --mono: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
  --reading: "Literata", "Iowan Old Style", Georgia, serif;
  --status-todo: #967a4d;
  --status-in-progress: #2e7897;
  --status-blocked: #b34d2e;
  --status-done: #347a56;
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 300px;
  min-height: 100dvh;
  overflow-x: clip;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.42;
  background-image: radial-gradient(rgba(62, 64, 47, 0.17) 0.55px, transparent 0.65px);
  background-size: 7px 7px;
  mix-blend-mode: multiply;
}

body.detail-open {
  overflow-anchor: none;
}

button,
input,
select {
  font: inherit;
}

button {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
}

svg {
  display: block;
}

h1,
h2,
h3,
p,
dl,
dd,
ul {
  margin: 0;
}

ul {
  padding: 0;
  list-style: none;
}

:where(a, button, input, select, [tabindex]):focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

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

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 100;
  transform: translateY(-180%);
  padding: 10px 16px;
  border-radius: 8px;
  background: var(--forest);
  color: var(--cream);
  font-weight: 600;
  text-decoration: none;
  transition: transform 150ms ease;
}
.skip-link:focus-visible {
  transform: translateY(0);
  outline-color: var(--focus-dark);
}

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

.app-shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 272px minmax(0, 1fr);
  min-height: 100dvh;
}

/* ——— Sidebar ——— */

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  height: 100dvh;
  padding: 30px 22px 24px;
  overflow-y: auto;
  overscroll-behavior: contain;
  background:
    radial-gradient(circle at 18% 0%, rgba(217, 232, 172, 0.1), transparent 36%),
    linear-gradient(175deg, #1a382c 0%, var(--forest) 54%, #132a21 100%);
  color: var(--cream);
}

.sidebar::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.18;
  background-image: linear-gradient(rgba(243, 238, 227, 0.08) 1px, transparent 1px);
  background-size: 100% 48px;
  -webkit-mask-image: linear-gradient(to bottom, black, transparent 72%);
  mask-image: linear-gradient(to bottom, black, transparent 72%);
}

.brand {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  align-self: flex-start;
  padding: 4px;
  margin: -4px;
  border-radius: 12px;
  text-decoration: none;
}
.brand:focus-visible {
  outline-color: var(--focus-dark);
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 43px;
  height: 43px;
  border: 1px solid var(--forest-line);
  border-radius: 13px;
  background: rgba(217, 232, 172, 0.07);
  color: var(--lime);
}
.brand-mark svg {
  width: 29px;
  height: 29px;
}
.brand-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.brand-name {
  font-family: var(--serif);
  font-size: 28px;
  line-height: 0.95;
  letter-spacing: -0.015em;
}
.brand-sub {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--cream-soft);
}

.sidebar-block {
  position: relative;
  z-index: 1;
  margin-top: 38px;
}
.sidebar-label {
  margin-bottom: 10px;
  font-family: var(--mono);
  font-size: 10px;
  line-height: 1.3;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #9eb0a4;
}
.workspace-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid var(--forest-line);
  border-radius: 13px;
  background: rgba(255, 253, 248, 0.035);
}
.workspace-avatar {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 31px;
  height: 31px;
  border-radius: 9px;
  background: var(--lime);
  color: var(--forest);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.03em;
}
.workspace-name {
  min-width: 0;
  overflow: hidden;
  font-size: 13.5px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.workspace-local {
  flex: 0 0 auto;
  margin-left: auto;
  padding: 2px 7px;
  border: 1px solid rgba(217, 232, 172, 0.25);
  border-radius: 999px;
  color: var(--lime);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sidebar-nav {
  position: relative;
  z-index: 1;
  margin-top: 32px;
}
.nav-item {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  margin: 2px 0;
  padding: 10px 11px;
  border: 1px solid transparent;
  border-radius: 11px;
  background: transparent;
  color: var(--cream-soft);
  text-align: left;
  cursor: pointer;
  transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease;
}
.nav-item:hover {
  background: rgba(255, 253, 248, 0.07);
  color: var(--cream);
}
.nav-item:focus-visible {
  outline-color: var(--focus-dark);
}
.nav-item.is-active {
  border-color: var(--forest-line);
  background: rgba(255, 253, 248, 0.09);
  color: var(--cream);
}
.nav-item.is-active .nav-text {
  font-weight: 600;
}
.nav-text {
  min-width: 0;
  overflow: hidden;
  font-size: 13.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nav-count {
  min-width: 22px;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.16);
  color: #b9c6bd;
  font-family: var(--mono);
  font-size: 10px;
  line-height: 1.4;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.nav-item.is-active .nav-count {
  background: var(--lime);
  color: var(--forest);
}
.nav-icon {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  color: #a7b7ac;
}
.nav-icon svg {
  width: 16px;
  height: 16px;
}

.status-dot {
  display: inline-block;
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  margin: 0 auto;
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.03);
}
.status-dot--todo { background: var(--status-todo); }
.status-dot--in-progress { background: var(--status-in-progress); }
.status-dot--blocked { background: var(--status-blocked); }
.status-dot--done { background: var(--status-done); }

.sidebar-footer {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin-top: auto;
  padding-top: 30px;
  color: #a8b6ac;
}
.local-pulse {
  flex: 0 0 auto;
  width: 7px;
  height: 7px;
  margin-top: 5px;
  border-radius: 50%;
  background: var(--lime-deep);
  box-shadow: 0 0 0 4px rgba(179, 207, 109, 0.12);
}
.sidebar-footer p {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sidebar-footer strong {
  color: #dce5dc;
  font-size: 11.5px;
  font-weight: 600;
}
.sidebar-footer span {
  font-size: 10.5px;
  line-height: 1.4;
}

/* ——— Workspace & header ——— */

.workspace {
  min-width: 0;
}

.mobile-bar {
  display: none;
}

.main {
  width: 100%;
  max-width: 1380px;
  margin: 0 auto;
  padding: clamp(28px, 3.3vw, 48px) clamp(22px, 3.5vw, 52px) 64px;
}

.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 28px;
  padding-bottom: 30px;
  margin-bottom: 26px;
  border-bottom: 1px solid var(--line);
}
.page-heading {
  min-width: 0;
  max-width: 760px;
}
.eyebrow {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 10px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  line-height: 1.4;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.eyebrow span {
  color: var(--line-strong);
}
.page-heading h1 {
  color: var(--ink);
  font-family: var(--serif);
  font-size: clamp(44px, 4.8vw, 68px);
  font-weight: 400;
  line-height: 0.94;
  letter-spacing: -0.035em;
  text-wrap: balance;
}
.heading-mark {
  color: var(--rust);
}
.page-intro {
  max-width: 57ch;
  margin-top: 16px;
  color: var(--muted);
  font-size: 14.5px;
  line-height: 1.6;
  text-wrap: pretty;
}
.team-summary {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 12px;
  padding-bottom: 5px;
}
.avatar-stack {
  display: flex;
  align-items: center;
  padding-left: 8px;
}
.avatar-stack .avatar {
  width: 34px;
  height: 34px;
  margin-left: -8px;
  border: 2px solid var(--paper);
  font-size: 10px;
}
.avatar-stack .avatar:first-child {
  margin-left: 0;
}
.avatar-stack .avatar--more {
  background: var(--ink);
  color: var(--cream);
}
.team-summary-copy {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}
.team-summary-copy span:first-child {
  font-family: var(--serif);
  font-size: 24px;
  font-variant-numeric: lining-nums tabular-nums;
}
.team-summary-copy span:last-child {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* ——— Layout grid ——— */

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 410px);
  align-items: start;
  gap: clamp(22px, 2.6vw, 34px);
}

.inbox-view {
  min-width: 0;
}

/* ——— Search and filter ——— */

.toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 184px;
  gap: 14px;
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.field {
  min-width: 0;
}
.field-label {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9.5px;
  line-height: 1.2;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.search-wrap,
.select-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.search-icon {
  position: absolute;
  left: 13px;
  display: grid;
  place-items: center;
  width: 19px;
  height: 19px;
  color: var(--muted);
  pointer-events: none;
}
.search-icon svg {
  width: 19px;
  height: 19px;
}
#task-search {
  width: 100%;
  min-width: 0;
  height: 45px;
  padding: 0 40px 0 42px;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  background: var(--surface-soft);
  color: var(--ink);
  font-size: 14px;
  transition: border-color 150ms ease, background-color 150ms ease, box-shadow 150ms ease;
}
#task-search::placeholder {
  color: var(--muted-light);
  opacity: 1;
}
#task-search:hover {
  border-color: #b9ad98;
}
#task-search:focus {
  border-color: var(--focus);
  background: var(--surface);
  outline: none;
  box-shadow: 0 0 0 3px rgba(27, 115, 88, 0.15);
}
#task-search::-webkit-search-cancel-button {
  display: none;
}
.clear-search {
  position: absolute;
  right: 7px;
  display: grid;
  place-items: center;
  width: 31px;
  height: 31px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background-color 120ms ease, color 120ms ease;
}
.clear-search:hover {
  background: var(--paper-deep);
  color: var(--ink);
}
.clear-search svg {
  width: 15px;
  height: 15px;
}

.select-dot {
  position: absolute;
  left: 13px;
  z-index: 1;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--line-strong);
  pointer-events: none;
}
.select-dot[data-status="todo"] { background: var(--status-todo); }
.select-dot[data-status="in-progress"] { background: var(--status-in-progress); }
.select-dot[data-status="blocked"] { background: var(--status-blocked); }
.select-dot[data-status="done"] { background: var(--status-done); }
#status-filter {
  width: 100%;
  height: 45px;
  padding: 0 36px 0 29px;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  background-color: var(--surface-soft);
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  appearance: none;
  transition: border-color 150ms ease, background-color 150ms ease, box-shadow 150ms ease;
}
#status-filter:hover {
  border-color: #b9ad98;
}
#status-filter:focus {
  border-color: var(--focus);
  background-color: var(--surface);
  outline: none;
  box-shadow: 0 0 0 3px rgba(27, 115, 88, 0.15);
}
.select-chevron {
  position: absolute;
  right: 12px;
  display: grid;
  place-items: center;
  width: 16px;
  height: 16px;
  color: var(--muted);
  pointer-events: none;
}
.select-chevron svg {
  width: 16px;
  height: 16px;
}

/* ——— List heading ——— */

.list-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  padding: 28px 3px 13px;
}
.list-heading h2 {
  font-size: 17px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.01em;
}
.sort-note {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11.5px;
}
.results-count {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.02em;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* ——— Task rows ——— */

.task-list {
  display: grid;
  gap: 9px;
}
.task-item {
  min-width: 0;
}
.task-open {
  --accent: var(--line-strong);
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 30px;
  gap: 14px;
  align-items: center;
  width: 100%;
  padding: 17px 17px 16px 19px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 15px;
  background: var(--surface);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  box-shadow: 0 1px 0 rgba(33, 40, 30, 0.02);
  transition: border-color 150ms ease, background-color 150ms ease, box-shadow 150ms ease, transform 150ms ease;
}
.task-open::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  background: linear-gradient(105deg, transparent 50%, rgba(217, 232, 172, 0.17) 100%);
  transition: opacity 180ms ease;
}
.task-open:hover {
  border-color: var(--line-strong);
  background: #fffefa;
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.task-open:hover::after {
  opacity: 1;
}
.task-open:focus-visible {
  border-color: var(--focus);
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}
.task-item[data-status="todo"] .task-open { --accent: var(--status-todo); }
.task-item[data-status="in-progress"] .task-open { --accent: var(--status-in-progress); }
.task-item[data-status="blocked"] .task-open { --accent: var(--status-blocked); }
.task-item[data-status="done"] .task-open { --accent: var(--status-done); }
.task-item.is-selected .task-open {
  border-color: var(--forest);
  border-left-color: var(--accent);
  box-shadow: 0 0 0 1px var(--forest), var(--shadow-md);
}
.task-item.is-selected .task-glyph {
  background: var(--forest);
  border-color: var(--forest);
  color: var(--cream);
}

.task-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.task-topline {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px 9px;
  min-width: 0;
  margin-bottom: 6px;
}
.project-name {
  overflow: hidden;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.09em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}
.meta-sep {
  color: var(--line-strong);
  font-size: 10px;
}
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px 3px 7px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 600;
  line-height: 1.35;
  white-space: nowrap;
}
.status-pill .status-dot {
  width: 6px;
  height: 6px;
  margin: 0;
  box-shadow: none;
}
.status-pill--todo { background: #f1e9d9; color: #695537; }
.status-pill--in-progress { background: #e0edf3; color: #205d79; }
.status-pill--blocked { background: #f5e2da; color: #853b23; }
.status-pill--done { background: #e2ede5; color: #255e42; }

.task-title {
  display: block;
  margin-bottom: 5px;
  overflow-wrap: anywhere;
  font-size: 17.5px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.015em;
  text-wrap: pretty;
}
.task-summary {
  display: -webkit-box;
  overflow: hidden;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.55;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  text-wrap: pretty;
}
.task-footer {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px 13px;
  margin-top: 11px;
}
.assignee {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
}
.avatar {
  display: inline-grid;
  flex: 0 0 auto;
  place-items: center;
  width: 23px;
  height: 23px;
  border-radius: 50%;
  background: #e6e1d4;
  color: #34453c;
  font-family: var(--sans);
  font-size: 8.5px;
  font-weight: 800;
  letter-spacing: 0.02em;
}
.tone-1 { background: #dbe7d8; color: #2c5438; }
.tone-2 { background: #efe0d3; color: #71462c; }
.tone-3 { background: #dce7ec; color: #2f5968; }
.tone-4 { background: #e8e2c9; color: #655827; }
.tone-5 { background: #e6dce8; color: #5e3e63; }
.tone-6 { background: #e2e4e9; color: #3f4b5d; }
.due {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-size: 10.5px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.due svg {
  width: 12px;
  height: 12px;
}
.task-tags {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-left: auto;
}
.tag {
  padding: 2px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
  line-height: 1.5;
  white-space: nowrap;
}
.task-glyph {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 29px;
  height: 29px;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--muted);
  transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease, transform 150ms ease;
}
.task-glyph svg {
  width: 14px;
  height: 14px;
}
.task-open:hover .task-glyph {
  border-color: var(--forest);
  background: var(--forest);
  color: var(--cream);
  transform: translateX(1px);
}

/* ——— Empty state ——— */

.empty-state {
  padding: 46px 28px 42px;
  border: 1px dashed var(--line-strong);
  border-radius: 18px;
  background: rgba(255, 253, 248, 0.55);
  text-align: center;
}
.empty-art {
  width: 96px;
  margin: 0 auto 16px;
  color: var(--line-strong);
}
.empty-state h2 {
  font-family: var(--serif);
  font-size: 30px;
  font-weight: 400;
  line-height: 1.1;
  letter-spacing: -0.02em;
}
.empty-state p {
  max-width: 38ch;
  margin: 8px auto 20px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 9px 17px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease;
}
.button--primary {
  border: 1px solid var(--forest);
  background: var(--forest);
  color: var(--cream);
}
.button--primary:hover {
  border-color: var(--forest-soft);
  background: var(--forest-soft);
}

/* ——— Detail rail placeholder ——— */

.detail-rail {
  position: sticky;
  top: 28px;
  min-width: 0;
}
.detail-placeholder {
  position: relative;
  min-height: 460px;
  padding: 36px 31px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 22px;
  background:
    radial-gradient(circle at 85% 12%, rgba(217, 232, 172, 0.32), transparent 35%),
    var(--surface);
  box-shadow: var(--shadow-sm);
}
.detail-placeholder::after {
  content: "";
  position: absolute;
  right: -46px;
  bottom: -58px;
  width: 180px;
  height: 180px;
  border: 1px solid var(--line);
  border-radius: 50%;
  opacity: 0.8;
}
.placeholder-orbit {
  width: 96px;
  margin-bottom: 26px;
  color: #a8ad9c;
}
.placeholder-orbit svg {
  width: 96px;
  height: 96px;
}
.detail-placeholder .eyebrow {
  margin-bottom: 9px;
}
.detail-placeholder h2 {
  font-family: var(--serif);
  font-size: 39px;
  font-weight: 400;
  line-height: 1.02;
  letter-spacing: -0.03em;
  text-wrap: balance;
}
.detail-placeholder h2 em {
  color: var(--rust);
  font-style: italic;
}
.placeholder-copy {
  max-width: 32ch;
  margin-top: 16px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
  text-wrap: pretty;
}
.placeholder-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 7px 14px;
  margin-top: 34px;
  padding-top: 17px;
  border-top: 1px solid var(--line);
}
.placeholder-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.placeholder-legend .status-dot {
  width: 6px;
  height: 6px;
  margin: 0;
}

/* ——— Detail card ——— */

.detail-card {
  max-height: calc(100dvh - clamp(250px, 34vh, 330px));
  padding: 23px 25px 27px;
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: var(--shadow-md);
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
  animation: detail-enter 200ms cubic-bezier(0.2, 0.75, 0.3, 1) both;
}
@keyframes detail-enter {
  from { opacity: 0; transform: translateY(9px); }
  to { opacity: 1; transform: translateY(0); }
}
.detail-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 17px;
}
.mobile-detail-heading {
  display: none;
}
.detail-kicker {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.11em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}
.close-detail {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 5px;
  min-height: 32px;
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 140ms ease, background-color 140ms ease, color 140ms ease;
}
.close-detail:hover {
  border-color: var(--line-strong);
  background: var(--paper-deep);
  color: var(--ink);
}
.close-detail svg {
  width: 14px;
  height: 14px;
}
.detail-close-label--mobile {
  display: none;
}
.detail-title {
  padding-right: 5px;
  overflow-wrap: anywhere;
  font-family: var(--serif);
  font-size: clamp(29px, 2.7vw, 38px);
  font-weight: 400;
  line-height: 1.04;
  letter-spacing: -0.025em;
  text-wrap: balance;
}
.detail-projectline {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}
.detail-project {
  color: var(--ink-soft);
  font-size: 11.5px;
  font-weight: 500;
}
.detail-project::before {
  content: "";
  display: inline-block;
  width: 5px;
  height: 5px;
  margin-right: 7px;
  border-radius: 50%;
  background: var(--rust);
  vertical-align: 2px;
}
.priority {
  margin-left: auto;
  padding: 2px 7px;
  border-radius: 5px;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.priority--high { background: #f5dfd7; color: #8a341d; }
.priority--medium { background: #f1ead7; color: #6e5a26; }
.priority--low { background: #e6ece4; color: #456347; }

.status-panel {
  margin-top: 19px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface-soft);
}
.status-panel-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.status-panel-label {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.saved-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.03em;
}
.saved-badge::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--status-done);
}
.detail-status-wrap {
  position: relative;
  display: flex;
  align-items: center;
  margin-top: 8px;
}
.detail-status-wrap .select-dot {
  left: 12px;
  width: 8px;
  height: 8px;
}
#detail-status {
  width: 100%;
  height: 42px;
  padding: 0 38px 0 30px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background-color: var(--surface);
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  appearance: none;
  transition: border-color 150ms ease, box-shadow 150ms ease, background-color 150ms ease;
}
#detail-status:hover {
  border-color: #b9ad98;
}
#detail-status:focus {
  border-color: var(--focus);
  outline: none;
  box-shadow: 0 0 0 3px rgba(27, 115, 88, 0.16);
}
.detail-status-wrap .select-chevron {
  right: 12px;
}
.status-feedback {
  min-height: 0;
  margin-top: 9px;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.5;
}
.status-feedback.is-active {
  min-height: 20px;
  color: var(--ink-soft);
}
.status-feedback .inline-action {
  margin-left: 3px;
  padding: 0;
  border: 0;
  border-bottom: 1px solid currentColor;
  background: transparent;
  color: var(--focus);
  font-size: inherit;
  font-weight: 700;
  cursor: pointer;
}
.status-feedback .inline-action:hover {
  color: var(--forest);
}

.detail-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px 17px;
  margin-top: 21px;
}
.meta-item {
  min-width: 0;
}
.meta-label {
  margin-bottom: 4px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.meta-value {
  display: flex;
  align-items: center;
  gap: 7px;
  overflow-wrap: anywhere;
  color: var(--ink);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
}
.meta-value .avatar {
  width: 25px;
  height: 25px;
  font-size: 8.5px;
}
.meta-value svg {
  width: 13px;
  height: 13px;
  color: var(--muted);
}
.detail-brief {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}
.detail-brief h3 {
  margin-bottom: 9px;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 400;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}
.detail-brief p {
  color: var(--ink-soft);
  font-family: var(--reading);
  font-size: 13.5px;
  line-height: 1.72;
  text-wrap: pretty;
  overflow-wrap: anywhere;
}
.detail-brief p + p {
  margin-top: 11px;
}
.detail-tags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  margin-top: 22px;
}
.detail-tags .tag {
  padding: 3px 8px;
  font-size: 9px;
}
.detail-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 24px;
  padding-top: 15px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.02em;
}
.detail-footer span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.detail-footer svg {
  width: 12px;
  height: 12px;
}
.detail-footer .task-id {
  color: var(--muted-light);
  text-transform: uppercase;
}

.noscript-note {
  position: fixed;
  inset: auto 16px 16px;
  z-index: 20;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
  box-shadow: var(--shadow-md);
}

/* ——— Responsive: tablet and phone ——— */

@media (max-width: 1120px) {
  .workspace-grid {
    grid-template-columns: minmax(0, 1fr) minmax(315px, 360px);
    gap: 22px;
  }
  .task-tags {
    display: none;
  }
  .toolbar {
    grid-template-columns: minmax(0, 1fr);
  }
  .field--filter {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 12px;
  }
  .field--filter .field-label {
    margin-bottom: 0;
  }
}

@media (max-width: 1080px) {
  .app-shell {
    display: block;
  }
  .sidebar {
    display: none;
  }
  .mobile-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    min-height: 72px;
    padding: max(14px, env(safe-area-inset-top)) clamp(18px, 4vw, 30px) 14px;
    border-bottom: 1px solid var(--line);
    background: rgba(255, 253, 248, 0.42);
  }
  .brand--mobile {
    color: var(--ink);
  }
  .brand--mobile:focus-visible {
    outline-color: var(--focus);
  }
  .brand--mobile .brand-mark {
    width: 37px;
    height: 37px;
    border-color: var(--line-strong);
    background: var(--surface);
    color: var(--forest);
  }
  .brand--mobile .brand-mark svg {
    width: 25px;
    height: 25px;
  }
  .brand--mobile .brand-name {
    font-size: 24px;
  }
  .brand--mobile .brand-sub {
    color: var(--muted);
    font-size: 8.5px;
  }
  .mobile-count {
    display: inline-flex;
    align-items: baseline;
    gap: 4px;
    padding: 5px 10px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
    color: var(--muted);
    font-family: var(--mono);
    font-size: 9px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    white-space: nowrap;
  }
  .mobile-count span {
    color: var(--ink);
    font-size: 11px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
  }
  .main {
    padding: 26px clamp(16px, 4vw, 30px) max(48px, calc(24px + env(safe-area-inset-bottom)));
  }
  .page-header {
    align-items: flex-start;
    gap: 20px;
    padding-bottom: 22px;
    margin-bottom: 20px;
  }
  .page-heading h1 {
    font-size: clamp(42px, 8vw, 58px);
  }
  .team-summary {
    padding-top: 6px;
  }
  .team-summary-copy {
    display: none;
  }
  .workspace-grid {
    display: block;
  }
  .detail-rail {
    display: none;
    position: static;
  }
  .detail-placeholder {
    display: none;
  }
  body.detail-open .inbox-view,
  body.detail-open .page-header,
  body.detail-open .mobile-bar {
    display: none;
  }
  body.detail-open .detail-rail {
    display: block;
  }
  body.detail-open .main {
    padding-top: 18px;
  }
  body.detail-open .mobile-detail-heading {
    display: block;
  }
  .detail-card {
    max-height: none;
    min-height: calc(100dvh - 92px);
    padding: 20px clamp(17px, 4vw, 26px) 30px;
    border-radius: 20px;
  }
  .detail-title {
    font-size: clamp(31px, 7.2vw, 44px);
  }
  .detail-close-label--desktop {
    display: none;
  }
  .detail-close-label--mobile {
    display: inline;
  }
  .detail-brief p {
    font-size: 14.5px;
  }
}

@media (max-width: 620px) {
  .toolbar {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
    padding: 14px;
    border-radius: 16px;
  }
  .field--filter {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 12px;
  }
  .field--filter .field-label {
    margin-bottom: 0;
  }
  .page-header {
    flex-direction: column;
    gap: 16px;
  }
  .team-summary {
    padding-top: 0;
  }
  .team-summary-copy {
    display: flex;
  }
  .list-heading {
    padding-top: 23px;
  }
  .task-open {
    grid-template-columns: minmax(0, 1fr) 24px;
    gap: 10px;
    padding: 15px 14px 14px 15px;
    border-radius: 14px;
  }
  .task-summary {
    display: none;
  }
  .task-title {
    font-size: 16.5px;
  }
  .task-footer {
    gap: 6px 11px;
    margin-top: 9px;
  }
  .task-glyph {
    width: 24px;
    height: 24px;
  }
  .task-glyph svg {
    width: 12px;
    height: 12px;
  }
  .results-count {
    font-size: 9.5px;
  }
  .detail-meta {
    gap: 13px;
  }
  .detail-footer {
    flex-wrap: wrap;
  }
}

@media (max-width: 430px) {
  .main {
    padding-left: 14px;
    padding-right: 14px;
  }
  .mobile-bar {
    padding-left: 14px;
    padding-right: 14px;
  }
  .page-heading h1 {
    font-size: 43px;
  }
  .page-intro {
    margin-top: 12px;
    font-size: 13px;
  }
  .eyebrow {
    font-size: 9px;
  }
  .brand-name {
    font-size: 22px;
  }
  .task-topline {
    gap: 5px 7px;
  }
  .project-name {
    font-size: 9px;
  }
  .status-pill {
    padding: 2px 7px;
    font-size: 9.5px;
  }
  .assignee {
    font-size: 10.5px;
  }
  .avatar {
    width: 21px;
    height: 21px;
    font-size: 8.5px;
  }
  .due {
    font-size: 9.5px;
  }
  .detail-card {
    padding: 18px 15px 26px;
    min-height: calc(100dvh - 82px);
  }
  .detail-topline {
    margin-bottom: 15px;
  }
  .close-detail {
    min-height: 36px;
    padding: 6px 10px;
    font-size: 10px;
  }
  .status-panel {
    padding: 12px;
  }
  .detail-meta {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .detail-title {
    font-size: 32px;
  }
  .detail-brief p {
    font-size: 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .task-open:hover {
    transform: none;
  }
  .task-open:hover .task-glyph {
    transform: none;
  }
}
