.tk {
  padding-block: var(--space-7) var(--space-8);
}

.tk__grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(280px, 0.78fr);
  gap: var(--space-7);
  align-items: start;
}

.tk__main {
  min-width: 0;
}

.tk__main h1,
.tk-chat__top h1 {
  margin-bottom: var(--space-2);
  font-size: var(--text-2xl);
  letter-spacing: -0.03em;
  overflow-wrap: anywhere;
}

.tk__lead {
  margin-bottom: var(--space-6);
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}

.tk-chat__top .tk__lead {
  margin-bottom: var(--space-5);
}

.tk__lead a {
  color: var(--color-accent-pink-soft);
}

.tk-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  min-width: 0;
}

.tk-form .field {
  min-width: 0;
}

.tk-form label {
  color: var(--color-text-muted);
}

.tk-req {
  color: var(--color-danger);
}

.tk-ico {
  position: relative;
}

.tk-ico .input {
  padding-left: 44px;
}

.tk-ico svg {
  position: absolute;
  left: 14px;
  top: 50%;
  width: 16px;
  height: 16px;
  transform: translateY(-50%);
  color: var(--color-text-muted);
  pointer-events: none;
}

.tk-ico--area svg {
  top: 18px;
  transform: none;
}

.tk-area {
  min-height: 128px;
  resize: vertical;
  line-height: 1.5;
}

.tk-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
  min-width: 0;
}

.tk-select {
  appearance: none;
  background-image: url('../img/icons/chevron-down.svg');
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 18px;
  padding-right: 40px;
}

.tk-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
  margin-top: var(--space-2);
}

.tk-clip {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border: 1px solid var(--color-line);
  border-radius: var(--radius-full);
  background: var(--color-surface);
  color: var(--color-text-soft);
}

.tk-clip:hover {
  border-color: var(--color-line-strong);
  color: var(--color-text);
}

.tk-clip svg {
  width: 18px;
  height: 18px;
}

.tk-file {
  color: var(--color-text-muted);
  font-size: var(--text-xs);
  overflow-wrap: anywhere;
}

.tk-side {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  min-width: 0;
  position: sticky;
  top: calc(var(--header-h) + 20px);
}

.tk-shot {
  position: relative;
  overflow: hidden;
  min-height: 280px;
  border-radius: var(--radius-l);
  border: 1px solid var(--color-line);
  background: var(--color-bg-deep);
  color: var(--color-text);
}

.tk-shot:hover {
  text-decoration: none;
  color: var(--color-text);
}

.tk-shot picture,
.tk-shot img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 58% 40%;
}

.tk-shot__dim {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(5, 4, 6, 0.12) 20%, rgba(5, 4, 6, 0.82) 100%);
}

.tk-shot__arr {
  position: absolute;
  top: 18px;
  left: 18px;
  z-index: 1;
  width: 28px;
  height: 28px;
  color: #fff;
}

.tk-shot__copy {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: var(--space-2);
  min-height: 280px;
  padding: var(--space-5);
}

.tk-shot__copy strong {
  max-width: 18ch;
  font-size: var(--text-lg);
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.tk-shot__copy span {
  color: var(--color-text-soft);
  font-size: var(--text-sm);
  overflow-wrap: anywhere;
}

.tk-hours {
  display: flex;
  gap: var(--space-3);
  align-items: flex-start;
  padding: var(--space-4) var(--space-5);
  border: 1px solid var(--color-line);
  border-radius: var(--radius-l);
  background: var(--color-surface);
}

.tk-hours svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  margin-top: 1px;
  color: var(--color-text-muted);
}

.tk-hours p {
  margin: 0;
  max-width: none;
  color: var(--color-text-soft);
  font-size: var(--text-sm);
}

.tk-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  min-width: 0;
}

.tk-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  width: 100%;
  min-width: 0;
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--color-line);
  border-radius: var(--radius-m);
  background: var(--color-bg-deep);
  color: inherit;
  text-align: left;
}

.tk-item:hover {
  border-color: var(--color-accent-pink);
  text-decoration: none;
  color: inherit;
}

.tk-item strong {
  display: block;
  font-size: var(--text-sm);
  overflow-wrap: anywhere;
}

.tk-item small {
  display: block;
  color: var(--color-text-muted);
  font-size: var(--text-xs);
}

.tk-st {
  flex-shrink: 0;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  background: rgba(110, 231, 183, 0.12);
  color: var(--color-mint);
  font-size: var(--text-xs);
  white-space: nowrap;
}

.tk-st--wait {
  background: rgba(252, 211, 77, 0.1);
  color: var(--color-accent-gold);
}

.tk-st--off {
  background: rgba(167, 156, 162, 0.12);
  color: var(--color-text-muted);
}

.tk-item .tk-st {
  margin-left: auto;
}

.tk-chat {
  min-width: 0;
}

.tk-chat__grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 340px);
  gap: var(--space-5);
  align-items: stretch;
}

.tk-pane {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 480px;
  padding: var(--space-5);
  border: 2px solid var(--color-line);
  border-radius: var(--radius-l);
  background: var(--color-bg-deep);
}

.tk-feed {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  padding-bottom: var(--space-4);
}

.tk-post {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  gap: var(--space-3);
  min-width: 0;
}

.tk-ava {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--color-surface-2);
  color: var(--color-text-muted);
}

.tk-ava svg {
  width: 18px;
  height: 18px;
}

.tk-post__who {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}

.tk-post__who strong {
  font-size: var(--text-sm);
  overflow-wrap: anywhere;
}

.tk-badge {
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: var(--color-surface-2);
  color: var(--color-text-muted);
  font-size: 11px;
  font-weight: 500;
}

.tk-badge--me {
  background: rgba(110, 231, 183, 0.14);
  color: var(--color-mint);
}

.tk-bubble {
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--color-line);
  border-radius: 14px;
  background: var(--color-surface);
  color: var(--color-text-soft);
  font-size: var(--text-sm);
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.tk-bubble textarea {
  width: 100%;
  min-height: 72px;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  resize: vertical;
}

.tk-bubble textarea:focus {
  outline: none;
}

.tk-post__foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
  margin-top: var(--space-2);
  color: var(--color-text-on-dark-dim);
  font-size: var(--text-xs);
}

.tk-post__foot button {
  color: var(--color-text-muted);
  font-size: var(--text-xs);
}

.tk-post__foot button:hover {
  color: var(--color-accent-pink-soft);
}

.tk-post__foot .tk-del:hover {
  color: var(--color-danger);
}

.tk-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  min-width: 0;
  min-height: 420px;
  padding: var(--space-5);
  border: 1px solid var(--color-line);
  border-radius: var(--radius-l);
  background: var(--color-surface);
}

.tk-card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
}

.tk-card__ttl {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-width: 0;
}

.tk-card__ttl strong {
  font-size: var(--text-sm);
  overflow-wrap: anywhere;
}

.tk-meta {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin: 0;
  padding: 0;
  list-style: none;
}

.tk-meta li {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  color: var(--color-text-soft);
  font-size: var(--text-sm);
  overflow-wrap: anywhere;
}

.tk-meta svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  margin-top: 3px;
  color: var(--color-text-muted);
}

.tk-close {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  width: 100%;
  min-height: 48px;
  margin-top: auto;
  border: 1px solid var(--color-line);
  border-radius: var(--radius-m);
  background: var(--color-bg-deep);
  color: var(--color-text-soft);
  font-size: var(--text-sm);
}

.tk-close:hover {
  border-color: var(--color-danger);
  color: var(--color-danger);
}

.tk-close svg {
  width: 14px;
  height: 14px;
}

.tk-composer {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
  margin-top: auto;
  padding: 8px 8px 8px 16px;
  border: 1px solid var(--color-line);
  border-radius: 20px;
  background: var(--color-surface);
}

.tk-clip {
  position: relative;
  overflow: hidden;
}

.tk-clip input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.tk-composer__field {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex: 1;
  min-width: 0;
}

.tk-composer__field svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: var(--color-text-muted);
}

.tk-composer .input {
  min-height: 44px;
  padding: 8px 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.tk-composer .input:focus {
  outline: none;
  box-shadow: none;
}

.tk-send {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--gradient-primary);
  color: var(--color-on-accent);
  box-shadow: var(--glow-pink-soft);
}

.tk-send:hover {
  box-shadow: var(--glow-pink);
}

.tk-send svg {
  width: 18px;
  height: 18px;
}

.tk-send.is-loading {
  position: relative;
  pointer-events: none;
}

.tk-send.is-loading svg {
  visibility: hidden;
}

.tk-send.is-loading::after {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: var(--color-on-accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.tk-attach {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: var(--space-2);
  padding: 6px 12px;
  border: 1px solid var(--color-line);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  color: var(--color-text);
  background: var(--color-surface);
  text-decoration: none;
}

.tk-attach:hover {
  border-color: var(--color-accent-pink);
  text-decoration: none;
}

.tk-attach--img {
  display: block;
  padding: 0;
  border-radius: var(--radius-m);
  overflow: hidden;
  max-width: 220px;
}

.tk-attach--img img {
  display: block;
  width: 100%;
  height: auto;
}

.tk-loading {
  padding-top: var(--space-6);
}

.tk-composer.is-off {
  opacity: 0.55;
  pointer-events: none;
}

.tk [hidden] {
  display: none !important;
}

@media (max-width: 1024px) {
  .tk__grid,
  .tk-chat__grid {
    grid-template-columns: 1fr;
  }

  .tk-side {
    position: static;
    max-width: 560px;
  }

  .tk-card {
    min-height: 0;
  }

  .tk-pane {
    min-height: 0;
    border-width: 1px;
  }
}

@media (max-width: 640px) {
  .tk {
    padding-block: var(--space-5) var(--space-6);
  }

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

  .tk-shot,
  .tk-shot__copy {
    min-height: 220px;
  }

  .tk-actions .btn {
    flex: 1 1 auto;
  }

  .tk-pane {
    padding: var(--space-4);
    border-width: 1px;
    border-radius: var(--radius-m);
  }

  .tk-composer {
    padding-left: 10px;
  }

  .tk-composer__field svg {
    display: none;
  }

  .tk-composer .input {
    min-height: 40px;
  }

  .tk-send,
  .tk-clip {
    width: 40px;
    height: 40px;
  }
}

/* ---------- задача пользователя 2026-09-05: события в чате, мягкое удаление, счётчик
   непрочитанных, вложения с превью, кнопка назад в ЛК ---------- */

.tk-event {
  margin: var(--space-2) auto;
  padding: 4px 14px;
  max-width: fit-content;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.04);
  color: var(--color-text-muted);
  font-size: var(--text-xs);
  text-align: center;
}

.tk-chat__top {
  position: relative;
}

.tk-back-link {
  position: absolute;
  top: 2px;
  right: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border: 1px solid var(--color-line);
  border-radius: var(--radius-full);
  color: var(--color-text);
  font-size: var(--text-sm);
  background: var(--color-surface);
  text-decoration: none;
  transition: border-color var(--dur-fast) var(--ease-out);
}

.tk-back-link:hover {
  border-color: var(--color-accent-pink);
  text-decoration: none;
}

.tk-back-link svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

@media (max-width: 560px) {
  .tk-back-link span {
    display: none;
  }
  .tk-back-link {
    padding: 8px;
  }
  .tk-chat__top h1 {
    padding-right: 44px;
  }
}

.tk-item-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  margin-left: auto;
}

.tk-unread {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: var(--radius-full);
  background: var(--color-accent-pink);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}

.tk-attach-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: var(--space-2) 0;
  padding: 6px 10px;
  border: 1px solid var(--color-line);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  background: var(--color-surface);
  width: fit-content;
}

.tk-attach-chip button {
  display: grid;
  place-items: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  color: var(--color-text-muted);
  flex-shrink: 0;
}

.tk-attach-chip button:hover {
  color: var(--color-danger);
}

/* ---------- кастомный выпадающий список (задача пользователя 2026-09-05) — настоящий
   <select> остаётся в DOM визуально скрытым и единственным источником истины, сюда только
   стилизованная надстройка ---------- */

.csel {
  position: relative;
}

.csel__native {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.csel__trigger {
  display: flex;
  align-items: center;
  width: 100%;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none'%3E%3Cpath d='m4 6 4 4 4-4' stroke='%23c9b8bd' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-4) center;
  padding-right: calc(var(--space-4) * 2 + 16px);
}

.csel__trigger.is-placeholder {
  color: var(--color-text-on-dark-dim);
}

.csel.is-disabled .csel__trigger {
  opacity: 0.55;
  cursor: not-allowed;
}

.csel__trigger.is-open {
  border-color: var(--color-accent-pink);
  box-shadow: 0 0 0 3px rgba(215, 95, 139, 0.22);
}

.csel__list {
  position: absolute;
  z-index: 20;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: 240px;
  overflow-y: auto;
  margin: 0;
  padding: 6px;
  list-style: none;
  border: 1px solid var(--color-line-strong);
  border-radius: var(--radius-m);
  background: var(--color-bg-space);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
}

.csel__opt {
  padding: 10px 12px;
  border-radius: var(--radius-s);
  font-size: var(--text-base);
  cursor: pointer;
  overflow-wrap: anywhere;
}

.csel__opt:hover,
.csel__opt.is-active,
.csel__opt.is-focused {
  background: rgba(255, 255, 255, 0.06);
}

.csel__opt.is-active {
  color: var(--color-accent-pink-soft);
}
