/* ============================================================
   Topbar
   ============================================================ */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  background: var(--header-bg);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
  z-index: 10;
  transition: background var(--speed) ease, border-color var(--speed) ease;
}

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

.brand { display: flex; align-items: center; gap: 10px; }

.brand__dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
  transition: background var(--speed) ease, box-shadow var(--speed) ease;
}

.brand__title {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

/* ============================================================
   Кнопка темы
   ============================================================ */

.theme-btn {
  position: relative;
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--speed), color var(--speed);
}
.theme-btn:hover { background: var(--overlay); color: var(--text); }

.theme-btn__icon {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  line-height: 1;
  transition: opacity var(--speed) ease, transform var(--speed) ease;
}
.theme-btn__icon--moon { opacity: 0; transform: rotate(-30deg); }

[data-theme="dark"] .theme-btn__icon--sun  { opacity: 0; transform: rotate(30deg); }
[data-theme="dark"] .theme-btn__icon--moon { opacity: 1; transform: rotate(0); }

/* ============================================================
   Status
   ============================================================ */

.status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.status__dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--text-soft);
  box-shadow: 0 0 0 3px rgba(0,0,0,0);
  transition: background var(--speed), box-shadow var(--speed);
}
.status.online  .status__dot { background: var(--ok);     box-shadow: 0 0 0 3px rgba(34,197,94,.15); }
.status.offline .status__dot { background: var(--danger); box-shadow: 0 0 0 3px rgba(239,68,68,.15); }

/* ============================================================
   Board
   ============================================================ */

.board {
  flex: 1;
  display: flex;
  gap: 14px;
  padding: 20px 24px;
  overflow-x: auto;
  overflow-y: hidden;
  align-items: flex-start;
}

.board::-webkit-scrollbar { height: 10px; }
.board::-webkit-scrollbar-thumb {
  background: var(--scrollbar);
  border-radius: 10px;
  border: 3px solid var(--bg);
}

/* ============================================================
   List
   ============================================================ */

.list {
  width: 284px;
  min-width: 284px;
  max-height: 100%;
  background: var(--surface-2);
  border-radius: var(--radius);
  padding: 10px;
  display: flex;
  flex-direction: column;
  transition: background var(--speed) ease, box-shadow var(--speed) ease;
}

.list__header {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 2px 2px 8px;
}

.list__title {
  flex: 1;
  min-width: 0;
  padding: 5px 8px;
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  outline: none;
  transition: background var(--speed), border-color var(--speed), box-shadow var(--speed);
}
.list__title:hover { background: var(--overlay-strong); }
.list__title:focus {
  background: var(--input-bg);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.list__count {
  font-size: 12px;
  color: var(--text-soft);
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--overlay-soft);
  font-variant-numeric: tabular-nums;
}

.list__cards {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 2px;
  flex: 1;
  min-height: 12px;
  border-radius: var(--radius-sm);
  transition: background var(--speed);
}
.list__cards::-webkit-scrollbar { width: 8px; }
.list__cards::-webkit-scrollbar-thumb {
  background: var(--scrollbar-soft);
  border-radius: 8px;
}

.list__empty {
  padding: 12px 10px;
  font-size: 12.5px;
  color: var(--text-soft);
  text-align: center;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  transition: border-color var(--speed) ease, color var(--speed) ease;
}

/* ============================================================
   Card
   ============================================================ */

.card {
  background: var(--surface);
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13.5px;
  line-height: 1.45;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: flex-start;
  gap: 6px;
  cursor: grab;
  transition: box-shadow var(--speed), transform var(--speed),
              border-color var(--speed), background var(--speed);
}
.card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--border);
  transform: translateY(-1px);
}
.card:active { cursor: grabbing; }

.card__text {
  flex: 1;
  min-width: 0;
  outline: none;
  border-radius: 4px;
  cursor: text;
  white-space: pre-wrap;
  word-break: break-word;
}
.card__text[contenteditable="true"] {
  background: var(--input-bg);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* ============================================================
   Иконки-кнопки (×)
   ============================================================ */

.icon-btn {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  padding: 0;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity var(--speed), background var(--speed), color var(--speed);
}
.list__header:hover .icon-btn,
.card:hover .icon-btn { opacity: 1; }
.icon-btn:hover { background: var(--overlay); color: var(--danger); }

/* ============================================================
   Add card / add list
   ============================================================ */

.add-card {
  margin-top: 6px;
  padding: 8px 10px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 13px;
  text-align: left;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--speed), color var(--speed);
}
.add-card:hover { background: var(--add-card-hover); color: var(--text); }

.add-list {
  min-width: 284px;
  padding: 18px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  background: var(--add-list-bg);
  color: var(--text-muted);
  font: inherit;
  font-size: 13.5px;
  cursor: pointer;
  transition: background var(--speed), color var(--speed), border-color var(--speed);
}
.add-list:hover {
  background: var(--surface);
  color: var(--text);
  border-color: var(--accent);
  box-shadow: var(--shadow-sm);
}

/* ============================================================
   Инлайн-формы
   ============================================================ */

.inline-form {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 6px;
}
.inline-form--list {
  min-width: 284px;
  padding: 10px;
  background: var(--surface-2);
  border-radius: var(--radius);
  margin-top: 0;
}

.inline-form textarea,
.inline-form input {
  width: 100%;
  padding: 9px 10px;
  font: inherit;
  font-size: 13.5px;
  line-height: 1.4;
  color: var(--text);
  background: var(--input-bg);
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  outline: none;
  resize: none;
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.inline-form__actions { display: flex; gap: 6px; }

.btn {
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background var(--speed), color var(--speed);
}
.btn--primary { background: var(--accent); color: #fff; }
.btn--primary:hover { background: var(--accent-hover); }
.btn--ghost { background: transparent; color: var(--text-muted); }
.btn--ghost:hover { background: var(--overlay); color: var(--text); }

/* ============================================================
   Drag & drop
   ============================================================ */

.list__grip {
  flex-shrink: 0;
  padding: 4px 2px;
  font-size: 14px;
  line-height: 1;
  color: var(--text-muted);
  cursor: grab;
  user-select: none;
  opacity: 0;
  transition: opacity var(--speed), color var(--speed);
}
.list__header:hover .list__grip { opacity: 1; }
.list__grip:hover { color: var(--text); }
.list__grip:active { cursor: grabbing; }

.card.dragging { opacity: 0.35; transform: rotate(1.5deg); }
.list.dragging { opacity: 0.4; }

.list.drop-target {
  background: var(--drop-bg);
  box-shadow: 0 0 0 2px var(--accent) inset;
}

.list__cards.drop-target {
  background: var(--drop-bg-soft);
  outline: 1.5px dashed var(--drop-outline);
  outline-offset: -2px;
}

/* ========== Бренд-ссылка на главной/доске ========== */

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  text-decoration: none;
}
a.brand:hover .brand__title { color: var(--accent); }

.brand__title { transition: color var(--speed); }

.board-error {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  text-align: center;
  color: var(--text-muted);
  padding: 40px;
}
.board-error h2 {
  margin: 0;
  font-size: 20px;
  color: var(--text);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

/* ========== Скелетоны ========== */

.list--skeleton { pointer-events: none; }

.skeleton {
  border-radius: var(--radius-sm);
  background: linear-gradient(
    90deg,
    var(--overlay-soft) 0%,
    var(--overlay)      50%,
    var(--overlay-soft) 100%
  );
  background-size: 200% 100%;
  animation: skeleton-pulse 1.4s ease-in-out infinite;
}

.skeleton--title { height: 22px; width: 60%; margin-bottom: 12px; }
.skeleton--card  { height: 42px; margin-bottom: 8px; }

@keyframes skeleton-pulse {
  0%   { background-position:  200% 0; }
  100% { background-position: -200% 0; }
}

/* ========== Анимация появления карточки ========== */

@keyframes card-enter {
  from { opacity: 0; transform: translateY(-6px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0)    scale(1); }
}
.card--enter { animation: card-enter 180ms ease-out; }

/* ========== Подсветка поиска ========== */

.card--found {
  box-shadow: 0 0 0 2px var(--accent), var(--shadow-md);
  border-color: var(--accent);
}

/* ========== Бренд как ссылка ========== */

a.brand { color: inherit; text-decoration: none; }
a.brand:hover .brand__title { color: var(--accent); }
.brand__title { transition: color var(--speed); }

/* ========== 404-страница доски ========== */

.board-error {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  text-align: center;
  color: var(--text-muted);
  padding: 40px;
}
.board-error h2 {
  margin: 0;
  font-size: 20px;
  color: var(--text);
}
.board-error .btn { text-decoration: none; }

/* ========== Уважение к reduced motion ========== */

@media (prefers-reduced-motion: reduce) {
  .skeleton,
  .card--enter { animation: none; }
}

/* ============================================================
   Топбар: хлебные крошки
   ============================================================ */

.topbar__left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.topbar__sep {
  color: var(--text-soft);
  font-size: 14px;
  user-select: none;
  flex-shrink: 0;
}

.topbar__current {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  letter-spacing: -0.01em;
}

.topbar__actions {
  display: flex;
  gap: 6px;
  margin-left: 12px;
}

.btn--danger {
  color: var(--danger) !important;
}
.btn--danger:hover {
  background: rgba(239, 68, 68, 0.08) !important;
}

.invite__actions {
  display: flex;
  gap: 6px;
}