* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, sans-serif;
  background: #f3f4f6;
  color: #1f2937;
}

.topbar {
  min-height: 90px;
  padding: 20px 30px;
  background: #ffffff;
  border-bottom: 1px solid #e5e7eb;

  display: flex;
  align-items: center;
  justify-content: space-between;
}

.topbar h1 {
  margin: 0;
  font-size: 26px;
}

.topbar p {
  margin: 5px 0 0;
  color: #6b7280;
}

.primary-btn {
  border: none;
  border-radius: 8px;
  padding: 12px 18px;

  background: #2563eb;
  color: white;

  font-size: 15px;
  cursor: pointer;
}

.primary-btn:hover {
  background: #1d4ed8;
}

.board {
  display: flex;
  gap: 20px;

  padding: 25px;

  overflow-x: auto;
  min-height: calc(100vh - 90px);
}

.column {
  flex: 0 0 280px;

  background: #e9edf3;
  border-radius: 12px;

  padding: 14px;

  min-height: 500px;
}

.column-header {
  display: flex;
  align-items: center;
  justify-content: space-between;

  margin-bottom: 15px;
}

.column-header h2 {
  margin: 0;
  font-size: 17px;
}

.task-count {
  display: inline-flex;

  align-items: center;
  justify-content: center;

  min-width: 28px;
  height: 28px;

  padding: 0 8px;

  background: white;

  border-radius: 20px;

  font-size: 13px;
}

.task-list {
  min-height: 400px;
}

.task-card {
  background: white;

  border-radius: 10px;

  padding: 14px;

  margin-bottom: 12px;

  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);

  cursor: grab;
}

.task-card:active {
  cursor: grabbing;
}

.task-card.dragging {
  opacity: 0.5;
}

.task-title {
  margin: 0 0 8px;

  font-size: 16px;
}

.task-description {
  margin: 0 0 12px;

  font-size: 13px;
  color: #6b7280;

  white-space: pre-wrap;
}

.task-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.badge {
  padding: 4px 8px;

  border-radius: 20px;

  font-size: 11px;

  background: #e5e7eb;
}

.priority-low {
  background: #dcfce7;
}

.priority-medium {
  background: #dbeafe;
}

.priority-high {
  background: #ffedd5;
}

.priority-urgent {
  background: #fee2e2;
}

.tags {
  margin-top: 10px;

  display: flex;
  flex-wrap: wrap;

  gap: 5px;
}

.tag {
  background: #ede9fe;

  padding: 4px 8px;

  border-radius: 20px;

  font-size: 11px;
}

.modal {
  position: fixed;

  inset: 0;

  background: rgba(0, 0, 0, 0.45);

  display: flex;

  align-items: center;
  justify-content: center;

  padding: 20px;

  z-index: 1000;
}

.modal.hidden,
.hidden {
  display: none !important;
}

.modal-content {
  width: 100%;
  max-width: 650px;

  max-height: 90vh;

  overflow-y: auto;

  background: white;

  border-radius: 14px;

  padding: 24px;
}

.modal-header {
  display: flex;

  justify-content: space-between;
  align-items: center;

  margin-bottom: 20px;
}

.modal-header h2 {
  margin: 0;
}

.close-btn {
  border: none;

  background: transparent;

  font-size: 30px;

  cursor: pointer;
}

label {
  display: flex;

  flex-direction: column;

  gap: 7px;

  margin-bottom: 16px;

  font-size: 14px;

  font-weight: 600;
}

input,
textarea,
select {
  width: 100%;

  padding: 10px;

  border: 1px solid #d1d5db;

  border-radius: 8px;

  font: inherit;

  font-weight: normal;
}

textarea {
  resize: vertical;
}

.form-row {
  display: grid;

  grid-template-columns: 1fr 1fr;

  gap: 15px;
}

.modal-actions {
  display: flex;

  justify-content: space-between;

  align-items: center;

  margin-top: 25px;
}

.right-actions {
  display: flex;

  gap: 10px;
}

button {
  padding: 10px 16px;

  border: none;

  border-radius: 8px;

  cursor: pointer;

  font-size: 14px;
}

.danger-btn {
  background: #dc2626;
  color: white;
}

.danger-btn:hover {
  background: #b91c1c;
}

.column.drag-over {
  background: #dbeafe;
}

@media (max-width: 700px) {

  .topbar {
    flex-direction: column;

    align-items: flex-start;

    gap: 15px;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .board {
    padding: 15px;
  }

}
/* =========================================================
   АДАПТИВНЫЙ KANBAN
========================================================= */

html,
body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}


/* =========================================================
   ПЛАНШЕТ
========================================================= */

@media (max-width: 1100px) {

  .board {
    gap: 15px;
    padding: 18px;
  }

  .column {
    flex-basis: 270px;
  }

}


/* =========================================================
   ТЕЛЕФОН
========================================================= */

@media (max-width: 768px) {

  .topbar {
    min-height: auto;
    padding: 14px;
    gap: 12px;
    flex-wrap: wrap;
  }

  .topbar h1 {
    font-size: 21px;
  }

  .topbar p {
    font-size: 13px;
  }

  .primary-btn {
    padding: 10px 14px;
    font-size: 14px;
  }


  /*
     Доска остаётся горизонтальной,
     но каждая колонка почти на весь экран.
  */

  .board {

    display: flex;

    flex-direction: row;

    gap: 12px;

    width: 100%;

    min-height: calc(100vh - 120px);

    padding: 12px;

    overflow-x: auto;

    overflow-y: hidden;

    scroll-snap-type: x mandatory;

    -webkit-overflow-scrolling: touch;

  }


  /*
     Одна колонка = почти весь экран телефона.
  */

  .column {

    flex: 0 0 calc(100vw - 24px);

    width: calc(100vw - 24px);

    min-width: calc(100vw - 24px);

    max-width: calc(100vw - 24px);

    min-height: calc(100vh - 150px);

    scroll-snap-align: start;

    padding: 12px;

  }


  .column-header {
    margin-bottom: 12px;
  }


  .column-header h2 {
    font-size: 16px;
  }


  /*
     Карточка полностью помещается
     внутри колонки.
  */

  .task-card {

    width: 100%;

    min-width: 0;

    max-width: 100%;

    padding: 12px;

    margin-bottom: 9px;

    overflow: hidden;

  }


  .task-title {

    font-size: 15px;

    line-height: 1.35;

    word-break: break-word;

  }


  .task-meta {

    display: flex;

    flex-wrap: wrap;

    gap: 5px;

  }


  .tags {

    display: flex;

    flex-wrap: wrap;

    gap: 4px;

  }


  /*
     Модальное окно превращаем
     в нижнюю панель телефона.
  */

  .modal {

    align-items: flex-end;

    padding: 0;

  }


  .modal-content {

    width: 100%;

    max-width: 100%;

    max-height: 94vh;

    margin: 0;

    border-radius: 18px 18px 0 0;

    overflow-y: auto;

  }


  /*
     Поля формы удобны для пальца.
  */

  .modal-content input,
  .modal-content textarea,
  .modal-content select {

    width: 100%;

    font-size: 16px;

  }


  .modal-content textarea {

    min-height: 110px;

  }


  /*
     Кнопки тоже увеличиваем.
  */

  .modal-content button {

    min-height: 42px;

  }


  /*
     Прогресс.
  */

  #progressBox {

    width: 100%;

  }


  .progress-controls {

    gap: 28px;

  }


  .progress-button {

    width: 46px;

    height: 46px;

    min-width: 46px;

    min-height: 46px;

  }

}


/* =========================================================
   МАЛЕНЬКИЙ ТЕЛЕФОН
========================================================= */

@media (max-width: 420px) {

  .topbar {
    padding: 12px;
  }

  .topbar h1 {
    font-size: 19px;
  }

  .topbar p {
    font-size: 12px;
  }


  .board {

    gap: 10px;

    padding: 10px;

  }


  .column {

    flex-basis: calc(100vw - 20px);

    width: calc(100vw - 20px);

    min-width: calc(100vw - 20px);

    padding: 10px;

  }


  .task-card {

    padding: 10px;

  }


  .task-title {

    font-size: 14px;

  }

}


/* =========================================================
   LANDSCAPE
========================================================= */

@media (max-width: 900px) and (orientation: landscape) {

  .column {

    flex-basis: 75vw;

    width: 75vw;

    min-width: 75vw;

  }

}
