@font-face {
  font-family: "Space Grotesk";
  src: url("./assets/space-grotesk.ttf") format("truetype");
  font-display: swap;
}

@font-face {
  font-family: "IBM Plex Mono";
  src: url("./assets/ibm-plex-mono.ttf") format("truetype");
  font-display: swap;
}

:root {
  color-scheme: light dark;
  --page: #ebece7;
  --surface: #f7f7f3;
  --surface-strong: #fdfdf9;
  --surface-muted: #e1e3dd;
  --ink: #1e2423;
  --ink-soft: #5c6460;
  --line: #c8ccc4;
  --line-strong: #9aa19b;
  --accent: #ad3f20;
  --accent-ink: #fff8f4;
  --focus: #246ec4;
  --radius: 12px;
  --shadow: 0 24px 70px rgb(40 47 43 / 0.18);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100dvh;
  background: var(--page);
  color: var(--ink);
  font-family: "Space Grotesk", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.45;
}

button, input, select { font: inherit; color: inherit; }
button, select { cursor: pointer; }
a { color: inherit; }

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 30;
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--ink);
  color: var(--surface);
  transform: translateY(-160%);
}

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

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

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  height: 100dvh;
  padding: 28px 20px 22px;
  border-right: 1px solid var(--line);
  background: var(--surface);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  width: fit-content;
  color: var(--ink);
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -0.04em;
  text-decoration: none;
}

.brand-mark {
  position: relative;
  display: inline-block;
  width: 25px;
  height: 25px;
}

.brand-mark i {
  position: absolute;
  width: 15px;
  height: 15px;
  border: 2px solid var(--ink);
  border-radius: 5px;
  transform: rotate(12deg);
}

.brand-mark i:first-child { top: 1px; left: 1px; }
.brand-mark i:last-child { right: 1px; bottom: 1px; border-color: var(--accent); }

.workspace-card {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 34px 0 28px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
}

.workspace-card > span:last-child { font-weight: 650; line-height: 1.2; }
.workspace-card small, .sidebar-foot small { display: block; color: var(--ink-soft); font-size: 11px; font-weight: 500; }

.workspace-avatar,
.initial-avatar {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: var(--ink);
  color: var(--surface);
  font-weight: 700;
}

.side-nav { display: grid; gap: 4px; }
.side-nav a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 42px;
  padding: 0 12px;
  border-radius: 9px;
  color: var(--ink-soft);
  font-weight: 600;
  text-decoration: none;
}

.side-nav a:hover { color: var(--ink); background: var(--surface-muted); }
.side-nav a.active { color: var(--surface); background: var(--ink); }
.nav-count { font-family: "IBM Plex Mono", monospace; font-size: 12px; }

.team-block { margin-top: 34px; padding: 0 12px; }
.side-label {
  margin: 0 0 13px;
  color: var(--ink-soft);
  font-family: "IBM Plex Mono", monospace;
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.team-block > p:last-child { max-width: 150px; margin: 12px 0 0; color: var(--ink-soft); font-size: 12px; }

.avatar-stack { display: flex; padding-left: 4px; }
.avatar-stack span {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  margin-left: -4px;
  border: 2px solid var(--surface);
  border-radius: 8px;
  background: var(--surface-muted);
  color: var(--ink);
  font-family: "IBM Plex Mono", monospace;
  font-size: 9px;
  font-weight: 600;
}
.avatar-stack span:nth-child(even) { background: #d6d9d2; }

.sidebar-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: auto;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  font-size: 13px;
}
.sidebar-foot .initial-avatar { width: 34px; height: 34px; background: var(--accent); color: var(--accent-ink); font-size: 10px; }
.sidebar-foot strong { font-weight: 650; }

.main { min-width: 0; padding: 0 5vw 64px; }
.mobile-header { display: none; }

.masthead {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 48px;
  max-width: 1080px;
  margin: 0 auto;
  padding: 70px 0 48px;
}

.kicker {
  margin: 0 0 14px;
  color: var(--accent);
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(42px, 5vw, 68px);
  font-weight: 650;
  letter-spacing: -0.065em;
  line-height: 0.96;
}

.intro { margin: 17px 0 0; color: var(--ink-soft); font-size: 17px; }

.summary { display: grid; grid-template-columns: repeat(3, 90px); }
.summary div { padding-left: 16px; border-left: 1px solid var(--line-strong); }
.summary strong { display: block; font-size: 28px; font-weight: 580; letter-spacing: -0.04em; line-height: 1; }
.summary span { display: block; margin-top: 8px; color: var(--ink-soft); font-size: 11px; }

.inbox { max-width: 1080px; margin: 0 auto; }

.toolbar {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) 220px;
  gap: 12px;
  margin-bottom: 32px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.field { position: relative; }
.field label {
  position: absolute;
  top: 8px;
  left: 14px;
  z-index: 1;
  color: var(--ink-soft);
  font-family: "IBM Plex Mono", monospace;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  pointer-events: none;
}

.field input, .field select {
  width: 100%;
  height: 57px;
  padding: 23px 42px 7px 14px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-strong);
  color: var(--ink);
  font-size: 14px;
}

.field input::placeholder { color: #68706b; opacity: 1; }
.field input:hover, .field select:hover { border-color: var(--line-strong); }
.field input:focus, .field select:focus { border-color: var(--focus); outline: 3px solid color-mix(in srgb, var(--focus) 25%, transparent); }
.search-field::after {
  content: "⌕";
  position: absolute;
  right: 15px;
  bottom: 12px;
  color: var(--ink-soft);
  font-size: 20px;
  pointer-events: none;
}

.list-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 0 4px 12px;
  border-bottom: 1px solid var(--line-strong);
}
.list-heading p { margin: 0; font-weight: 650; }
.list-heading span { color: var(--ink-soft); font-family: "IBM Plex Mono", monospace; font-size: 10px; }

.task-list { min-height: 280px; }

.task-item {
  position: relative;
  display: grid;
  grid-template-columns: 122px minmax(260px, 1fr) 132px 92px;
  gap: 20px;
  align-items: center;
  min-height: 105px;
  border-bottom: 1px solid var(--line);
  transition: background-color 160ms ease, transform 160ms ease;
}

.task-item:hover { background: color-mix(in srgb, var(--surface) 55%, transparent); }
.task-item:has(.open-item:active) { transform: scale(0.995); }

.open-item {
  position: absolute;
  inset: 0;
  z-index: 1;
  border: 0;
  background: transparent;
  text-align: left;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 27px;
  padding: 3px 8px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: transparent;
  color: var(--ink-soft);
  font-family: "IBM Plex Mono", monospace;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.status-in-progress { border-color: var(--ink); color: var(--ink); background: var(--surface-strong); }
.status-blocked { border-color: var(--accent); color: var(--accent); }
.status-done { border-style: dashed; color: var(--ink-soft); }

.task-copy { min-width: 0; padding: 19px 0; }
.task-copy h2 {
  margin: 0;
  overflow: hidden;
  font-size: 16px;
  font-weight: 650;
  letter-spacing: -0.02em;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.task-copy p {
  display: -webkit-box;
  margin: 6px 0 0;
  overflow: hidden;
  color: var(--ink-soft);
  font-size: 12px;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.assignee { display: flex; align-items: center; gap: 8px; min-width: 0; color: var(--ink-soft); font-size: 12px; }
.assignee span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-avatar {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: var(--surface-muted);
  color: var(--ink);
  font-family: "IBM Plex Mono", monospace;
  font-size: 9px;
  font-weight: 600;
}

.date { color: var(--ink-soft); font-family: "IBM Plex Mono", monospace; font-size: 10px; text-align: right; }

.loading-state { padding: 3px 0; }
.loading-state span {
  display: block;
  height: 84px;
  margin-top: 1px;
  border-radius: 8px;
  background: linear-gradient(90deg, var(--surface-muted), var(--surface), var(--surface-muted));
  background-size: 220% 100%;
}

.empty-state, .error-state {
  display: grid;
  place-items: start;
  min-height: 280px;
  padding: 58px 6px;
  border-bottom: 1px solid var(--line);
}
.empty-state strong, .error-state strong { font-size: 22px; letter-spacing: -0.03em; }
.empty-state p, .error-state p { max-width: 420px; margin: 7px 0 20px; color: var(--ink-soft); }

.text-button, .close-button {
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--ink);
  border-radius: 8px;
  background: var(--ink);
  color: var(--surface);
  font-weight: 650;
  white-space: nowrap;
}
.text-button:active, .close-button:active { transform: translateY(1px); }

.detail-layer { position: fixed; inset: 0; z-index: 20; }
.detail-layer[hidden] { display: none; }
.scrim { position: absolute; inset: 0; width: 100%; border: 0; background: rgb(28 34 32 / 0.48); }

.detail-panel {
  position: absolute;
  top: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  width: min(570px, 100%);
  height: 100dvh;
  overflow: auto;
  border: 0;
  border-left: 1px solid var(--line);
  background: var(--surface-strong);
  box-shadow: var(--shadow);
}

.detail-topbar {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 70px;
  padding: 0 36px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface-strong) 94%, transparent);
  backdrop-filter: blur(12px);
}
.detail-topbar span { color: var(--ink-soft); font-family: "IBM Plex Mono", monospace; font-size: 10px; }
.close-button { background: transparent; color: var(--ink); }

.detail-content { padding: 42px 36px 64px; }
.detail-project { margin: 0 0 13px; color: var(--accent); font-family: "IBM Plex Mono", monospace; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; }
.detail-content h2 { max-width: 480px; margin: 0; font-size: clamp(31px, 4vw, 44px); font-weight: 620; letter-spacing: -0.055em; line-height: 1.03; }

.detail-people { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 34px 0; }
.detail-meta { padding: 13px 14px; border: 1px solid var(--line); border-radius: 9px; }
.detail-meta small { display: block; margin-bottom: 7px; color: var(--ink-soft); font-family: "IBM Plex Mono", monospace; font-size: 9px; text-transform: uppercase; letter-spacing: 0.08em; }
.detail-meta strong { font-weight: 620; }

.detail-body {
  margin-top: 30px;
  padding-top: 28px;
  border-top: 1px solid var(--line);
}
.detail-body h3 { margin: 0 0 13px; font-size: 13px; }
.detail-body p { margin: 0 0 18px; color: var(--ink-soft); font-size: 15px; line-height: 1.65; }
.detail-body p:last-child { color: var(--ink); }

.tag-row { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 28px; }
.tag { padding: 6px 9px; border: 1px solid var(--line); border-radius: 7px; color: var(--ink-soft); font-family: "IBM Plex Mono", monospace; font-size: 9px; }

.status-field { margin-top: 38px; padding: 22px; border-radius: var(--radius); background: var(--surface-muted); }
.status-field label { display: block; margin-bottom: 8px; font-weight: 650; }
.status-field p { margin: 0 0 14px; color: var(--ink-soft); font-size: 12px; }
.status-field select { width: 100%; height: 48px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface-strong); }
.status-feedback { min-height: 20px; margin: 10px 0 0 !important; color: var(--accent) !important; font-weight: 650; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 25;
  max-width: calc(100% - 32px);
  padding: 11px 16px;
  border-radius: 9px;
  background: var(--ink);
  color: var(--surface);
  box-shadow: 0 12px 30px rgb(36 42 39 / 0.24);
  font-size: 13px;
  font-weight: 650;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition: opacity 180ms ease, transform 180ms ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

body.detail-open { overflow: hidden; }

@media (prefers-reduced-motion: no-preference) {
  .loading-state span { animation: shimmer 1.4s ease infinite; }
  .detail-layer:not([hidden]) .scrim { animation: fade-in 180ms ease both; }
  .detail-layer:not([hidden]) .detail-panel { animation: slide-in 260ms cubic-bezier(.22, 1, .36, 1) both; }
  @keyframes shimmer { to { background-position: -220% 0; } }
  @keyframes fade-in { from { opacity: 0; } }
  @keyframes slide-in { from { opacity: 0; transform: translateX(24px); } }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

@media (prefers-color-scheme: dark) {
  :root {
    --page: #171b1a;
    --surface: #1d2220;
    --surface-strong: #242a27;
    --surface-muted: #303633;
    --ink: #edf0ea;
    --ink-soft: #adb5af;
    --line: #3a423e;
    --line-strong: #59635d;
    --accent: #ed7650;
    --accent-ink: #171b1a;
    --focus: #70adf1;
    --shadow: 0 24px 70px rgb(7 10 9 / 0.5);
  }
  .avatar-stack span:nth-child(even) { background: #39403d; }
  .scrim { background: rgb(5 8 7 / 0.66); }
}

@media (max-width: 1020px) {
  .app-shell { grid-template-columns: 210px minmax(0, 1fr); }
  .sidebar { padding-inline: 16px; }
  .main { padding-inline: 4vw; }
  .masthead { grid-template-columns: 1fr; gap: 30px; }
  .summary { width: min(100%, 390px); }
  .task-item { grid-template-columns: 112px minmax(230px, 1fr) 90px; }
  .assignee { display: none; }
}

@media (max-width: 767px) {
  .app-shell { display: block; min-height: 100dvh; }
  .sidebar { display: none; }
  .main { width: 100%; padding: 0 16px 42px; }
  .mobile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 66px;
    border-bottom: 1px solid var(--line);
  }
  .mobile-header .brand { font-size: 18px; }
  .mobile-workspace { color: var(--ink-soft); font-size: 11px; }
  .masthead { display: block; padding: 38px 0 30px; }
  .kicker { margin-bottom: 10px; }
  h1 { font-size: 43px; }
  .intro { max-width: 320px; margin-top: 13px; font-size: 15px; }
  .summary { grid-template-columns: repeat(3, 1fr); width: 100%; margin-top: 30px; }
  .summary div { padding-left: 12px; }
  .summary strong { font-size: 24px; }
  .toolbar { grid-template-columns: 1fr; gap: 8px; margin-bottom: 24px; padding: 9px; }
  .field input, .field select { height: 55px; }
  .list-heading { padding-bottom: 10px; }
  .list-heading span { display: none; }
  .task-item {
    grid-template-columns: 1fr auto;
    grid-template-areas: "copy status" "meta meta";
    gap: 4px 10px;
    min-height: 0;
    padding: 17px 0;
  }
  .task-item > .status-badge { grid-area: status; align-self: start; }
  .task-copy { grid-area: copy; padding: 0; }
  .task-copy h2 { font-size: 15px; white-space: normal; }
  .task-copy p { margin-top: 5px; -webkit-line-clamp: 2; }
  .assignee { display: flex; grid-area: meta; margin-top: 9px; }
  .date { grid-area: meta; align-self: center; justify-self: end; }
  .mini-avatar { width: 24px; height: 24px; }
  .detail-panel { width: 100%; border-left: 0; }
  .detail-topbar { min-height: 64px; padding: 0 18px; }
  .detail-content { padding: 30px 18px 48px; }
  .detail-content h2 { font-size: 34px; }
  .detail-people { grid-template-columns: 1fr; gap: 8px; margin-block: 26px; }
  .status-field { margin-top: 30px; padding: 18px; }
  .toast { bottom: 16px; width: calc(100% - 32px); text-align: center; }
}

@media (max-width: 380px) {
  .main { padding-inline: 12px; }
  h1 { font-size: 40px; }
  .status-badge { font-size: 8px; }
  .task-copy p { -webkit-line-clamp: 1; }
}
