:root {
  --ground: #f4f3ef;
  --surface: #ffffff;
  --ink: #1c1f1d;
  --muted: #5a5f5b;
  --line: #d9d7d0;
  --accent: #1d5c57;
  --accent-soft: #e2eeec;
  --danger: #8a2f1f;

  --todo-bg: #e7e5df;
  --todo-fg: #3f443f;
  --progress-bg: #dbe7f3;
  --progress-fg: #1f4a72;
  --blocked-bg: #f5dfd9;
  --blocked-fg: #8a2f1f;
  --done-bg: #dcebdc;
  --done-fg: #2c5a2c;

  --radius: 10px;
  --font: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  color-scheme: light;
}

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

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

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--ground);
  color: var(--ink);
  font: 400 16px/1.5 var(--font);
}

::selection {
  background: var(--accent-soft);
  color: var(--ink);
}

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

.skip-link {
  position: absolute;
  top: -100px;
  left: 16px;
  z-index: 10;
  padding: 8px 14px;
  background: var(--ink);
  color: var(--surface);
  border-radius: 6px;
  text-decoration: none;
}

.skip-link:focus {
  top: 12px;
}

/* Top bar */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: 960px;
  margin: 0 auto;
  padding: 20px 24px;
  border-bottom: 1px solid var(--line);
}

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

.brand-mark {
  width: 28px;
  height: 28px;
  fill: none;
  stroke: var(--accent);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.brand-name {
  font-size: 1.125rem;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.team-label {
  margin: 0;
  color: var(--muted);
  font-size: 0.875rem;
}

/* Workspace */

.workspace {
  max-width: 960px;
  margin: 0 auto;
  padding: 28px 24px 64px;
}

.toolbar-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-bottom: 16px;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.25;
  font-weight: 650;
  letter-spacing: -0.01em;
}

h1 {
  font-size: 1.5rem;
}

.result-count {
  margin: 0;
  color: var(--muted);
  font-size: 0.9375rem;
  font-variant-numeric: tabular-nums;
}

.controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  gap: 12px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.field label,
.detail-status label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--muted);
}

input[type="search"],
select {
  width: 100%;
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid #b9b7af;
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
}

input[type="search"]::placeholder {
  color: #6b706c;
}

input[type="search"]::-webkit-search-cancel-button {
  cursor: pointer;
}

select {
  cursor: pointer;
}

/* Task list */

.task-list {
  list-style: none;
  margin: 24px 0 0;
  padding: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.task {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 16px;
  padding: 16px 20px;
}

.task + .task {
  border-top: 1px solid var(--line);
}

.task:hover {
  background: #fafaf7;
}

.task:focus-within {
  background: var(--accent-soft);
}

.task-title {
  font-size: 1rem;
}

.task-open {
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

/* Stretch the button over the whole row so the entire row is a target. */
.task-open::after {
  content: "";
  position: absolute;
  inset: 0;
}

.task-open:focus-visible {
  outline-offset: 0;
}

.task-open:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.task-meta {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.875rem;
}

.task-meta span + span::before {
  content: "·";
  margin: 0 6px;
}

.status {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.8125rem;
  font-weight: 600;
  background: var(--todo-bg);
  color: var(--todo-fg);
}

.status[data-status="in-progress"] {
  background: var(--progress-bg);
  color: var(--progress-fg);
}

.status[data-status="blocked"] {
  background: var(--blocked-bg);
  color: var(--blocked-fg);
}

.status[data-status="done"] {
  background: var(--done-bg);
  color: var(--done-fg);
}

/* Empty state */

.empty {
  margin-top: 24px;
  padding: 32px 24px;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.empty h2 {
  font-size: 1.125rem;
}

.empty p {
  margin: 6px 0 16px;
  color: var(--muted);
}

/* Buttons */

.btn {
  min-height: 44px;
  padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid transparent;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.btn-secondary {
  background: var(--surface);
  border-color: #b9b7af;
  color: var(--ink);
}

.btn-secondary:hover {
  background: #f1f0eb;
}

.btn-ghost {
  background: none;
  color: var(--accent);
  padding-inline: 10px;
}

.btn-ghost:hover {
  background: var(--accent-soft);
}

/* Detail dialog */

.detail {
  width: min(680px, calc(100vw - 32px));
  max-height: calc(100dvh - 48px);
  overflow: auto;
  padding: 0;
  border: 0;
  border-radius: 14px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 24px 60px -20px rgb(28 31 29 / 0.35);
}

.detail::backdrop {
  background: rgb(28 31 29 / 0.4);
}

.detail-inner {
  padding: 24px 28px 32px;
}

.detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: -8px -10px 0 0;
}

.detail-project {
  margin: 0;
  color: var(--muted);
  font-size: 0.875rem;
  font-weight: 600;
}

.detail-title {
  margin-top: 8px;
  font-size: 1.375rem;
  line-height: 1.3;
}

.detail-title:focus {
  outline: none;
}

.detail-status {
  display: grid;
  grid-template-columns: auto minmax(0, 220px);
  align-items: center;
  gap: 8px 12px;
  margin-top: 20px;
  padding: 14px 16px;
  background: #f8f7f3;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.feedback {
  grid-column: 1 / -1;
  min-height: 1.5em;
  margin: 0;
  color: var(--accent);
  font-size: 0.875rem;
  font-weight: 600;
}

.facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 24px;
  margin: 20px 0 0;
}

.facts div {
  min-width: 0;
}

.facts dt {
  color: var(--muted);
  font-size: 0.8125rem;
  font-weight: 600;
}

.facts dd {
  margin: 2px 0 0;
  overflow-wrap: anywhere;
}

.facts-wide {
  grid-column: 1 / -1;
}

.detail-body {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.detail-body p {
  margin: 0 0 14px;
  max-width: 68ch;
}

.detail-body p:last-child {
  margin-bottom: 0;
}

/* Narrow screens */

@media (max-width: 720px) {
  .topbar {
    padding: 16px 16px;
  }

  .workspace {
    padding: 20px 16px 48px;
  }

  .controls {
    grid-template-columns: 1fr;
  }

  .task {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
    padding: 14px 16px;
  }

  .task .status {
    justify-self: start;
  }

  .detail {
    width: 100vw;
    max-width: 100vw;
    height: 100dvh;
    max-height: none;
    margin: 0;
    border-radius: 0;
  }

  .detail-inner {
    padding: 20px 18px 40px;
  }

  .detail-status {
    grid-template-columns: 1fr;
  }

  .facts {
    grid-template-columns: 1fr;
  }
}

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