:root {
  --paper: #f4f1e8;
  --surface: #fffdf7;
  --ink: #1e1c19;
  --muted: #5b564d;
  --line: #d9d2c3;
  --line-strong: #b4ab98;
  --forest: #1f3d35;
  --forest-2: #2b5247;
  --accent: #2f6b5a;
  --focus: #a2461f;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}

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

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

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  background: var(--paper);
  color: var(--ink);
}

[hidden] {
  display: none !important;
}

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

.skip-link {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 10;
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
}

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

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100dvh;
  padding: 32px 22px;
  display: flex;
  flex-direction: column;
  gap: 28px;
  background: var(--forest);
  color: #efeade;
}

.sidebar :focus-visible {
  outline-color: #f0c08f;
}

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

.mark {
  width: 38px;
  height: 38px;
  flex: none;
}

.brand-name {
  margin: 0;
  font-family: var(--serif);
  font-size: 24px;
  font-weight: 600;
  line-height: 1.1;
  color: #fff;
}

.brand-sub {
  margin: 2px 0 0;
  font-size: 13px;
  opacity: 0.75;
}

.status-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 4px;
}

.status-chip {
  width: 100%;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.status-chip:hover {
  background: rgba(255, 255, 255, 0.08);
}

.status-chip[aria-pressed="true"] {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.24);
  font-weight: 650;
}

.chip-count {
  min-width: 30px;
  padding: 1px 8px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.22);
  font-size: 13px;
  text-align: center;
}

.sidebar-note {
  margin: auto 0 0;
  font-size: 13px;
  opacity: 0.7;
}

.workspace {
  width: 100%;
  max-width: 1040px;
  padding: 40px clamp(20px, 4vw, 56px) 64px;
}

.eyebrow {
  margin: 0 0 6px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}

h1,
h2 {
  font-family: var(--serif);
  font-weight: 600;
  letter-spacing: -0.01em;
}

h1 {
  margin: 0;
  font-size: clamp(32px, 4vw, 42px);
  line-height: 1.1;
}

.result-count {
  margin: 10px 0 24px;
  font-size: 15px;
  color: var(--muted);
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  gap: 14px;
  margin-bottom: 20px;
}

.field label {
  display: block;
  margin-bottom: 6px;
  font-size: 14px;
  font-weight: 600;
}

.field input,
.field select,
.status-select {
  width: 100%;
  min-height: 46px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 16px;
}

.task-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 12px;
}

.item {
  position: relative;
  display: grid;
  gap: 8px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.item:hover {
  border-color: var(--accent);
  box-shadow: 0 4px 16px rgba(30, 28, 25, 0.07);
}

.item-open {
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink);
  font: inherit;
  font-size: 17px;
  font-weight: 650;
  line-height: 1.35;
  text-align: left;
  cursor: pointer;
}

.item-open::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 14px;
}

.item-summary {
  margin: 0;
  font-size: 15px;
  color: var(--muted);
}

.item-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 14px;
  font-size: 14px;
  color: var(--muted);
}

.priority-high {
  color: #7a2414;
  font-weight: 600;
}

.priority-medium {
  color: #5c4200;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px 3px 8px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 650;
  white-space: nowrap;
}

.badge::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}

.badge-todo {
  background: #e4e7ec;
  color: #2f3744;
}

.badge-in-progress {
  background: #f7e6bd;
  color: #5c4200;
}

.badge-blocked {
  background: #f5d3cb;
  color: #7a2414;
}

.badge-done {
  background: #d3eadc;
  color: #1d5136;
}

.empty-state {
  padding: 40px 24px;
  border: 1px dashed var(--line-strong);
  border-radius: 14px;
  background: var(--surface);
  text-align: center;
}

.empty-state h2 {
  margin: 0 0 8px;
  font-size: 22px;
}

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--forest);
  border-radius: 10px;
  background: var(--forest);
  color: #fff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.btn:hover {
  background: var(--forest-2);
}

.btn.secondary {
  border-color: var(--line-strong);
  background: transparent;
  color: var(--ink);
}

.btn.secondary:hover {
  background: var(--paper);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 20;
  max-width: calc(100vw - 32px);
  padding: 12px 18px;
  border-radius: 10px;
  background: var(--forest);
  color: #fff;
  font-size: 15px;
  box-shadow: 0 10px 30px rgba(30, 28, 25, 0.25);
  opacity: 0;
  transform: translate(-50%, 16px);
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.detail {
  position: fixed;
  inset: 0 0 0 auto;
  width: min(620px, 100vw);
  height: 100dvh;
  max-width: 100vw;
  max-height: 100dvh;
  margin: 0;
  padding: 0;
  border: 0;
  background: var(--surface);
  color: var(--ink);
  box-shadow: -16px 0 40px rgba(30, 28, 25, 0.2);
}

.detail[open] {
  display: flex;
  flex-direction: column;
}

.detail::backdrop {
  background: rgba(30, 28, 25, 0.45);
}

.detail-head {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
}

.detail-head .eyebrow {
  margin: 0;
  overflow-wrap: anywhere;
}

.detail-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 28px 28px 40px;
}

.detail h2 {
  margin: 0 0 14px;
  font-size: clamp(24px, 3vw, 30px);
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.detail-status {
  margin: 0 0 22px;
}

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

.facts dt {
  font-size: 13px;
  color: var(--muted);
}

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

.status-panel {
  margin-bottom: 24px;
  padding: 16px 18px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--paper);
}

.status-panel label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
}

.feedback {
  min-height: 1.5em;
  margin: 10px 0 0;
  font-size: 15px;
  color: var(--forest-2);
}

.details h3 {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.task-body {
  white-space: pre-line;
  font-size: 16px;
  line-height: 1.65;
}

@media (max-width: 760px) {
  .app {
    grid-template-columns: minmax(0, 1fr);
  }

  .sidebar {
    position: static;
    height: auto;
    gap: 14px;
    padding: 16px 16px 0;
  }

  .sidebar-note {
    display: none;
  }

  .status-nav ul {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 14px;
    scrollbar-width: none;
  }

  .status-nav li {
    flex: none;
  }

  .status-chip {
    width: auto;
    background: rgba(255, 255, 255, 0.06);
    white-space: nowrap;
  }

  .workspace {
    padding: 24px 16px 56px;
  }

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

  .detail {
    width: 100vw;
  }

  .detail-scroll {
    padding: 22px 20px 32px;
  }

  .facts {
    grid-template-columns: minmax(0, 1fr);
  }
}

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