.tb-page {
  --tb-bg: #1d2125;
  --tb-col: #101204;
  --tb-card: #22272b;
  --tb-card-hover: #282e33;
  --tb-text: #b6c2cf;
  --tb-text-strong: #dee4ea;
  --tb-muted: #8c9bab;
  --tb-line: #38414a;
  --tb-accent: #579dff;
  --tb-green: #4bce97;
  --tb-green-ink: #1d2125;
  --tb-danger: #f87168;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--tb-text);
  min-height: 0;
  padding: 4px 0 0 0;
  display: flex;
  flex-direction: column;
}

.tb-loading { padding: 40px; color: var(--tb-muted); font-size: 16px; }

.tb-top {
  display: flex;
  align-items: baseline;
  gap: 14px;
  padding: 0 18px 14px 4px;
}

.tb-top h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -.01em;
}

.tb-top-stat { font-size: 13px; color: var(--tb-muted); }

.tb-board {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0 18px 18px 0;
  flex: 1;
}

.tb-board::-webkit-scrollbar { height: 12px; }
.tb-board::-webkit-scrollbar-thumb { background: rgba(255,255,255,.22); border-radius: 8px; }
.tb-board::-webkit-scrollbar-track { background: rgba(255,255,255,.06); border-radius: 8px; }

.tb-col {
  flex: 0 0 272px;
  width: 272px;
  max-height: calc(100vh - 200px);
  max-height: calc(100dvh - 200px);
  display: flex;
  flex-direction: column;
  background: var(--tb-col);
  border-radius: 12px;
  box-shadow: 0 1px 1px rgba(0,0,0,.3), 0 0 1px rgba(0,0,0,.3);
}

.tb-col.is-dragging { opacity: .4; }

.tb-col-head {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 8px 6px 16px;
  cursor: grab;
}

.tb-col-title {
  flex: 1;
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--tb-text-strong);
  line-height: 1.3;
  cursor: pointer;
  overflow-wrap: anywhere;
}

.tb-col-title-input {
  flex: 1;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  color: var(--tb-text-strong);
  background: #22272b;
  border: 2px solid var(--tb-accent);
  border-radius: 6px;
  padding: 4px 8px;
  outline: none;
}

.tb-col-count { font-size: 14px; color: var(--tb-muted); }

.tb-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--tb-muted);
  cursor: pointer;
  font-size: 14px;
}

.tb-icon-btn:hover { background: rgba(255,255,255,.09); color: var(--tb-text-strong); }

.tb-cards {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 4px 8px 2px;
  overflow-y: auto;
  min-height: 8px;
}

.tb-cards::-webkit-scrollbar { width: 8px; }
.tb-cards::-webkit-scrollbar-thumb { background: rgba(255,255,255,.18); border-radius: 8px; }

.tb-card {
  position: relative;
  background: var(--tb-card);
  border-radius: 8px;
  padding: 10px 40px 10px 12px;
  box-shadow: 0 1px 1px rgba(0,0,0,.35), 0 0 1px rgba(0,0,0,.35);
  cursor: pointer;
  outline: 2px solid transparent;
  transition: background .12s ease, outline-color .12s ease;
}

.tb-card:hover { background: var(--tb-card-hover); outline-color: var(--tb-accent); }
.tb-card.is-dragging { opacity: .35; }

.tb-card-title {
  font-size: 15px;
  line-height: 1.35;
  color: var(--tb-text-strong);
  overflow-wrap: anywhere;
  transition: padding-left .15s ease;
}

.tb-complete {
  position: absolute;
  left: 10px;
  top: 10px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--tb-muted);
  background: transparent;
  color: transparent;
  font-size: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
  opacity: 0;
  transition: opacity .12s ease;
}

.tb-card:hover .tb-complete { opacity: 1; }
.tb-card:hover .tb-card-title,
.tb-card.is-complete .tb-card-title { padding-left: 28px; }

.tb-card.is-complete .tb-complete {
  opacity: 1;
  border-color: var(--tb-green);
  background: var(--tb-green);
  color: var(--tb-green-ink);
}

.tb-card.is-complete .tb-card-title { color: var(--tb-muted); }

.tb-card-edit {
  position: absolute;
  right: 6px;
  top: 6px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,.08);
  color: var(--tb-text);
  font-size: 12px;
  cursor: pointer;
  opacity: 0;
}

.tb-card:hover .tb-card-edit { opacity: 1; }
.tb-card-edit:hover { background: rgba(255,255,255,.16); }

.tb-badges { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }

.tb-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  color: var(--tb-text);
  padding: 2px 6px;
  border-radius: 4px;
  line-height: 18px;
}

.tb-badge b { font-weight: 400; }

.tb-badge.is-done {
  background: var(--tb-green);
  color: var(--tb-green-ink);
}

.tb-marker {
  flex: 0 0 auto;
  border-radius: 8px;
  background: rgba(255,255,255,.08);
  outline: 2px dashed rgba(255,255,255,.18);
}

.tb-marker-col { flex: 0 0 272px; min-height: 120px; border-radius: 12px; }

.tb-col-foot { padding: 6px 8px 8px; }

.tb-add {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--tb-text);
  font-size: 15px;
  text-align: left;
  cursor: pointer;
}

.tb-add:hover { background: rgba(255,255,255,.09); color: var(--tb-text-strong); }

.tb-newcol { flex: 0 0 272px; }

.tb-add-col {
  background: rgba(255,255,255,.12);
  color: #ffffff;
  border-radius: 12px;
  padding: 12px 14px;
}

.tb-add-col:hover { background: rgba(255,255,255,.2); }

.tb-composer textarea,
.tb-col-composer input,
.tb-item-add textarea,
.tb-item-edit {
  width: 100%;
  font: inherit;
  font-size: 15px;
  color: var(--tb-text-strong);
  background: var(--tb-card);
  border: none;
  border-radius: 8px;
  padding: 8px 12px;
  resize: none;
  outline: none;
  box-shadow: inset 0 0 0 1px var(--tb-line);
}

.tb-composer textarea:focus,
.tb-col-composer input:focus,
.tb-item-add textarea:focus,
.tb-item-edit:focus { box-shadow: inset 0 0 0 2px var(--tb-accent); }

.tb-col-composer {
  background: var(--tb-col);
  border-radius: 12px;
  padding: 8px;
}

.tb-composer-row { display: flex; align-items: center; gap: 6px; margin-top: 8px; }

.tb-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border: none;
  border-radius: 6px;
  background: rgba(255,255,255,.1);
  color: var(--tb-text-strong);
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
}

.tb-btn:hover { background: rgba(255,255,255,.17); }
.tb-btn-primary { background: var(--tb-accent); color: #1d2125; }
.tb-btn-primary:hover { background: #85b8ff; }
.tb-btn-danger { background: var(--tb-danger); color: #1d2125; }
.tb-btn-danger:hover { background: #fd9891; }

.tb-menu {
  position: absolute;
  top: 44px;
  right: 8px;
  z-index: 20;
  width: 240px;
  padding: 6px 0;
  background: #282e33;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,.5);
}

.tb-menu button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 16px;
  border: none;
  background: transparent;
  color: var(--tb-text-strong);
  font: inherit;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
}

.tb-menu button i { width: 14px; color: var(--tb-muted); }
.tb-menu button:hover { background: rgba(255,255,255,.08); }
.tb-menu button.is-danger { color: var(--tb-danger); }
.tb-menu button.is-danger i { color: var(--tb-danger); }

/* ------------------------------ окно карточки ------------------------------ */

.tb-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 48px 20px;
  background: rgba(0,0,0,.64);
  overflow-y: auto;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: #b6c2cf;
  --tb-card: #22272b;
  --tb-text: #b6c2cf;
  --tb-text-strong: #dee4ea;
  --tb-muted: #8c9bab;
  --tb-line: #38414a;
  --tb-accent: #579dff;
  --tb-green: #4bce97;
  --tb-green-ink: #1d2125;
  --tb-danger: #f87168;
}

.tb-modal {
  width: min(1080px, 100%);
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  background: #1d2125;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 24px 64px rgba(0,0,0,.55);
  max-height: calc(100vh - 96px);
  grid-template-rows: minmax(0, 1fr);
}

.tb-modal-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }

.tb-modal-top {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 16px 10px 24px;
  border-bottom: 1px solid #2c333a;
}

.tb-spacer { flex: 1; }

.tb-col-select {
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  color: #dee4ea;
  background: rgba(255,255,255,.1);
  border: none;
  border-radius: 6px;
  padding: 6px 10px;
  cursor: pointer;
}

.tb-modal-scroll { flex: 1 1 auto; min-height: 0; padding: 18px 28px 28px; overflow-y: auto; overscroll-behavior: contain; }

.tb-title-row { display: flex; align-items: flex-start; gap: 12px; }

.tb-complete-lg {
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  margin-top: 8px;
  border-radius: 50%;
  border: 2px solid #8c9bab;
  background: transparent;
  color: transparent;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
}

.tb-complete-lg.is-on { background: #4bce97; border-color: #4bce97; color: #1d2125; }

.tb-title-input {
  flex: 1;
  font: inherit;
  font-size: 26px;
  font-weight: 700;
  line-height: 1.3;
  color: #ffffff;
  background: transparent;
  border: none;
  border-radius: 6px;
  padding: 4px 8px;
  resize: none;
  overflow: hidden;
  outline: none;
}

.tb-title-input:focus { background: #22272b; box-shadow: inset 0 0 0 2px #579dff; }

.tb-sec { margin-top: 26px; }

.tb-sec-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.tb-sec-head > i { width: 24px; text-align: center; color: #b6c2cf; font-size: 17px; }
.tb-sec-head h4 { margin: 0; font-size: 16px; font-weight: 600; color: #dee4ea; }

.tb-desc {
  width: calc(100% - 36px);
  margin-left: 36px;
  min-height: 72px;
  font: inherit;
  font-size: 15px;
  line-height: 1.5;
  color: #dee4ea;
  background: #22272b;
  border: 1px solid #38414a;
  border-radius: 8px;
  padding: 10px 12px;
  resize: none;
  outline: none;
}

.tb-desc:focus { border-color: #579dff; box-shadow: 0 0 0 1px #579dff; }

.tb-progress { display: flex; align-items: center; gap: 12px; margin: 4px 0 10px; }
.tb-pct { width: 24px; font-size: 12px; color: #8c9bab; text-align: right; }

.tb-track {
  flex: 1;
  height: 8px;
  background: #2c333a;
  border-radius: 4px;
  overflow: hidden;
}

.tb-fill {
  height: 100%;
  width: 0;
  background: #579dff;
  border-radius: 4px;
  transition: width .25s ease, background .25s ease;
}

.tb-fill.is-full { background: #4bce97; }

.tb-items { display: flex; flex-direction: column; }

.tb-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 6px 4px;
  border-radius: 8px;
}

.tb-item:hover { background: rgba(255,255,255,.05); }

.tb-cb { flex: 0 0 auto; margin: 2px 0 0; cursor: pointer; position: relative; }
.tb-cb input { position: absolute; opacity: 0; width: 0; height: 0; }

.tb-cb-box {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  border: 2px solid #738496;
  display: flex;
  align-items: center;
  justify-content: center;
  color: transparent;
  font-size: 11px;
  transition: background .12s ease, border-color .12s ease;
}

.tb-cb input:checked + .tb-cb-box { background: #579dff; border-color: #579dff; color: #1d2125; }
.tb-cb input:focus-visible + .tb-cb-box { box-shadow: 0 0 0 2px #85b8ff; }

.tb-item-text {
  flex: 1;
  font-size: 15px;
  line-height: 1.45;
  color: #dee4ea;
  padding: 1px 0;
  cursor: text;
  overflow-wrap: anywhere;
}

.tb-item-sub {
  margin-top: 4px;
  font-size: 13px;
  line-height: 1.5;
  color: #9fadbc;
  white-space: pre-line;
}

.tb-item.is-done .tb-item-text { color: #8c9bab; text-decoration: line-through; }
.tb-item.is-done .tb-item-sub { color: #738496; }

.tb-item-edit { flex: 1; }

.tb-item-del { opacity: 0; width: 28px; height: 28px; }
.tb-item:hover .tb-item-del { opacity: 1; }

.tb-item-add { margin: 8px 0 0 36px; }

.tb-modal-side {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: #161a1d;
  border-left: 1px solid #2c333a;
  padding: 18px 18px 0;
}

.tb-side-head .tb-btn { height: 30px; font-size: 13px; }

.tb-comment { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; margin-bottom: 14px; }

.tb-comment-input {
  width: 100%;
  font: inherit;
  font-size: 14px;
  color: #dee4ea;
  background: #22272b;
  border: 1px solid #38414a;
  border-radius: 8px;
  padding: 9px 12px;
  resize: none;
  outline: none;
  min-height: 40px;
}

.tb-comment-input:focus { border-color: #579dff; }

.tb-feed { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding-bottom: 18px; }

.tb-feed-empty { color: #8c9bab; font-size: 14px; padding: 8px 0; }

.tb-note { display: flex; gap: 10px; padding: 8px 0; }

.tb-ava {
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #1d7afc;
  color: #ffffff;
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tb-note-body { min-width: 0; flex: 1; }

.tb-note-line { font-size: 14px; line-height: 1.45; color: #b6c2cf; overflow-wrap: anywhere; }
.tb-note-line b { color: #dee4ea; font-weight: 600; }

.tb-bubble {
  margin-top: 4px;
  font-size: 14px;
  line-height: 1.45;
  color: #dee4ea;
  background: #22272b;
  border-radius: 8px;
  padding: 8px 12px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.tb-note-date { margin-top: 3px; font-size: 12px; color: #579dff; text-decoration: underline; text-underline-offset: 2px; }

.tb-overlay-confirm { align-items: center; }

.tb-confirm {
  width: min(420px, 100%);
  background: #282e33;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 24px 64px rgba(0,0,0,.55);
}

.tb-confirm p { margin: 0 0 8px; font-size: 15px; color: #dee4ea; line-height: 1.45; }

@media (max-width: 860px) {
  .tb-modal { grid-template-columns: 1fr; grid-template-rows: auto; max-height: none; }
  .tb-modal-side { border-left: none; border-top: 1px solid #2c333a; }
  .tb-overlay { padding: 12px; }
  .tb-modal-scroll { padding: 16px; }
  .tb-desc, .tb-item-add { margin-left: 0; width: 100%; }
}

@media (max-width: 600px) {
  .tb-page { padding: 0; }
  .tb-col, .tb-newcol, .tb-marker-col { flex-basis: 84vw; width: 84vw; }
}

.tb-cards,
.tb-board,
.tb-feed,
.tb-modal-scroll {
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.2) transparent;
}

.tb-cards::-webkit-scrollbar-track,
.tb-feed::-webkit-scrollbar-track,
.tb-modal-scroll::-webkit-scrollbar-track {
  background: transparent;
}


/* ------------------------------ Каравай: метки, ответственные, поля карточки ------------------------------ */

.tb-labels { display: flex; flex-wrap: wrap; gap: 4px; margin: -2px 0 6px; }

.tb-label {
  display: inline-flex;
  align-items: center;
  height: 18px;
  padding: 0 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  color: #1d2125;
  background: var(--lbl, #8c9bab);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tb-card:hover .tb-labels,
.tb-card.is-complete .tb-labels { padding-left: 28px; }

.tb-ava-sm {
  margin-left: auto;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: #1d2125;
  background: var(--ava, #8c9bab);
}

.tb-card .tb-badges { align-items: center; }

.tb-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  margin: 14px 0 0 38px;
}

.tb-field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.tb-field > span { font-size: 12px; font-weight: 600; color: #8c9bab; }

.tb-field select {
  font: inherit;
  font-size: 14px;
  color: #dee4ea;
  background: rgba(255,255,255,.1);
  border: none;
  border-radius: 6px;
  padding: 6px 10px;
  cursor: pointer;
  max-width: 100%;
}

.tb-field select:focus-visible,
.tb-col-select:focus-visible { outline: 2px solid #579dff; outline-offset: 1px; }


@media (max-width: 860px) {
  .tb-fields { margin-left: 0; }
}

@media (hover: none) {
  .tb-complete, .tb-card-edit, .tb-item-del { opacity: 1; }
  .tb-card .tb-card-title, .tb-card .tb-labels { padding-left: 28px; }
}

.tb-sec-head { flex-wrap: wrap; row-gap: 8px; }
.tb-sec-head h4 { white-space: nowrap; }

@media (max-width: 600px) {
  .tb-sec-head .tb-spacer { flex-basis: 100%; height: 0; }
  .tb-side-head .tb-spacer { flex-basis: auto; }
}
