/* Канбан для разработчика */
.kb {
  display: flex;
  gap: 12px;
  height: 100%;
  min-height: 0;
}

.kb__main {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
  min-width: 0;
  min-height: 0;
}

.kb__bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.kb__spacer {
  flex: 1;
}

/* сайдбар проектов */
.kb__side {
  width: 200px;
  flex: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
}

.kb__side-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.kb__side-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.kb__boards {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  min-height: 0;
  flex: 1;
  max-height: calc(100vh - 320px);
}

.kb__item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.kb__item-row {
  display: flex;
  align-items: center;
  gap: 4px;
}

.kb__item-btn {
  flex: 1;
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
}

.kb__item-btn:hover {
  filter: brightness(1.15);
}

.kb__item--active .kb__item-btn {
  outline: 1px solid var(--accent-border);
}

.kb__item-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: none;
}

.kb__item-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kb__item-flag {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-faint);
  width: 24px;
  height: 24px;
  font-size: 12px;
  cursor: pointer;
  flex: none;
  padding: 0;
}

.kb__item-flag--on {
  color: #facc15;
  border-color: rgba(250, 204, 21, 0.5);
  background: rgba(250, 204, 21, 0.12);
}

.kb__item-status {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 11px;
  padding: 4px 6px;
}

.kb__item-warn {
  font-size: 11px;
  color: #facc15;
  padding: 0 2px;
}

.kb__tab-del {
  background: none;
  border: none;
  color: var(--text-faint);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
  flex: none;
}

.kb__tab-del:hover {
  color: #f87171;
}

.kb__board {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  align-items: start;
  flex: 1;
  min-height: 0;
}

.kb__col {
  display: flex;
  flex-direction: column;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
  min-height: 160px;
  max-height: 100%;
  overflow: hidden;
  transition: border-color 120ms;
}

.kb__col--over {
  border-color: var(--colc, var(--accent-border));
  box-shadow: 0 0 0 1px var(--colc, var(--accent-border)) inset;
}

.kb__col-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}

.kb__col-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.kb__col-count {
  font-size: 11px;
  color: var(--text-faint);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1px 7px;
}

.kb__col-add {
  margin-left: auto;
}

.kb__cards {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  overflow-y: auto;
  flex: 1;
  min-height: 60px;
  max-height: calc(100vh - 340px);
}

.kb__empty {
  text-align: center;
  color: var(--text-faint);
  font-size: 12px;
  padding: 18px 0;
  border: 1px dashed var(--border);
  border-radius: 8px;
}

.kb__card {
  display: flex;
  flex: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  cursor: grab;
}

.kb__card:active {
  cursor: grabbing;
}

.kb__card--drag {
  opacity: 0.4;
}

.kb__card-bar {
  width: 4px;
  flex: none;
}

.kb__card-body {
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  flex: 1;
}

.kb__card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  word-break: break-word;
}

.kb__card-desc {
  font-size: 12px;
  color: var(--text-muted);
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  white-space: pre-wrap;
}

.kb__card-foot {
  display: flex;
  align-items: center;
  gap: 8px;
}

.kb__badge {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  border: 1px solid;
  border-radius: 4px;
  padding: 1px 6px;
}

.kb__date {
  font-size: 11px;
  color: var(--text-faint);
}

.kb__card-btns {
  margin-left: auto;
  display: inline-flex;
  gap: 2px;
  opacity: 0;
  transition: opacity 120ms;
}

.kb__card:hover .kb__card-btns,
.kb__card-btns:focus-within {
  opacity: 1;
}

.kb__mini {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 13px;
  width: 22px;
  height: 22px;
  border-radius: 5px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.kb__mini:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.kb__mini--del:hover {
  color: #f87171;
}

/* модалка */
.kb__modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
}

.kb__modal[hidden] {
  display: none;
}

.kb__modal-card {
  width: min(420px, 92vw);
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.kb__modal-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.kb__files {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 140px;
  overflow-y: auto;
}

.kb__files-empty {
  font-size: 12px;
  color: var(--text-faint);
}

.kb__file {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 8px;
}

.kb__file--new {
  border-style: dashed;
}

.kb__file-name {
  background: none;
  border: none;
  color: var(--accent-2);
  font-size: 12px;
  cursor: pointer;
  padding: 0;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
}

.kb__file--new .kb__file-name {
  color: var(--text-muted);
  cursor: default;
}

.kb__file-size {
  font-size: 11px;
  color: var(--text-faint);
  flex: none;
}

.kb__clip {
  font-size: 11px;
  color: var(--text-muted);
}

.kb__card-files {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.kb__card-file {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 2px 7px;
  font-size: 11px;
  color: var(--text-muted);
  cursor: pointer;
  text-align: left;
  min-width: 0;
}

.kb__card-file:hover {
  filter: brightness(1.2);
}

.kb__card-file-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex: none;
}

.kb__card-file-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kb__card-file-more {
  font-size: 10px;
  color: var(--text-faint);
  padding-left: 4px;
}

/* чеклист на карточке */
.kb__check {
  display: flex;
  flex-direction: column;
  gap: 2px;
  border-top: 1px dashed var(--border);
  padding-top: 5px;
}

.kb__check-prog {
  font-size: 10px;
  color: var(--text-faint);
}

.kb__check-item {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--text);
  cursor: pointer;
  min-width: 0;
}

.kb__check-item input {
  margin: 0;
  accent-color: #4ade80;
  flex: none;
}

.kb__check-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kb__check-text--done {
  text-decoration: line-through;
  color: var(--text-faint);
}

/* чеклист в модалке */
.kb__mcheck {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 160px;
  overflow-y: auto;
}

.kb__check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 12px;
}

.kb__check-row input {
  accent-color: #4ade80;
  flex: none;
}

.kb__check-row .kb__check-text {
  flex: 1;
}

.kb__modal-label .input {
  flex: 1;
  min-width: 0;
  font-size: 12px;
  padding: 4px 8px;
}

.kb__file-thumb {
  width: 34px;
  height: 34px;
  object-fit: cover;
  border-radius: 4px;
  flex: none;
  background: var(--bg);
}

.kb__modal-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
}

.kb__modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

@media (max-width: 900px) {
  .kb__board {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 560px) {
  .kb {
    flex-direction: column;
  }
  .kb__side {
    width: auto;
  }
  .kb__boards {
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
    max-height: 130px;
  }
  .kb__item {
    min-width: 170px;
  }
  .kb__board {
    grid-template-columns: 1fr;
  }
  .kb__card-btns {
    opacity: 1;
  }
}

.kb__name-dialog { color: var(--text); background: var(--surface); border: 1px solid var(--border-strong); max-width: calc(100vw - 32px); }
.kb__name-dialog::backdrop { background: rgb(0 0 0 / .65); }
