:root {
  color-scheme: light;
  --bg: #f8faf9;
  --surface: #ffffff;
  --surface-soft: #f4f8f8;
  --text: #172033;
  --muted: #667085;
  --line: #ccd6df;
  --line-strong: #9fb0bc;
  --teal: #007f89;
  --teal-dark: #00626a;
  --teal-soft: #e7f6f6;
  --red: #df3454;
  --orange: #ff7a1a;
  --amber: #f3bf0b;
  --slate: #98a2b3;
  --shadow: 0 20px 60px rgba(28, 47, 65, 0.08);
  --radius: 8px;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
}

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

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  padding: 28px clamp(16px, 2.4vw, 36px);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 28px;
}

.brand,
.topbar-actions,
.search,
.filters,
.field-row,
.form-actions {
  display: flex;
  align-items: center;
}

.brand {
  gap: 12px;
  margin-right: auto;
}

.brand h1 {
  margin: 0;
  font-size: clamp(1.35rem, 2vw, 1.75rem);
  line-height: 1;
  letter-spacing: 0;
}

.brand-mark,
.avatar {
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  color: #ffffff;
  background: var(--teal);
  font-weight: 800;
}

.brand-mark {
  width: 34px;
  height: 34px;
  font-size: 1.15rem;
}

.avatar {
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
}

.icon-button {
  width: 34px;
  height: 34px;
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  border: 0;
  background: transparent;
  padding: 0;
}

.icon-button span {
  width: 24px;
  height: 2px;
  border-radius: 2px;
  background: var(--text);
}

.topbar-actions {
  gap: 18px;
}

.search {
  width: min(260px, 28vw);
  gap: 8px;
  padding: 9px 12px;
  border: 1px solid transparent;
  border-radius: 999px;
  color: var(--muted);
}

.search:focus-within {
  border-color: var(--line);
  background: #ffffff;
}

.search input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
}

.workspace {
  display: grid;
  gap: 24px;
}

.quick-add-form {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  min-height: 72px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 1px 0 rgba(23, 32, 51, 0.02);
}

.task-input-wrap {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 18px;
  padding: 0 22px;
  color: var(--muted);
}

.task-input-wrap span {
  font-size: 1.9rem;
  line-height: 1;
}

.task-input-wrap input {
  width: 100%;
  border: 0;
  outline: 0;
  color: var(--text);
  font-size: 1.02rem;
}

.quick-add-form button,
.primary-button {
  min-height: 46px;
  border: 0;
  border-radius: 7px;
  padding: 0 20px;
  font-weight: 750;
}

.quick-add-form button {
  margin-right: 12px;
  background: transparent;
  color: var(--muted);
}

.quick-add-form button:hover {
  color: var(--teal);
}

.filters {
  gap: 8px;
  flex-wrap: wrap;
}

.filter-button {
  min-height: 50px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  border-radius: var(--radius);
  padding: 0 20px;
  font-weight: 700;
}

.filter-button.active {
  color: var(--teal-dark);
  border-color: var(--teal);
  background: var(--teal-soft);
}

.filter-button span {
  margin-right: 8px;
}

.task-layout {
  display: grid;
  grid-template-columns: minmax(360px, 0.95fr) minmax(420px, 1fr);
  min-height: 560px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.task-panel,
.detail-panel {
  min-width: 0;
  padding: 24px;
}

.task-panel {
  border-right: 1px solid var(--line);
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
}

.panel-header h2,
.eyebrow {
  margin: 0;
}

.panel-header h2 {
  font-size: 1.25rem;
  letter-spacing: 0;
}

.eyebrow,
label span,
legend {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.count {
  display: inline-grid;
  place-items: center;
  min-width: 34px;
  height: 34px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-weight: 700;
}

.task-list {
  display: grid;
  gap: 8px;
}

.task-item {
  width: 100%;
  min-height: 58px;
  display: grid;
  grid-template-columns: 28px 12px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  padding: 10px 12px;
  color: var(--text);
  text-align: left;
}

.task-item:hover,
.task-item.selected {
  border-color: var(--teal);
  background: var(--surface-soft);
}

.task-item.done .task-title {
  color: var(--muted);
  text-decoration: line-through;
}

.check {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  color: #ffffff;
  background: #ffffff;
  font-weight: 900;
}

.task-item.done .check {
  border-color: var(--teal);
  background: var(--teal);
}

.priority-dot {
  width: 11px;
  height: 11px;
  border-radius: 999px;
  background: var(--slate);
}

.priority-dot.medium {
  background: var(--amber);
}

.priority-dot.high {
  background: var(--orange);
}

.priority-dot.urgent {
  background: var(--red);
}

.task-copy {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.task-title {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 700;
}

.task-notes {
  display: block;
  margin-top: 3px;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.88rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.due {
  color: var(--muted);
  font-size: 0.9rem;
  white-space: nowrap;
}

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

.detail-form {
  display: grid;
  gap: 20px;
}

.detail-form label {
  display: grid;
  gap: 8px;
}

.detail-form input,
.detail-form textarea,
.detail-form select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  color: var(--text);
  outline: 0;
  padding: 14px 16px;
}

.detail-form textarea {
  resize: vertical;
  min-height: 132px;
}

.detail-form input:focus,
.detail-form textarea:focus,
.detail-form select:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(0, 127, 137, 0.12);
}

.field-row {
  gap: 14px;
}

.field-row label {
  flex: 1 1 0;
}

fieldset {
  margin: 0;
  padding: 0;
  border: 0;
}

legend {
  margin-bottom: 8px;
}

.priority-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.priority-choice {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 52px;
  border-right: 1px solid var(--line);
}

.priority-choice:last-child {
  border-right: 0;
}

.priority-choice input {
  width: 12px;
  height: 12px;
  accent-color: var(--teal);
}

.priority-choice span {
  color: var(--text);
  font-size: 0.95rem;
  text-transform: none;
  letter-spacing: 0;
}

.priority-choice:has(input:checked) {
  background: var(--teal-soft);
  box-shadow: inset 0 0 0 1px var(--teal);
}

.form-actions {
  justify-content: space-between;
  gap: 14px;
  margin-top: 20px;
}

.primary-button {
  background: var(--teal);
  color: #ffffff;
  min-width: 160px;
}

.primary-button:hover {
  background: var(--teal-dark);
}

.ghost-button {
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #ffffff;
  color: var(--text);
  padding: 0 18px;
  font-weight: 700;
}

.ghost-button:hover {
  border-color: var(--line-strong);
}

.danger {
  color: #b42318;
}

.close-detail {
  display: none;
  width: 42px;
  padding: 0;
  font-size: 1.8rem;
  line-height: 1;
}

@media (max-width: 920px) {
  .app-shell {
    padding: 18px 12px;
  }

  .topbar {
    gap: 12px;
  }

  .search {
    width: 44px;
    justify-content: center;
  }

  .search input {
    width: 0;
  }

  .task-layout {
    grid-template-columns: 1fr;
  }

  .task-panel {
    border-right: 0;
  }

  .detail-panel {
    border-top: 1px solid var(--line);
  }
}

@media (max-width: 640px) {
  .brand h1 {
    font-size: 1.2rem;
  }

  .avatar {
    width: 38px;
    height: 38px;
    flex-basis: 38px;
  }

  .quick-add-form {
    grid-template-columns: 1fr;
    padding-bottom: 10px;
  }

  .quick-add-form button {
    justify-self: end;
    margin: 0 10px 0 0;
  }

  .filters {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
  }

  .filter-button {
    padding: 0 8px;
  }

  .task-panel,
  .detail-panel {
    padding: 18px 14px;
  }

  .task-item {
    grid-template-columns: 28px 10px minmax(0, 1fr);
  }

  .due {
    grid-column: 3;
    justify-self: start;
  }

  .field-row,
  .form-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .priority-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .priority-choice:nth-child(2) {
    border-right: 0;
  }

  .priority-choice:nth-child(-n + 2) {
    border-bottom: 1px solid var(--line);
  }
}
