/* Hopper — team task inbox */

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

:root {
  --bg: #f3f4f7;
  --surface: #ffffff;
  --surface-2: #f7f8fa;
  --surface-3: #f0f2f6;

  --ink: #171b21;
  --ink-2: #3f4753;
  --ink-3: #5d6673;
  --ink-4: #6b7480;

  --line: #e5e8ee;
  --line-2: #d3d8e0;

  --accent: #2e5bd9;
  --accent-deep: #2449ad;
  --accent-soft: #edf2fd;
  --accent-ring: rgba(46, 91, 217, 0.22);

  --st-todo-fg: #4e5866;    --st-todo-bg: #edf0f4;    --st-todo-dot: #8b94a3;
  --st-prog-fg: #175cd3;    --st-prog-bg: #e9f0fd;    --st-prog-dot: #2e90fa;
  --st-blocked-fg: #b42318; --st-blocked-bg: #fcedec; --st-blocked-dot: #f04438;
  --st-done-fg: #087443;    --st-done-bg: #e7f5ec;    --st-done-dot: #12b76a;

  --radius: 10px;
  --shadow-panel: -28px 0 64px rgba(18, 22, 30, 0.16), 0 0 0 1px rgba(18, 22, 30, 0.06);

  font-size: 16px;
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  font-family: "Work Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

body:has(.detail[open]) { overflow: hidden; }

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

button, input, select { font: inherit; color: inherit; }

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

input, textarea { caret-color: var(--accent); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb {
  background: var(--line-2);
  border-radius: 6px;
  border: 2px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-track { background: transparent; }

.skip-link {
  position: absolute;
  left: 16px;
  top: -48px;
  z-index: 60;
  padding: 8px 14px;
  background: var(--ink);
  color: #fff;
  border-radius: 0 0 8px 8px;
  text-decoration: none;
  font-weight: 500;
  transition: top 160ms cubic-bezier(0.2, 0.7, 0.2, 1);
}
.skip-link:focus-visible { top: 0; }

/* ---------- Shell ---------- */

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

/* ---------- Rail ---------- */

.rail {
  position: sticky;
  top: 0;
  height: 100dvh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 24px 16px 20px;
  border-right: 1px solid var(--line);
  scrollbar-width: thin;
  scrollbar-color: var(--line-2) transparent;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 6px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: var(--ink);
  color: #fff;
  flex: none;
}
.brand-mark svg { width: 18px; height: 18px; }

.brand-name {
  display: flex;
  flex-direction: column;
  font-size: 1.0625rem;
  font-weight: 650;
  letter-spacing: -0.015em;
  line-height: 1.15;
}

.brand-sub {
  font-size: 0.6875rem;
  font-weight: 480;
  letter-spacing: 0.02em;
  color: var(--ink-3);
}

.rail-label {
  margin: 0 0 8px;
  padding: 0 8px;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-4);
}

.views ul,
.team-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.view {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink-2);
  font-size: 0.8438rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background-color 140ms ease, color 140ms ease;
}
.view:hover { background: rgba(23, 27, 33, 0.05); color: var(--ink); }
.view.is-active {
  background: var(--surface);
  color: var(--ink);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(18, 22, 30, 0.09), 0 0 0 1px var(--line);
}

.count {
  font-variant-numeric: tabular-nums;
  font-size: 0.75rem;
  font-weight: 550;
  color: var(--ink-3);
  background: rgba(23, 27, 33, 0.06);
  border-radius: 999px;
  padding: 1px 7px;
  min-width: 22px;
  text-align: center;
}
.view.is-active .count { background: var(--accent-soft); color: var(--accent-deep); }

.team { margin-top: 4px; }

.team-row {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 5px 8px;
  font-size: 0.8125rem;
  color: var(--ink-2);
}

.avatar {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  font-size: 0.625rem;
  font-weight: 650;
  letter-spacing: 0.02em;
  flex: none;
}
.av-0 { background: #e3ecfd; color: #2851b8; }
.av-1 { background: #e0f2ee; color: #0f766e; }
.av-2 { background: #fcecdd; color: #8a5a16; }
.av-3 { background: #fbe9ea; color: #a63a3e; }
.av-4 { background: #ece8fa; color: #5b45b0; }
.av-5 { background: #e8f0e4; color: #4a7233; }

.team-count {
  margin-left: auto;
  font-variant-numeric: tabular-nums;
  font-size: 0.75rem;
  color: var(--ink-3);
}

.rail-note {
  margin: auto 8px 0;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  font-size: 0.75rem;
  line-height: 1.5;
  color: var(--ink-4);
}

/* ---------- Board ---------- */

.board {
  background: var(--surface);
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.toolbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 18px 28px;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.board-title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 650;
  letter-spacing: -0.015em;
  line-height: 1;
}

.tools {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.search { position: relative; }

.search-icon {
  position: absolute;
  left: 11px;
  top: 50%;
  translate: 0 -50%;
  width: 15px;
  height: 15px;
  color: var(--ink-4);
  pointer-events: none;
}

#taskSearch {
  width: 280px;
  max-width: 100%;
  padding: 8px 12px 8px 33px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  background: var(--surface);
  font-size: 0.8438rem;
  color: var(--ink);
  transition: border-color 140ms ease, box-shadow 140ms ease;
}
#taskSearch::placeholder { color: var(--ink-4); }
#taskSearch:hover { border-color: #b9c0cc; }
#taskSearch:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}
#taskSearch::-webkit-search-cancel-button { -webkit-appearance: none; }

select {
  appearance: none;
  -webkit-appearance: none;
  padding: 8px 32px 8px 12px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%235d6673' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E") no-repeat right 10px center / 14px,
    var(--surface);
  font-size: 0.8438rem;
  font-weight: 500;
  color: var(--ink);
  cursor: pointer;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}
select:hover { border-color: #b9c0cc; }
select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

/* ---------- List ---------- */

.list-head,
.row {
  display: grid;
  grid-template-columns: 116px minmax(0, 1fr) 168px 76px 64px 20px;
  gap: 16px;
  align-items: center;
  padding-inline: 28px;
}

.list-head {
  padding-block: 12px 10px;
  border-bottom: 1px solid var(--line);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ink-4);
}
.th-comments { text-align: right; padding-right: 6px; }

.result-note {
  margin: 0;
  padding: 12px 28px 4px;
  font-size: 0.75rem;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

.tasks {
  list-style: none;
  margin: 0 0 40px;
  padding: 0 0 0;
}

.tasks li + li .row,
.tasks li + li { border-top: 1px solid var(--line); }

.row {
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  padding-block: 15px;
  cursor: pointer;
  transition: background-color 140ms ease;
}
.row:hover { background: var(--surface-2); }
.row:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
  border-radius: 8px;
}
.row.is-open { background: var(--accent-soft); }
.row.is-open .row-title { color: var(--accent-deep); }

.row:hover .row-chevron { color: var(--accent); translate: 2px 0; }

.row-chevron {
  width: 16px;
  height: 16px;
  color: var(--ink-4);
  transition: color 140ms ease, translate 140ms ease;
}
.row-chevron svg { width: 100%; height: 100%; display: block; }

/* Pills */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 3px 10px 3px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 560;
  letter-spacing: 0.005em;
  white-space: nowrap;
  max-width: 116px;
}
.pill::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--pill-dot, currentColor);
  flex: none;
}
.pill-todo        { background: var(--st-todo-bg);     color: var(--st-todo-fg);     --pill-dot: var(--st-todo-dot); }
.pill-in-progress { background: var(--st-prog-bg);     color: var(--st-prog-fg);     --pill-dot: var(--st-prog-dot); }
.pill-blocked     { background: var(--st-blocked-bg);  color: var(--st-blocked-fg);  --pill-dot: var(--st-blocked-dot); }
.pill-done        { background: var(--st-done-bg);     color: var(--st-done-fg);     --pill-dot: var(--st-done-dot); }

/* Row content */

.row-main { min-width: 0; }

.row-title {
  display: block;
  font-size: 0.9375rem;
  font-weight: 570;
  letter-spacing: -0.008em;
  line-height: 1.35;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-meta {
  display: block;
  margin-top: 2px;
  font-size: 0.75rem;
  color: var(--ink-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-assignee {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8125rem;
  color: var(--ink-2);
  min-width: 0;
}
.row-assignee .avatar { width: 26px; height: 26px; font-size: 0.625rem; }
.row-assignee .assignee-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.due {
  font-variant-numeric: tabular-nums;
  font-size: 0.8125rem;
  color: var(--ink-2);
}

.comments {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
  font-variant-numeric: tabular-nums;
  font-size: 0.7813rem;
  color: var(--ink-3);
}
.comments svg { width: 14px; height: 14px; flex: none; }

/* ---------- Empty state ---------- */

.empty {
  margin: 48px auto;
  max-width: 400px;
  padding: 0 24px;
  text-align: center;
}
.empty-icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  margin: 0 auto 16px;
  border-radius: 14px;
  background: var(--surface-3);
  color: var(--ink-3);
}
.empty-icon svg { width: 26px; height: 26px; }
.empty-title {
  margin: 0 0 6px;
  font-size: 1.0625rem;
  font-weight: 640;
  letter-spacing: -0.01em;
}
.empty-text { margin: 0 0 18px; font-size: 0.8438rem; color: var(--ink-3); }
.empty-actions { display: flex; justify-content: center; gap: 10px; }

.btn {
  padding: 8px 14px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  background: var(--surface);
  font-size: 0.8438rem;
  font-weight: 550;
  color: var(--ink);
  cursor: pointer;
  transition: background-color 140ms ease, border-color 140ms ease;
}
.btn:hover { background: var(--surface-2); border-color: #b9c0cc; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-deep); border-color: var(--accent-deep); }

/* ---------- Detail dialog ---------- */

.detail {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: auto;
  width: min(500px, 100vw);
  height: 100dvh;
  max-height: 100dvh;
  max-width: 100vw;
  margin: 0;
  padding: 0;
  border: 0;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-panel);
  overflow: hidden;
}
.detail[open] { animation: panel-in 220ms cubic-bezier(0.2, 0.8, 0.2, 1); }
.detail::backdrop {
  background: rgba(16, 19, 26, 0.36);
  animation: backdrop-in 220ms ease;
}

@keyframes panel-in {
  from { transform: translateX(28px); opacity: 0.4; }
  to   { transform: translateX(0); opacity: 1; }
}
@keyframes backdrop-in { from { opacity: 0; } to { opacity: 1; } }

.detail-inner { display: flex; flex-direction: column; height: 100%; }

.detail-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 20px 14px 26px;
  border-bottom: 1px solid var(--line);
}

.task-ref {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.6875rem;
  letter-spacing: 0.04em;
  color: var(--ink-3);
  background: var(--surface-3);
  border-radius: 6px;
  padding: 3px 7px;
}

.detail-head .pill { margin-left: 2px; }
.detail-head .pill.pulse { animation: pill-pulse 480ms ease; }
@keyframes pill-pulse {
  0% { box-shadow: 0 0 0 0 var(--accent-ring); }
  70% { box-shadow: 0 0 0 7px rgba(46, 91, 217, 0); }
  100% { box-shadow: 0 0 0 0 rgba(46, 91, 217, 0); }
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  margin-left: auto;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink-3);
  cursor: pointer;
  transition: background-color 140ms ease, color 140ms ease;
}
.icon-btn:hover { background: var(--surface-3); color: var(--ink); }
.icon-btn svg { width: 17px; height: 17px; }

.detail-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 22px 26px 36px;
  scrollbar-width: thin;
  scrollbar-color: var(--line-2) transparent;
}

.detail-title {
  margin: 0 0 18px;
  font-size: 1.1875rem;
  font-weight: 650;
  letter-spacing: -0.015em;
  line-height: 1.3;
  overflow-wrap: break-word;
}

.status-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 12px 14px;
  margin-bottom: 22px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.status-label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.status-feedback {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.7813rem;
  font-weight: 530;
  color: var(--st-done-fg);
  opacity: 0;
  translate: 0 2px;
  transition: opacity 180ms ease, translate 180ms ease;
}
.status-feedback.is-visible { opacity: 1; translate: 0 0; }
.status-feedback svg { width: 13px; height: 13px; flex: none; }

.meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px 24px;
  margin: 0 0 24px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
}
.meta-grid div { min-width: 0; }
.meta-grid dt {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ink-4);
  margin-bottom: 3px;
}
.meta-grid dd {
  margin: 0;
  font-size: 0.875rem;
  font-weight: 530;
  color: var(--ink);
  overflow-wrap: break-word;
}
.meta-tags { grid-column: 1 / -1; }

.tag-row { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  padding: 2px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
  font-size: 0.7188rem;
  font-weight: 520;
  color: var(--ink-2);
}

.detail-body p {
  margin: 0 0 14px;
  font-size: 0.9375rem;
  line-height: 1.65;
  color: var(--ink-2);
  max-width: 62ch;
}
.detail-body p:last-child { margin-bottom: 0; }
.detail-body strong { color: var(--ink); font-weight: 600; }

/* ---------- Motion preferences ---------- */

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

/* ---------- Responsive ---------- */

@media (max-width: 1080px) {
  .list-head,
  .row { grid-template-columns: 104px minmax(0, 1fr) 140px 64px 48px 18px; gap: 12px; }
  #taskSearch { width: 220px; }
}

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }

  .rail {
    position: static;
    height: auto;
    overflow: visible;
    flex-direction: row;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .views, .team, .rail-note { display: none; }
  .brand { padding: 0; }

  .toolbar {
    flex-wrap: wrap;
    gap: 10px;
    padding: 12px 16px;
  }
  .board-title { display: none; }
  .tools { width: 100%; margin-left: 0; }
  #taskSearch { flex: 1; width: auto; min-width: 0; }
  #statusFilter { flex: none; }

  .list-head { display: none; }
  .result-note { padding: 12px 16px 2px; }

  .row {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "pill     due"
      "title    title"
      "meta     meta"
      "assignee comments";
    row-gap: 7px;
    padding: 15px 16px;
  }
  .row .pill { grid-area: pill; justify-self: start; }
  .row .due { grid-area: due; }
  .row .row-main { grid-area: title; }
  .row-title { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .row .row-meta { grid-area: meta; white-space: normal; }
  .row .row-assignee { grid-area: assignee; }
  .row .comments { grid-area: comments; }
  .row .row-chevron { display: none; }

  .detail { width: 100vw; }
  .detail-scroll { padding: 20px 18px 32px; }
  .detail-head { padding: 14px 14px 12px 18px; }
}

@media (max-width: 420px) {
  .empty-actions { flex-direction: column; align-items: stretch; }
}
