:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-width: 320px;
  min-height: 100%;
  margin: 0;
  color: #151515;
  background: #ffffff;
}

.page-header {
  position: sticky;
  top: 0;
  z-index: 10;
  padding: 14px clamp(16px, 4vw, 56px);
  border-bottom: 1px solid #dedede;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
}

.page-header__inner,
.role-board {
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
}

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

.role-picker__label {
  color: #6b6b6b;
  font-size: 0.9375rem;
  font-weight: 650;
}

.role-picker__control {
  position: relative;
  display: inline-flex;
}

.role-picker__control::after {
  position: absolute;
  top: 50%;
  right: 16px;
  width: 8px;
  height: 8px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  content: "";
  pointer-events: none;
  transform: translateY(-70%) rotate(45deg);
}

.role-picker select {
  min-width: 240px;
  max-width: 100%;
  padding: 10px 44px 10px 14px;
  border: 1px solid #1b1b1b;
  border-radius: 10px;
  color: #151515;
  background: #ffffff;
  font: inherit;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  appearance: none;
}

.role-picker select:hover {
  background: #f5f5f5;
}

.role-picker select:focus-visible {
  outline: 2px solid #1b1b1b;
  outline-offset: 2px;
}

.role-picker select:disabled {
  border-color: #cfcfcf;
  color: #8a8a8a;
  cursor: default;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 760;
  letter-spacing: -0.045em;
  line-height: 1;
}

main {
  padding: 32px clamp(16px, 4vw, 56px) 64px;
}

.role-board {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

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

.role-board__count {
  margin: 0;
  color: #7a7a7a;
  font-size: 0.9375rem;
}

.task-empty {
  margin: 0;
  padding: 32px 16px;
  color: #8a8a8a;
  text-align: center;
}

/* Задачи */

.task-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.task-list:empty {
  display: none;
}

.task-card {
  position: relative;
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 16px;
  padding: 18px;
  border: 1px solid #e2e2e2;
  border-radius: 12px;
  background: #ffffff;
  overflow-wrap: break-word;
  cursor: pointer;
  transition: border-color 120ms, box-shadow 120ms;
}

.task-card.is-new {
  animation: task-in 160ms ease-out;
}

.task-card:hover {
  border-color: #1b1b1b;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
}

.task-card:focus-visible {
  outline: 2px solid #1b1b1b;
  outline-offset: 2px;
}

@keyframes task-in {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
}

.task-card__num {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 50%;
  color: #ffffff;
  background: #151515;
  font-size: 0.8125rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.task-card__body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.task-card__title {
  margin: 0;
  padding: 5px 28px 0 0;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.35;
  white-space: pre-line;
}

.task-card__meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
}

.task-card__field {
  padding: 8px 12px;
  border-radius: 8px;
  background: #f4f4f4;
}

.task-card__field dt {
  margin-bottom: 2px;
  color: #7a7a7a;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.task-card__field dd {
  margin: 0;
  color: #151515;
  font-size: 0.875rem;
  font-weight: 550;
  line-height: 1.35;
}

.task-card__field dd.is-empty {
  color: #a8a8a8;
  font-weight: 400;
}

.task-card__remove {
  position: absolute;
  top: 10px;
  right: 10px;
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 6px;
  color: #8a8a8a;
  background: transparent;
  font-size: 1.125rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  transition: opacity 120ms, background-color 120ms, color 120ms;
}

.task-card:hover .task-card__remove,
.task-card__remove:focus-visible {
  opacity: 1;
}

.task-card__remove:hover {
  color: #151515;
  background: #ececec;
}

@media (hover: none) {
  .task-card__remove {
    opacity: 1;
  }
}

.add-task {
  width: 100%;
  padding: 16px;
  border: 1px dashed #b9b9b9;
  border-radius: 10px;
  color: #444444;
  background: transparent;
  font: inherit;
  font-size: 1rem;
  font-weight: 650;
  cursor: pointer;
  transition: border-color 120ms, color 120ms, background-color 120ms;
}

.add-task:hover {
  border-color: #1b1b1b;
  color: #151515;
  background: #f5f5f5;
}

button:focus-visible {
  outline: 2px solid #1b1b1b;
  outline-offset: 2px;
}

/* Модалка */

.task-dialog {
  width: min(520px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  padding: 0;
  border: 0;
  border-radius: 24px;
  color: #151515;
  background: #ffffff;
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.04),
    0 32px 80px rgba(0, 0, 0, 0.28);
}

.task-dialog::backdrop {
  background: rgba(15, 15, 15, 0.5);
  backdrop-filter: blur(6px);
}

.task-dialog[open] {
  animation: dialog-in 220ms cubic-bezier(0.2, 0.9, 0.3, 1.15);
}

@keyframes dialog-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.96);
  }
}

.task-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 28px;
}

.task-form__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.task-form__head h2 {
  margin: 0;
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.1;
}

.task-form__role {
  display: inline-block;
  margin: 0 0 10px;
  padding: 5px 11px;
  border-radius: 999px;
  color: #ffffff;
  background: #151515;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.task-form__close {
  display: grid;
  flex: none;
  width: 40px;
  height: 40px;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: #151515;
  background: #f1f1f1;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  transition: background-color 150ms, transform 150ms;
}

.task-form__close:hover {
  background: #e4e4e4;
  transform: rotate(90deg);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field__label {
  font-size: 0.875rem;
  font-weight: 800;
}

.field__note {
  color: #8a8a8a;
  font-weight: 500;
}

.field input,
.field textarea {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid transparent;
  border-radius: 14px;
  color: inherit;
  background: #f1f1f1;
  font: inherit;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.4;
  transition: border-color 120ms, background-color 120ms, box-shadow 120ms;
}

.field input::placeholder,
.field textarea::placeholder {
  color: #a3a3a3;
  font-weight: 500;
}

.field textarea {
  min-height: 100px;
  resize: none;
}

.field input:hover,
.field textarea:hover {
  background: #eaeaea;
}

.field input:focus,
.field textarea:focus {
  border-color: #151515;
  outline: none;
  background: #ffffff;
  box-shadow: 0 0 0 4px rgba(21, 21, 21, 0.08);
}

.field__error {
  display: none;
  color: #d92d20;
  font-size: 0.8125rem;
  font-weight: 600;
}

.field--invalid input,
.field--invalid textarea,
.field--invalid input:focus,
.field--invalid textarea:focus {
  border-color: #d92d20;
  background: #fff5f4;
  box-shadow: 0 0 0 4px rgba(217, 45, 32, 0.12);
}

.field--invalid .field__error {
  display: block;
}

.task-form__actions {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 10px;
  margin-top: 4px;
}

.button {
  padding: 15px 20px;
  border: 0;
  border-radius: 14px;
  font: inherit;
  font-size: 1rem;
  font-weight: 750;
  cursor: pointer;
  transition: background-color 120ms, transform 80ms;
}

.button:active {
  transform: scale(0.98);
}

.button--ghost {
  color: #151515;
  background: #f1f1f1;
}

.button--ghost:hover {
  background: #e4e4e4;
}

.button--primary {
  color: #ffffff;
  background: #151515;
}

.button--primary:hover {
  background: #333333;
}

@media (max-width: 720px) {
  main {
    padding-top: 20px;
  }

  .role-picker {
    justify-content: space-between;
  }

  .role-picker__control {
    flex: 1;
  }

  .role-picker select {
    width: 100%;
    min-width: 0;
  }

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

  .task-card__num {
    width: 28px;
    height: 28px;
  }

  .task-card__title {
    padding-top: 3px;
    padding-right: 24px;
  }

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

  .task-form {
    gap: 16px;
    padding: 20px;
  }

  .task-form__head h2 {
    font-size: 1.5rem;
  }
}
